diff --git a/.github/plugin-it.sh b/.github/plugin-it.sh index 19fc318d..7f3d3e18 100755 --- a/.github/plugin-it.sh +++ b/.github/plugin-it.sh @@ -212,7 +212,7 @@ reset grep -q "AI index plan" "$LOGS/run4.log" || fail "the plan was not printed" # The routing rule is matched BY ID here, which proves the condition tree routed rather than # everything falling through to the fallback. -grep -q "| java | file-body-java |" "$LOGS/run4.log" \ +grep -q "| java | file-body-oop |" "$LOGS/run4.log" \ || fail "the .java routing rule did not match -- the condition tree did not route" # If srcmorph.planOnly is ever renamed, the property stops binding, the run generates for real, and # this is the assertion that catches it. @@ -304,7 +304,7 @@ mvn -B --no-transfer-progress -f "$REPO_ROOT/srcmorph-maven-plugin/pom.xml" -P s "net.ladenthin:srcmorph-maven-plugin:$VERSION:generate" -Dsrcmorph.planOnly=true \ > "$LOGS/run7-selftest.log" 2>&1 \ || { cat "$LOGS/run7-selftest.log"; fail "the srcmorph-selftest profile did not plan"; } -grep -q "| java | file-body-java |" "$LOGS/run7-selftest.log" \ +grep -q "| java | file-body-oop |" "$LOGS/run7-selftest.log" \ || fail "the self-test profile routed no Java file to its java rule" echo "ok: the self-test profile planned" diff --git a/.github/plugin-it/srcmorph.yaml b/.github/plugin-it/srcmorph.yaml index 417dbad0..d6d9bfb9 100644 --- a/.github/plugin-it/srcmorph.yaml +++ b/.github/plugin-it/srcmorph.yaml @@ -25,6 +25,17 @@ srcMorph: - "**/package-info.java" aiVersion: "${it.aiVersion}" + # When a summary is rewritten. force: true rewrites every one. Otherwise a summary is rewritten when + # it is missing or empty, its aiVersion changed, or a change below whose switch is true (each one is + # by default); false keeps the summary and records the new value at its next rewrite. + force: false + regenerateOn: + source: true # C: the file's source, a package's files, the project's packages + prompt: true # P: the rule's prompts, its map and reduce prompts too + facts: true # N: the rule's fact counters + model: true # M: the rule's model (definition key, remoteModel, model file) + children: true # K: the summaries a package or the project is written from + aiDefinitions: - key: fixture-model modelPath: unused-with-the-mock-provider.gguf @@ -44,7 +55,7 @@ srcMorph: fieldGenerations: # Extra.java: inline facts with an ignore counter, kept out of the facts line and out of the count. - id: extra - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: "${it.model}" priority: 10 facts: @@ -66,7 +77,7 @@ srcMorph: - pathGlob: "**/Names.java" - size: {max: 100000} - id: java - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: "${it.model}" factsKey: java-facts condition: diff --git a/CHANGELOG.md b/CHANGELOG.md index 73741b93..9170badb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,24 @@ The release procedure (prompt template and step-by-step instructions) lives in [ ## [Unreleased] +### Upgrading from 1.4.0 + +The entries below hold the details; what a 1.4.0 user changes: + +- **A rule naming `promptKey: file-body-java` names `file-body-oop`:** profile v3 has no + `file-body-java` any more. +- **The first run rewrites every summary**, one model call each: a summary of 1.4.0 records no `M` + and no `K`, the project's `C` is built differently, and every file prompt of profile v3 changed (the + secrets rule). To keep the old summaries instead, set all five `regenerateOn` switches to `false` + and keep them there: a field is recorded only when its summary is written, so a run with the + switches on later still finds it missing and rewrites then. `force: true` rewrites everything at once. +- **Java callers of the library** (the CLI and the plugin need nothing): `AiMdHeader.withHashes` + takes `(prompt, facts, model, children)`; the `PackageIndexer` and both `ProjectIndexer` + constructors take an `AiRegenerateOn` after `force`; the `SourceFileIndexer` constructor takes + `fileNames` and `fileInterpreters` (after `fileExtensions`), an `AiRegenerateOn` (after `force`) + and `contentHeadChars` (last); `SourceFileIndexer.indexFile` takes a `modelHash` (last); + `AiMdHeaderSupport` takes the five switches as booleans (without arguments, all on). + ### Added - **`examples/copilot-api-gateway/srcmorph-luna.yaml`:** GPT-6 Luna through the GitHub Copilot API @@ -20,11 +38,204 @@ The release procedure (prompt template and step-by-step instructions) lives in [ sampled. It takes every extension of the self-test profile and leaves out `target/`, `.git/`, `.idea/`, `.vscode/`, `.gradle/`, `node_modules/` and `.claude/` (agent worktrees, a second copy of the sources). `ExamplesConfigBindingTest` pins the routing, the facts, the strategy and the - chunk prompts. + chunk prompts. It routes every kind profile v3 knows (below): Java with Jakarta EE imports + or annotations written with their package (`contentMatches`) to the EE counters, Kotlin, Groovy + and Scala to the shared OOP prompt, the EE descriptors and mappings by name (`fileNames`), MyBatis + mappers and integration routes by their DTD or namespace, BPMN, DMN, WSDL, JSP, Facelets, OpenAPI + and AsyncAPI by their first key, Protobuf, Avro and GraphQL, GitHub Actions by path, Kubernetes by + `kind:`, Compose files by name, Ansible playbooks and roles, Terraform, Camel's YAML DSL by its + `- route:` / `- from:`, Dockerfiles and Jenkinsfiles by name, Gradle build scripts of both DSLs + and `.properties` files to the ops prompt, PowerShell and batch files to the fallback prompt with + their counters, and scripts without an extension by their `#!` line (`fileInterpreters`). + `ExamplesConfigBindingTest` routes one file of each. +- **Benchmark: the enterprise corpus** ([`docs/ai-index-benchmark/corpus-enterprise/`](docs/ai-index-benchmark/corpus-enterprise/README.md)), + seventeen files of those kinds around one shop backoffice, with `modelcard/facts-enterprise.json`. + `run.py` routes the kinds its corpora hold as the Luna example does (not AsyncAPI, Ansible, Camel + YAML, PowerShell, batch or scripts by their `#!` line, which none of them has) and takes + `--java-prompt`, so the Java + prompt and the shared OOP prompt run side by side on the card corpus; `score.py` reports + `secretsLeaked`, the summaries that copy a value the facts mark as a secret. +- **`ProfileFactPatternsLinearityTest` measures that every pattern of every facts file of the + profile reads linearly**, the `[ignore]` lines included, over 110 adversarial lines (unclosed + openers and tags, heredoc markers, unbalanced parentheses, runs of one character). It counts the + characters the matcher reads instead of timing it: four times the input may read at most six + times as many (linear reads four times, quadratic sixteen), so the result is the same on any + machine. A facts file added to the profile is measured without a change to the test. Against the + facts files of 1.4.0 it reports six quadratic patterns, all fixed above. +- **Files without an extension can be indexed and routed** (`fileNames`, under `srcMorph` and as a + condition leaf): globs over the file name without its directory, matched in any case + (`Dockerfile`, `Jenkinsfile`, `Dockerfile.*`); a name with a `/` fails the run in both places (it + could never match: use `pathGlob`). Up to now only `fileExtensions` selected a file, so a Dockerfile + or a Jenkinsfile could not be indexed at all. +- **Routing by content** (`contentMatches`, a condition leaf): a Java regular expression found in the + first `contentHeadChars` characters of the file (under `srcMorph`, 16,384 by default, at least 256 + so the `interpreters` condition sees a whole `#!` line; raise it for a marker behind a long license + header: the head is never read past the file's end), so a Kubernetes manifest, an OpenAPI document and a Camel + route, all `.yaml`, take different rules (`(?m)^apiVersion:`). Planning reads only that start of a + file unless it reads the whole file anyway; an invalid expression fails the check. The pattern is + compiled once and has the read budget of a fact pattern: one that backtracks past it does not match, + with a warning, so it cannot hang the plan. +- **Scripts without an extension can be indexed and routed by their `#!` line** + (`fileInterpreters` under `srcMorph`, `interpreters` as a condition leaf): `[bash, sh, perl]` + selects a `bin/deploy` that starts with `#!/usr/bin/env bash`. The interpreter is the program the + line names, or what `env` runs (options and assignments skipped); a name matches its versions too + (`python` matches `python3.12`; a name ending with a digit only from a dot on: `python3.1` does not + match `python3.12`), and the arguments of `env`'s options (GNU `-u`, `-C`, `-a`, BSD `-P`, `-L`, + `-U`) and its `-S` command line are read as `env` reads them. The line is read only for a file the subtrees, excludes and size band let + through; one that cannot be read is skipped with a warning, the run goes on. `support.AiShebang` holds the rule; an interpreter given with its directory + (`/bin/bash`) fails the run. +- **Fact counters can count before the blanking and count names** (`[raw]` and `[distinct]` in a + facts file, `raw` and `distinct` in a configuration): a raw counter counts the source as written, + so a `TODO` in a comment counts next to counters that skip comments; a distinct counter counts the + different texts it matched, its first group where that took part (twelve `@Inject Clock` are one + type). A summary written before keeps its facts hash; the markers enter it only where set. +- **Every fact pattern has a time limit**: it may read 2,000 characters per character of the source + plus 1,000,000, counted by the matcher's reads, so the limit is the same on every machine. A + pattern of a user's own that backtracks past it is stopped: its counter is left out of the facts + line, an ignore counter blanks nothing, and a warning names it. The profile's patterns read at + most about 830 per character; the linearity test asserts that none reaches the limit. +- **Fact counters for the kinds that had a prompt and none**: `scala-facts`, `proto-facts`, + `avro-facts`, `graphql-facts`, `asyncapi-facts`, `terraform-facts` (OpenTofu and Terragrunt too), + `ansible-facts`, `compose-facts` and `camel-yaml-facts`; `dmn-facts` for DMN decisions (inputs, + outputs, rules, hit policies other than UNIQUE, the decision requirements); `gradle-facts` and + `properties-facts`, and `powershell-facts` and `batch-facts` for the fallback prompt. + `ContractFactPatternsTest`, `OpsFactPatternsTest`, `JvmFactPatternsTest` and (DMN) + `EnterpriseXmlFactPatternsTest` pin each on a sample + of its kind with a commented-out or quoted declaration that must not count. The YAML ones blank + the body of a block scalar from the indentation of its first line, as YAML reads it, and keep its + key (`ansible.builtin.shell: |` counts). +- **`{a,b}` alternatives in every glob** (`excludes`, `pathGlob`, `fileNames`), nested too: + `**/*.{yml,yaml}`, `**/{target,build}/**`. The syntax lives once in `support.AiGlob`; a glob that + opens a `{` it does not close fails the run, naming it. + +- **Profile v3 covers the kinds of an enterprise Java code base**, with four prompts and fifteen + fact files, so one generic prompt serves every language of a kind: + - `file-body-oop`: one prompt for the class-based languages (Java, Kotlin, Groovy, Scala); it + replaces `file-body-java` (below), with + their facts per language: `kotlin-facts` (types, companion objects, data and sealed types, + functions, extension and suspend functions, constructor properties, nested comments and string + templates blanked), `groovy-facts` (types, typed and `def` methods, Spock features and blocks, + closures, GStrings and slashy strings blanked) and `java-ee-facts` (`java-facts` plus the EJB, + JPA, CDI, JAX-RS, JAX-WS, Servlet, JTA and security annotations). + - `file-body-xml` defines Jakarta EE descriptors, JPA and Hibernate mappings, MyBatis mappers, + Camel, Spring Integration, Mule and Synapse routes, BPMN and DMN, and WSDL, each counted by its + own file: `jee-facts`, `persistence-facts`, `mybatis-facts` (which reads the SQL in CDATA), + `integration-facts`, `bpmn-facts` (the diagram blanked) and `wsdl-facts`. + - `file-body-view` for JSP, tag files and Facelets (`jsp-facts`, `facelets-facts`): the data a + page reads, the actions it sends, its template and its server code. + - `file-body-contract` for OpenAPI, AsyncAPI, JSON Schema, Avro, Protobuf and GraphQL + (`openapi-facts`, YAML or JSON, block scalars blanked) and `file-body-ops` for CI pipelines, + Dockerfiles, Compose, Kubernetes, Helm, Ansible and Terraform (`k8s-facts`, `actions-facts`, + `dockerfile-facts`). + + `JvmFactPatternsTest`, `EnterpriseXmlFactPatternsTest`, `ViewFactPatternsTest` and + `OpsFactPatternsTest` pin every counter on a sample of its kind with its traps; the linearity + test measures every pattern. +- **A facts file can include another** (`[include]`): its counters, `[ignore]` lines + included, at the place of the line, so `jee-facts` is `xml-facts` plus the descriptor counters and + copies none. A cycle fails the run naming the chain; a label two of the files use fails as before. +- **Secrets stay out of the index.** Every file prompt names a password, private key, token, API key + or credentials in a URL without copying it (`DB_PASSWORD=***`): the shell, XML and fallback + prompts asked for "every value", so a `` of a data source or a token in a script went + into the summary, and the default output directory `src/site/ai` is published with the Maven + site. The self-test, `examples/build-your-own-jar/srcmorph.yaml` and the Luna example skip the + files that hold credentials (`id: secrets`: `.env`, `*.tfvars`, `*.tfstate`, Maven's + `settings.xml`, keys, `*secret*` and `*credential*` configuration files), so they never reach a + model; `ExamplesConfigBindingTest` pins which names it skips and that no source file is among + them. + +### Changed + +- **`SourceFileIndexer` is final**, and its public constructor takes `fileNames`, + `fileInterpreters`, `regenerateOn` and `contentHeadChars` (Upgrading from 1.4.0). The file phase's log lines name a file by its path below + the base directory (as the model reads it), with the system's separators, where they named the + absolute path. +- **Java takes `file-body-oop`; `file-body-java` is gone from profile v3.** A rule naming + `promptKey: file-body-java` fails the run (no such file in the profile): name `file-body-oop`. + Three runs each with both prompts on the model-card corpus gave the same Java recall, GPT-6 Luna + 100 % in all three with the shared prompt + ([`remeasure-2026-11-04/`](docs/ai-index-benchmark/remeasure-2026-11-04/README.md)). The self-test, + the examples, the plugin-it fixture and `run.py` (`--java-prompt`, default `file-body-oop`) name it. +- **What rewrites a summary is set per cause** (`regenerateOn` under `srcMorph`: `source`, + `prompt`, `facts`, `model`, `children`, each `true` by default), next to `force`, which rewrites + every summary whatever the switches say. Each switch compares one header field: `C` (the source; a + package's files, the project's packages), `P` (the rule's prompts, map and reduce included), `N` + (its fact counters), the new `M` (the model: definition key, `remoteModel`, model file name) and + the new `K` (the child summaries a package or the project is written from). A missing or empty + summary, another header format, node, title or `aiVersion` rewrite it always; `D`, `T` and `G` are + recorded only. Up to now only a changed source, `aiVersion` or `force` rewrote a summary (1.4.0 + recorded `P` and `N` without acting on them), so a summary of an older prompt or model stayed; and + a package was never rewritten when its files were re-summarized over unchanged sources, since its + checksum is built from theirs, nor when its own prompt changed: packages and the project now + record `P`, `M` and `K` too (the project's checksum is built from its packages and their + checksums, as a package's from its children, no longer folded with the overview's prompt key and + model). `P` reads a prompt's line endings as `\n`, so a profile checked out with CRLF on one machine + and LF on another hashes the same. A field a summary does not record counts as changed, so the + first run after the upgrade rewrites every summary, one model call each (Upgrading from 1.4.0 says + how to keep them). `AiMdHeaderSupportTest` pins every switch on and off, + `PackageIndexerTest` and `ProjectIndexerTest` the children and overview hashes; the plugin README's + header section says what rewrites a summary, and every example configuration shows the switches. +- **`java-facts` counts code only**: an `[ignore]` line blanks comments, Javadoc, text blocks, + strings and character literals, so a `public` or `class` in them no longer counts, and + `TODO/FIXME` is a `[raw]` counter, counted in the comments as before. The facts line of a Java file + with such text changes (`java-ee-facts` includes it), and so does the facts hash, which with + `regenerateOn.facts` rewrites the Java summaries that carry facts. +- **DMN has its own counters**: `bpmn-facts` counts BPMN only (its "decisions" and "decision rules" + went to `dmn-facts`), and the Luna example and `run.py` route `.dmn` to `dmn-facts`. +- **The model reads a file's path below the base directory**, not its name alone, at the head of the + user message (`billing/src/main/webapp/WEB-INF/web.xml`), so two files of one name in different + modules read apart; every file prompt of profile v3 says so in its last paragraph. The plan's + window check counts the same line. A package's and the project's message are unchanged. +- **Profile v3's file prompts ask for more** + ([`remeasure-2026-11-04b/`](docs/ai-index-benchmark/remeasure-2026-11-04b/README.md): the enterprise + corpus 97.9 to 99.7 % with gpt-oss-20b, 97.3 to 99.9 % with GPT-6 Luna; the card corpus 99.5 % and + 100 %, the language corpus 99.0 % over nine gpt-oss runs and 99.5 %): `file-body-oop` names the private + functions, constants and fields the logic uses and each call on a dependency, which the enterprise + runs found by chance only (`nextNumber`, `PREFIX`, a `refund` call); `file-body-ops` names a CI + workflow or pipeline by its name (`release-backoffice` was missing in every gpt-oss run) and + defines Gradle build and settings scripts (plugins, dependencies by configuration, repositories, + tasks, included projects, the toolchain), which take it now. +- **`pathGlob` matches in the case written**, also on Windows, so a rule routes the same file on + every system; `fileNames` and `extensions` match in any case, as names of a kind are written in + either. Decided and documented, unchanged. +- **A `{` in a glob opens an alternative**; it matched itself before. An exclude or a `pathGlob` + with a literal brace pair now means its alternatives. +- **A source file with a byte order mark is read without it**, and one with the UTF-16 mark as + UTF-16. Before, a UTF-8 file saved with a mark (as some Windows editors do) began with U+FEFF, so + its first line did not start with its first word for the fact counters and the prompt, and a + UTF-16 file read as replacement characters. The checksum is still over the bytes, so such a file + is not rewritten for this alone. ### Fixed +- **An ignored region at the start of a line left a space there**, so a counter anchored at the line + start (`^class`, `^import`, Perl's `^my`) missed the code after it: `/* x */class A {}` counted no + type, the same code on two lines one. Such a region now leaves nothing; within a line it still + leaves a space, so the words around it stay apart. The facts hash is unchanged (it hashes the + counters, not the counts). +- **A JSON configuration file with a UTF-8 byte order mark did not load**: Windows PowerShell 5.1 + writes one (`Out-File -Encoding utf8`), and Jackson read it as a character before the `{`. The + loader reads a configuration file as it reads a source, without the mark (YAML too). +- **A key defined twice in `aiDefinitions`, `promptDefinitions` or `factDefinitions` was taken + silently, the last one winning**, so a rule could run with another model or prompt than the one + read first. It now fails the run, naming the list, the index and the key. - **`docs/copilot-api-gateway.md`** showed `maxOutputTokens: 2048` for the example, which has 4096. +- **The XML and POM fact counters of profile v3 were quadratic over unclosed markup.** In + `xml-facts.tsv` the `[ignore]` line scanned to the end of the file again from every ` +# Enterprise corpus + +Seventeen source files of the kinds an enterprise Java code base holds besides Java and SQL, one or +two per kind that profile v3 has a prompt or fact counters for since November 2026. Like the +[language corpus](../corpus-languages/README.md) they are written for this benchmark (Apache-2.0), +around one shop backoffice, and each holds the traps its counters and its prompt have to get past: +a commented-out servlet, route or step, a KDoc and a string that mention `fun`, a password in a +persistence unit that must not reach a summary. + +| File | Kind | Rule (run.py) | +|---|---|---| +| [`java/shop/OrderResource.java`](java/shop/OrderResource.java) | a stateless EJB that is a JAX-RS resource, with a timer | `java-ee` | +| [`other/kotlin/InvoiceService.kt`](other/kotlin/InvoiceService.kt) | Kotlin: a value class, data and sealed types, a coroutine, an extension function | `kotlin` | +| [`other/groovy/ShippingRulesSpec.groovy`](other/groovy/ShippingRulesSpec.groovy) | a Spock specification and the Groovy class it tests | `groovy` | +| [`other/jee/web.xml`](other/jee/web.xml) | servlets, a filter, a listener, security constraints, a resource reference | `jee` | +| [`other/jee/ejb-jar.xml`](other/jee/ejb-jar.xml) | session and message-driven beans, an interceptor, transaction attributes | `jee` | +| [`other/persistence/persistence.xml`](other/persistence/persistence.xml) | two persistence units, one with a password | `persistence` | +| [`other/persistence/Shipment.hbm.xml`](other/persistence/Shipment.hbm.xml) | a Hibernate mapping with a subclass, associations and named queries | `persistence` | +| [`other/mybatis/CustomerMapper.xml`](other/mybatis/CustomerMapper.xml) | a MyBatis mapper: statements, dynamic SQL, a `${}` substitution | `mybatis` | +| [`other/integration/order-routes.xml`](other/integration/order-routes.xml) | Apache Camel routes in Spring XML | `integration` | +| [`other/bpmn/order-fulfilment.bpmn`](other/bpmn/order-fulfilment.bpmn) | a Camunda 7 process with a diagram | `bpmn` | +| [`other/wsdl/StockService.wsdl`](other/wsdl/StockService.wsdl) | a SOAP service with an embedded schema | `wsdl` | +| [`other/jsp/order-list.jsp`](other/jsp/order-list.jsp) | a JSP page: directives, a scriptlet, JSTL, a form | `jsp` | +| [`other/facelets/checkout.xhtml`](other/facelets/checkout.xhtml) | a Facelets view bound to a bean | `facelets` | +| [`other/openapi/orders-api.yaml`](other/openapi/orders-api.yaml) | an OpenAPI 3.0 contract | `openapi` | +| [`other/k8s/orders-deployment.yaml`](other/k8s/orders-deployment.yaml) | a Deployment, a Service and an Ingress | `k8s` | +| [`other/actions/.github/workflows/release.yml`](other/actions/.github/workflows/release.yml) | a GitHub Actions release workflow | `actions` | +| [`other/docker/Dockerfile`](other/docker/Dockerfile) | a two-stage Dockerfile | `dockerfile` | + +What a faithful summary names is in [`../modelcard/facts-enterprise.json`](../modelcard/facts-enterprise.json); +its `secret` entry is the password `score.py` checks no summary copies (`secretsLeaked`). The +counts the fact files give are pinned on samples of each kind by `JvmFactPatternsTest`, +`EnterpriseXmlFactPatternsTest`, `ViewFactPatternsTest` and `OpsFactPatternsTest` (`srcmorph` +module). To measure a profile on it: + +```bash +python run.py --cp --models gpt-oss-20b,gpt-6-luna --work \ + --corpus ../corpus-enterprise --out --meta --facts [--java-prompt file-body-oop] +python score.py --work --out --facts facts-enterprise.json +``` diff --git a/docs/ai-index-benchmark/corpus-enterprise/java/shop/OrderResource.java b/docs/ai-index-benchmark/corpus-enterprise/java/shop/OrderResource.java new file mode 100644 index 00000000..11864e10 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/java/shop/OrderResource.java @@ -0,0 +1,83 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package shop; + +import jakarta.annotation.security.RolesAllowed; +import jakarta.ejb.EJB; +import jakarta.ejb.Schedule; +import jakarta.ejb.Stateless; +import jakarta.ejb.TransactionAttribute; +import jakarta.ejb.TransactionAttributeType; +import jakarta.inject.Inject; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import java.util.List; + +/** + * REST resource of the order backoffice: lists open orders, looks one up and cancels it. The + * nightly purge removes cancelled orders older than {@link #PURGE_AFTER_DAYS} days. + * + *

An older version used {@code @Stateful} and kept a cart; that moved to the storefront.

+ */ +@Stateless +@Path("/orders") +@Produces(MediaType.APPLICATION_JSON) +@RolesAllowed({"backoffice", "admin"}) +public class OrderResource { + + /** Days a cancelled order is kept before the nightly purge deletes it. */ + static final int PURGE_AFTER_DAYS = 30; + + @PersistenceContext(unitName = "shop") + private EntityManager em; + + @Inject + private PaymentGateway payments; + + @EJB + private AuditLog audit; + + // @Inject private LegacyCartService carts; + + @GET + public List openOrders() { + return em.createNamedQuery("Order.open", Order.class).getResultList(); + } + + @GET + @Path("{id}") + public Response find(@PathParam("id") long id) { + final Order order = em.find(Order.class, id); + return order == null ? Response.status(Response.Status.NOT_FOUND).build() : Response.ok(order).build(); + } + + @POST + @Path("{id}/cancel") + @TransactionAttribute(TransactionAttributeType.REQUIRED) + public Response cancel(@PathParam("id") long id) { + final Order order = em.find(Order.class, id); + if (order == null) { + return Response.status(Response.Status.NOT_FOUND).build(); + } + payments.refund(order.getPaymentReference(), order.getTotal()); + order.setStatus(OrderStatus.CANCELLED); + audit.record("order.cancelled", id); + return Response.noContent().build(); + } + + @Schedule(hour = "2", minute = "15", persistent = false) + void purgeCancelled() { + final int removed = em.createNamedQuery("Order.purgeCancelled") + .setParameter("days", PURGE_AFTER_DAYS) + .executeUpdate(); + audit.record("order.purged", removed); + } +} diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/actions/.github/workflows/release.yml b/docs/ai-index-benchmark/corpus-enterprise/other/actions/.github/workflows/release.yml new file mode 100644 index 00000000..32317859 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/actions/.github/workflows/release.yml @@ -0,0 +1,49 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +name: release-backoffice +on: + push: + tags: ['v*'] + workflow_dispatch: +permissions: + contents: read + packages: write +jobs: + build: + runs-on: ubuntu-24.04 + strategy: + matrix: + java: [21, 25] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ matrix.java }} + - name: Build and test + run: mvn -B verify -Pci + # - name: Upload coverage + # uses: codecov/codecov-action@v4 + image: + needs: build + runs-on: ubuntu-24.04 + environment: production + steps: + - uses: actions/checkout@v4 + - name: Log in to the registry + uses: docker/login-action@v3 + with: + registry: registry.shop.example + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + - name: Push the image + run: | + docker build -t registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v} . + docker push registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v} + deploy: + needs: image + uses: ./.github/workflows/deploy-k8s.yml + with: + environment: production + secrets: inherit diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/bpmn/order-fulfilment.bpmn b/docs/ai-index-benchmark/corpus-enterprise/other/bpmn/order-fulfilment.bpmn new file mode 100644 index 00000000..4ed75c20 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/bpmn/order-fulfilment.bpmn @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + ${order.total > 1000} + + + ${order.total <= 1000} + + + + + + + + + + + + + + + + + + + + diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/docker/Dockerfile b/docs/ai-index-benchmark/corpus-enterprise/other/docker/Dockerfile new file mode 100644 index 00000000..0a53e715 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/docker/Dockerfile @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +FROM maven:3.9-eclipse-temurin-21 AS build +WORKDIR /src +COPY pom.xml . +RUN mvn -B dependency:go-offline +COPY src ./src +RUN mvn -B package -DskipTests + +FROM eclipse-temurin:21-jre-alpine +ARG APP_VERSION=2.1.0 +ENV JAVA_OPTS="-XX:MaxRAMPercentage=75" \ + SHOP_PROFILE=production +RUN addgroup -S shop && adduser -S backoffice -G shop +COPY --from=build /src/target/orders-backoffice.jar /opt/shop/orders-backoffice.jar +EXPOSE 8080 +USER backoffice +HEALTHCHECK --interval=30s CMD wget -qO- http://localhost:8080/health/live || exit 1 +# ENTRYPOINT ["java", "-agentlib:jdwp=transport=dt_socket,server=y", "-jar", "/opt/shop/orders-backoffice.jar"] +ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"] diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/facelets/checkout.xhtml b/docs/ai-index-benchmark/corpus-enterprise/other/facelets/checkout.xhtml new file mode 100644 index 00000000..b91ea4b4 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/facelets/checkout.xhtml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/groovy/ShippingRulesSpec.groovy b/docs/ai-index-benchmark/corpus-enterprise/other/groovy/ShippingRulesSpec.groovy new file mode 100644 index 00000000..2f486d72 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/groovy/ShippingRulesSpec.groovy @@ -0,0 +1,70 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package shop.shipping + +import groovy.transform.CompileStatic +import spock.lang.Specification +import spock.lang.Unroll + +/* + * class ShippingRulesLegacySpec was merged into this one. + */ +class ShippingRulesSpec extends Specification { + + static final BigDecimal FREE_SHIPPING_THRESHOLD = 50.00 + + def rules = new ShippingRules(carrier: 'DHL', maxParcelKg: 31.5) + + def "orders above the threshold ship for free"() { + given: + def order = new Order(total: 75.00, weightKg: 2) + + when: + def cost = rules.costFor(order) + + then: + cost == 0 + } + + @Unroll + def "a parcel of #weight kg costs #expected"() { + expect: + rules.costFor(new Order(total: 10, weightKg: weight)) == expected + + where: + weight | expected + 1 | 4.99 + 10 | 9.99 + 30 | 19.99 + } + + def "an overweight parcel is rejected"() { + when: + rules.costFor(new Order(total: 10, weightKg: 40)) + + then: + thrown(ParcelTooHeavyException) + } + + private Order heavyOrder(BigDecimal kg) { + new Order(total: 10, weightKg: kg) + } +} + +@CompileStatic +class ShippingRules { + String carrier + BigDecimal maxParcelKg + + BigDecimal costFor(Order order) { + if (order.weightKg > maxParcelKg) { + throw new ParcelTooHeavyException("parcel of ${order.weightKg} kg exceeds ${maxParcelKg}") + } + if (order.total >= ShippingRulesSpec.FREE_SHIPPING_THRESHOLD) { + return 0 + } + def tiers = [[upTo: 2, price: 4.99], [upTo: 10, price: 9.99], [upTo: 31.5, price: 19.99]] + tiers.find { tier -> order.weightKg <= tier.upTo }.price as BigDecimal + } +} diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/integration/order-routes.xml b/docs/ai-index-benchmark/corpus-enterprise/other/integration/order-routes.xml new file mode 100644 index 00000000..4ba78a41 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/integration/order-routes.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + shop.integration.ErpUnavailableException + + true + + + + + + + + + ${body.total} > {{orders.review.threshold}} + + + + + + + + + + + + + + + + + + + ${body.lines} + + + + + + + diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/jee/ejb-jar.xml b/docs/ai-index-benchmark/corpus-enterprise/other/jee/ejb-jar.xml new file mode 100644 index 00000000..3cf7bb12 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/jee/ejb-jar.xml @@ -0,0 +1,57 @@ + + + + + + StockReservationBean + shop.stock.StockReservationBean + Stateless + + reservationMinutes + java.lang.Integer + 45 + + + + CheckoutSessionBean + shop.checkout.CheckoutSessionBean + Stateful + + ejb/StockReservation + shop.stock.StockReservation + + + + OrderPlacedListener + shop.events.OrderPlacedListener + + + destinationLookup + java:/jms/queue/OrderPlaced + + + + + + + shop.audit.TimingInterceptor + + + + + + StockReservationBean + reserve + + RequiresNew + + + * + shop.audit.TimingInterceptor + + + diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/jee/web.xml b/docs/ai-index-benchmark/corpus-enterprise/other/jee/web.xml new file mode 100644 index 00000000..328bdcba --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/jee/web.xml @@ -0,0 +1,66 @@ + + + + shop-backoffice + + + shop.reportDirectory + /var/shop/reports + + + + ReportDownloadServlet + shop.web.ReportDownloadServlet + 1 + + + ReportDownloadServlet + /reports/* + + + + + + RequestIdFilter + shop.web.RequestIdFilter + + + RequestIdFilter + /* + + + + shop.web.StartupAuditListener + + + + 20 + + + + + backoffice + /admin/* + + + admin + + + + admin + + + + jdbc/ShopDS + javax.sql.DataSource + + diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/jsp/order-list.jsp b/docs/ai-index-benchmark/corpus-enterprise/other/jsp/order-list.jsp new file mode 100644 index 00000000..9e0eca0a --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/jsp/order-list.jsp @@ -0,0 +1,35 @@ +<%-- +SPDX-FileCopyrightText: 2026 Bernard Ladenthin + +SPDX-License-Identifier: Apache-2.0 +--%> +<%@ page contentType="text/html;charset=UTF-8" import="java.util.List,shop.Order,shop.OrderFilter" %> +<%@ taglib prefix="c" uri="jakarta.tags.core" %> +<%@ taglib prefix="fmt" uri="jakarta.tags.fmt" %> +<%@ include file="/WEB-INF/jspf/header.jspf" %> +<%-- The CSV export link was removed: CSV --%> +<% + OrderFilter filter = (OrderFilter) request.getAttribute("orderFilter"); + int pageSize = filter == null ? 25 : filter.getPageSize(); +%> +

Open orders

+
+ + + +
+ + + + + + + + + +
overduecancel
+

Page size: <%= pageSize %>

+ diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/k8s/orders-deployment.yaml b/docs/ai-index-benchmark/corpus-enterprise/other/k8s/orders-deployment.yaml new file mode 100644 index 00000000..beb454a2 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/k8s/orders-deployment.yaml @@ -0,0 +1,68 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +apiVersion: apps/v1 +kind: Deployment +metadata: + name: orders-backoffice + labels: + app: orders-backoffice +spec: + replicas: 3 + selector: + matchLabels: + app: orders-backoffice + template: + metadata: + labels: + app: orders-backoffice + spec: + containers: + - name: backoffice + image: registry.shop.example/orders-backoffice:2.1.0 + ports: + - containerPort: 8080 + env: + - name: SHOP_DB_URL + value: jdbc:postgresql://orders-db:5432/shop + - name: SHOP_DB_PASSWORD + valueFrom: + secretKeyRef: + name: orders-db-credentials + key: password + readinessProbe: + httpGet: + path: /health/ready + port: 8080 + resources: + limits: + memory: 768Mi + cpu: "1" +--- +apiVersion: v1 +kind: Service +metadata: + name: orders-backoffice +spec: + selector: + app: orders-backoffice + ports: + - port: 80 + targetPort: 8080 +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: orders-backoffice +spec: + rules: + - host: backoffice.shop.example + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: orders-backoffice + port: + number: 80 diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/kotlin/InvoiceService.kt b/docs/ai-index-benchmark/corpus-enterprise/other/kotlin/InvoiceService.kt new file mode 100644 index 00000000..4077ca20 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/kotlin/InvoiceService.kt @@ -0,0 +1,61 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package shop.billing + +import java.math.BigDecimal +import java.time.LocalDate +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext + +/** Number of days a customer has to pay an invoice. */ +const val PAYMENT_TERM_DAYS = 14 + +@JvmInline +value class InvoiceNumber(val value: String) + +data class InvoiceLine(val sku: String, val quantity: Int, val unitPrice: BigDecimal) { + val amount: BigDecimal get() = unitPrice.multiply(BigDecimal(quantity)) +} + +sealed interface InvoiceResult { + data class Issued(val number: InvoiceNumber, val dueDate: LocalDate) : InvoiceResult + data class Rejected(val reason: String) : InvoiceResult +} + +/** + * Issues invoices for completed orders: numbers them, applies the reduced tax rate to books and + * stores them. A fun fact in KDoc: `fun legacyIssue()` was removed in 2.0. + */ +class InvoiceService( + private val repository: InvoiceRepository, + private val clock: () -> LocalDate = LocalDate::now, +) { + companion object { + private const val PREFIX = "INV" + val REDUCED_TAX_CATEGORIES = setOf("books", "food") + } + + private var sequence = 0 + + lateinit var defaultCurrency: String + + // fun issueDraft(order: Order): InvoiceResult = TODO() + + suspend fun issue(order: CompletedOrder): InvoiceResult = withContext(Dispatchers.IO) { + if (order.lines.isEmpty()) { + return@withContext InvoiceResult.Rejected("order ${order.id} has no lines") + } + val number = nextNumber() + val invoice = Invoice(number, order.customerId, order.lines, clock().plusDays(PAYMENT_TERM_DAYS.toLong())) + repository.save(invoice) + InvoiceResult.Issued(number, invoice.dueDate) + } + + fun taxRate(category: String): BigDecimal = + if (category in REDUCED_TAX_CATEGORIES) BigDecimal("0.07") else BigDecimal("0.19") + + private fun nextNumber(): InvoiceNumber = InvoiceNumber("$PREFIX-${++sequence}") +} + +fun List.total(): BigDecimal = fold(BigDecimal.ZERO) { sum, line -> sum + line.amount } diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/mybatis/CustomerMapper.xml b/docs/ai-index-benchmark/corpus-enterprise/other/mybatis/CustomerMapper.xml new file mode 100644 index 00000000..f62b80d0 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/mybatis/CustomerMapper.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT + + + + + + + + + insert into CUSTOMER (EMAIL, LOYALTY_TIER, CREATED_AT) values (#{email}, #{loyaltyTier}, now()) + + + + update CUSTOMER + LOYALTY_TIER = #{tier} + where CUSTOMER_ID in + #{id} + + + + delete from CUSTOMER where LAST_ORDER_AT < #{cutoff} + + diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/openapi/orders-api.yaml b/docs/ai-index-benchmark/corpus-enterprise/other/openapi/orders-api.yaml new file mode 100644 index 00000000..4b6e03d5 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/openapi/orders-api.yaml @@ -0,0 +1,97 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +openapi: 3.0.3 +info: + title: Shop Orders API + version: 2.1.0 + description: | + Read and change orders of the shop backoffice. + The legacy endpoint /v1/orders/export: was removed in 2.0. +servers: + - url: https://api.shop.example/backoffice +paths: + /orders: + get: + operationId: listOrders + summary: List orders, newest first + parameters: + - name: status + in: query + schema: + $ref: '#/components/schemas/OrderStatus' + - name: limit + in: query + schema: + type: integer + maximum: 200 + responses: + '200': + description: a page of orders + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Order' + /orders/{orderId}: + get: + operationId: getOrder + parameters: + - name: orderId + in: path + required: true + schema: + type: string + responses: + '200': + description: the order + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + '404': + description: no such order + /orders/{orderId}/cancel: + post: + operationId: cancelOrder + security: + - backofficeToken: [orders:write] + parameters: + - name: orderId + in: path + required: true + schema: + type: string + responses: + '204': + description: cancelled + '409': + description: already shipped +components: + securitySchemes: + backofficeToken: + type: oauth2 + flows: + clientCredentials: + tokenUrl: https://auth.shop.example/token + scopes: + orders:write: change orders + schemas: + OrderStatus: + type: string + enum: [OPEN, PAID, SHIPPED, CANCELLED] + Order: + type: object + required: [orderId, status, total] + properties: + orderId: + type: string + status: + $ref: '#/components/schemas/OrderStatus' + total: + type: number + format: double + couponCode: + type: string + deprecated: true diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/persistence/Shipment.hbm.xml b/docs/ai-index-benchmark/corpus-enterprise/other/persistence/Shipment.hbm.xml new file mode 100644 index 00000000..c7f2d567 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/persistence/Shipment.hbm.xml @@ -0,0 +1,36 @@ + + + + + + + + SHIPMENT_SEQ + + + + + + + + + + + + + + + + + + + diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/persistence/persistence.xml b/docs/ai-index-benchmark/corpus-enterprise/other/persistence/persistence.xml new file mode 100644 index 00000000..5f81e718 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/persistence/persistence.xml @@ -0,0 +1,27 @@ + + + + + org.hibernate.jpa.HibernatePersistenceProvider + java:/jdbc/ShopDS + META-INF/order-queries.xml + shop.Order + shop.OrderLine + shop.Customer + + + + + + + + + java:/jdbc/ReportingDS + shop.reporting.DailyRevenue + true + + diff --git a/docs/ai-index-benchmark/corpus-enterprise/other/wsdl/StockService.wsdl b/docs/ai-index-benchmark/corpus-enterprise/other/wsdl/StockService.wsdl new file mode 100644 index 00000000..98636ba4 --- /dev/null +++ b/docs/ai-index-benchmark/corpus-enterprise/other/wsdl/StockService.wsdl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/ai-index-benchmark/modelcard/facts-enterprise.json b/docs/ai-index-benchmark/modelcard/facts-enterprise.json new file mode 100644 index 00000000..48e3ece0 --- /dev/null +++ b/docs/ai-index-benchmark/modelcard/facts-enterprise.json @@ -0,0 +1,109 @@ +{ + "_comment": "Expected facts of the enterprise corpus (../corpus-enterprise: Java EE, Kotlin, Groovy, Jakarta EE descriptors, JPA and Hibernate, MyBatis, Camel, BPMN, WSDL, JSP, Facelets, OpenAPI, Kubernetes, GitHub Actions, Dockerfile), as in facts.json: 'ids' a faithful summary names, 'numbers' values it states, 'words' the ids that count only marked as code. The password in persistence.xml must not be named: 'secret' is the value no summary may copy. Scored with score.py --facts facts-enterprise.json.", + "java/shop/OrderResource.java": { + "ids": ["OrderResource", "openOrders", "find", "cancel", "purgeCancelled", "PURGE_AFTER_DAYS", "PaymentGateway", + "AuditLog", "EntityManager", "Stateless", "Schedule", "RolesAllowed", "/orders", "refund"], + "words": ["find", "cancel", "refund"], + "numbers": [30] + }, + "other/kotlin/InvoiceService.kt": { + "ids": ["InvoiceService", "InvoiceNumber", "InvoiceLine", "InvoiceResult", "Issued", "Rejected", "issue", + "taxRate", "nextNumber", "total", "PAYMENT_TERM_DAYS", "REDUCED_TAX_CATEGORIES", "InvoiceRepository", + "defaultCurrency", "PREFIX"], + "words": ["issue", "total"], + "numbers": [14] + }, + "other/groovy/ShippingRulesSpec.groovy": { + "ids": ["ShippingRulesSpec", "ShippingRules", "costFor", "FREE_SHIPPING_THRESHOLD", "ParcelTooHeavyException", + "maxParcelKg", "carrier", "heavyOrder", "Specification"], + "words": ["carrier"], + "numbers": [] + }, + "other/jee/web.xml": { + "ids": ["ReportDownloadServlet", "RequestIdFilter", "StartupAuditListener", "shop.reportDirectory", "/reports/*", + "/admin/*", "admin", "jdbc/ShopDS"], + "words": ["admin"], + "numbers": [20] + }, + "other/jee/ejb-jar.xml": { + "ids": ["StockReservationBean", "CheckoutSessionBean", "OrderPlacedListener", "TimingInterceptor", + "reservationMinutes", "Stateless", "Stateful", "RequiresNew", "java:/jms/queue/OrderPlaced", + "ejb/StockReservation"], + "words": [], + "numbers": [45] + }, + "other/persistence/persistence.xml": { + "ids": ["shop", "reporting", "java:/jdbc/ShopDS", "java:/jdbc/ReportingDS", "Order", "OrderLine", "Customer", + "DailyRevenue", "hibernate.dialect", "JTA", "RESOURCE_LOCAL"], + "words": ["shop", "reporting"], + "numbers": [50], + "secret": "Tr0ub4dor-shop-2026" + }, + "other/persistence/Shipment.hbm.xml": { + "ids": ["Shipment", "SHIPMENT", "ExpressShipment", "trackingCode", "carrier", "Parcel", "SHIPMENT_SEQ", + "Shipment.undelivered", "Shipment.countByCarrier", "ORDER_ID"], + "words": ["carrier"], + "numbers": [] + }, + "other/mybatis/CustomerMapper.xml": { + "ids": ["shop.customer.CustomerMapper", "customerResult", "customerColumns", "findByEmail", "search", "insert", + "promote", "deleteInactive", "CUSTOMER", "sortColumn"], + "words": ["search", "insert", "promote"], + "numbers": [] + }, + "other/integration/order-routes.xml": { + "ids": ["incomingOrders", "toErp", "manualReview", "orderValidator", "invoiceTranslator", "orders.incoming.queue", + "orders.review.threshold", "erp.host", "seda:orderAudit", "ErpUnavailableException", "orders.deadletter"], + "words": [], + "numbers": [5] + }, + "other/bpmn/order-fulfilment.bpmn": { + "ids": ["orderFulfilment", "reserveStock", "ReserveStockDelegate", "waitForPayment", "PaymentReceived", + "amountCheck", "approveOrder", "shipOrder", "shipping", "createInvoice", "invoicing", "OutOfStock", + "backoffice"], + "words": ["shipping", "invoicing", "backoffice"], + "numbers": [1000] + }, + "other/wsdl/StockService.wsdl": { + "ids": ["StockService", "StockPortType", "GetStockLevel", "StockSoapBinding", "StockPort", "UnknownSku", + "StockLevelRequest", "StockLevelResponse", "https://erp.shop.example/soap/stock"], + "words": [], + "numbers": [] + }, + "other/jsp/order-list.jsp": { + "ids": ["orderFilter", "orders", "customerEmail", "status", "/orders/search", "header.jspf", "footer.jspf", + "pageSize", "OrderFilter"], + "words": ["orders", "status"], + "numbers": [25] + }, + "other/facelets/checkout.xhtml": { + "ids": ["checkoutBean", "placeOrder", "recalculate", "shippingMethod", "checkoutForm", "street", "zip", + "/WEB-INF/templates/shop.xhtml", "payment-hints.xhtml"], + "words": ["street", "zip"], + "numbers": [] + }, + "other/openapi/orders-api.yaml": { + "ids": ["listOrders", "getOrder", "cancelOrder", "/orders", "/orders/{orderId}", "/orders/{orderId}/cancel", + "Order", "OrderStatus", "backofficeToken", "couponCode", "orders:write"], + "words": [], + "numbers": [200, 404, 409] + }, + "other/k8s/orders-deployment.yaml": { + "ids": ["orders-backoffice", "registry.shop.example/orders-backoffice:2.1.0", "SHOP_DB_URL", "SHOP_DB_PASSWORD", + "orders-db-credentials", "/health/ready", "backoffice.shop.example", "Deployment", "Service", "Ingress"], + "words": [], + "numbers": [3, 8080] + }, + "other/actions/.github/workflows/release.yml": { + "ids": ["release-backoffice", "build", "image", "deploy", "actions/checkout@v4", "actions/setup-java@v4", + "docker/login-action@v3", "REGISTRY_USER", "REGISTRY_TOKEN", "deploy-k8s.yml", "production"], + "words": ["build", "image", "deploy", "production"], + "numbers": [] + }, + "other/docker/Dockerfile": { + "ids": ["maven:3.9-eclipse-temurin-21", "eclipse-temurin:21-jre-alpine", "APP_VERSION", "JAVA_OPTS", + "SHOP_PROFILE", "backoffice", "orders-backoffice.jar", "/health/live", "build"], + "words": ["backoffice", "build"], + "numbers": [8080] + } +} diff --git a/docs/ai-index-benchmark/modelcard/run.py b/docs/ai-index-benchmark/modelcard/run.py index 7ad6c124..2481d648 100644 --- a/docs/ai-index-benchmark/modelcard/run.py +++ b/docs/ai-index-benchmark/modelcard/run.py @@ -18,6 +18,9 @@ python run.py --cp --java --models gpt-6-luna,gemma-4-31b python run.py ... --backend openrouter (every model of one backend) Options: --profile (default v3; it needs the five prompt keys' files), + --java-prompt (the Java rule's prompt, default file-body-oop, the one Java, Kotlin, + Groovy and Scala share; the Java EE rule takes it too; file-body-java for a profile of the + history before 2026-11-04), --profile-dir (default the repository's profiles/; an earlier prompt set is restored from the history into a directory of its own, see profiles/README.md), @@ -65,7 +68,10 @@ REPO = HERE.parents[2] CORPUS = HERE.parent / "corpus" PROFILES = REPO / "profiles" -PROMPT_KEYS = ("file-body-java", "file-body-sql", "file-body-fallback", "package-body", "project-body") +PROMPT_KEYS = ("file-body-sql", "file-body-fallback", "package-body", "project-body") +# The prompt of the Java rule (--java-prompt): the one class-based languages share. Up to 2026-11-04 it +# was file-body-java, which an earlier profile restored from the history still has. +JAVA_PROMPT = "file-body-oop" # The prompts appended to a rule's prompt in a map and a reduce call, when the profile has them. CHUNK_PROMPT_KEYS = {"mapPromptKey": "map-chunk", "reducePromptKey": "reduce-parts"} @@ -85,15 +91,58 @@ "provider/LlamaCppJniConfig.java", "provider/OpenAiCompatibleProviderSupport.java", ] -EXTENSIONS = [".java", ".sql", ".h", ".c", ".cl", ".py", ".sh", ".bash", ".ksh", ".pl", ".pm", ".xml", ".xsd", ".xsl", ".xslt"] +EXTENSIONS = [".java", ".sql", ".h", ".c", ".cl", ".py", ".sh", ".bash", ".ksh", ".pl", ".pm", ".xml", ".xsd", ".xsl", ".xslt", + ".wsdl", ".kt", ".kts", ".groovy", ".scala", ".jsp", ".jspf", ".tag", ".xhtml", ".bpmn", ".dmn", + ".yml", ".yaml", ".proto", ".avsc", ".graphql", ".graphqls", ".tf", ".hcl", ".gradle", ".properties"] +# Files without an extension the runs index by name. +FILE_NAMES = ["Dockerfile", "Containerfile"] # A language gets a rule of its own when the profile has its prompt (file-body-.md) or when # --facts asks for its counters (-facts.tsv); otherwise the fallback rule summarizes it. A POM # matches pom and xml; its priority gives it the Maven counters, with the XML prompt. XML_EXTENSIONS = [".xml", ".xsd", ".xsl", ".xslt"] +# The enterprise kinds (corpus-enterprise/) take a prompt a kind shares (None: the Java rule's), the more +# specific ones by name or by content at priority 10 over their extension's rule. +EE_IMPORTS = (r"(?m)(?:^import[ \t]+(?:static[ \t]+)?|@)(?:javax|jakarta)\.(?:ejb|persistence|ws\.rs|servlet|jws" + r"|xml\.ws|inject|transaction|enterprise|annotation\.security)\.") +YAML_EXTENSIONS = [".yml", ".yaml"] + + +def _and(*conditions): + return {"and": {"conditions": list(conditions)}} + + LANGUAGES = (("shell", {"extensions": [".sh", ".bash", ".ksh"]}, "shell", 0), ("perl", {"extensions": [".pl", ".pm"]}, "perl", 0), ("pom", {"pathGlob": "**/*pom.xml"}, "xml", 10), - ("xml", {"extensions": XML_EXTENSIONS}, "xml", 0)) + ("xml", {"extensions": XML_EXTENSIONS + [".wsdl"]}, "xml", 0), + ("java-ee", _and({"extensions": [".java"]}, {"contentMatches": EE_IMPORTS}), None, 10), + ("kotlin", {"extensions": [".kt", ".kts"]}, "oop", 0), + ("groovy", {"extensions": [".groovy"]}, "oop", 0), + ("scala", {"extensions": [".scala"]}, "oop", 0), + ("jee", {"fileNames": ["web.xml", "web-fragment.xml", "ejb-jar.xml", "application.xml"]}, "xml", 10), + ("persistence", {"fileNames": ["persistence.xml", "orm.xml", "*.hbm.xml"]}, "xml", 10), + ("mybatis", _and({"extensions": [".xml"]}, {"contentMatches": r"mybatis\.org//DTD Mapper"}), "xml", 10), + ("integration", _and({"extensions": [".xml"]}, {"contentMatches": r"camel\.apache\.org/schema|" + r"springframework\.org/schema/integration|mulesoft\.org/schema/mule|" + r"ws\.apache\.org/ns/synapse"}), "xml", 10), + ("bpmn", {"extensions": [".bpmn"]}, "xml", 10), + ("dmn", {"extensions": [".dmn"]}, "xml", 10), + ("wsdl", {"extensions": [".wsdl"]}, "xml", 10), + ("jsp", {"extensions": [".jsp", ".jspf", ".tag"]}, "view", 0), + ("facelets", {"extensions": [".xhtml"]}, "view", 0), + ("openapi", _and({"extensions": YAML_EXTENSIONS}, {"contentMatches": r"(?m)^[\"']?(?:openapi|swagger)[\"']?[ \t]*:"}), + "contract", 10), + ("proto", {"extensions": [".proto"]}, "contract", 0), + ("avro", {"extensions": [".avsc"]}, "contract", 0), + ("graphql", {"extensions": [".graphql", ".graphqls"]}, "contract", 0), + ("actions", {"pathGlob": "**/.github/workflows/*.{yml,yaml}"}, "ops", 10), + ("k8s", _and({"extensions": YAML_EXTENSIONS}, {"contentMatches": r"(?m)^kind:[ \t]*[A-Z]"}), "ops", 5), + ("dockerfile", {"fileNames": ["Dockerfile", "Dockerfile.*", "Containerfile"]}, "ops", 0), + ("compose", {"fileNames": ["docker-compose*.{yml,yaml}", "compose*.{yml,yaml}"]}, "ops", 10), + ("terraform", {"extensions": [".tf", ".hcl"]}, "ops", 0), + ("gradle", {"extensions": [".gradle"]}, "ops", 10), + ("properties", {"extensions": [".properties"]}, "ops", 0), + ("ops", {"extensions": YAML_EXTENSIONS}, "ops", 0)) PHASES = ("GenerateFileIndex", "AggregatePackages", "AggregateProject") WORK_MARKER = ".srcmorph-benchmark-work" OVERSIZE = ("fail", "sample", "mapReduce", "sampleChunks", "deterministic") @@ -148,22 +197,24 @@ def chunk_prompts(profile): return {field: key for field, key in CHUNK_PROMPT_KEYS.items() if (Path(profile) / f"{key}.md").is_file()} -def file_rules(profile, key, facts=False, oversize=None, max_chunks=None): - """The GenerateFileIndex rules: java, sql, a rule per language that has a prompt or (with facts) - counters of its own, and the fallback. With oversize every rule takes that strategy, and with - mapReduce or sampleChunks the profile's map and reduce prompts.""" - rules = [{"id": "java", "promptKey": "file-body-java", "condition": {"extensions": [".java"]}}, +def file_rules(profile, key, facts=False, oversize=None, max_chunks=None, java_prompt=JAVA_PROMPT): + """The GenerateFileIndex rules: java (with java_prompt), sql, a rule per language that has a prompt + or (with facts) counters of its own in the profile, and the fallback. With oversize every rule takes + that strategy, and with mapReduce or sampleChunks the profile's map and reduce prompts.""" + rules = [{"id": "java", "promptKey": java_prompt, "condition": {"extensions": [".java"]}}, {"id": "sql", "promptKey": "file-body-sql", "condition": {"extensions": [".sql"]}}] if facts: rules[0]["factsKey"], rules[1]["factsKey"] = "java-facts", "sql-facts" for name, condition, prompt, priority in LANGUAGES: - own_prompt = (Path(profile) / f"file-body-{prompt}.md").is_file() - if own_prompt or facts: - rule = {"id": name, "promptKey": f"file-body-{prompt}" if own_prompt else "file-body-fallback", - "condition": dict(condition)} + prompt_key = java_prompt if prompt is None else f"file-body-{prompt}" + own_prompt = (Path(profile) / f"{prompt_key}.md").is_file() + own_facts = facts and (Path(profile) / f"{name}-facts.tsv").is_file() + if own_prompt or own_facts: + rule = {"id": name, "promptKey": prompt_key if own_prompt else "file-body-fallback", + "condition": json.loads(json.dumps(condition))} if priority: rule["priority"] = priority - if facts: + if own_facts: rule["factsKey"] = f"{name}-facts" rules.append(rule) rules.append({"id": "fallback", "promptKey": "file-body-fallback", "fallback": True}) @@ -179,12 +230,12 @@ def file_rules(profile, key, facts=False, oversize=None, max_chunks=None): def phase_config(phase, work, out_dir, profile, definition, facts=False, oversize=None, max_chunks=None, - run_record=None): + run_record=None, java_prompt=JAVA_PROMPT): """The CLI configuration of one phase. The file phase's rules are srcMorph's fieldGenerations; the package and project phases take their one rule from packageFieldGenerations and projectFieldGenerations, as the CLI reads them.""" key = definition["key"] - rules = file_rules(profile, key, facts, oversize, max_chunks) + rules = file_rules(profile, key, facts, oversize, max_chunks, java_prompt) config = { "command": phase, "srcMorph": { @@ -192,6 +243,7 @@ def phase_config(phase, work, out_dir, profile, definition, facts=False, oversiz "outputDirectory": str(out_dir), "subtrees": ["java", "sql", "other"], "fileExtensions": EXTENSIONS, + "fileNames": FILE_NAMES, "generationProvider": definition["provider"], "projectName": "srcmorph-modelcard", "force": True, @@ -335,7 +387,7 @@ def files_not_written(log_path): def run_model(args, models, profile, model): key = model["key"] definition = ai_definition(models, model, args.model_dir, args.seed, args.chars_per_token) - rules = file_rules(profile, key, args.facts, args.oversize or None, args.max_chunks) + rules = file_rules(profile, key, args.facts, args.oversize or None, args.max_chunks, args.java_prompt) out_dir = Path(args.out) / key if out_dir.exists(): shutil.rmtree(out_dir) @@ -354,7 +406,8 @@ def run_model(args, models, profile, model): for k, v in definition.items() if k != "apiKeyEnv"}, "javaCommit": None if args.corpus else args.commit, "corpus": Path(args.corpus).name if args.corpus else "srcmorph", - "profile": args.profile, "facts": args.facts, "oversize": args.oversize or None, + "profile": args.profile, "javaPrompt": args.java_prompt, "facts": args.facts, + "oversize": args.oversize or None, "maxChunks": args.max_chunks, "profileHashes": profile_hashes(profile, rules), "cli": cli_jar(classpath), "java": java_version(args.java), "startedAt": utc_now(), "phases": {}} @@ -366,7 +419,7 @@ def run_model(args, models, profile, model): config_path = log_dir / f"config_{phase}.json" config_path.write_text(json.dumps(phase_config(phase, Path(args.work), out_dir, profile, definition, args.facts, args.oversize or None, args.max_chunks, - run_record), + run_record, args.java_prompt), indent=1), encoding="utf-8") start = time.time() with open(log_dir / f"{phase}.log", "w", encoding="utf-8") as log: @@ -442,6 +495,7 @@ def main(): parser.add_argument("--oversize", default="", choices=("",) + OVERSIZE) parser.add_argument("--max-chunks", type=int, default=None) parser.add_argument("--chars-per-token", type=float, default=None) + parser.add_argument("--java-prompt", default=JAVA_PROMPT) args = parser.parse_args() # srcmorph resolves a relative path against the configuration file's directory, not the working one for name in ("work", "out", "meta"): @@ -451,7 +505,7 @@ def main(): validate(parser, args, models) profile = Path(args.profile_dir).resolve() / args.profile - for prompt_key in PROMPT_KEYS: + for prompt_key in PROMPT_KEYS + (args.java_prompt,): if not (profile / f"{prompt_key}.md").is_file(): sys.exit(f"profile {args.profile}: {profile / prompt_key}.md is missing") wanted = [m for m in models["models"] diff --git a/docs/ai-index-benchmark/modelcard/score.py b/docs/ai-index-benchmark/modelcard/score.py index e6eb6ef3..307ff966 100644 --- a/docs/ai-index-benchmark/modelcard/score.py +++ b/docs/ai-index-benchmark/modelcard/score.py @@ -311,6 +311,10 @@ def score_model(model_dir, work, facts, cut_off=frozenset()): body = body_of(out.read_text(encoding="utf-8")) row = score_file(source, body, ids, numbers, case_insensitive=kind_of(source_path) == "sql", everyday=everyday) + secret = (facts.get(rel) or {}).get("secret") + if secret: + # a value the facts mark as a secret: the summary may name it, never copy it + row["secretLeaked"] = secret in body middle = (facts.get(rel) or {}).get("middle", []) if middle: row["middleExpected"] = len(middle) @@ -359,6 +363,7 @@ def summarize(rows): "badHeadings": sum(r["badHeadings"] for r in answered), "fences": sum(r["fences"] for r in answered), "leaks": sum(r["leaks"] for r in present), + "secretsLeaked": sum(1 for r in present if r.get("secretLeaked")), } return summary diff --git a/docs/ai-index-benchmark/modelcard/tests/test_score.py b/docs/ai-index-benchmark/modelcard/tests/test_score.py index fdecc3e1..217b5515 100644 --- a/docs/ai-index-benchmark/modelcard/tests/test_score.py +++ b/docs/ai-index-benchmark/modelcard/tests/test_score.py @@ -165,6 +165,26 @@ def test_scoreModel_missingAndCutOff(self): self.assertEqual(summary["java"]["failed"], {"missing": 1}) self.assertEqual(summary["java"]["cutOff"], 1) + def test_scoreModel_aSecretTheFactsMark_countsWhenCopied(self): + with tempfile.TemporaryDirectory() as tmp: + work, out = Path(tmp) / "work", Path(tmp) / "out" + (work / "other").mkdir(parents=True) + (work / "other" / "a.xml").write_text("

", encoding="utf-8") + (work / "other" / "b.xml").write_text("

", encoding="utf-8") + (out / "other").mkdir(parents=True) + (out / "other" / "a.xml.ai.md").write_text("h: 1\n---\n" + body("`password=***`."), encoding="utf-8") + (out / "other" / "b.xml.ai.md").write_text("h: 1\n---\n" + body("`password=s3cret-2`."), + encoding="utf-8") + facts = {"other/a.xml": {"ids": ["password"], "secret": "s3cret-1"}, + "other/b.xml": {"ids": ["password"], "secret": "s3cret-2"}} + + rows = score.score_model(out, work, facts) + + by_file = {r["file"]: r for r in rows} + self.assertFalse(by_file["other/a.xml"]["secretLeaked"]) + self.assertTrue(by_file["other/b.xml"]["secretLeaked"]) + self.assertEqual(score.summarize(rows)["other"]["secretsLeaked"], 1) + class JavaNamesTest(unittest.TestCase): diff --git a/docs/ai-index-benchmark/modelcard/tests/test_tools.py b/docs/ai-index-benchmark/modelcard/tests/test_tools.py index afafa1b2..ee9d2323 100644 --- a/docs/ai-index-benchmark/modelcard/tests/test_tools.py +++ b/docs/ai-index-benchmark/modelcard/tests/test_tools.py @@ -89,6 +89,46 @@ def test_chunkedRules_nameTheMapAndReducePrompts_otherRulesNot(self): for r in chunked)) self.assertTrue(all("mapPromptKey" not in r and "reducePromptKey" not in r for r in sampled)) + def test_javaPrompt_namesTheJavaAndTheJavaEeRule(self): + profile = run.PROFILES / "v3" + default = {r["id"]: r for r in run.file_rules(profile, "m")} + with tempfile.TemporaryDirectory() as tmp: + # a profile of the history before 2026-11-04, with its Java prompt + (Path(tmp) / "file-body-java.md").write_text("Java.", encoding="utf-8") + older = {r["id"]: r for r in run.file_rules(Path(tmp), "m", java_prompt="file-body-java")} + + self.assertEqual(default["java"]["promptKey"], "file-body-oop") + self.assertEqual(default["java-ee"]["promptKey"], "file-body-oop") + self.assertEqual(default["java-ee"]["priority"], 10) + self.assertEqual(older["java"]["promptKey"], "file-body-java") + self.assertEqual(older["java-ee"]["promptKey"], "file-body-java") + + def test_enterpriseKinds_takeTheirSharedPromptAndTheirOwnFacts(self): + rules = {r["id"]: r for r in run.file_rules(run.PROFILES / "v3", "m", facts=True)} + + self.assertEqual((rules["kotlin"]["promptKey"], rules["kotlin"]["factsKey"]), ("file-body-oop", "kotlin-facts")) + self.assertEqual((rules["jee"]["promptKey"], rules["jee"]["factsKey"]), ("file-body-xml", "jee-facts")) + self.assertEqual((rules["jsp"]["promptKey"], rules["jsp"]["factsKey"]), ("file-body-view", "jsp-facts")) + self.assertEqual(rules["openapi"]["promptKey"], "file-body-contract") + self.assertEqual(rules["dockerfile"]["factsKey"], "dockerfile-facts") + self.assertEqual((rules["scala"]["promptKey"], rules["scala"]["factsKey"]), ("file-body-oop", "scala-facts")) + self.assertEqual((rules["proto"]["promptKey"], rules["proto"]["factsKey"]), ("file-body-contract", "proto-facts")) + self.assertEqual((rules["gradle"]["promptKey"], rules["gradle"]["priority"]), ("file-body-ops", 10)) + # a kind without a facts file of its own counts nothing + self.assertNotIn("factsKey", rules["ops"]) + + def test_aProfileWithoutAKindsPromptOrFacts_hasNoRuleForIt(self): + with tempfile.TemporaryDirectory() as tmp: + rules = {r["id"] for r in run.file_rules(Path(tmp), "m", facts=True)} + + self.assertEqual(rules, {"java", "sql", "fallback"}) + + def test_aPhaseConfig_indexesFilesWithoutAnExtensionByName(self): + definition = {"key": "m", "provider": "mock"} + config = run.phase_config("GenerateFileIndex", Path("w"), Path("o"), run.PROFILES / "v3", definition) + + self.assertEqual(config["srcMorph"]["fileNames"], ["Dockerfile", "Containerfile"]) + def test_chunkPrompts_onlyThoseTheProfileHas(self): self.assertEqual(run.chunk_prompts(Path("no-such-profile")), {}) @@ -96,12 +136,12 @@ def test_profileHashes_ofTheFilesTheRulesName(self): profile = run.PROFILES / "v3" hashes = run.profile_hashes(profile, run.file_rules(profile, "m", facts=True)) - self.assertIn("file-body-java.md", hashes) + self.assertIn("file-body-oop.md", hashes) self.assertIn("sql-facts.tsv", hashes) self.assertIn("package-body.md", hashes) self.assertIn("map-chunk.md", hashes) self.assertIn("reduce-parts.md", hashes) - self.assertEqual(hashes["file-body-java.md"], run.sha256_of(profile / "file-body-java.md")) + self.assertEqual(hashes["file-body-oop.md"], run.sha256_of(profile / "file-body-oop.md")) class CostTest(unittest.TestCase): diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/README.md b/docs/ai-index-benchmark/remeasure-2026-11-04/README.md new file mode 100644 index 00000000..4058dbf9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/README.md @@ -0,0 +1,59 @@ + +# Re-measurement, 2026-11-04 + +The runs behind the profile changes of 2026-11-04: the secrets rule in every file prompt, the XML +prompt's definitions of the enterprise kinds, and the shared prompt `file-body-oop` for Java, Kotlin, +Groovy and Scala. gpt-oss-20b and GPT-6 Luna on OpenRouter, three runs each, one after the other. +Every run directory holds `meta/.json` and `out//`. + +**What ran.** srcmorph at `f5dc742`, `profiles/v3` at that commit (which still had +`file-body-java.md`), the tools of `modelcard/` at that commit. + +| Directory | Corpus | Options | +|---|---|---| +| `benchmark-java/run1..3` | the model-card corpus | `--profile v3 --java-prompt file-body-java` | +| `benchmark-oop/run1..3` | the same | `--profile v3 --java-prompt file-body-oop` | +| `languages/run1..3` | [`corpus-languages/`](../corpus-languages/) | `--profile v3` | +| `enterprise/run1..3` | [`corpus-enterprise/`](../corpus-enterprise/README.md) | `--profile v3 --facts --java-prompt file-body-oop` | + +Scored with `score.py` (the language corpus with `facts-languages.json`, the enterprise corpus with +`facts-enterprise.json`); quality is the model card's, the mean of the kinds' recalls and the format +share (`repeat.quality`). No reader search ran. + +| | Run 1 / 2 / 3 | Mean | s/file | USD per run (account delta) | +|---|---|---|---|---| +| gpt-oss-20b, card corpus, `file-body-java` | 99.4 / 100 / 100 % | 99.8 % | 4.1 to 9.1 | 0.002 to 0.004 | +| gpt-oss-20b, card corpus, `file-body-oop` | 100 / 99.7 / 100 % | 99.9 % | 4.3 to 6.5 | 0.003 to 0.004 | +| GPT-6 Luna, card corpus, `file-body-java` | 100 / 99.2 / 100 % | 99.7 % | 7.3 to 8.1 | 0.017 to 0.027 | +| GPT-6 Luna, card corpus, `file-body-oop` | 100 / 100 / 100 % | 100 % | 6.8 to 7.6 | 0.017 to 0.022 | +| gpt-oss-20b, language corpus | 99.0 / 98.6 / 98.3 % | 98.7 % | 3.7 to 4.3 | 0.001 to 0.002 | +| GPT-6 Luna, language corpus | 100 / 99.3 / 100 % | 99.8 % | 7.9 to 8.4 | 0.006 to 0.008 | +| gpt-oss-20b, enterprise corpus | 97.2 / 99.3 / 97.2 % | 97.9 % | 4.1 to 4.2 | 0.002 to 0.003 | +| GPT-6 Luna, enterprise corpus | 97.5 / 97.3 / 97.1 % | 97.3 % | 5.7 to 5.9 | 0.009 to 0.014 | + +No run failed a file, wrote a code fence or a `###` heading, or copied the password the enterprise +corpus's `persistence.xml` holds (`secretsLeaked` 0 in every run). + +- **The shared prompt holds Java.** On the card corpus the Java recall is the same with either + prompt (gpt-oss 99.9 to 100 %, Luna 100 %), and every miss is one seen before: `setCachePrompt` of + `AiGenerationConfig` (gpt-oss, two runs with `file-body-java`, one with `file-body-oop`) and + `book_free_le_total` of the SQL migration, which no Java prompt touches. Java therefore moved to + `file-body-oop`, and `file-body-java.md` went: one prompt serves every class-based language. +- **The language corpus**, after the secrets rule and the XML prompt's new definitions: Luna 99.8 % + (99.5 % on 2026-11-02), gpt-oss 98.7 % (99.1 %, scored the same way). gpt-oss's misses are those of + 2026-11-02 (`LEVEL_RANK`, the XSLT's `format-number`, the deploy script's `lib/common.sh`) plus + `systemctl` of the deploy script in two runs and `settled_payment` of the ksh script in one. Three + runs against three cannot tell that from variation. +- **The enterprise corpus** is new, so it has nothing to compare against. What the models left out + is mostly private: Luna the Kotlin service's `nextNumber` and `PREFIX` and the Java resource's + `refund` call in every run (the prompt asks for the public API), gpt-oss the workflow's name + `release-backoffice` in every run (the ops prompt does not ask for a workflow's name), the Java + resource's `PURGE_AFTER_DAYS` and the Kotlin `defaultCurrency` in two, and in one run both + session types `Stateless` / `Stateful` of `ejb-jar.xml` (80 % for that file), in another and the Facelets + view's template path. `web.xml`, both persistence files, the MyBatis mapper, the Camel routes, the + BPMN process, the WSDL, the JSP, the OpenAPI contract, the Kubernetes manifest and the Dockerfile + scored 100 % in all six runs. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/meta/gpt-6-luna.json new file mode 100644 index 00000000..6596c685 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/meta/gpt-6-luna.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:09:59Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 187.7, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 72.0, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.4, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:14:23Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 83203, + "cachedPromptTokens": 0, + "completionTokens": 18761, + "seconds": 187.0383047 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.017701, + "costUsd": 0.026536, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/meta/gpt-oss-20b.json new file mode 100644 index 00000000..a0165f92 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/meta/gpt-oss-20b.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:14:23Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 219.3, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 99.3, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 6.7, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:19:49Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 84734, + "cachedPromptTokens": 2086, + "completionTokens": 17078, + "seconds": 218.6359992 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.004762, + "costUsd": 0.003729, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..1dc5963e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,57 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:10:00Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Evaluates file-selection rules using extensions, size, line count, modification time, and relative-path globs, and validates rule trees before indexing. + +#### Purpose +- Matches `AiCondition` trees against `AiFileContext` file facts. +- Validates rule configuration and detects whether line counting is required. + +#### Type +- `public final class AiConditionEvaluator` — final class; no superclass or implemented interfaces. +- No notable annotations. + +#### Input +- `AiCondition` tree and `AiFileContext` supplied to evaluation methods. +- Reads condition branches and group children; reads context filename, size, line count, modification time, and relative path. + +#### Output +- `matches` returns a boolean match result. +- `usesLines` returns whether a tree contains a line-count condition. +- `validate` returns no value; throws on invalid configuration. +- No persistent state or resource writes. + +#### Core logic +- `matches` evaluates `and` children all-true, `or` children any-true, and `not` by negation. +- Leaf checks compare filename suffixes against extensions, size and line count against `AiRangeCondition`, timestamps against parsed ISO-8601 instants, or relative paths against a glob. +- `validate` requires exactly one of nine branch/leaf fields per node; recursively validates combinator children. +- Rejects empty `and`/`or` groups, empty extension lists, unbounded size/line ranges, invalid timestamps, and blank path globs. +- `usesLines` recursively searches `and`, `or`, and `not` trees for a `lines` leaf. + +#### Public API +- `AiConditionEvaluator()` -> create evaluator +- `matches(AiCondition, AiFileContext) -> boolean` — test file against condition +- `validate(AiCondition) -> void` — reject invalid condition tree +- `usesLines(AiCondition) -> boolean` — detect line-count requirement + +#### Dependencies +- `AiCondition`, `AiConditionGroup`, `AiFileContext`, `AiRangeCondition` +- `AiSourceExcludeFilter` +- `Instant`, `DateTimeParseException` +- `Collections`, `List`, `@Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for invalid branch counts, groups, leaves, or timestamps. +- Timestamp parsing wraps `DateTimeParseException` in `IllegalArgumentException`. +- `matches` throws `IllegalStateException` if no condition branch is selected; documented to assume prior validation. +- Extension matching ignores null entries; null group child lists are treated as empty by matching and `usesLines`. + +#### Concurrency +- Stateless after construction; no synchronization or mutable instance state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..ba8cd771 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,46 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:10:08Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Groups child AI conditions so Maven configuration can represent the contents of `` and `` combinators. + +#### Purpose +- Holds configured child `AiCondition` entries for an `AiCondition` combinator. +- Uses a `conditions` field so Maven binds items as `…`. + +#### Type +- `public class AiConditionGroup` — class; annotated `@ToString`. + +#### Input +- `setConditions(Collection)` accepts child conditions or `null`. + +#### Output +- `getConditions()` returns the stored `List` or `null`. +- `setConditions(...)` stores a defensive `ArrayList` copy, or `null`. + +#### Core logic +- `AiConditionGroup` stores child conditions in a nullable `conditions` list. +- Copies incoming collections to an `ArrayList` to avoid retaining the caller’s collection. + +#### Public API +- `AiConditionGroup()` -> `void` — creates an empty group. +- `getConditions()` -> `@Nullable List` — returns child conditions. +- `setConditions(Collection)` -> `void` — replaces child conditions. + +#### Dependencies +- `AiCondition` +- `ArrayList`, `Collection`, `List` +- Lombok `@ToString` +- JSpecify `@Nullable` + +#### Exceptions / Errors +- `null` conditions are accepted and preserved as `null`. + +#### Concurrency +- Mutable field; no synchronization or thread-safety guarantees. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..061167f3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,61 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:10:12Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Produces exact whole-source counts for configured regex-based code facts, ready to prepend to an AI-generated summary. + +#### Purpose +- `AiFactExtractor` formats configured fact counts as a deterministic facts block. +- `AiFactExtractor` validates labels and regex patterns before use. + +#### Type +- `public final class AiFactExtractor` — utility class; not instantiable. +- No superclass or implemented interfaces. +- Uses `@Nullable` on counter-list parameters. + +#### Input +- `factsBlock(List, String)` consumes counters and full source text. +- `validate(List)` consumes configured counters. +- Each `AiFactCounter` supplies a label and regex pattern. + +#### Output +- `factsBlock` returns a formatted string, or `""` when no entries are reportable. +- `validate` returns no value; throws for invalid counter configuration. +- Public constants define the header, separators, and trailing blank line. + +#### Core logic +- `factsBlock` returns `""` for a null or empty list; skips null counters and counters with null labels or patterns. +- For each remaining counter, compiles its regex and counts non-overlapping matches across the full source using `Matcher.find()`. +- Formats entries as `label: count`, joins them with `; `, and wraps them with `**Facts (exact, whole file):** ` and `\n\n`. +- `validate` skips null lists and null counters; rejects counters with missing labels or patterns. +- `validate` compiles each pattern to detect invalid regex syntax. + +#### Public API +- `FACTS_HEADER` — exact-count facts header. +- `LABEL_COUNT_SEPARATOR` — label/count separator. +- `ENTRY_SEPARATOR` — entries separator. +- `FACTS_SUFFIX` — trailing blank line. +- `factsBlock(List, String) -> String` — build facts block. +- `validate(List) -> void` — validate fact counters. + +#### Dependencies +- `AiFactCounter` +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for missing labels, missing patterns, or invalid regex syntax; wraps `PatternSyntaxException` as the cause. +- `factsBlock` does not validate patterns; invalid regex syntax propagates as `PatternSyntaxException`. +- A null source passed to `factsBlock` can cause `NullPointerException` during matching. + +#### Concurrency +- Stateless and uses only local variables; no shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..3e775a11 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,99 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:10:19Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures model routing, prompt limits, sampling, reasoning, hardware, caching, and stopping behavior for AI-generated project summaries. + +#### Purpose +- Carries one AI generation step’s settings between Maven configuration and AI providers. +- Supplies defaults and mutable JavaBean accessors for local and OpenAI-compatible generation. + +#### Type +- `public class AiGenerationConfig` — class; Lombok `@ToString`; mutable identity-managed bean. +- Nullable `modelPath`, thinking mode, and calibration; no `equals`/`hashCode` generation. + +#### Input +- Constructor takes no arguments; all settings are configured through setters. +- Settings include model path, context/output limits, sampling, trimming, provider/API endpoint, reasoning, cache, hardware, DRY controls, stop strings, and optional `AiCalibration`. + +#### Output +- Exposes configuration values through getters; fields are mutated by setters. +- Returns unmodifiable views of DRY sequence breakers and stop strings. +- Lombok-generated `toString()` renders instance fields for diagnostics. + +#### Core logic +- Initializes instance settings from public defaults, including available-processor-capped inference threads and sampling defaults. +- Uses nullable chat-template thinking mode to distinguish unset from explicitly enabled or disabled. +- Uses sentinel defaults (such as `-1` and empty strings) to represent provider/binding defaults or omitted settings. +- Resets nullable list and string inputs to empty/default values where implemented; list getters wrap current lists as unmodifiable views. +- Stores provider routing, remote model, base URL, and API-key environment-variable name; does not store the API key itself. +- Holds optional per-machine calibration without applying it. + +#### Public API +- `AiGenerationConfig()` -> constructor; initializes defaults. +- Constants: `DEFAULT_CONTEXT_SIZE`, `DEFAULT_MAX_OUTPUT_TOKENS`, `DEFAULT_TEMPERATURE`, `DEFAULT_THREADS`, `DEFAULT_MAX_INPUT_CHARS`, `DEFAULT_CHARS_PER_TOKEN`, `DEFAULT_SAFETY_MARGIN_CHARS`, `DEFAULT_WARN_ON_TRIM`, `DEFAULT_TOP_P`, `DEFAULT_TOP_K`, `DEFAULT_MIN_P`, `DEFAULT_TOP_N_SIGMA`, `DEFAULT_REPEAT_PENALTY`, `DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING`, `DEFAULT_CACHE_PROMPT`, `DEFAULT_REASONING_EFFORT`, `DEFAULT_REASONING_BUDGET_TOKENS`, `DEFAULT_SWA_FULL`, `DEFAULT_CACHE_REUSE`, `DEFAULT_GPU_LAYERS`, `DEFAULT_SEED`, `DEFAULT_CPU_MOE_LAYERS`, `DEFAULT_CPU_FFN_LAYERS`, `DEFAULT_KV_UNIFIED_PER_SLOT`, `DEFAULT_LAZY_MODE`, `DEFAULT_REPEAT_LAST_N`, `DEFAULT_CACHE_TYPE_K`, `DEFAULT_CACHE_TYPE_V`, `DEFAULT_FLASH_ATTN`, `DEFAULT_BATCH_SIZE`, `DEFAULT_UBATCH_SIZE`, `DEFAULT_THREADS_BATCH`, `DEFAULT_MAIN_GPU`, `DEFAULT_DEVICES`, `DEFAULT_PROVIDER`, `DEFAULT_REMOTE_MODEL`, `DEFAULT_BASE_URL`, `DEFAULT_API_KEY_ENV`, `DEFAULT_DRY_MULTIPLIER`, `DEFAULT_DRY_BASE`, `DEFAULT_DRY_ALLOWED_LENGTH`, `DEFAULT_DRY_PENALTY_LAST_N`. +- `getModelPath()`/`setModelPath(String)` -> model file path. +- `getContextSize()`/`setContextSize(int)` -> context window. +- `getMaxOutputTokens()`/`setMaxOutputTokens(int)` -> output token limit. +- `getTemperature()`/`setTemperature(float)` -> sampling temperature. +- `getThreads()`/`setThreads(int)` -> inference threads. +- `getCharsPerToken()`/`setCharsPerToken(int)` -> input budget estimate ratio. +- `getMaxInputChars()`/`setMaxInputChars(int)` -> prompt input character limit. +- `isWarnOnTrim()`/`setWarnOnTrim(boolean)` -> trim warning setting. +- `getTopP()`/`setTopP(float)` -> nucleus sampling threshold. +- `getTopK()`/`setTopK(int)` -> top-k sampling limit. +- `getRepeatPenalty()`/`setRepeatPenalty(float)` -> repetition penalty. +- `getMinP()`/`setMinP(float)` -> min-p threshold. +- `getTopNSigma()`/`setTopNSigma(float)` -> top-n-sigma threshold. +- `getChatTemplateEnableThinking()`/`setChatTemplateEnableThinking(Boolean)` -> nullable thinking mode. +- `isCachePrompt()`/`setCachePrompt(boolean)` -> prompt KV caching. +- `isSwaFull()`/`setSwaFull(boolean)` -> full SWA KV cache. +- `getCacheReuse()`/`setCacheReuse(int)` -> KV prefix reuse chunk. +- `getGpuLayers()`/`setGpuLayers(int)` -> GPU layer offload. +- `getCpuMoeLayers()`/`setCpuMoeLayers(int)` -> CPU MoE layer count. +- `getSeed()`/`setSeed(int)` -> generation RNG seed. +- `getCpuFfnLayers()`/`setCpuFfnLayers(int)` -> CPU FFN layer count. +- `getKvUnifiedPerSlot()`/`setKvUnifiedPerSlot(int)` -> per-slot KV context cap. +- `getLazyMode()`/`setLazyMode(String)` -> tensor-read laziness. +- `getRepeatLastN()`/`setRepeatLastN(int)` -> repetition penalty window. +- `getCacheTypeK()`/`setCacheTypeK(String)` -> K-cache data type. +- `getCacheTypeV()`/`setCacheTypeV(String)` -> V-cache data type. +- `isFlashAttn()`/`setFlashAttn(boolean)` -> Flash Attention setting. +- `getBatchSize()`/`setBatchSize(int)` -> logical batch size. +- `getUbatchSize()`/`setUbatchSize(int)` -> physical batch size. +- `getThreadsBatch()`/`setThreadsBatch(int)` -> prompt-processing threads. +- `getMainGpu()`/`setMainGpu(int)` -> primary GPU index. +- `getDevices()`/`setDevices(String)` -> backend device selection. +- `getProvider()`/`setProvider(String)` -> per-model AI provider. +- `getRemoteModel()`/`setRemoteModel(String)` -> remote model identifier. +- `getBaseUrl()`/`setBaseUrl(String)` -> OpenAI-compatible API base URL. +- `getApiKeyEnv()`/`setApiKeyEnv(String)` -> API-key environment variable name. +- `getReasoningEffort()`/`setReasoningEffort(String)` -> reasoning effort level. +- `getReasoningBudgetTokens()`/`setReasoningBudgetTokens(int)` -> reasoning token budget. +- `getDryMultiplier()`/`setDryMultiplier(float)` -> DRY repetition penalty multiplier. +- `getDryBase()`/`setDryBase(float)` -> DRY penalty growth base. +- `getDryAllowedLength()`/`setDryAllowedLength(int)` -> DRY unpenalized n-gram length. +- `getDryPenaltyLastN()`/`setDryPenaltyLastN(int)` -> DRY look-back window. +- `getDrySequenceBreakers()`/`setDrySequenceBreakers(List)` -> DRY sequence breakers. +- `getStopStrings()`/`setStopStrings(List)` -> generation stop strings. +- `getCalibration()`/`setCalibration(AiCalibration)` -> optional timing calibration. + +#### Dependencies +- `AiCalibration` +- `ArrayList`, `Collections`, `List` +- Lombok `ToString` +- JSpecify `Nullable` +- `Runtime` for available processor count + +#### Exceptions / Errors +- No explicit exceptions thrown or caught. +- Nullable model path, thinking mode, and calibration are supported; selected nullable setter inputs reset to defaults or empty lists. + +#### Concurrency +- Mutable, unsynchronized configuration bean; no thread-safety guarantees. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..cea5634d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,41 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:10:33Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures how source files exceeding an AI model’s context window are handled, from aborting or sampling to chunked summarization or deterministic output. + +#### Purpose +- Provides the per-routing-rule `` strategy for oversized source files. +- Uses `FAIL` when no strategy is configured. + +#### Type +- `AiOversizeStrategy` — enum. +- Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`; public constant `DEFAULT = FAIL`. + +#### Input +- `fromConfig(@Nullable String value)` accepts the configured `` token. + +#### Output +- `configValue()` returns a strategy’s configuration token. +- `fromConfig(...)` returns the matching strategy; null or blank input returns `DEFAULT`. + +#### Core logic +- Associates strategies with tokens: `fail`, `sample`, `mapReduce`, `deterministic`. +- Parses tokens after trimming, using case-insensitive matching. +- Represents handling choices: abort; summarize the window-trimmed head; summarize line-boundary chunks then combine; or emit model-free deterministic metadata and samples. + +#### Public API +- `configValue() -> String` — return configuration token. +- `fromConfig(String) -> AiOversizeStrategy` — parse strategy token. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `fromConfig(...)` throws `IllegalArgumentException` for non-blank, unrecognized tokens. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..8066319c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,78 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:10:39Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures source-file indexing and AI-generated documentation, including file scope, model routing, inference settings, and output metadata. + +#### Purpose +- Provides a mutable, binding-independent configuration for `srcmorph` runs. +- Supplies source filtering, AI prompt/model/fact routing, generation defaults, and `.ai.md` output settings. + +#### Type +- `public class SrcMorphConfiguration` — class; Lombok `@ToString`; mutable JavaBean. +- No superclass or implemented interfaces declared. + +#### Input +- Constructor takes no arguments. +- Setters accept project/output/model directories; source subtrees, excludes, extensions, and size limits; AI provider, prompts, models, field-generation and fact definitions; llama.cpp settings; version metadata and project title. +- Configuration can be populated by Maven, future JSON/YAML binding, or direct Java callers. + +#### Output +- Getter methods expose configured values to `srcmorph` consumers. +- Configuration describes `.ai.md` output location, processing scope, AI generation behavior, and index metadata; this type performs no generation or file writes. + +#### Core logic +- Initializes defaults: output directory `src/site/ai`, provider `mock`, llama.cpp context size `2048`, output tokens `128`, temperature `0.15f`, threads from `AiGenerationConfig.DEFAULT_THREADS`, AI version `0.0.0`. +- Leaves `force`, `planOnly`, and file-size bounds at Java defaults (`false`, `false`, `0`); other optional fields are nullable. +- Stores source selection controls: base-relative subtrees and exclude globs, file extensions, exclusive minimum and inclusive maximum byte sizes. +- Stores AI routing inputs: prompt definitions, model definitions, per-field generation rules, and reusable fact definitions. +- Stores llama.cpp fallback model path and inference parameters; documentation identifies fallback settings as applicable when `fieldGenerations` is empty. +- Stores plugin/AI versions and optional project title for generated metadata. +- Excludes Maven lifecycle skip flags; an engine built from this configuration runs when invoked. + +#### Public API +- `SrcMorphConfiguration()` → constructor; initializes field defaults. +- `getBaseDirectory()`/`setBaseDirectory(File)` → project base directory. +- `getOutputDirectory()`/`setOutputDirectory(File)` → generated `.ai.md` directory. +- `isForce()`/`setForce(boolean)` → regenerate populated AI fields. +- `getSubtrees()`/`setSubtrees(List)` → restrict source roots. +- `getExcludes()`/`setExcludes(List)` → skip matching source files. +- `getFileExtensions()`/`setFileExtensions(List)` → select indexed file extensions. +- `getMinFileSizeBytes()`/`setMinFileSizeBytes(long)` → exclusive lower size bound. +- `getMaxFileSizeBytes()`/`setMaxFileSizeBytes(long)` → inclusive upper size bound. +- `isPlanOnly()`/`setPlanOnly(boolean)` → stop after routing plan. +- `getGenerationProvider()`/`setGenerationProvider(String)` → default AI provider. +- `getPromptDefinitions()`/`setPromptDefinitions(List)` → prompt templates. +- `getAiDefinitions()`/`setAiDefinitions(List)` → model definitions. +- `getModelDirectory()`/`setModelDirectory(File)` → resolve relative model paths. +- `getFieldGenerations()`/`setFieldGenerations(List)` → per-field routing rules. +- `getFactDefinitions()`/`setFactDefinitions(List)` → reusable fact groups. +- `getLlamaModelPath()`/`setLlamaModelPath(String)` → fallback GGUF model path. +- `getLlamaContextSize()`/`setLlamaContextSize(int)` → fallback context window. +- `getLlamaMaxOutputTokens()`/`setLlamaMaxOutputTokens(int)` → fallback token limit. +- `getLlamaTemperature()`/`setLlamaTemperature(float)` → fallback sampling temperature. +- `getLlamaThreads()`/`setLlamaThreads(int)` → fallback inference thread count. +- `getPluginVersion()`/`setPluginVersion(String)` → generated-header plugin version. +- `getAiVersion()`/`setAiVersion(String)` → generated-header AI logic version. +- `getProjectName()`/`setProjectName(String)` → aggregate index title. + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `AiGenerationConfig`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No exceptions declared or caught. +- Nullable lists, paths, and project name represent unspecified configuration; nonpositive minimum disables its bound, and nonpositive maximum means unlimited. + +#### Concurrency +- Mutable, unsynchronized JavaBean; no thread-safety guarantees. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/package.ai.md new file mode 100644 index 00000000..fedd8a09 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/config/package.ai.md @@ -0,0 +1,48 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:13:08Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> Defines source-indexing and AI-generation configuration, including file-selection rules, model routing, exact source facts, and oversized-file handling for generated project documentation. + +#### Purpose +- Centralizes configuration and utility logic for selecting source files, validating AI rules, and preparing generation settings. +- Supplies defaults and parsing/formatting helpers for AI generation, fact extraction, and oversized-source policies. + +#### Responsibilities +- **File-selection rules:** `AiConditionEvaluator` validates and evaluates nested conditions over file extensions, size, line count, modification time, and relative-path globs; `AiConditionGroup` stores Maven-bindable `and`/`or` children. +- **Generation configuration:** `AiGenerationConfig` carries model, provider, prompt limits, sampling, reasoning, caching, hardware, DRY, stop-string, and calibration settings; `SrcMorphConfiguration` holds run-level scope, routing, fallback inference, and output metadata. +- **Facts and oversized files:** `AiFactExtractor` validates regex counters and formats exact whole-source match counts; `AiOversizeStrategy` parses configured policies for oversized source handling. + +#### Key units +- `AiConditionEvaluator` — validates condition trees, detects line-count requirements, and matches conditions against `AiFileContext`. +- `AiConditionGroup` — stores child `AiCondition` entries for Maven combinators. +- `AiFactExtractor` — validates `AiFactCounter` definitions and formats exact counts into a facts block. +- `AiGenerationConfig` — mutable per-generation settings bean with defaults for local and OpenAI-compatible providers. +- `AiOversizeStrategy` — enum mapping `fail`, `sample`, `mapReduce`, and `deterministic` tokens to oversized-file policies; defaults to `FAIL`. +- `SrcMorphConfiguration` — mutable run-level configuration for source scope, AI definitions and routing, fallback settings, and `.ai.md` output metadata. + +#### Data flow +- `AiConditionEvaluator` validates configured `AiCondition` trees, detects whether line counts are needed, then evaluates file facts from `AiFileContext`. +- `AiFactExtractor` validates counters and scans complete source text with each configured regex, formatting reportable counts as a facts block. +- Configuration beans carry run-level and generation-level settings to consumers; `AiOversizeStrategy.fromConfig` converts configured tokens into policy enum values. + +#### Dependencies +- Internal rule and generation types: `AiCondition`, `AiRangeCondition`, `AiFileContext`, `AiFactCounter`, `AiCalibration`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, and `AiFactDefinition`. +- Java time, collection, and regex utilities; Lombok `@ToString`; JSpecify `@Nullable`. +- `AiConditionEvaluator` also depends on `AiSourceExcludeFilter`; `AiGenerationConfig` uses `Runtime` to cap its default inference-thread count. + +#### Cross-cutting +- Configuration classes are mutable, unsynchronized JavaBeans; `AiConditionEvaluator` and `AiFactExtractor` are stateless. +- Validation rejects malformed condition trees, invalid timestamps, missing fact labels or patterns, and invalid regexes; invalid nonblank oversize tokens raise `IllegalArgumentException`. +- Nullable inputs represent unspecified settings in several configuration types; list getters in `AiGenerationConfig` expose unmodifiable views. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..127969e9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,56 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:13:23Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Configures source-aware AI documentation generation and routes text-generation requests to mock, local llama.cpp, or OpenAI-compatible backends. + +#### Purpose +- Defines run-level and per-generation settings for source selection, facts, model behavior, and oversized-file policies. +- Provides a pluggable generation-provider system with shared request handling, completion parsing, and optional timing metrics. + +#### Responsibilities +- **Source selection and validation:** `AiConditionEvaluator` checks nested file conditions against `AiFileContext`; `AiConditionGroup` supports Maven-bound `and`/`or` rules. +- **Generation and run configuration:** `AiGenerationConfig` and `SrcMorphConfiguration` hold model, provider, sampling, runtime, routing, scope, fallback, and output settings. +- **Facts and oversized sources:** `AiFactExtractor` validates regex counters and formats match counts; `AiOversizeStrategy` maps configured tokens to `fail`, `sample`, `mapReduce`, or `deterministic` policies. +- **Provider selection and inference:** `AiGenerationProviderFactory` resolves provider precedence; provider implementations include mock, llama.cpp JNI, and OpenAI-compatible backends. +- **Request and completion handling:** `OpenAiCompatibleProviderSupport` builds requests and applies endpoint, API-key, error, and timing policies; `AiCompletionParser` cleans leading reasoning blocks. + +#### Key units +- `AiConditionEvaluator` — validates and evaluates condition trees, including whether line counts are required. +- `AiFactExtractor` — scans complete source text with configured regex counters and formats exact counts. +- `AiGenerationConfig` — mutable per-generation settings bean with local and OpenAI-compatible defaults. +- `SrcMorphConfiguration` — mutable run-level configuration for source scope, AI definitions, routing, fallback, and output metadata. +- `AiOversizeStrategy` — parses oversized-source policy tokens, defaulting to `FAIL`. +- `AiGenerationProvider` — backend contract for text generation, optional timings, and resource cleanup. +- `AiGenerationProviderFactory` — selects a backend, preferring a nonblank model provider over the run-level provider. +- `LlamaCppJniAiGenerationProvider` — lazily loads and reuses a GGUF model for local inference and returns parsed completions. +- `LlamaCppJniConfig` — immutable local-runtime and generation configuration built through a mutable builder. +- `OpenAiCompatibleProviderSupport` — serializes chat-completion requests and applies API-key, endpoint, error, and timing rules. +- `AiCompletionParser` — removes a leading reasoning block or raises `IOException` if it is unclosed. + +#### Data flow +- `AiConditionEvaluator` validates configured rules, identifies required file facts, then evaluates each `AiFileContext`. +- `AiFactExtractor` applies configured counters to complete source text and produces a facts block. +- Run-level and generation-level configuration supplies settings to downstream consumers; `AiOversizeStrategy.fromConfig` converts tokens to policy values. +- `AiGenerationProviderFactory` resolves provider settings and creates the backend; the selected provider consumes an `AiGenerationRequest` and returns completion text, optionally with timings. +- The llama.cpp path builds inference inputs using `AiPromptSupport`, obtains a chat response, and parses its completion; the OpenAI-compatible path serializes chat messages and derives timings from response usage and elapsed time. + +#### Dependencies +- Internal configuration and rule types include `AiCondition`, `AiRangeCondition`, `AiFileContext`, `AiFactCounter`, `AiCalibration`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, and `AiFactDefinition`. +- Provider types include `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, `MockAiGenerationProvider`, and `OpenAiCompatibleAiGenerationProvider`. +- Local inference uses `LlamaCppJniProviderSupport`, `LlamaModel`, llama.cpp response types, and `ChatResponseParser`; OpenAI-compatible handling uses Jackson and `ChatResponse`/`Usage`. +- Utilities include Java time, collections, regex, URL and environment lookup, `Runtime`, Lombok `@ToString`, and JSpecify `@Nullable`. + +#### Cross-cutting +- Configuration beans are generally mutable and unsynchronized; `LlamaCppJniConfig` is immutable with a mutable, non-thread-safe builder. +- `AiConditionEvaluator` and `AiFactExtractor` are stateless; condition, timestamp, counter, and regex validation reject malformed input. +- The provider contract extends `AutoCloseable`; default timing and close behavior provide zero metrics and a no-op cleanup. +- Llama.cpp model initialization and access are lazy and unsynchronized; the provider closes the model when present. +- API keys are resolved from a configured environment variable and rejected for plain-HTTP endpoints outside supported loopback hosts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..fd8a0e22 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,47 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:10:49Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Removes leading Gemma-4 internal reasoning from model completions so only the answer is stored, while preserving markers that occur within answer text. + +#### Purpose +- Cleans raw LLM completion text before it is persisted in an AI index. +- Rejects responses that begin a thinking block but lack its closing marker. + +#### Type +- `public class AiCompletionParser` — class; non-final, no superclass or interfaces. +- Annotated `@ToString`. + +#### Input +- `parseCompletion(String response)` — raw model completion; may be `null`. +- Public markers define the Gemma-4 thinking block boundaries. + +#### Output +- Returns trimmed answer text, never `null`; `null` input returns `""`. +- No fields are mutated and no resources are written. + +#### Core logic +- Trims the response before checking its prefix. +- If the trimmed response does not start with `THINKING_BLOCK_START_MARKER`, returns it unchanged apart from trimming; any markers within it remain text. +- For a leading thinking block, finds the first `THINKING_BLOCK_END_MARKER` after the start marker and returns the trimmed text following it. +- Throws `IOException` if the leading block has no closing marker, reporting token-budget exhaustion and the original response length. + +#### Public API +- `AiCompletionParser()` -> constructor; no-op initialization. +- `THINKING_BLOCK_START_MARKER` -> `String`; Gemma-4 thinking-block opener. +- `THINKING_BLOCK_END_MARKER` -> `String`; Gemma-4 thinking-block closer. +- `parseCompletion(String)` -> `String`; strip leading reasoning. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `parseCompletion` throws `IOException` when a leading thinking block is unclosed. +- `null` input is handled as an empty response. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..a94ae02d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,46 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:10:53Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Generates requested text through a pluggable AI backend, optionally returning model timing data for calibration. + +#### Purpose +- Defines the backend contract for generating text from an `AiGenerationRequest`. +- Supports providers with optional timing metrics and resource cleanup. + +#### Type +- `public interface AiGenerationProvider` — interface; extends `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume an `AiGenerationRequest` containing generation context. + +#### Output +- `generate` returns generated text. +- `generateWithTimings` returns `AiGenerationTimings`; default timing rates and counts are zero. +- Default `close()` performs no action. + +#### Core logic +- Requires implementations to provide `generate`, which may use provider-specific default sampling parameters. +- Default `generateWithTimings` delegates to `generate` and wraps the text with zero timing values; providers can override it. +- Provides a no-op default `close()`. + +#### Public API +- `generate(AiGenerationRequest)` -> `String` — generate text. +- `generateWithTimings(AiGenerationRequest)` -> `AiGenerationTimings` — generate text with timing data. +- `close()` -> `void` — release provider resources. + +#### Dependencies +- `AutoCloseable` +- `IOException` +- `AiGenerationRequest` +- `AiGenerationTimings` + +#### Exceptions / Errors +- `generate` and `generateWithTimings` declare `IOException` for provider failures. +- `generate` is documented to return non-null text, which may be blank. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..cb7637d2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,57 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:10:58Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Selects mock, llama.cpp JNI, or OpenAI-compatible AI generation for a model, preferring the model’s provider over the run-level setting. + +#### Purpose +- Resolves the effective provider key from model and run configuration. +- Creates the matching `AiGenerationProvider`, defaulting to the deterministic mock provider when no key is set. + +#### Type +- `public class AiGenerationProviderFactory` — class. +- Annotated with Lombok `@ToString`. + +#### Input +- `create(providerName, llamaConfig, promptSupport)` consumes the run-level provider key, model configuration, and prompt lookup support. +- `effectiveProvider(runProvider, modelProvider)` consumes nullable provider keys. +- Holds a `Java8CompatibilityHelper` for blank-string checks. + +#### Output +- `create(...)` returns a newly instantiated `AiGenerationProvider`. +- `effectiveProvider(...)` returns the trimmed model provider when nonblank; otherwise returns the run provider. + +#### Core logic +- `effectiveProvider` prefers a non-null, nonblank model provider; trims it before returning. +- `create` uses the effective provider, defaulting to `MockAiGenerationProvider` when null or blank. +- Maps `mock` to `MockAiGenerationProvider`, `llamacpp-jni` to `LlamaCppJniAiGenerationProvider`, and `openai-compatible` to `OpenAiCompatibleAiGenerationProvider`. +- Passes `llamaConfig` and `promptSupport` to the llama.cpp JNI and OpenAI-compatible providers. +- Throws `IllegalArgumentException` for an unrecognized provider key. + +#### Public API +- `AiGenerationProviderFactory()` — constructs factory. +- `PROVIDER_MOCK` — mock provider key; value `"mock"`. +- `PROVIDER_LLAMACPP_JNI` — llama.cpp JNI provider key; value `"llamacpp-jni"`. +- `PROVIDER_OPENAI_COMPATIBLE` — OpenAI-compatible provider key; value `"openai-compatible"`. +- `effectiveProvider(String, String) -> @Nullable String` — resolves model or run provider. +- `create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider` — creates configured provider. + +#### Dependencies +- `AiGenerationProvider` +- `MockAiGenerationProvider` +- `LlamaCppJniAiGenerationProvider` +- `OpenAiCompatibleAiGenerationProvider` +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `Java8CompatibilityHelper` +- Lombok `ToString` +- JSpecify `Nullable` + +#### Exceptions / Errors +- `create(...)` throws `IllegalArgumentException` with the unsupported provider key when no provider mapping exists. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..f3ed638e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,61 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:11:09Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Generates AI completions from locally loaded GGUF models and reports llama.cpp throughput and prompt-cache usage. + +#### Purpose +- Provides `AiGenerationProvider` completions using llama.cpp through the JNI binding. +- Loads the model on first generation and reuses it for subsequent requests. + +#### Type +- `public final class LlamaCppJniAiGenerationProvider`; implements `AiGenerationProvider`, `AutoCloseable`. +- Annotated `@ToString`; excludes the native model handle and provider support from the rendered output. + +#### Input +- Constructor accepts `LlamaCppJniConfig` and `AiPromptSupport`. +- Generation methods accept `AiGenerationRequest`; `LlamaCppJniProviderSupport` builds inference parameters and chat-template arguments from configuration and prompt support. +- Model configuration includes context size, threads, GPU/CPU layer placement, KV cache, attention, batching, device selection, and lazy loading options. + +#### Output +- `generate` returns parsed completion text. +- `generateWithTimings` returns `AiGenerationTimings` with completion text, prompt/cache/prediction token counts, and measured rates; absent timings produce zero metrics. +- `close` closes the loaded `LlamaModel`, if initialized. + +#### Core logic +- Constructor rejects null configuration or prompt support and initializes `LlamaCppJniProviderSupport`; it does not load native resources. +- On first use, `model()` builds `ModelParameters` from configuration, applying optional settings only when their configured values meet the relevant guards, then constructs and caches `LlamaModel`. +- Each request builds inference parameters, calls `chatComplete`, and parses the full response as `ChatResponse`. +- `generate` warns about truncated answers, logs prompt-cache reuse, and parses the first response content with `AiCompletionParser`. +- `generateWithTimings` returns first content plus model-reported prompt, cache, and prediction metrics; missing timing data yields zero rates and counts. +- `close` releases the cached model when present. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport)` — creates provider with lazy model loading. +- `generate(AiGenerationRequest) -> String` — generates parsed completion text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` — generates text and timing metrics. +- `close() -> void` — closes loaded model. + +#### Dependencies +- `AiGenerationProvider`, `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport` +- `LlamaCppJniConfig`, `LlamaCppJniProviderSupport`, `LlamaModel` +- `ModelParameters`, `FlashAttn`, `ReasoningFormat` +- `ChatResponseParser`, `ChatResponse`, `Timings`, `AiCompletionParser` +- `Java8CompatibilityHelper` +- `IOException`, `Map`, `Objects`, Lombok `ToString`, JSpecify `Nullable` + +#### Exceptions / Errors +- Constructor throws `NullPointerException` for null `config` or `promptSupport`. +- `generate` declares `IOException`; `generateWithTimings` does not declare a checked exception. +- Model loading, inference, and response parsing may propagate unchecked failures; none are caught. +- `generateWithTimings` treats missing timing data as zero metrics. + +#### Concurrency +- Lazy model initialization and model access are unsynchronized; concurrent first calls may initialize multiple models. +- Configuration and support fields are final; the cached model reference is mutable. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..fb9fb40c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,91 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:11:17Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures GGUF model generation, sampling, llama.cpp runtime resources, remote-provider settings, reasoning controls, and stop behavior. + +#### Purpose +- `LlamaCppJniConfig` carries model and generation options from named builder inputs to provider code. +- Supplies `AiGenerationConfig` defaults and immutable access to the resulting configuration. + +#### Type +- `public final class LlamaCppJniConfig`; annotated `@ConvertToRecord`, Lombok `@ToString` and `@EqualsAndHashCode`. +- Nested `public static final class Builder`; builder pattern; no inheritance or implemented interfaces. +- Nullable `Boolean chatTemplateEnableThinking`; list-valued DRY sequence breakers and stop strings. + +#### Input +- `builder(String modelPath)` requires a non-null GGUF model path. +- Optional fluent `Builder` setters configure sampling, threading, cache and GPU settings, provider/API fields, reasoning, DRY sampling, and stop strings. +- Builder fields initialize from corresponding `AiGenerationConfig.DEFAULT_*` constants; list defaults are empty lists. + +#### Output +- `build()` creates an immutable `LlamaCppJniConfig` containing 41 configuration values. +- Record-style accessors expose configuration; list accessors return unmodifiable views. +- Lombok generates equality, hash code, and string representation over all fields. + +#### Core logic +- `Builder` stores the required model path and initializes all other options with defaults. +- Fluent setters replace option values; nullable string and list inputs restore defaults when null. `chatTemplateEnableThinking` preserves null as unset. +- Private constructor copies every builder value into final fields; it performs no validation or normalization. +- `drySequenceBreakers()` and `stopStrings()` wrap their stored lists with `Collections.unmodifiableList`. + +#### Public API +- `builder(String)` → `Builder` — start with model path and defaults. +- `modelPath()` → `String` — GGUF model path. +- `contextSize()` → `int` — context window. +- `maxOutputTokens()` → `int` — output token limit. +- `temperature()` → `float` — sampling temperature. +- `threads()` → `int` — CPU thread count. +- `topP()` → `float` — nucleus sampling threshold. +- `topK()` → `int` — top-k sampling limit. +- `minP()` → `float` — min-p threshold. +- `topNSigma()` → `float` — top-n-sigma threshold. +- `repeatPenalty()` → `float` — repetition penalty. +- `chatTemplateEnableThinking()` → `@Nullable Boolean` — chat-template thinking mode. +- `cachePrompt()` → `boolean` — prompt caching flag. +- `swaFull()` → `boolean` — full-size SWA KV cache flag. +- `cacheReuse()` → `int` — KV prefix-reuse chunk size. +- `gpuLayers()` → `int` — GPU layer offload count. +- `seed()` → `int` — generation RNG seed. +- `cpuMoeLayers()` → `int` — CPU MoE layer count. +- `cpuFfnLayers()` → `int` — CPU FFN layer count. +- `kvUnifiedPerSlot()` → `int` — per-slot unified KV cap. +- `lazyMode()` → `String` — tensor-read laziness mode. +- `repeatLastN()` → `int` — repetition penalty window. +- `cacheTypeK()` / `cacheTypeV()` → `String` — KV-cache data types. +- `flashAttn()` → `boolean` — Flash Attention flag. +- `batchSize()` / `ubatchSize()` → `int` — logical and physical batch sizes. +- `threadsBatch()` → `int` — batch-processing thread count. +- `mainGpu()` → `int` — primary GPU index. +- `devices()` → `String` — device selection. +- `provider()` → `String` — provider selection. +- `remoteModel()` → `String` — remote model identifier. +- `baseUrl()` → `String` — OpenAI-compatible API base URL. +- `apiKeyEnv()` → `String` — environment variable name for API key. +- `reasoningEffort()` → `String` — reasoning effort setting. +- `reasoningBudgetTokens()` → `int` — reasoning token budget. +- `dryMultiplier()` / `dryBase()` → `float` — DRY sampling parameters. +- `dryAllowedLength()` / `dryPenaltyLastN()` → `int` — DRY length and penalty window. +- `drySequenceBreakers()` / `stopStrings()` → `List` — generation stop controls. +- `Builder` has 40 fluent setters: `contextSize(int)`, `maxOutputTokens(int)`, `temperature(float)`, `threads(int)`, `topP(float)`, `topK(int)`, `minP(float)`, `topNSigma(float)`, `repeatPenalty(float)`, `chatTemplateEnableThinking(@Nullable Boolean)`, `cachePrompt(boolean)`, `swaFull(boolean)`, `cacheReuse(int)`, `gpuLayers(int)`, `seed(int)`, `cpuMoeLayers(int)`, `cpuFfnLayers(int)`, `kvUnifiedPerSlot(int)`, `lazyMode(String)`, `repeatLastN(int)`, `cacheTypeK(String)`, `cacheTypeV(String)`, `flashAttn(boolean)`, `batchSize(int)`, `ubatchSize(int)`, `threadsBatch(int)`, `mainGpu(int)`, `devices(String)`, `provider(String)`, `remoteModel(String)`, `baseUrl(String)`, `apiKeyEnv(String)`, `reasoningEffort(String)`, `reasoningBudgetTokens(int)`, `dryMultiplier(float)`, `dryBase(float)`, `dryAllowedLength(int)`, `dryPenaltyLastN(int)`, `drySequenceBreakers(List)`, `stopStrings(List)` — each returns `Builder` and sets its option. +- `Builder.build()` → `LlamaCppJniConfig` — construct immutable configuration. + +#### Dependencies +- `AiGenerationConfig` — option defaults. +- `ConvertToRecord` — record-migration marker. +- Lombok `@EqualsAndHashCode`, `@ToString`. +- JSpecify `@Nullable`; Java `Collections`, `List`, `Objects`. + +#### Exceptions / Errors +- `builder(null)` throws `NullPointerException` via `Objects.requireNonNull`, message `modelPath`. +- No other validation or explicit exception handling; null string/list setter inputs restore defaults, except nullable thinking mode. + +#### Concurrency +- `LlamaCppJniConfig` fields are final; intended immutable configuration. +- `Builder` is mutable and explicitly not thread-safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..5db960b6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,110 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:11:31Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Builds OpenAI-compatible chat-completion requests for configured models while protecting API keys and translating responses into generation timing data. + +#### Purpose +- Provides network-independent request construction and policy logic for OpenAI-compatible model calls. +- Handles endpoint and API-key validation, HTTP status/error formatting, and response timing calculation. + +#### Type +- `final class OpenAiCompatibleProviderSupport`; package-private, final; annotated `@ToString`. +- No superclass or implemented interfaces. + +#### Input +- Constructor: `LlamaCppJniConfig`, `AiPromptSupport`, and an environment-variable lookup `Function`. +- `requestBody`: `AiGenerationRequest`; reads model, sampling options, API configuration, prompts, source file, and source text through dependencies. +- `apiKeyFor`: endpoint URL string; resolves the configured environment variable. +- `errorMessage`: endpoint, HTTP status, and error-body text. +- `timings`: completion text, `ChatResponse`, and elapsed seconds. + +#### Output +- Serializes request data to a JSON string; `endpoint()` returns the chat-completions URL. +- Returns a trimmed API key or `null`; rejects unsafe cleartext key delivery. +- Returns HTTP success status, formatted error message, loopback-host classification, and `AiGenerationTimings`. +- Maintains final references to configuration, prompt support, environment lookup, and compatibility helper. + +#### Core logic +- `requestBody` creates two chat messages: system prompt from `promptKey`, then user content from source file and text. +- Includes `model` and `reasoning.effort` only when nonblank; always writes `max_tokens`, `temperature`, `top_p`, `repetition_penalty`, and `stream=false`. +- Adds `top_k` and `min_p` only when positive, `seed` when nonnegative, and `stop` when the configured list is nonempty. +- `endpoint` trims `baseUrl`, permits only `http://` or `https://`, removes trailing slashes, and appends `/chat/completions`. +- `apiKey` looks up the configured environment variable and returns its trimmed nonblank value. +- `apiKeyFor` allows configured keys over HTTPS or plain HTTP only to exact `localhost`, IPv4 `127.x.x.x`, or `[::1]`. +- `isSuccess` recognizes HTTP 200–299; `errorMessage` includes at most 500 body characters, followed by `...` when truncated. +- `timings` extracts prompt, cached, and completion token counts; computes completion tokens per elapsed second, or zero for nonpositive duration; prefill rate is zero. + +#### Public API +- `requestBody(AiGenerationRequest) -> String` — serialize chat request. +- `endpoint() -> String` — build chat-completions URL. +- `apiKey() -> @Nullable String` — resolve configured key. +- `apiKeyFor(String) -> @Nullable String` — enforce safe key transport. +- `isLoopbackHost(String) -> boolean` — recognize loopback hosts. +- `isSuccess(int) -> boolean` — classify HTTP status. +- `errorMessage(String, int, String) -> String` — format HTTP failure. +- `timings(String, ChatResponse, double) -> AiGenerationTimings` — calculate generation rates. + +#### Dependencies +- `LlamaCppJniConfig`, `AiPromptSupport`, `AiGenerationRequest`, `Java8CompatibilityHelper`. +- Jackson `ObjectMapper`, `ObjectNode`, `ArrayNode`. +- `ChatResponse`, `Usage`, `AiGenerationTimings`. +- Java `IOException`, `URL`, `List`, `Objects`, `Function`, `Pattern`; JSpecify `Nullable`; Lombok `ToString`. + +#### Exceptions / Errors +- Constructor uses `Objects.requireNonNull` for all three dependencies. +- `requestBody` propagates `IOException` from JSON serialization. +- `endpoint` throws `IllegalArgumentException` for non-HTTP(S) base URLs. +- `apiKeyFor` propagates URL parsing `IOException`; throws `IOException` when a key would be sent over plain HTTP to a non-loopback host. +- `errorMessage` truncates long bodies; no null handling is specified for its arguments. + +#### Concurrency +- Final configuration and dependency references; no synchronization or mutable shared request state. +- Static `ObjectMapper` is shared across calls. A new `ObjectNode` is built per request. isumaqatigiiss + 二四六 + 恒一 + + +> Builds OpenAI-compatible chat-completion requests for configured models while protecting API keys and deriving generation timing data from responses. + +#### Purpose +- Supplies network-independent request construction and policy logic for OpenAI-compatible model calls. +- Handles endpoint validation, API-key transport checks, HTTP error formatting, and response timing calculations. + +#### Type +- `final class OpenAiCompatibleProviderSupport`; package-private, final; annotated `@ToString`. +- No explicit superclass or implemented interfaces. + +#### Input +- Constructor receives `LlamaCppJniConfig`, `AiPromptSupport`, and an environment-variable lookup function. +- Request construction consumes an `AiGenerationRequest` and model sampling configuration. +- Key validation consumes an endpoint URL; timing calculation consumes completion text, `ChatResponse`, and elapsed seconds. + +#### Output +- Produces serialized JSON request bodies, endpoint URLs, API keys or `null`, error messages, and `AiGenerationTimings`. +- Stores final references to configuration, prompt support, environment lookup, and compatibility helper. + +#### Core logic +- Builds a system message from the request’s prompt key and a user message from its source file and text. +- Always includes `max_tokens`, `temperature`, `top_p`, `repetition_penalty`, and `stream=false`; conditionally includes model, `top_k`, `min_p`, seed, stop strings, and reasoning effort. +- Trims the configured base URL, accepts only `http://` or `https://`, removes trailing slashes, and appends `/chat/completions`. +- Resolves a configured environment variable to a trimmed API key; permits sending it over plain HTTP only to exact `localhost`, matching `127.<1–3 digits>.<1–3 digits>.<1–3 digits>`, or `[::1]`. +- Classifies HTTP 200–299 as success; formats failures with endpoint, status, and up to 500 body characters plus `...` if truncated. +- Extracts token usage; computes completion-token rate from elapsed seconds, using zero for nonpositive duration, and sets prefill rate to zero. + +#### Dependencies +- `LlamaCppJniConfig`, `AiPromptSupport`, `AiGenerationRequest`, `Java8CompatibilityHelper`. +- Jackson `ObjectMapper`, `ObjectNode`, `ArrayNode`; `ChatResponse`, `Usage`, `AiGenerationTimings`. +- Java `IOException`, `URL`, `List`, `Objects`, `Function`, `Pattern`; JSpecify `Nullable`; Lombok `ToString`. + +#### Exceptions / Errors +- Constructor rejects null configuration, prompt support, or environment lookup with `Objects.requireNonNull`. +- Request serialization can throw `IOException`. +- `endpoint()` throws `IllegalArgumentException` for a base URL without an accepted HTTP(S) prefix. +- `apiKeyFor()` can throw `IOException` for an invalid URL or a configured key targeting a non-loopback plain-HTTP host. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/package.ai.md new file mode 100644 index 00000000..47e68666 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/java/provider/package.ai.md @@ -0,0 +1,54 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:13:15Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Generates AI text through selectable mock, local llama.cpp, or OpenAI-compatible backends, with shared configuration, completion cleanup, and optional generation metrics. + +#### Purpose +- Defines a pluggable text-generation contract and selects a backend using model- and run-level provider settings. +- Configures local and remote generation options and provides completion parsing and OpenAI-compatible request policies. + +#### Responsibilities +- **Provider contract and selection:** `AiGenerationProvider` defines generation, optional timing results, and cleanup; `AiGenerationProviderFactory` resolves provider precedence and creates mock, llama.cpp JNI, or OpenAI-compatible providers. +- **Local inference:** `LlamaCppJniAiGenerationProvider` lazily loads and reuses a GGUF model, runs chat completion, parses results, and reports available token and throughput metrics. +- **Configuration:** `LlamaCppJniConfig` collects model, sampling, runtime, remote API, reasoning, and stop-control settings in an immutable builder-produced object. +- **Completion cleanup:** `AiCompletionParser` strips a leading Gemma-4 reasoning block while retaining markers elsewhere in answer text. +- **OpenAI-compatible request policy:** `OpenAiCompatibleProviderSupport` constructs chat-completion JSON, validates endpoints and API-key transport, formats HTTP failures, and derives timing data. + +#### Key units +- `AiGenerationProvider` — backend interface for generating text, optionally with `AiGenerationTimings`, and closing resources. +- `AiGenerationProviderFactory` — prefers a nonblank model provider over the run provider and maps provider keys to implementations. +- `LlamaCppJniAiGenerationProvider` — performs lazy, cached llama.cpp JNI inference and parses completion content. +- `LlamaCppJniConfig` — immutable configuration for local model runtime, generation sampling, and remote-provider options. +- `OpenAiCompatibleProviderSupport` — builds OpenAI-compatible requests and applies endpoint, API-key, error, and timing policies. +- `AiCompletionParser` — removes a leading reasoning block or raises `IOException` if it is unclosed. + +#### Data flow +- The factory resolves the effective provider from model and run settings, then creates the corresponding provider; absent or blank settings select the mock provider. +- The llama.cpp provider combines `AiGenerationRequest`, `LlamaCppJniConfig`, and `AiPromptSupport` to build inference inputs, obtains a chat response, and returns parsed completion text or text with timing metrics. +- OpenAI-compatible request support uses the request’s prompt key and source content plus configured sampling options to serialize chat messages; response usage and elapsed time feed `AiGenerationTimings`. +- `AiCompletionParser` trims completions and, when they begin with a thinking-block marker, returns the text following the closing marker. + +#### Dependencies +- Shared generation types: `AiGenerationRequest`, `AiGenerationTimings`, and `AiPromptSupport`. +- Local inference: `LlamaCppJniProviderSupport`, `LlamaModel`, llama.cpp model and response types, and `ChatResponseParser`. +- Provider selection: `MockAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`, `LlamaCppJniConfig`, and `Java8CompatibilityHelper`. +- OpenAI-compatible request handling: Jackson JSON nodes, `ChatResponse`/`Usage`, and Java URL and environment-lookup utilities. +- Configuration defaults come from `AiGenerationConfig`; completion parsing uses `IOException`. + +#### Cross-cutting +- `AiGenerationProvider` extends `AutoCloseable`; its default timing method wraps ordinary generation with zero metrics, and its default `close()` is a no-op. +- `LlamaCppJniAiGenerationProvider` loads its native model on first use and closes it when present; lazy initialization and access are unsynchronized. +- `LlamaCppJniConfig` has final fields and unmodifiable list accessors; its mutable builder is not thread-safe. +- API keys are resolved from a configured environment variable and are rejected for plain-HTTP endpoints outside the supported loopback hosts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..c00048ec --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/kernels/histogram.cl.ai.md @@ -0,0 +1,47 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:12:33Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Counts the frequency of each byte value in an image or byte stream using per-work-group histograms and a final reduction. + +#### Purpose +- Builds a 256-bin byte histogram in two OpenCL passes. +- Uses work-group-local counts to produce partial histograms, then combines them per bin. + +#### Type +- OpenCL C 1.2 kernel source; defines two `__kernel` entry points. + +#### Input +- `histogram_partial`: `input` byte buffer, `length`, and caller-provided local-memory buffer `local_bins`. +- `histogram_reduce`: `partial` buffer and `group_count`. + +#### Output +- `histogram_partial` writes one 256-counter partial histogram per work-group to `partial`. +- `histogram_reduce` writes the final 256-bin counts to `histogram`. + +#### Core logic +- `histogram_partial` zeroes `local_bins` cooperatively across work-items and synchronizes. +- Work-items stride over input indices by global work size; each byte increments its corresponding local bin atomically. +- After a local-memory barrier, work-items copy the local counts to the work-group’s region in `partial`. +- `histogram_reduce` assigns one work-item per bin, sums that bin across `group_count` partial histograms, and stores the total. + +#### Public API +- `histogram_partial(input, length, partial, local_bins) -> void` — count bytes per work-group. +- `histogram_reduce(partial, group_count, histogram) -> void` — combine partial counts by bin. + +#### Constants and configuration +- `BINS=256`. + +#### Dependencies +- OpenCL types: `uchar`, `uint`. +- OpenCL built-ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `barrier`, `atomic_inc`. +- OpenCL flag: `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- No explicit error handling or status codes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/kernels/package.ai.md new file mode 100644 index 00000000..fc9b4d91 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/kernels/package.ai.md @@ -0,0 +1,34 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:13:31Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes byte-value frequency distributions for image or byte-stream data using parallel OpenCL histogram kernels. + +#### Purpose +- Builds a 256-bin histogram in two passes, first producing per-work-group counts and then reducing them into final counts. + +#### Responsibilities +- **Partial histogram:** Count input bytes into work-group-local bins and write each group’s 256 counters to a partial buffer. +- **Reduction:** Sum each bin across work-group partial histograms. + +#### Key units +- `histogram_partial` — OpenCL kernel that counts byte values into per-work-group histograms. +- `histogram_reduce` — OpenCL kernel that combines partial counts into the final `histogram`. +- `BINS` — Defines the 256 byte-value bins. + +#### Data flow +- `input` bytes and `length` feed `histogram_partial`; work-groups accumulate counts in `local_bins` and write to `partial`. +- `histogram_reduce` reads `partial` and `group_count`, then writes the combined counts to `histogram`. + +#### Dependencies +- OpenCL C 1.2 types, built-ins, barriers, atomic increments, and local-memory fence. + +#### Cross-cutting +- Uses local-memory accumulation with atomic increments, followed by a separate reduction pass. +- Provides no explicit error handling or status codes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..8f65f18d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,46 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:13:45Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> This package provides low-level byte-processing utilities and command-line workflows for histogram analysis, FIFO buffering, backup rotation, and regional sales reporting. + +#### Purpose +- Compute byte-value distributions with parallel OpenCL kernels and move bytes through a bounded ring buffer. +- Automate compressed backup retention and produce monthly, regional revenue summaries from order CSVs. + +#### Responsibilities +- **Byte analysis (`kernels/`):** Count input byte values into 256 bins using work-group histograms and a reduction pass. +- **FIFO storage (`ringbuf/`):** Provide bounded, dynamically allocated byte storage with partial reads and writes, occupancy measurements, and cleanup. +- **Operations and reporting (`scripts/`):** Create timestamped compressed backups with retention limits; parse currency-filtered orders and report qualifying monthly regional totals. + +#### Key units +- `histogram_partial` / `histogram_reduce` — build per-work-group byte counts and combine them into a final histogram; `BINS` defines the 256 byte-value bins. +- `ringbuf_t` — holds byte storage, capacity, and volatile `head`/`tail` indices; `ringbuf_status_t` defines operation status codes. +- `ringbuf_init`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space`, `ringbuf_free` — initialize, transfer, measure, and release ring-buffer storage. +- `rotate_backups.sh` — creates UTC-dated `.tar.gz` archives and removes older matching archives beyond the configured retention. +- `Order`, `parse_orders(path, currency)`, `revenue_by_month_and_region(orders)`, `main(argv=None)` — parse orders, aggregate monthly regional revenue, and print threshold-qualified totals. + +#### Data flow +- **Histogram:** Input bytes and length → per-work-group local histograms in `partial` → reduction across groups → final 256-bin histogram. +- **Ring buffer:** Initialization validates capacity and allocates storage; writes advance `head`, reads advance `tail`, and wraparound transfers use up to two copies. +- **Backup:** Source directory → temporary `.partial` archive → final timestamped archive → newest-first retention check and removal. +- **Sales report:** CSV inputs → header validation and currency filtering → `Order` records → monthly regional sums → threshold-filtered tab-separated output. + +#### Dependencies +- `kernels/` uses OpenCL C 1.2 types, built-ins, barriers, atomic increments, and local-memory fences. +- `ringbuf.c` implements the API in `ringbuf.h`; uses standard `malloc`, `free`, and `memcpy`. +- Backup rotation uses Bash and external `tar`, `date`, `mkdir`, `mv`, `ls`, and `rm` commands. +- Sales reporting uses Python standard-library CSV, argument parsing, date, decimal, and collection utilities. + +#### Cross-cutting +- Ring-buffer capacity must be a nonzero power of two; one allocated slot is reserved to distinguish full from empty, and the API is designed for single-producer/single-consumer use. +- Histogram processing uses local-memory accumulation followed by a separate reduction pass. +- Backup scripts use strict Bash settings and an `EXIT` cleanup trap; sales parsing reports invalid headers, dates, or amounts with file context. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/ringbuf/package.ai.md new file mode 100644 index 00000000..118ea58d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/ringbuf/package.ai.md @@ -0,0 +1,42 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:13:36Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides bounded FIFO byte storage for passing data between a single producer and a single consumer. + +#### Purpose +- Define and implement a dynamically allocated byte ring buffer with partial reads and writes. +- Measure buffered and writable bytes while reserving one slot to distinguish full from empty. + +#### Responsibilities +- **Buffer API and state:** Declare `ringbuf_t`, status codes, and operations for initialization, transfer, measurement, and cleanup. +- **Ring-buffer operations:** Validate power-of-two capacity, allocate storage, copy bytes across wrap boundaries, and update producer and consumer positions. + +#### Key units +- `ringbuf_t` — stores the byte array, capacity, and volatile `head` and `tail` indices. +- `ringbuf_status_t` — defines `RINGBUF_OK`, `RINGBUF_EINVAL`, and `RINGBUF_ENOMEM`. +- `ringbuf_init` — validates capacity and allocates and initializes buffer storage. +- `ringbuf_write` / `ringbuf_read` — transfer up to the available bytes into or out of the FIFO. +- `ringbuf_used` / `ringbuf_free_space` — report occupancy and writable capacity. +- `ringbuf_free` — releases storage and resets buffer state. + +#### Data flow +- `ringbuf_init` accepts a nonzero power-of-two capacity and prepares the buffer, failing with `RINGBUF_EINVAL` or `RINGBUF_ENOMEM` when appropriate. +- `ringbuf_write` copies available input bytes from `src`, advancing `head`; `ringbuf_read` copies buffered bytes to `dst`, advancing `tail`. +- Transfers split into up to two copies when they wrap around the array; `ringbuf_used` and `ringbuf_free_space` report current occupancy and capacity. + +#### Dependencies +- `ringbuf.c` implements the API declared in `ringbuf.h`. +- Uses standard `malloc`/`free` and `memcpy`; the header uses `size_t` and `uint8_t`. + +#### Cross-cutting +- Designed for single-producer/single-consumer use, with producer-owned `head` and consumer-owned `tail`. +- Requires nonzero power-of-two capacity; usable capacity is allocated capacity minus one. +- `head` and `tail` are `volatile size_t`; C++ callers receive C linkage. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..c3429b47 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,63 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:12:37Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides bounded FIFO byte buffering for producers and consumers using a power-of-two ring buffer. + +#### Purpose +- Stores and transfers bytes in FIFO order, including writes and reads that wrap around the buffer end. +- Leaves one slot unused to distinguish full from empty. + +#### Type +- C implementation file; defines exported `ringbuf_*` functions and static helpers. +- Uses `ringbuf_t` and `ringbuf_status_t` from `ringbuf.h`. + +#### Input +- `ringbuf_init`: buffer pointer and requested capacity. +- `ringbuf_write`: ring buffer, source byte array, and requested length. +- `ringbuf_read`: ring buffer, destination byte array, and requested length. +- `ringbuf_used`, `ringbuf_free_space`, `ringbuf_free`: ring buffer pointer. + +#### Output +- `ringbuf_init` returns initialization status; allocates `capacity` bytes and initializes buffer state on success. +- `ringbuf_write` and `ringbuf_read` return the number of bytes transferred. +- `ringbuf_used` and `ringbuf_free_space` return occupancy and writable capacity. +- `ringbuf_free` releases storage and resets buffer fields. + +#### Core logic +- `ringbuf_init` accepts only nonzero power-of-two capacities; allocation failure returns `RINGBUF_ENOMEM`. +- Tracks read and write positions with `tail` and `head`; wraps index updates using `capacity - 1` as a bitmask. +- Computes used bytes as `(head - tail) & (capacity - 1)`; reserves one slot, so writable space is `capacity - 1 - used`. +- Reads and writes at most the available bytes, copying in up to two chunks when data wraps around the array boundary. +- Advances `head` after writes and `tail` after reads. + +#### Public API +- `ringbuf_init(rb, capacity) -> ringbuf_status_t` — allocate and initialize buffer. +- `ringbuf_free(rb) -> void` — release and reset buffer. +- `ringbuf_used(rb) -> size_t` — report buffered bytes. +- `ringbuf_free_space(rb) -> size_t` — report writable bytes. +- `ringbuf_write(rb, src, len) -> size_t` — append available bytes. +- `ringbuf_read(rb, dst, len) -> size_t` — consume available bytes. +- Internal helpers: `is_power_of_two`, `min_size`. + +#### Constants and configuration +- `RINGBUF_EINVAL` — invalid capacity. +- `RINGBUF_ENOMEM` — allocation failure. +- `RINGBUF_OK` — successful initialization. +- Capacity must be a nonzero power of two. + +#### Dependencies +- `"ringbuf.h"` — ring-buffer types and status codes. +- `` — `malloc`, `free`. +- `` — `memcpy`. +- `` — `uint8_t` (referenced by the API through the header or included declarations). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` for zero or non-power-of-two capacity. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if `malloc` fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..b4f83cbb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,61 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:12:44Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides fixed-capacity byte buffering between a single producer and a single consumer. + +#### Purpose +- Defines the ring buffer state, status codes, and operations for initializing, reading, writing, measuring, and freeing a byte buffer. +- Uses one reserved slot, so usable capacity is `capacity - 1` bytes. + +#### Type +- C header; declares `ringbuf_t` struct and `ringbuf_status_t` enum. +- `ringbuf_t` fields: `data` (`uint8_t *`), `capacity` (`size_t`), `head` and `tail` (`volatile size_t`). +- C++ callers receive C linkage via `extern "C"`. + +#### Input +- `ringbuf_init`: `ringbuf_t *rb`, requested `size_t capacity`. +- `ringbuf_write`: buffer, source byte pointer, requested length. +- `ringbuf_read`: buffer, destination byte pointer, requested length. +- `ringbuf_used` / `ringbuf_free_space`: buffer pointer. +- Capacity must be a nonzero power of two. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`. +- Read and write return the number of bytes actually copied, up to the requested length. +- `ringbuf_used` and `ringbuf_free_space` return `size_t` measurements. +- `ringbuf_free` releases buffer resources. + +#### Core logic +- Declares a fixed-capacity byte ring buffer for single-producer/single-consumer use. +- Tracks the next write position in producer-owned `head` and the next read position in consumer-owned `tail`. +- Reserves one slot to distinguish full from empty; usable capacity is one less than allocated capacity. +- Declares partial read and write operations that report actual bytes copied. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — initialize buffer. +- `ringbuf_free(ringbuf_t *rb) -> void` — release buffer. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — copy bytes into buffer. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — copy bytes out. +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report bytes in use. +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report available space. + +#### Constants and configuration +- `RINGBUF_H` — include guard. +- `RINGBUF_OK = 0` — success. +- `RINGBUF_EINVAL = -1` — capacity is zero or not a power of two. +- `RINGBUF_ENOMEM = -2` — allocation failed. + +#### Dependencies +- Standard headers: ``, ``. +- Types: `size_t`, `uint8_t`. + +#### Exceptions / Errors +- `ringbuf_init` reports invalid capacity with `RINGBUF_EINVAL`. +- `ringbuf_init` reports allocation failure with `RINGBUF_ENOMEM`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/scripts/package.ai.md new file mode 100644 index 00000000..51faadc5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/scripts/package.ai.md @@ -0,0 +1,39 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:13:40Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides command-line utilities for rotating compressed directory backups and summarizing order revenue by month and region. + +#### Purpose +- Create timestamped archives with configurable retention for a source directory. +- Aggregate CSV orders into monthly regional revenue reports for a selected currency. + +#### Responsibilities +- **Backup rotation:** Validate source and retention settings, create a compressed archive, and remove older matching archives beyond the retention limit. +- **Sales reporting:** Parse and currency-filter order CSVs, aggregate revenue by month and region, and print totals meeting a minimum threshold. + +#### Key units +- `rotate_backups.sh` — creates a UTC-dated `.tar.gz` archive and retains the newest configured number. +- `Order` — frozen dataclass representing an order’s date, region, and amount. +- `parse_orders(path, currency)` — validates CSV headers and yields matching-currency orders. +- `revenue_by_month_and_region(orders)` — returns sorted totals keyed by month and region. +- `main(argv=None)` — parses report options, combines input files, and prints qualifying totals. + +#### Data flow +- Backup: source directory → temporary `.partial` tarball → final timestamped archive → newest-first retention listing and removal of excess archives. +- Sales: CSV files → header validation and currency filtering → parsed `Order` records → monthly regional sums → threshold-filtered tab-separated output. + +#### Dependencies +- Backup rotation uses Bash features and external commands including `tar`, `date`, `mkdir`, `mv`, `ls`, and `rm`. +- Sales reporting uses Python standard-library CSV, argument parsing, date, decimal, and collection utilities. + +#### Cross-cutting +- Both are command-line scripts with configurable inputs and explicit status or error behavior. +- Backup failures are governed by strict Bash settings and an `EXIT` cleanup trap; sales parsing reports invalid headers, dates, or amounts with file context. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..af9f1e96 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,62 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:12:51Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates a dated compressed archive of a directory and removes older archives beyond the configured retention count. + +#### Purpose +- Back up one source directory as a timestamped `.tar.gz` archive and retain only the newest `KEEP` archives for that source. +- Run directly with source directory, backup directory, and optional retention count. + +#### Type +- Bash; `set -euo pipefail`. + +#### Input +- Positional argument `$1` → `SOURCE_DIR`; required source directory. +- Positional argument `$2` → `BACKUP_DIR`; required archive directory. +- Positional argument `$3` → `KEEP`; optional positive integer, default `7`. +- Reads the contents of `SOURCE_DIR` for archiving and lists matching archives in `BACKUP_DIR`. + +#### Output +- Creates `BACKUP_DIR` if needed. +- Writes `BACKUP_DIR/${name}_.tar.gz`, first as a `.partial` file, then renames it to the final archive. +- Prints the created archive path and human-readable size; prints each removed archive path. +- Deletes matching archives after the newest `KEEP`. +- Exits with status `2` for an invalid `KEEP` or missing source directory. With `set -e`, failures of unguarded commands terminate the script. + +#### Core logic +- Require `SOURCE_DIR` and `BACKUP_DIR`; set `KEEP` to the third argument or `7`. +- Validate `KEEP` as a positive integer; reject invalid values with a diagnostic. +- Check that `SOURCE_DIR` is a directory; create `BACKUP_DIR`. +- Derive the source basename and construct a UTC-timestamped archive path and `.partial` path. +- Register an `EXIT` trap to remove the partial file. +- Create the gzip-compressed tar archive from the source directory’s parent, then rename the partial file to the final path. +- Print the archive path and size. +- List matching archives newest-first and delete entries after the first `KEEP`. + +#### Constants and configuration +- `SOURCE_DIR="${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR="${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP="${3:-7}"` +- `name="$(basename "$SOURCE_DIR")"` +- `archive="$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp="$archive.partial"` +- `archives` — populated by `mapfile -t` from the newest-first matching archive listing. + +#### Dependencies +- External commands: `basename`, `date`, `mkdir`, `tar`, `mv`, `echo`, `du`, `cut`, `ls`, `rm`. +- Bash built-ins/features: `[[ ]]`, `mapfile`, process substitution, array slicing, `trap`. +- Uses source directory contents and archive files matching `BACKUP_DIR/${name}_*.tar.gz`. + +#### Errors and exit codes +- Exit `2` if `KEEP` is not a positive integer. +- Exit `2` if `SOURCE_DIR` is not a directory. +- Required-argument expansion fails when `$1` or `$2` is unset or empty; `set -u` also terminates on unset variables. +- `set -e` terminates on an unhandled command failure; `set -o pipefail` propagates pipeline failures. +- `EXIT` trap runs `rm -f "$tmp"` to remove the partial archive. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..48729012 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/other/scripts/sales_report.py.ai.md @@ -0,0 +1,57 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:12:59Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Aggregates CSV order amounts into monthly revenue totals by region for a selected currency. + +#### Purpose +- Reads one or more order CSV exports and reports monthly revenue per region. +- Skips orders in other currencies and filters totals below a minimum revenue. + +#### Type +- Python script; defines frozen `Order` dataclass. + +#### Input +- Positional `csv_files`: one or more CSV file paths; expects `order_date`, `region`, `amount`, and `currency` columns. +- `--currency`: currency to include. +- `--min-revenue`: minimum monthly regional revenue to print. +- CSV rows: ISO-formatted order date, region, decimal amount, and currency. + +#### Output +- Prints tab-separated month, region, and revenue formatted to two decimal places with the selected currency. +- Writes `no orders found` to stderr and returns status `1` when no matching orders exist. +- Returns status `0` after reporting results. + +#### Core logic +- `parse_orders` validates required CSV headers, filters rows by currency, and yields `Order` instances with parsed dates, stripped regions, and decimal amounts. +- `revenue_by_month_and_region` sums amounts by `(YYYY-MM, region)` and returns totals sorted by key. +- `main` combines orders from all input files, handles the empty result, and prints totals meeting the minimum revenue threshold. +- Script entry point exits with `main()`'s status. + +#### Public API +- `Order(order_date, region, amount)` -> `Order` — represents a parsed order. +- `parse_orders(path, currency)` -> iterator of `Order` — yields matching-currency orders. +- `revenue_by_month_and_region(orders)` -> `dict` — aggregates sorted monthly regional totals. +- `main(argv=None)` -> `int` — parses arguments and runs report. +- Internal: `__main__` entry point invokes `sys.exit(main())`. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")`. +- `csv_files`: positional CLI argument; one or more paths. +- `--currency`: defaults to `"EUR"`. +- `--min-revenue`: parsed as `Decimal`; defaults to `Decimal("0")`. + +#### Dependencies +- Standard library: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. +- Uses `open`, `csv.DictReader`, `date.fromisoformat`, `Decimal`, `date.strftime`, `argparse.ArgumentParser`, and `sys.exit`. + +#### Exceptions / Errors +- `parse_orders` raises `ValueError` when required columns are missing, identifying the file and column names. +- Invalid dates or amounts raise `ValueError` with file and CSV line number; original `ValueError` or `InvalidOperation` is chained. +- File-opening and CSV parsing errors are not caught. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..b79bdf6e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/package.ai.md @@ -0,0 +1,51 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:14:12Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> Supports AI-assisted documentation generation alongside byte-processing, operational reporting, and database workflows for circulation, order fulfillment, and stock synchronization. + +#### Purpose +- Combines source-aware AI generation configuration and provider routing with utility workflows for byte analysis, buffering, backups, and sales reporting. +- Defines database schemas and routines for library circulation, shop inventory reservation, and warehouse stock synchronization. + +#### Responsibilities +- **AI generation (`java/`):** Select source files using conditions, extract configured facts, apply oversized-source policies, and generate completions through mock, llama.cpp, or OpenAI-compatible providers. +- **Byte utilities and operations (`other/`):** Calculate byte histograms, manage bounded FIFO byte storage, rotate compressed backups, and report monthly regional sales. +- **Database workflows (`sql/`):** Manage library loans and audit/reporting, reserve shop stock for order items, and synchronize warehouse balances from supplier feeds. + +#### Key units +- `AiConditionEvaluator`, `AiFactExtractor`, `AiGenerationConfig`, `SrcMorphConfiguration` — evaluate source rules, extract source facts, and hold generation and run settings. +- `AiOversizeStrategy`, `AiGenerationProvider`, `AiGenerationProviderFactory`, `AiCompletionParser` — resolve oversized-source policies and provider selection, then process completions. +- `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport` — execute local llama.cpp and OpenAI-compatible generation paths. +- `histogram_partial`, `histogram_reduce`, `BINS` — count byte values in parallel and reduce counts into a 256-bin histogram. +- `ringbuf_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space`, `ringbuf_free` — manage bounded byte storage and transfers. +- `rotate_backups.sh` — create timestamped compressed archives and enforce retention. +- `Order`, `parse_orders`, `revenue_by_month_and_region`, `main` — parse filtered order CSVs, aggregate revenue, and print qualifying totals. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `loan_audit`, `overdue_loans`, `member_loan_stats`, `popular_books` — implement library circulation, audit, and reporting. +- `add_order_item` — add or increment shop order lines, reserve product stock, and recalculate order totals. +- `dbo.usp_SyncStock`, `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog` — synchronize warehouse quantities and track run outcomes. + +#### Data flow +- AI source conditions and facts feed configured generation requests; the provider factory selects a backend, which returns parsed completion text and optional timings. +- Histogram input bytes flow through per-work-group counts and a reduction; ring-buffer writes and reads update wrapped storage indices. +- Backup rotation archives a source directory and prunes older matching archives; sales CSV rows become filtered `Order` records, monthly regional aggregates, and threshold-qualified output. +- Library checkout and return update loans and inventory with audit events; shop item addition locks and deducts stock; warehouse sync aggregates feed rows into balances and records success or failure. + +#### Dependencies +- AI configuration and provider collaborators include `AiFileContext`, condition and fact types, `AiGenerationRequest`, `AiPromptSupport`, llama.cpp support, Jackson, and OpenAI-compatible response types. +- Histogram kernels use OpenCL C; ring-buffer implementation uses standard C allocation and memory-copy functions. +- Backup rotation uses Bash and system archive/date/file commands; sales reporting uses Python standard-library CSV, date, decimal, and argument-parsing utilities. +- SQL workflows use PostgreSQL library tables, MySQL 8 shop tables, and SQL Server warehouse tables and procedures. + +#### Cross-cutting +- AI configuration is generally mutable; the provider contract supports optional timing and cleanup, while local model initialization is lazy and unsynchronized. +- Ring-buffer capacity must be a nonzero power of two; the API is designed for single-producer/single-consumer use. +- Database constraints and indexes support integrity and lookup; shop stock updates use locking, and warehouse synchronization is transactional with rollback and error logging. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..b0de0045 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: F5F3823A +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:14:20Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project combines AI-assisted documentation generation—using source-indexing configuration and selectable mock, local llama.cpp, or OpenAI-compatible text-generation backends—with byte-processing utilities, including parallel OpenCL histograms and bounded FIFO buffering. Its database workflows cover library circulation and inventory, shop orders and stock reservation, and warehouse synchronization from supplier feeds; command-line tools also support backup rotation and regional sales reporting. + +#### Packages +- java/config — Defines source-indexing and AI-generation configuration, including file-selection rules, model routing, exact source facts, and oversized-file handling for generated project documentation. +- java — Configures source-aware AI documentation generation and routes text-generation requests to mock, local llama.cpp, or OpenAI-compatible backends. +- java/provider — Generates AI text through selectable mock, local llama.cpp, or OpenAI-compatible backends, with shared configuration, completion cleanup, and optional generation metrics. +- other/kernels — Computes byte-value frequency distributions for image or byte-stream data using parallel OpenCL histogram kernels. +- other — This package provides low-level byte-processing utilities and command-line workflows for histogram analysis, FIFO buffering, backup rotation, and regional sales reporting. +- other/ringbuf — Provides bounded FIFO byte storage for passing data between a single producer and a single consumer. +- other/scripts — Provides command-line utilities for rotating compressed directory backups and summarizing order revenue by month and region. +- . — Supports AI-assisted documentation generation alongside byte-processing, operational reporting, and database workflows for circulation, order fulfillment, and stock synchronization. +- sql/library — Manages book lending from catalog and member records through checkout, returns, overdue reporting, and branch-based physical inventory. +- sql — Implements database workflows for library circulation, shop order fulfillment, and warehouse stock synchronization. +- sql/shop — Manages shop inventory and customer order lines, reserving product stock and maintaining order totals when items are added. +- sql/warehouse — Synchronizes recent supplier-feed quantities into warehouse stock balances and records the outcome of each synchronization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..c750f7b4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/01_schema.sql.ai.md @@ -0,0 +1,56 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:11:46Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models authors, books, library members, and book loans, including inventory availability and loan return status. + +#### Purpose +- Defines the core lending-library schema and indexes for author, member, and open-loan lookups. + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- `author` + - `author_id BIGSERIAL` — primary key. + - `full_name VARCHAR(200) NOT NULL`. + - `birth_year SMALLINT` — `CHECK (birth_year BETWEEN 1000 AND 2100)`. + - `country_code CHAR(2)`. +- `book` + - `book_id BIGSERIAL` — primary key. + - `isbn VARCHAR(17) NOT NULL UNIQUE`. + - `title VARCHAR(300) NOT NULL`. + - `author_id BIGINT NOT NULL` — FK to `author.author_id`. + - `published_year SMALLINT`. + - `copies_total INTEGER NOT NULL DEFAULT 1` — `CHECK (copies_total >= 0)`. + - `copies_free INTEGER NOT NULL DEFAULT 1` — `CHECK (copies_free >= 0)`. + - `book_free_le_total CHECK (copies_free <= copies_total)`. +- `member` + - `member_id BIGSERIAL` — primary key. + - `email VARCHAR(254) NOT NULL UNIQUE`. + - `full_name VARCHAR(200) NOT NULL`. + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE`. + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE`. +- `loan` + - `loan_id BIGSERIAL` — primary key. + - `book_id BIGINT NOT NULL` — FK to `book.book_id`. + - `member_id BIGINT NOT NULL` — FK to `member.member_id`, `ON DELETE CASCADE`. + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE`. + - `due_on DATE NOT NULL`. + - `returned_on DATE`. + - `loan_due_after_loan CHECK (due_on > loaned_on)`. +- Indexes: + - `idx_book_author` on `book (author_id)`, default method. + - `idx_loan_member` on `loan (member_id)`, default method. + - `idx_loan_open` on `loan (due_on)`, default method, predicate `returned_on IS NULL`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (`ON DELETE CASCADE`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..b2500e5f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/02_views.sql.ai.md @@ -0,0 +1,38 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:11:52Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Provides lending-library reports for overdue loans, member borrowing activity, and recently popular books. + +#### Purpose +- Exposes loan and member reporting through two views and one materialized view. +- Identifies books loaned at least five times in the past 365 days. + +#### Type +- Views: `overdue_loans`, `member_loan_stats`; materialized view: `popular_books`. +- Dialect: PostgreSQL. + +#### Schema +- `overdue_loans`: `loan_id` (from `loan`), `member_id` (from `member`), `email` (from `member`), `title` (from `book`), `due_on` (from `loan`), `days_overdue` (date subtraction; integer). +- `member_loan_stats`: `member_id` (from `member`), `full_name` (from `member`), `loans_total` (count; bigint), `loans_open` (filtered count; bigint), `last_loan_on` (maximum `loaned_on`; source type). +- `popular_books`: `book_id` (from `book`), `title` (from `book`), `author_name` (from `author.full_name`), `times_loaned` (count; bigint). +- Index `idx_popular_books_id`: unique B-tree on `popular_books (book_id)`. + +#### Reads +- `overdue_loans`: `loan.loan_id`, `loan.member_id`, `loan.book_id`, `loan.due_on`, `loan.returned_on`; `member.member_id`, `member.email`; `book.book_id`, `book.title`. +- `member_loan_stats`: `member.member_id`, `member.full_name`; `loan.loan_id`, `loan.member_id`, `loan.returned_on`, `loan.loaned_on`. +- `popular_books`: `loan.book_id`, `loan.loaned_on`; `book.book_id`, `book.title`, `book.author_id`; `author.author_id`, `author.full_name`. + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..5b48b596 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/03_routines.sql.ai.md @@ -0,0 +1,55 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:11:58Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Implements library checkout and return workflows, tracks loan audit events, and calculates capped overdue fees. + +#### Purpose +- Prevents blocked-member checkout and decrements available book copies when creating a loan. +- Returns loans and copies, records checkout/return audit events, and computes late fees. + +#### Type +- PostgreSQL: table `loan_audit`; functions `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn`; procedure `sp_return_book`; trigger `trg_loan_audit`. + +#### Schema +- `loan_audit` + - `audit_id BIGSERIAL` — primary key. + - `loan_id BIGINT NOT NULL`. + - `action VARCHAR(10) NOT NULL` — CHECK `action IN ('CHECKOUT', 'RETURN')`. + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()`. + +#### Reads +- `member.member_id`, `member.is_blocked` — blocked-member check in `fn_checkout_book`. +- `book.book_id`, `book.copies_free` — checkout availability condition. +- `loan.loan_id`, `loan.returned_on` — return condition in `sp_return_book`. +- `loan` trigger row: `NEW.loan_id`, `NEW.returned_on`, `OLD.returned_on`. + +#### Writes +- `book.copies_free` — decrement on checkout; increment on return. +- `loan`: `book_id`, `member_id`, `due_on` — `fn_checkout_book` inserts 1 row per successful call; `loan_id` returned. +- `loan.returned_on` — `sp_return_book` sets to `CURRENT_DATE` for an unreturned loan. +- `loan_audit`: `loan_id`, `action` — trigger function inserts 1 `CHECKOUT` row per loan insert, or 1 `RETURN` row when `returned_on` changes from NULL to non-NULL. + +#### Routine logic +- `fn_checkout_book(p_member_id BIGINT, p_book_id BIGINT, p_days INTEGER DEFAULT 21) RETURNS BIGINT` + - Raises an exception for a blocked member or when no free copy is available. + - Decrements `book.copies_free`, inserts a loan due `p_days` from `CURRENT_DATE`, and returns its `loan_id`. +- `sp_return_book(p_loan_id BIGINT)` + - Sets `loan.returned_on` to `CURRENT_DATE` for an active loan and captures its `book_id`. + - Raises an exception for an unknown or already returned loan; otherwise increments the book’s free-copy count. +- `fn_late_fee(p_due_on DATE, p_returned_on DATE) RETURNS INTEGER` + - Immutable SQL function: charges 50 cents per overdue day, using `CURRENT_DATE` when the return date is NULL; floors at zero and caps at 2000 cents. +- `trg_loan_audit_fn() RETURNS TRIGGER` + - Inserts a `CHECKOUT` audit row on loan insert; inserts a `RETURN` audit row when `returned_on` changes from NULL to non-NULL; returns `NEW`. +- `trg_loan_audit` + - After each `loan` insert or update of `returned_on`, executes `trg_loan_audit_fn`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Trigger function: `trg_loan_audit_fn`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..933f2922 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,55 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:12:07Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds branch-based inventory to a lending library, assigns existing book copies to the main branch, and updates loan and member records for branch-aware circulation. + +#### Purpose +- Introduces branches and individual `book_copy` inventory records. +- Migrates existing copy counts into copy rows, then removes the per-book copy counters. + +#### Type +- PostgreSQL migration script; creates tables and an index, alters existing tables, and performs DML. + +#### Schema +- `branch` + - `branch_id SMALLSERIAL` — primary key. + - `name VARCHAR(100) NOT NULL UNIQUE` — unique constraint unnamed. + - `city VARCHAR(100) NOT NULL`. +- `book_copy` + - `copy_id BIGSERIAL` — primary key. + - `book_id BIGINT NOT NULL` — FK to `book(book_id)`. + - `branch_id SMALLINT NOT NULL` — FK to `branch(branch_id)`. + - `barcode VARCHAR(32) NOT NULL UNIQUE` — unique constraint unnamed. + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE'` — CHECK allows `AVAILABLE`, `ON_LOAN`, `LOST` (constraint unnamed). +- `loan`: adds `copy_id BIGINT` — FK to `book_copy(copy_id)`. +- `member`: renames `joined_on` to `member_since`; adds `home_branch_id SMALLINT` — FK to `branch(branch_id)`. +- `book`: drops constraint `book_free_le_total`; drops columns `copies_free` and `copies_total`. +- Index: `idx_book_copy_book` on `book_copy(book_id)`; default index method. + +#### Reads +- `book`: `book_id`, `isbn`, `copies_total`, `copies_free` (used to generate and classify copy rows). + +#### Writes +- `branch`: 1 row inserted — `Main`, `Springfield`. +- `book_copy`: one `INSERT ... SELECT`; inserts one row per generated copy for each `book` row, based on `copies_total` (exact total depends on source data). +- `loan`: adds `copy_id`. +- `member`: renames `joined_on` to `member_since`; adds `home_branch_id`; updates `home_branch_id = 1` where it is `NULL`. +- `book`: drops `book_free_le_total`, `copies_free`, and `copies_total`. +- Creates index `idx_book_copy_book`. + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- Tables: `book`, `loan`, `member`. +- Function: `generate_series`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..37162f77 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,29 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:12:14Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Populates a lending-library database with sample authors, catalog books, members, and loan histories. + +#### Purpose +- Seeds PostgreSQL lending-library data for authors, books, members, and loans. +- Runs all inserts in one transaction. + +#### Type +- DML transaction; PostgreSQL. + +#### Writes +- `author`: 15 single-row INSERTs = 15 rows; `author_id` 1–15, first `Radia Lovelace`, last `Grace Lamarr`. +- `book`: 110 single-row INSERTs = 110 rows; `book_id` 1–110, first `The Hidden Golden 1`, last `The Last Glass 110`; each row supplies ISBN, title, author, publication year, and total/free copy counts. +- `member`: 50 single-row INSERTs = 50 rows; `member_id` 1–50; supplies email, name, join date, and blocked status. +- `loan`: 150 single-row INSERTs = 150 rows; `loan_id` 1–150; supplies book, member, loan/due/return dates; some `returned_on` values are `NULL`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/package.ai.md new file mode 100644 index 00000000..532bc76d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/library/package.ai.md @@ -0,0 +1,54 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:13:51Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> Manages book lending from catalog and member records through checkout, returns, overdue reporting, and branch-based physical inventory. + +#### Purpose +- Defines and operates a PostgreSQL lending library, including circulation rules, audit history, and reporting. +- Evolves inventory from per-book copy counts to branch-assigned individual copies, with sample catalog and loan data. + +#### Responsibilities +- **Core catalog and circulation schema:** `author`, `book`, `member`, and `loan` tables with keys, constraints, and lookup indexes. +- **Lending reports:** Views for overdue loans and member borrowing statistics, plus a materialized view of frequently loaned books. +- **Checkout, return, and fee rules:** Routines enforce member and availability checks, update loan and inventory records, and calculate capped overdue fees. +- **Audit tracking:** A loan trigger records checkout and return events in `loan_audit`. +- **Branch inventory migration:** Adds `branch` and `book_copy`, associates loans and members with branches, migrates existing book counts into copy records, and removes the old counters. +- **Sample data:** Seeds authors, books, members, and loan histories in a transaction. + +#### Key units +- `author`, `book`, `member`, `loan` — core catalog, membership, and lending records. +- `overdue_loans` — reports active loans past their due date with member and book details. +- `member_loan_stats` — aggregates total and open loans and the member’s most recent loan date. +- `popular_books` — materialized report of books loaned at least five times in the prior 365 days. +- `fn_checkout_book` — checks member eligibility and copy availability, creates a loan, and returns its ID. +- `sp_return_book` — marks an active loan returned and restores inventory availability. +- `fn_late_fee` — calculates overdue charges at 50 cents per day, capped at 2000 cents. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — store and record checkout and return events. +- `branch`, `book_copy` — represent branches and individually identified copies with availability, loan, or lost status. + +#### Data flow +- `fn_checkout_book` validates the member and available inventory, updates book availability, and inserts a `loan`; the audit trigger records checkout. +- `sp_return_book` validates an active loan, records its return date, and restores availability; the trigger records the return, while `fn_late_fee` calculates any overdue charge. +- Reporting views aggregate `loan`, `member`, `book`, and `author` data; `popular_books` summarizes recent lending activity. +- The migration creates a main branch and generates `book_copy` rows from existing book copy counts, then links loans and members to branch-aware inventory. + +#### Dependencies +- Reporting and circulation routines read or write `author`, `book`, `member`, `loan`, and `loan_audit`. +- `book.author_id`, `loan.book_id`, and `loan.member_id` link catalog and lending records; member deletion cascades to loans. +- The migration uses `generate_series` and links `book_copy` to `book` and `branch`, `loan` to `book_copy`, and `member` to `branch`. + +#### Cross-cutting +- PostgreSQL constraints enforce identifiers, uniqueness, valid inventory counts, loan date ordering, and allowed copy and audit statuses. +- Indexes support author, member, open-loan, book-copy, and materialized popular-book lookups. +- Checkout rejects blocked members and unavailable copies; return rejects unknown or already returned loans. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/package.ai.md new file mode 100644 index 00000000..46381e7e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/package.ai.md @@ -0,0 +1,45 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:14:06Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> Implements database workflows for library circulation, shop order fulfillment, and warehouse stock synchronization. + +#### Purpose +- Defines relational schemas and operational routines for lending books, reserving shop inventory for orders, and synchronizing warehouse stock from supplier feeds. +- Includes reporting, audit, and run-outcome tracking where applicable. + +#### Responsibilities +- **Library lending and inventory:** Catalog, member, loan, branch, and individual-copy records; checkout, returns, late fees, audit history, and lending reports. +- **Shop orders and stock reservation:** Product and order tables; add order items by SKU while deducting stock and recalculating order totals. +- **Warehouse stock synchronization:** Aggregate recent supplier quantities into stock balances and log successful or failed synchronization runs. + +#### Key units +- `author`, `book`, `member`, `loan`, `branch`, `book_copy` — library catalog, membership, circulation, and branch inventory. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee` — library checkout, return, and overdue-fee rules. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — record library checkout and return events. +- `overdue_loans`, `member_loan_stats`, `popular_books` — library circulation reports. +- `product`, `customer_order`, `order_item`, `add_order_item` — shop catalog, order lines, stock reservation, and total recalculation. +- `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog`, `dbo.usp_SyncStock` — warehouse quantity inputs, current balances, synchronization outcomes, and the sync procedure. + +#### Data flow +- Library checkout validates members and copy availability, creates a loan, and records the event; return updates the loan and inventory, with audit tracking and late-fee calculation. Reporting units aggregate lending records. +- Shop item addition locks a product by SKU, inserts or increments an order line, deducts stock, and recalculates the order total. +- Warehouse synchronization filters supplier-feed rows by cutoff, aggregates quantities by warehouse and SKU, merges them into stock balances, and logs counts; failures roll back, log the error, and rethrow. + +#### Dependencies +- Library routines and reports operate on `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, and `book_copy`; foreign keys link catalog, loans, members, and copies. +- Shop `add_order_item` uses `product`, `order_item`, and `customer_order`; order items reference products and orders. +- Warehouse `dbo.usp_SyncStock` uses `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. + +#### Cross-cutting +- The package spans PostgreSQL library operations, MySQL 8 shop operations, and SQL Server T-SQL warehouse synchronization. +- Database constraints and indexes support valid records and lookups; locking protects shop product stock updates. +- Library checkout and return reject invalid member, availability, or loan states; warehouse changes and success logging are transactional, with rollback and error logging on failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..de6cfc61 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,65 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:12:18Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models shop products, customer orders, and order lines, with a procedure that reserves product stock and recalculates order totals. + +#### Purpose +- Stores product inventory, customer orders, and order-item quantities and prices. +- Adds an order line by SKU, deducts stock, and refreshes the order total. + +#### Type +- MySQL 8 tables: `product`, `customer_order`, `order_item`; procedure: `add_order_item`. +- `customer_order.status` enum: `NEW`, `PAID`, `SHIPPED`, `CANCELLED`. + +#### Schema +- `product` + - `product_id INT UNSIGNED` — `NOT NULL`, `AUTO_INCREMENT`, primary key. + - `sku VARCHAR(40)` — `NOT NULL`; unique key `uk_product_sku`. + - `name VARCHAR(200)` — `NOT NULL`. + - `price_cents INT UNSIGNED` — `NOT NULL`. + - `stock INT` — `NOT NULL`, `DEFAULT 0`. +- `customer_order` + - `order_id BIGINT UNSIGNED` — `NOT NULL`, `AUTO_INCREMENT`, primary key. + - `customer_id BIGINT UNSIGNED` — `NOT NULL`. + - `status ENUM('NEW', 'PAID', 'SHIPPED', 'CANCELLED')` — `NOT NULL`, `DEFAULT 'NEW'`. + - `created_at DATETIME` — `NOT NULL`, `DEFAULT CURRENT_TIMESTAMP`. + - `total_cents INT UNSIGNED` — `NOT NULL`, `DEFAULT 0`. +- `order_item` + - `order_id BIGINT UNSIGNED` — `NOT NULL`, composite primary key. + - `product_id INT UNSIGNED` — `NOT NULL`, composite primary key. + - `quantity SMALLINT UNSIGNED` — `NOT NULL`. + - `unit_price_cents INT UNSIGNED` — `NOT NULL`. + - Foreign key `fk_item_order`: `order_id` references `customer_order(order_id)`, `ON DELETE CASCADE`. + - Foreign key `fk_item_product`: `product_id` references `product(product_id)`. +- Indexes: + - `uk_product_sku` on `product(sku)` — unique key. + - `idx_order_customer` on `customer_order(customer_id, created_at)` — key. + - `order_item` primary key on `(order_id, product_id)`. + +#### Reads +- `product`: `product_id`, `price_cents`, `sku`, `stock` — lookup and row lock in `add_order_item`. +- `order_item`: `quantity`, `unit_price_cents`, `order_id` — total calculation. + +#### Writes +- `order_item`: inserts `order_id`, `product_id`, `quantity`, `unit_price_cents`; duplicate key updates `quantity`. +- `product`: updates `stock`. +- `customer_order`: updates `total_cents`. + +#### Relationships +- `order_item.order_id -> customer_order.order_id` +- `order_item.product_id -> product.product_id` + +#### Routine logic +- `add_order_item(p_order_id BIGINT UNSIGNED, p_sku VARCHAR(40), p_qty SMALLINT UNSIGNED)` +- Selects and locks a matching product with sufficient stock; signals SQLSTATE `45000` if no product is found. +- Inserts or increments the order-item quantity, deducts `p_qty` from product stock, then sets the order total to the sum of its line quantities times unit prices. + +#### Dependencies +- Tables: `product`, `order_item`, `customer_order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/shop/package.ai.md new file mode 100644 index 00000000..bf75bb1a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/shop/package.ai.md @@ -0,0 +1,39 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:13:57Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Manages shop inventory and customer order lines, reserving product stock and maintaining order totals when items are added. + +#### Purpose +- Stores products, customer orders, and order-item quantities and prices. +- Adds items by SKU while deducting inventory and recalculating the order total. + +#### Responsibilities +- **Catalog and inventory:** `product` stores SKU, name, price, and available stock. +- **Order records:** `customer_order` tracks customer, status, creation time, and total; `order_item` records quantities and unit prices. +- **Item addition and stock reservation:** `add_order_item` locks a matching product, inserts or increments its order line, deducts stock, and updates the order total. + +#### Key units +- `product` — product catalog and stock inventory, with unique SKU lookup. +- `customer_order` — customer order header with `NEW`, `PAID`, `SHIPPED`, or `CANCELLED` status. +- `order_item` — order lines keyed by `(order_id, product_id)`, linked to orders and products. +- `add_order_item(p_order_id, p_sku, p_qty)` — adds a requested quantity by SKU and refreshes stock and order total. + +#### Data flow +- `add_order_item` finds and locks a `product` by SKU, requiring sufficient stock; signals SQLSTATE `45000` if no matching product is found. +- It inserts an `order_item` or increments the existing line quantity, then deducts the requested quantity from `product.stock`. +- It recalculates `customer_order.total_cents` from the order’s line quantities and unit prices. + +#### Dependencies +- Internal tables: `product`, `order_item`, and `customer_order`. +- `order_item.order_id` references `customer_order.order_id` with cascade deletion; `order_item.product_id` references `product.product_id`. + +#### Cross-cutting +- Uses MySQL 8 tables and a stored procedure. +- Product lookup uses a row lock; `order_item` has a composite primary key to support duplicate-key quantity updates. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/warehouse/package.ai.md new file mode 100644 index 00000000..ee5c06b5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/warehouse/package.ai.md @@ -0,0 +1,37 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:14:02Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Synchronizes recent supplier-feed quantities into warehouse stock balances and records the outcome of each synchronization. + +#### Purpose +- Aggregate supplier quantities by warehouse and SKU since a cutoff, then apply them to current stock. +- Track inserted and updated rows, or log and rethrow synchronization errors. + +#### Responsibilities +- **Stock synchronization:** `dbo.usp_SyncStock` aggregates eligible feed rows and merges totals into `dbo.StockLevel`. +- **Outcome logging:** write synchronization counts or failure details to `dbo.SyncLog`. + +#### Key units +- `dbo.usp_SyncStock(@Since)`: transactionally updates stock from recent supplier-feed quantities and records the result. +- `dbo.SupplierFeed`: source rows with warehouse, SKU, quantity, and receipt time. +- `dbo.StockLevel`: current on-hand quantities keyed by warehouse and SKU. +- `dbo.SyncLog`: per-run start time, inserted and updated counts, and optional error message. + +#### Data flow +- Read `dbo.SupplierFeed` rows with `ReceivedAt >= @Since`; group by `WarehouseId` and `Sku`, summing `Quantity`. +- Merge the aggregates into `dbo.StockLevel`: update matched quantities and timestamps; insert unmatched warehouse/SKU pairs. +- Count merge actions, log successful counts, and commit; on failure, roll back, log the error, and rethrow. + +#### Dependencies +- SQL Server T-SQL; `dbo.usp_SyncStock` operates on `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. + +#### Cross-cutting +- Stock changes and success logging run in a transaction. +- Errors trigger rollback of any active transaction, failure logging with zero counts, and rethrowing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..29cac3b5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,68 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:12:25Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Aggregates recent supplier quantities by warehouse and SKU, updates current stock levels, and records synchronization outcomes or errors. + +#### Purpose +- Synchronizes supplier-feed quantities received since a cutoff into warehouse stock balances. +- Logs inserted and updated stock counts, or the error from a failed synchronization. + +#### Type +- Tables and procedure; SQL Server (T-SQL). +- Procedure: `dbo.usp_SyncStock` + +#### Schema +- `dbo.StockLevel` + - `WarehouseId INT NOT NULL` — composite primary key + - `Sku NVARCHAR(40) NOT NULL` — composite primary key + - `OnHand INT NOT NULL DEFAULT (0)` — constraint `DF_StockLevel_OnHand` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())` — constraint `DF_StockLevel_UpdatedAt` + - Constraint `PK_StockLevel`: primary key (`WarehouseId`, `Sku`) +- `dbo.SupplierFeed` + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL` — primary key + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + - Constraint `PK_SupplierFeed`: primary key (`FeedRowId`) +- `dbo.SyncLog` + - `SyncLogId INT IDENTITY(1,1) NOT NULL` — primary key + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + - Constraint `PK_SyncLog`: primary key (`SyncLogId`) + +#### Reads +- `dbo.SupplierFeed`: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`; filters by `ReceivedAt >= @Since`, groups by `WarehouseId`, `Sku`, sums `Quantity`. +- `dbo.StockLevel`: `WarehouseId`, `Sku`, `OnHand` for MERGE matching and matched-row updates. +- `@Changes`: `MergeAction` for inserted/updated counts. + +#### Writes +- `dbo.StockLevel` via MERGE: + - Matched rows: updates `OnHand`, `UpdatedAt`. + - Unmatched rows: inserts `WarehouseId`, `Sku`, `OnHand`. +- `dbo.SyncLog` on success: inserts `StartedAt`, `RowsInserted`, `RowsUpdated` from merge-action counts. +- `dbo.SyncLog` on failure: inserts one VALUES tuple with `StartedAt`, zero counts, and `ErrorMessage`; rethrows the error. + +#### Relationships +- `dbo.StockLevel.WarehouseId -> source.WarehouseId` and `dbo.StockLevel.Sku -> source.Sku` — MERGE matching against aggregated `dbo.SupplierFeed`. + +#### Routine logic +- `dbo.usp_SyncStock(@Since DATETIME2(0))`: + - Captures the UTC start time and initializes merge-action tracking. + - In a transaction, aggregates feed quantities since `@Since` and merges them into `dbo.StockLevel`. + - Records counts of inserted and updated stock rows in `dbo.SyncLog`, then commits. + - On error, rolls back any active transaction, logs the error, and rethrows. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..509323ac --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,55 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:14:24Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Evaluates and validates file‑selection conditions for the source‑morph indexer. + +#### Purpose +- Checks if a file satisfies a complex condition tree. +- Validates condition trees for correctness. +- Detects if line counting is required. + +#### Type +`final class AiConditionEvaluator` – class, final. + +#### Input +- `AiCondition` tree (branches: and, or, not, extensions, size, lines, modifiedAfter, modifiedBefore, pathGlob). +- `AiFileContext` (fileName, sizeBytes, lineCount, lastModifiedEpochMilli, relativePath). + +#### Output +- `boolean` from `matches`, `usesLines`. +- Exceptions (`IllegalArgumentException`, `IllegalStateException`) on invalid trees or parsing errors. + +#### Core logic +- `matches`: recursively evaluates and/or/not groups; leaf checks for extensions, size, lines, modification dates, path glob. +- `validate`: ensures exactly one branch/leaf per node; checks non‑empty lists, bounds, parsable dates, non‑blank glob. +- `usesLines`: traverses tree to find any `lines` condition. +- `branchCount`: counts non‑null branch/leaf fields. +- `matchesExtension`: checks file name suffix against list. +- `globMatches`: uses `AiSourceExcludeFilter` to test path glob. +- `parseEpochMilli`: parses ISO‑8601 instant to epoch milliseconds. + +#### Public API +- `AiConditionEvaluator()` – constructor, no-op. +- `matches(AiCondition, AiFileContext) -> boolean` – evaluate condition tree. +- `validate(AiCondition) -> void` – validate tree structure. +- `usesLines(AiCondition) -> boolean` – detect line‑count requirement. + +#### Dependencies +- `java.time.Instant`, `java.time.format.DateTimeParseException` +- `java.util.Collections`, `java.util.List` +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` for misconfigured nodes, empty lists, unbounded ranges, blank glob, or invalid ISO‑8601 instant. +- `IllegalStateException` if a node sets more than one branch/leaf. + +#### Concurrency +- Stateless; thread‑safe. No shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..ffdc0dec --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,48 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:14:33Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> A container for child AI conditions used by / combinators in configuration. + +#### Purpose +- Holds a list of child `AiCondition` objects for combinator bodies. + +#### Type +`public class AiConditionGroup` – class, public, no modifiers, annotated with `@ToString`, `@SuppressWarnings`. + +#### Input +- `setConditions(Collection)` receives a collection of `AiCondition` instances (nullable). + +#### Output +- `getConditions()` returns the internal `List` (nullable). +- Internal state: `private @Nullable List conditions`. + +#### Core logic +- Constructor: no initialization. +- `setConditions`: if argument non‑null, defensively copies into a new `ArrayList`; otherwise sets field to `null`. +- `getConditions`: returns the stored list or `null`. + +#### Public API +- `AiConditionGroup()` → creates empty group +- `List getConditions()` → retrieve child conditions +- `void setConditions(Collection)` → set child conditions (defensive copy) + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCondition` + +#### Exceptions / Errors +- No checked exceptions thrown. +- Null handling: `setConditions` accepts `null`, stores `null`; `getConditions` may return `null`. + +#### Concurrency +- No synchronization; class is not thread‑safe. +- Mutability: `setConditions` replaces the list; external callers must not modify the returned list to avoid unintended side effects. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..5b4cc8f8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,46 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:14:36Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Generates a deterministic “facts” block summarizing exact regex match counts for a source file. + +#### Purpose +- Compute exact, whole‑file counts for AI‑generated summaries. +- Prepend counts to AI body on oversize path. + +#### Type +`final class AiFactExtractor` – utility class, no instances. + +#### Input +- `List counters` (nullable). +- `String source` – full source text. + +#### Output +- `String` facts block ending with a blank line, or empty string if no counters. + +#### Core logic +- Skip null counters or those with null label/pattern. +- For each valid counter, append `label: count` to a `StringBuilder`. +- Separate entries with `; `, prefix with `**Facts (exact, whole file):** `, suffix with two newlines. +- Count matches via `Pattern.compile(pattern).matcher(source).find()` loop. +- `validate` ensures each counter has non‑null label/pattern and a compilable regex, throwing `IllegalArgumentException` otherwise. + +#### Public API +- `factsBlock(List, String) -> String` – build facts block. +- `validate(List) -> void` – validate counters. + +#### Dependencies +- `java.util.List`, `java.util.regex.Matcher`, `java.util.regex.Pattern`, `java.util.regex.PatternSyntaxException`, `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `IllegalArgumentException` from `validate` on missing label/pattern or invalid regex. +- `PatternSyntaxException` wrapped in `IllegalArgumentException`. + +#### Concurrency +- Stateless, thread‑safe; all methods are static and use local variables. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..b842951d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,141 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:14:41Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> A mutable JavaBean that holds all AI‑generation parameters for a single model run, exposing getters/setters for configuration values used by Maven plugin and AI providers. + +#### Purpose +- Stores AI generation settings (model path, sampling, prompt limits, provider details, GPU options, etc.). +- Serves as a data transfer object between Maven configuration and AI provider implementations. + +#### Type +`public class AiGenerationConfig` +- Modifiers: `public` +- Annotations: `@ToString`, `@SuppressWarnings({"NullAway.Init","initialization.fields.uninitialized"})` +- Extends: none +- Implements: none + +#### Input +- Constructor: no-arg, defaults to all static defaults. +- Setters for each field: `setModelPath`, `setContextSize`, `setMaxOutputTokens`, `setTemperature`, `setThreads`, `setCharsPerToken`, `setMaxInputChars`, `setWarnOnTrim`, `setTopP`, `setTopK`, `setMinP`, `setTopNSigma`, `setRepeatPenalty`, `setChatTemplateEnableThinking`, `setCachePrompt`, `setSwaFull`, `setCacheReuse`, `setGpuLayers`, `setSeed`, `setCpuMoeLayers`, `setCpuFfnLayers`, `setKvUnifiedPerSlot`, `setLazyMode`, `setRepeatLastN`, `setCacheTypeK`, `setCacheTypeV`, `setFlashAttn`, `setBatchSize`, `setUbatchSize`, `setThreadsBatch`, `setMainGpu`, `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, `setApiKeyEnv`, `setReasoningEffort`, `setReasoningBudgetTokens`, `setDryMultiplier`, `setDryBase`, `setDryAllowedLength`, `setDryPenaltyLastN`, `setDrySequenceBreakers`, `setStopStrings`, `setCalibration`. + +#### Output +- Getters for all fields: `getModelPath`, `getContextSize`, `getMaxOutputTokens`, `getTemperature`, `getThreads`, `getCharsPerToken`, `getMaxInputChars`, `isWarnOnTrim`, `getTopP`, `getTopK`, `getMinP`, `getTopNSigma`, `getRepeatPenalty`, `getChatTemplateEnableThinking`, `isCachePrompt`, `isSwaFull`, `getCacheReuse`, `getGpuLayers`, `getSeed`, `getCpuMoeLayers`, `getCpuFfnLayers`, `getKvUnifiedPerSlot`, `getLazyMode`, `getRepeatLastN`, `getCacheTypeK`, `getCacheTypeV`, `isFlashAttn`, `getBatchSize`, `getUbatchSize`, `getThreadsBatch`, `getMainGpu`, `getDevices`, `getProvider`, `getRemoteModel`, `getBaseUrl`, `getApiKeyEnv`, `getReasoningEffort`, `getReasoningBudgetTokens`, `getDryMultiplier`, `getDryBase`, `getDryAllowedLength`, `getDryPenaltyLastN`, `getDrySequenceBreakers`, `getStopStrings`, `getCalibration`. +- `getDrySequenceBreakers` and `getStopStrings` return unmodifiable lists. + +#### Core logic +- All fields initialized to static defaults. +- Setters perform minimal validation (e.g., null → default, empty → default). +- No additional computation; the class is a plain data holder. + +#### Public API +- `AiGenerationConfig()` -> empty config +- `getModelPath() -> String?` → model file path +- `setModelPath(String?) -> void` → set model path +- `getContextSize() -> int` → context window +- `setContextSize(int) -> void` → set context size +- `getMaxOutputTokens() -> int` → max output tokens +- `setMaxOutputTokens(int) -> void` → set max output tokens +- `getTemperature() -> float` → sampling temperature +- `setTemperature(float) -> void` → set temperature +- `getThreads() -> int` → CPU threads +- `setThreads(int) -> void` → set threads +- `getCharsPerToken() -> int` → chars per token +- `setCharsPerToken(int) -> void` → set chars per token +- `getMaxInputChars() -> int` → max input chars +- `setMaxInputChars(int) -> void` → set max input chars +- `isWarnOnTrim() -> boolean` → trim warning flag +- `setWarnOnTrim(boolean) -> void` → set trim warning +- `getTopP() -> float` → nucleus threshold +- `setTopP(float) -> void` → set top‑p +- `getTopK() -> int` → top‑k limit +- `setTopK(int) -> void` → set top‑k +- `getMinP() -> float` → min‑p threshold +- `setMinP(float) -> void` → set min‑p +- `getTopNSigma() -> float` → top‑n‑sigma threshold +- `setTopNSigma(float) -> void` → set top‑n‑sigma +- `getRepeatPenalty() -> float` → repetition penalty +- `setRepeatPenalty(float) -> void` → set repeat penalty +- `getChatTemplateEnableThinking() -> Boolean?` → chat‑template thinking flag +- `setChatTemplateEnableThinking(Boolean?) -> void` → set flag +- `isCachePrompt() -> boolean` → prompt‑caching flag +- `isSwaFull() -> boolean` → full‑SWA flag +- `setSwaFull(boolean) -> void` → set full‑SWA +- `getCacheReuse() -> int` → cache‑reuse chunk size +- `setCacheReuse(int) -> void` → set cache‑reuse +- `getGpuLayers() -> int` → GPU offload layers +- `setGpuLayers(int) -> void` → set GPU layers +- `getSeed() -> int` → RNG seed +- `setSeed(int) -> void` → set seed +- `getCpuMoeLayers() -> int` → CPU MoE layers +- `setCpuMoeLayers(int) -> void` → set CPU MoE +- `getCpuFfnLayers() -> int` → CPU FFN layers +- `setCpuFfnLayers(int) -> void` → set CPU FFN +- `getKvUnifiedPerSlot() -> int` → KV unified per‑slot cap +- `setKvUnifiedPerSlot(int) -> void` → set cap +- `getLazyMode() -> String` → tensor‑read laziness +- `setLazyMode(String?) -> void` → set laziness +- `getRepeatLastN() -> int` → repeat‑penalty window +- `setRepeatLastN(int) -> void` → set window +- `getCacheTypeK() -> String` → KV cache type K +- `setCacheTypeK(String?) -> void` → set type K +- `getCacheTypeV() -> String` → KV cache type V +- `setCacheTypeV(String?) -> void` → set type V +- `isFlashAttn() -> boolean` → Flash Attention flag +- `setFlashAttn(boolean) -> void` → set flag +- `getBatchSize() -> int` → logical batch size +- `setBatchSize(int) -> void` → set batch size +- `getUbatchSize() -> int` → physical batch size +- `setUbatchSize(int) -> void` → set physical batch size +- `getThreadsBatch() -> int` → batch thread count +- `setThreadsBatch(int) -> void` → set batch threads +- `getMainGpu() -> int` → primary GPU index +- `setMainGpu(int) -> void` → set GPU index +- `getDevices() -> String` → device list +- `setDevices(String) -> void` → set devices +- `getProvider() -> String` → AI provider +- `setProvider(String?) -> void` → set provider +- `getRemoteModel() -> String` → remote model id +- `setRemoteModel(String?) -> void` → set remote model +- `getBaseUrl() -> String` → base URL +- `setBaseUrl(String?) -> void` → set base URL +- `getApiKeyEnv() -> String` → API key env var name +- `setApiKeyEnv(String?) -> void` → set env var +- `getReasoningEffort() -> String` → reasoning effort level +- `setReasoningEffort(String) -> void` → set effort +- `getReasoningBudgetTokens() -> int` → reasoning budget +- `setReasoningBudgetTokens(int) -> void` → set budget +- `getDryMultiplier() -> float` → DRY multiplier +- `setDryMultiplier(float) -> void` → set multiplier +- `getDryBase() -> float` → DRY base +- `setDryBase(float) -> void` → set base +- `getDryAllowedLength() -> int` → DRY allowed length +- `setDryAllowedLength(int) -> void` → set length +- `getDryPenaltyLastN() -> int` → DRY penalty window +- `setDryPenaltyLastN(int) -> void` → set window +- `getDrySequenceBreakers() -> List` → DRY sequence breakers +- `setDrySequenceBreakers(List?) -> void` → set breakers +- `getStopStrings() -> List` → stop strings +- `setStopStrings(List?) -> void` → set stop strings +- `getCalibration() -> AiCalibration?` → calibration +- `setCalibration(AiCalibration?) -> void` → set calibration + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCalibration` + +#### Exceptions / Errors +- No checked exceptions thrown. +- Setters perform null checks, defaulting to static defaults; no validation errors. + +#### Concurrency +- No synchronization; the class is not thread‑safe. +- Intended for single‑threaded configuration building. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..3fe0645c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,45 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:15:03Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Defines how oversized source files are handled during routing. + +#### Purpose +- Determines action when a source file exceeds the model’s context window. + +#### Type +`public enum AiOversizeStrategy` – enum, public, final, implements `java.lang.Enum`. + +#### Input +- `String value` in `fromConfig(String)` – optional config token. + +#### Output +- `AiOversizeStrategy` instance from `fromConfig`. +- `String` token from `configValue()`. + +#### Core logic +- Enum constants map to config tokens (`fail`, `sample`, `mapReduce`, `deterministic`). +- `configValue()` returns the token. +- `fromConfig(String)`: + 1. Return `DEFAULT` if `value` is `null` or blank. + 2. Trim and compare case‑insensitively against each constant’s token. + 3. Return matching constant or throw `IllegalArgumentException` if none match. + +#### Public API +- `configValue() -> String` – get config token. +- `fromConfig(String) -> AiOversizeStrategy` – parse config value. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` in `fromConfig` for unknown tokens. + +#### Concurrency +- Immutable enum; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..cd385697 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,96 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:15:06Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> A mutable configuration bean that aggregates all parameters required to run the srcmorph AI code‑generation engine, bindable from Maven, JSON/YAML, or Java code. + +#### Purpose +- Holds all runtime settings for srcmorph. +- Serves as a single source of truth for plugin, CLI, or programmatic use. + +#### Type +`public class SrcMorphConfiguration` – mutable JavaBean, Lombok `@ToString`, no generics. + +#### Input +- Constructor: no arguments, defaults applied. +- Setter methods receive values for: + - File paths (`baseDirectory`, `outputDirectory`, `modelDirectory`, `llamaModelPath`). + - Boolean flags (`force`, `planOnly`). + - Lists of strings (`subtrees`, `excludes`, `fileExtensions`, `promptDefinitions`, `aiDefinitions`, `fieldGenerations`, `factDefinitions`). + - Numeric limits (`minFileSizeBytes`, `maxFileSizeBytes`, `llamaContextSize`, `llamaMaxOutputTokens`, `llamaTemperature`, `llamaThreads`). + - Strings (`generationProvider`, `pluginVersion`, `aiVersion`, `projectName`). + +#### Output +- Getter methods expose the configured values. +- No side‑effects beyond field mutation. + +#### Core logic +- No business logic; purely stores and exposes configuration values. +- Default constants provide fallback values when fields are unset. + +#### Public API +- `getBaseDirectory() -> File` – project root. +- `setBaseDirectory(File)` – set root. +- `getOutputDirectory() -> File` – output folder. +- `setOutputDirectory(File)` – set output. +- `isForce() -> boolean` – always regenerate flag. +- `setForce(boolean)` – set flag. +- `getSubtrees() -> List` – source subdirectories. +- `setSubtrees(List)` – set subtrees. +- `getExcludes() -> List` – glob patterns to skip. +- `setExcludes(List)` – set excludes. +- `getFileExtensions() -> List` – file extensions to index. +- `setFileExtensions(List)` – set extensions. +- `getMinFileSizeBytes() -> long` – lower size bound. +- `setMinFileSizeBytes(long)` – set bound. +- `getMaxFileSizeBytes() -> long` – upper size bound. +- `setMaxFileSizeBytes(long)` – set bound. +- `isPlanOnly() -> boolean` – stop after routing plan. +- `setPlanOnly(boolean)` – set flag. +- `getGenerationProvider() -> String` – AI provider name. +- `setGenerationProvider(String)` – set provider. +- `getPromptDefinitions() -> List` – prompt templates. +- `setPromptDefinitions(List)` – set templates. +- `getAiDefinitions() -> List` – AI model configs. +- `setAiDefinitions(List)` – set models. +- `getModelDirectory() -> File` – directory for relative model paths. +- `setModelDirectory(File)` – set directory. +- `getFieldGenerations() -> List` – routing rules. +- `setFieldGenerations(List)` – set rules. +- `getFactDefinitions() -> List` – reusable fact groups. +- `setFactDefinitions(List)` – set facts. +- `getLlamaModelPath() -> String` – fallback GGUF model path. +- `setLlamaModelPath(String)` – set path. +- `getLlamaContextSize() -> int` – context window size. +- `setLlamaContextSize(int)` – set size. +- `getLlamaMaxOutputTokens() -> int` – max output tokens. +- `setLlamaMaxOutputTokens(int)` – set tokens. +- `getLlamaTemperature() -> float` – sampling temperature. +- `setLlamaTemperature(float)` – set temperature. +- `getLlamaThreads() -> int` – CPU thread count. +- `setLlamaThreads(int)` – set threads. +- `getPluginVersion() -> String` – generator version. +- `setPluginVersion(String)` – set version. +- `getAiVersion() -> String` – AI logic version. +- `setAiVersion(String)` – set version. +- `getProjectName() -> String` – project title. +- `setProjectName(String)` – set title. + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No explicit exceptions thrown; setters accept null where annotated. + +#### Concurrency +- No synchronization; intended for single‑threaded configuration assembly. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..d47822ef --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,51 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:18:03Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> A Java library that configures, validates, and orchestrates AI‑powered source‑code generation and routing for the srcmorph engine. + +#### Purpose +- Provide a unified configuration model for AI generation, file selection, and oversize handling. +- Validate condition trees and generate deterministic fact blocks for AI prompts. + +#### Responsibilities +- **Configuration Management** – `SrcMorphConfiguration` aggregates all runtime settings; `AiGenerationConfig` holds AI provider parameters. +- **Condition Evaluation** – `AiConditionEvaluator` checks file‑selection rules; `AiConditionGroup` stores child conditions. +- **Oversize Strategy** – `AiOversizeStrategy` defines actions for files exceeding context limits. +- **Fact Extraction** – `AiFactExtractor` builds a facts block summarizing regex match counts for a source file. + +#### Key units +- `SrcMorphConfiguration` – mutable bean for plugin/CLI settings. +- `AiGenerationConfig` – mutable bean for AI provider options. +- `AiConditionEvaluator` – stateless validator/evaluator of `AiCondition` trees. +- `AiConditionGroup` – container for child `AiCondition` objects. +- `AiOversizeStrategy` – enum mapping config tokens to handling strategies. +- `AiFactExtractor` – static utility that counts regex matches and formats a facts block. + +#### Data flow +1. **Configuration**: `SrcMorphConfiguration` is populated from Maven/CLI/JSON/YAML. +2. **AI Settings**: `AiGenerationConfig` is derived from the configuration and passed to the AI provider. +3. **File Selection**: For each source file, `AiConditionEvaluator` evaluates the configured `AiCondition` tree (via `AiConditionGroup`) to decide inclusion. +4. **Oversize Handling**: If a file exceeds the model’s context window, `AiOversizeStrategy` determines whether to fail, sample, map‑reduce, or deterministically truncate. +5. **Fact Generation**: When generating prompts, `AiFactExtractor` counts regex matches in the source and prepends a facts block to the AI body. + +#### Dependencies +- **Internal**: `AiSourceExcludeFilter`, `AiCondition`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`. +- **External**: `java.time`, `java.util`, `java.io`, `java.util.regex`, Lombok (`@ToString`), `org.jspecify.annotations`. + +#### Cross‑cutting +- **Stateless utilities**: `AiConditionEvaluator` and `AiFactExtractor` are thread‑safe and contain no shared mutable state. +- **Validation**: Both evaluator and fact extractor perform strict input validation, throwing `IllegalArgumentException` for malformed configurations or regexes. +- **Configuration beans**: `SrcMorphConfiguration` and `AiGenerationConfig` are plain JavaBeans with getters/setters, no business logic, and are intentionally not thread‑safe. +- **Enum immutability**: `AiOversizeStrategy` is a simple, immutable enum used for configuration parsing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..8d96b6cd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,59 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:18:17Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Enables AI‑powered source‑code generation and routing for the srcmorph engine. + +#### Purpose +- Centralize AI configuration, validation, and orchestration for source‑code transformations. +- Provide pluggable AI back‑ends (local llama.cpp, OpenAI‑compatible, mock) with prompt handling, timing, and response parsing. + +#### Responsibilities +- **Configuration & Validation** – `SrcMorphConfiguration`, `AiGenerationConfig`, `AiConditionEvaluator`, `AiFactExtractor`. +- **File Selection & Oversize Handling** – `AiConditionGroup`, `AiOversizeStrategy`. +- **AI Provider Management** – `AiGenerationProviderFactory`, `AiGenerationProvider` implementations. +- **Prompt & Response Processing** – `OpenAiCompatibleProviderSupport`, `AiCompletionParser`. +- **Local Inference** – `LlamaCppJniAiGenerationProvider`, `LlamaCppJniConfig`. + +#### Key units +- `SrcMorphConfiguration` – mutable bean for runtime settings. +- `AiGenerationConfig` – mutable bean for AI provider options. +- `AiConditionEvaluator` – stateless validator of `AiCondition` trees. +- `AiFactExtractor` – static utility for regex‑based fact blocks. +- `AiOversizeStrategy` – enum for oversize actions. +- `AiGenerationProviderFactory` – resolves provider keys to concrete providers. +- `AiGenerationProvider` (interface) – `generate`, `generateWithTimings`, `close`. +- `MockAiGenerationProvider` – test stub. +- `LlamaCppJniAiGenerationProvider` – local llama.cpp inference. +- `OpenAiCompatibleProviderSupport` – OpenAI‑compatible request builder and parser. +- `AiCompletionParser` – strips reasoning blocks from completions. +- `LlamaCppJniConfig` – immutable config for llama.cpp parameters. + +#### Data flow +1. **Configuration** – `SrcMorphConfiguration` loaded from Maven/CLI/JSON/YAML → `AiGenerationConfig`. +2. **File Selection** – `AiConditionEvaluator` evaluates `AiCondition` trees via `AiConditionGroup` to filter source files. +3. **Oversize Handling** – `AiOversizeStrategy` determines truncation or sampling for files exceeding context limits. +4. **Fact Generation** – `AiFactExtractor` counts regex matches and prepends a facts block to the prompt. +5. **Provider Selection** – `AiGenerationProviderFactory.create` selects a provider based on config keys. +6. **Prompt Construction** – provider (or `OpenAiCompatibleProviderSupport`) obtains system/user prompts via `AiPromptSupport`. +7. **Generation** – provider’s `generate` or `generateWithTimings` produces AI text (local or OpenAI). +8. **Post‑processing** – `AiCompletionParser.parseCompletion` removes internal reasoning blocks before returning the final answer. + +#### Dependencies +- **Internal** – `AiCondition`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`, `AiPromptSupport`, `AiGenerationTimings`, `AiGenerationRequest`, `LlamaCppJniConfig`. +- **External** – `java.time`, `java.util`, `java.io`, `java.util.regex`, Lombok (`@ToString`), `org.jspecify.annotations`, `net.ladenthin.llama`, `com.fasterxml.jackson`, `java.net`. + +#### Cross‑cutting +- **Stateless utilities** – `AiConditionEvaluator`, `AiFactExtractor` are thread‑safe, no shared mutable state. +- **Immutability** – `LlamaCppJniConfig`, `OpenAiCompatibleProviderSupport` are immutable and thread‑safe. +- **Error handling** – `IllegalArgumentException` for malformed configs or URLs; `IOException` for I/O or response parsing errors. +- **Timing metrics** – `AiGenerationTimings` captures prompt, cache, and prediction times; providers expose `generateWithTimings`. +- **Resource management** – `AiGenerationProvider` extends `AutoCloseable`; local provider disposes native model on `close`. +- **Configuration beans** – `SrcMorphConfiguration` and `AiGenerationConfig` are plain JavaBeans, not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..8629aad6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,49 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:15:18Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Extracts the final answer from a Gemma‑4 LLM completion by removing the leading thinking block. + +#### Purpose +- Cleans raw LLM completion text. +- Removes internal reasoning before persisting the answer. + +#### Type +`public class AiCompletionParser` – class, non‑final, annotated `@ToString`. + +#### Input +- `parseCompletion(String response)` – raw completion text, may be `null`. + +#### Output +- `String` – trimmed answer text, never `null`. +- Throws `IOException` if a thinking block starts but no closing marker appears. + +#### Core logic +- Return empty string if input is `null`. +- Trim input. +- If trimmed text does **not** start with `THINKING_BLOCK_START_MARKER`, return trimmed text. +- Otherwise: + - Extract substring after the start marker. + - Find first occurrence of `THINKING_BLOCK_END_MARKER`. + - If absent, throw `IOException` with guidance to increase token budget. + - Return substring after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` – constructor, no-op. +- `String parseCompletion(String response) throws IOException` – strip leading thinking block. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `IOException` when a thinking block starts but ends abruptly (token budget exhausted). + +#### Concurrency +- Stateless; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..402fadcf --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,50 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:15:21Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Provides a pluggable AI backend that generates text for a generation request. + +#### Purpose +- Supplies AI-generated text for source‑code transformation requests. +- Supports optional timing metrics for calibration. + +#### Type +`public interface AiGenerationProvider` – interface, extends `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest request)` – request contains prompt key, source file, source text, current header. +- `generateWithTimings(AiGenerationRequest request)` – same request. + +#### Output +- `generate` returns non‑null `String` (may be blank). +- `generateWithTimings` returns `AiGenerationTimings` with generated text and timing data. +- `close` performs no action by default. + +#### Core logic +- `generate` is abstract; implementations provide text generation. +- `generateWithTimings` delegates to `generate` and supplies zeroed timing values unless overridden. +- `close` is a no‑op default. + +#### Public API +- `generate(AiGenerationRequest) -> String` – produce text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – produce text with timings. +- `close() -> void` – close resources. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.provider.AiGenerationTimings` + +#### Exceptions / Errors +- `generate` throws `IOException` on provider failure. +- `generateWithTimings` throws `IOException` if underlying `generate` fails. +- `close` throws `IOException` (default no‑op). + +#### Concurrency +- No explicit synchronization; implementations may manage thread safety. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..77af8a18 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,57 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:15:36Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Instantiates AI generation providers based on a provider key or model configuration. + +#### Purpose +- Selects and creates an `AiGenerationProvider` implementation. +- Resolves provider key from run or model configuration. + +#### Type +`public class AiGenerationProviderFactory` – class, public, no modifiers. + +#### Input +- `String providerName` – run‑level provider key. +- `LlamaCppJniConfig llamaConfig` – model configuration, may supply its own provider key. +- `AiPromptSupport promptSupport` – prompt lookup for providers that need it. + +#### Output +- Returns a concrete `AiGenerationProvider` instance. +- Throws `IllegalArgumentException` for unknown provider keys. + +#### Core logic +- `effectiveProvider` chooses model’s provider if present; otherwise uses run provider. +- `create` trims and checks the effective key: + - Blank or null → `MockAiGenerationProvider`. + - `"mock"` → `MockAiGenerationProvider`. + - `"llamacpp-jni"` → `LlamaCppJniAiGenerationProvider`. + - `"openai-compatible"` → `OpenAiCompatibleAiGenerationProvider`. + - Else → `IllegalArgumentException`. + +#### Public API +- `AiGenerationProviderFactory()` → constructs factory. +- `static @Nullable String effectiveProvider(String runProvider, String modelProvider)` → resolves provider key. +- `AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` → creates provider. + +#### Dependencies +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `lombok.ToString` +- `MockAiGenerationProvider` +- `LlamaCppJniAiGenerationProvider` +- `OpenAiCompatibleAiGenerationProvider` +- `LlamaCppJniConfig` + +#### Exceptions / Errors +- `IllegalArgumentException` when provider key is unrecognised. + +#### Concurrency +- Stateless; thread‑safe. No shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..871c1f51 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,74 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:15:40Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Provides local AI generation using llama.cpp via JNI, loading GGUF models lazily and parsing chat responses. + +#### Purpose +- Implements `AiGenerationProvider` for local inference. +- Extracts timing metrics from chat completions. + +#### Type +`final class LlamaCppJniAiGenerationProvider implements AiGenerationProvider, AutoCloseable` +- Modifiers: `final`. +- Annotation: `@ToString`. +- No inheritance. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate(AiGenerationRequest request)` → request data. +- `generateWithTimings(AiGenerationRequest request)` → request data. +- `close()` → no input. + +#### Output +- `generate` returns `String` (generated text). +- `generateWithTimings` returns `AiGenerationTimings` (text + metrics). +- `close` returns `void`. +- `model()` caches and returns `LlamaModel`. +- `chatResponse` returns `ChatResponse`. +- Side effects: logs prompt cache reuse, warns on truncated answers, caches model. + +#### Core logic +- `model()` lazily loads GGUF model: builds `ModelParameters` from `config`, sets GPU/CPU/MOE/FFN layers, KV cache, flash attention, quantization, batch sizes, device selection, then creates `LlamaModel`. +- `generate` obtains `ChatResponse` via `chatResponse`, warns on truncation, logs cache reuse, parses first content into completion text. +- `chatResponse` calls `model().chatComplete` with inference parameters from `support`, parses full JSON response. +- `generateWithTimings` obtains `ChatResponse`, extracts text and `Timings`; if missing, returns zeroed metrics; otherwise returns metrics including promptN, cacheN, promptPerSecond, predictedN, predictedPerSecond. +- `close` disposes cached `LlamaModel` if present. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport)` → construct provider. +- `generate(AiGenerationRequest) -> String` → generate text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` → generate with metrics. +- `close() -> void` → release native resources. + +#### Dependencies +- `java.io.IOException` +- `java.util.Map` +- `java.util.Objects` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.args.FlashAttn` +- `net.ladenthin.llama.args.ReasoningFormat` +- `net.ladenthin.llama.json.ChatResponseParser` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.ChatResponse` +- `net.ladenthin.llama.value.Timings` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `generate` throws `IOException`. +- `model()` and `chatResponse` may throw unchecked runtime exceptions. +- `close` throws none. + +#### Concurrency +- Lazy initialization of `model` is not synchronized; not thread‑safe. +- No explicit synchronization or immutability guarantees. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..08df0306 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,97 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:16:26Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Builds an immutable configuration for llama.cpp JNI provider, exposing all generation and runtime knobs. + +#### Purpose +- Holds all llama.cpp JNI configuration options. +- Provides immutable access to settings for model execution. + +#### Type +`final class LlamaCppJniConfig` – immutable value type, annotated with `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. 37 private final fields. + +#### Input +- `Builder` instance supplied to private constructor. +- `Builder` receives `modelPath` (required) and optional overrides for 36 other fields, defaulted from `AiGenerationConfig.DEFAULT_*`. + +#### Output +- Immutable `LlamaCppJniConfig` instance. +- Unmodifiable views of `drySequenceBreakers` and `stopStrings`. + +#### Core logic +- Constructor copies all builder fields to final fields. +- `builder(String)` creates a new `Builder` with required `modelPath`. +- Each getter returns the corresponding field. +- `drySequenceBreakers()` and `stopStrings()` wrap lists with `Collections.unmodifiableList`. +- `Builder` initializes all fields to defaults, provides fluent setters, and `build()` creates the config. + +#### Public API +- `static Builder builder(String)` → builder with defaults +- `String modelPath()` → model file path +- `int contextSize()` → context window size +- `int maxOutputTokens()` → max output tokens +- `float temperature()` → sampling temperature +- `int threads()` → CPU threads +- `float topP()` → nucleus‑sampling threshold +- `int topK()` → top‑k limit +- `float minP()` → min‑p threshold +- `float topNSigma()` → top‑n‑sigma threshold +- `float repeatPenalty()` → repetition penalty +- `@Nullable Boolean chatTemplateEnableThinking()` → chat‑template flag +- `boolean cachePrompt()` → prompt caching enabled +- `boolean swaFull()` → full‑size SWA cache kept +- `int cacheReuse()` → KV prefix‑reuse chunk size +- `int gpuLayers()` → GPU layers offloaded +- `int seed()` → RNG seed +- `int cpuMoeLayers()` → CPU MoE layers kept +- `int cpuFfnLayers()` → CPU FFN layers kept +- `int kvUnifiedPerSlot()` → per‑slot KV cap +- `String lazyMode()` → tensor‑read laziness +- `int repeatLastN()` → repeat‑penalty window +- `String cacheTypeK()` → KV‑cache type K +- `String cacheTypeV()` → KV‑cache type V +- `boolean flashAttn()` → Flash Attention enabled +- `int batchSize()` → logical batch size +- `int ubatchSize()` → physical batch size +- `int threadsBatch()` → batch/prompt thread count +- `int mainGpu()` → primary GPU index +- `String devices()` → device selection +- `String provider()` → AI provider name +- `String remoteModel()` → remote model ID +- `String baseUrl()` → OpenAI‑compatible base URL +- `String apiKeyEnv()` → API key environment variable name +- `String reasoningEffort()` → reasoning‑effort value +- `int reasoningBudgetTokens()` → reasoning token budget +- `float dryMultiplier()` → DRY multiplier +- `float dryBase()` → DRY base +- `int dryAllowedLength()` → DRY allowed length +- `int dryPenaltyLastN()` → DRY penalty look‑back +- `List drySequenceBreakers()` → unmodifiable list +- `List stopStrings()` → unmodifiable list + +`Builder` (inner class) +- `Builder(String)` – constructor (requires `modelPath`) +- 36 fluent setters (`contextSize`, `maxOutputTokens`, `temperature`, `threads`, `topP`, `topK`, `minP`, `topNSigma`, `repeatPenalty`, `chatTemplateEnableThinking`, `cachePrompt`, `swaFull`, `cacheReuse`, `gpuLayers`, `seed`, `cpuMoeLayers`, `cpuFfnLayers`, `kvUnifiedPerSlot`, `lazyMode`, `repeatLastN`, `cacheTypeK`, `cacheTypeV`, `flashAttn`, `batchSize`, `ubatchSize`, `threadsBatch`, `mainGpu`, `devices`, `provider`, `remoteModel`, `baseUrl`, `apiKeyEnv`, `reasoningEffort`, `reasoningBudgetTokens`, `dryMultiplier`, `dryBase`, `dryAllowedLength`, `dryPenaltyLastN`, `drySequenceBreakers`, `stopStrings`) – each returns `this`. +- `LlamaCppJniConfig build()` → constructs immutable config. + +#### Dependencies +- `net.ladenthin.srcmorph.config.AiGenerationConfig` +- `net.ladenthin.srcmorph.support.ConvertToRecord` +- `org.jspecify.annotations.Nullable` +- `java.util.Collections`, `java.util.List`, `java.util.Objects` +- Lombok annotations `@EqualsAndHashCode`, `@ToString` + +#### Exceptions / Errors +- `builder(String)` throws `NullPointerException` if `modelPath` is `null`. +- `Builder` constructor uses `Objects.requireNonNull` for `modelPath`. + +#### Concurrency +- Immutable `LlamaCppJniConfig` is thread‑safe. +- `Builder` is not thread‑safe; intended for single‑thread use. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..1b54b134 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,80 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:16:34Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Builds the JSON request, endpoint, and key handling for an OpenAI‑compatible chat‑completion provider, and interprets responses and errors. + +#### Purpose +- Constructs request payload for chat‑completion calls. +- Validates and builds endpoint URLs. +- Retrieves and secures API keys. +- Parses success status and error messages. +- Calculates generation timings. + +#### Type +`final class OpenAiCompatibleProviderSupport` +class, final, no inheritance, no interfaces. + +#### Input +- `LlamaCppJniConfig config` – model URL, key env, sampling knobs. +- `AiPromptSupport promptSupport` – system/user prompt templates. +- `Function environment` – env var lookup. +- `AiGenerationRequest request` – source file and text. +- `String endpoint` – URL for key validation. +- `int status, String body` – HTTP response details. +- `String text, ChatResponse response, double seconds` – parsed completion. + +#### Output +- JSON string body (`requestBody`). +- Endpoint URL (`endpoint`). +- Optional trimmed API key (`apiKey`, `apiKeyFor`). +- Boolean success flag (`isSuccess`). +- Error message string (`errorMessage`). +- `AiGenerationTimings` object (`timings`). + +#### Core logic +- Build JSON with optional fields based on config values. +- Trim and validate base URL scheme; append `/chat/completions`. +- Resolve API key from env; return `null` if unset or blank. +- For plain `http` endpoints, allow key only if host is loopback; otherwise throw `IOException`. +- Determine loopback hosts via exact match, IPv4 regex, or IPv6 literal. +- Check 2xx status range. +- Construct error message with truncated body excerpt. +- Compute decode rate from usage tokens and elapsed seconds; prefill rate set to 0. + +#### Public API +- `requestBody(AiGenerationRequest) -> String` – build request JSON. +- `endpoint() -> String` – construct chat‑completion URL. +- `apiKey() -> @Nullable String` – fetch trimmed key. +- `apiKeyFor(String) -> @Nullable String` – secure key for endpoint. +- `isLoopbackHost(String) -> boolean` – check loopback host. +- `isSuccess(int) -> boolean` – 2xx status check. +- `errorMessage(String,int,String) -> String` – format error. +- `timings(String,ChatResponse,double) -> AiGenerationTimings` – compute timings. + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper`, `ArrayNode`, `ObjectNode` +- `java.io.IOException`, `java.net.URL` +- `java.util.List`, `java.util.Objects`, `java.util.function.Function`, `java.util.regex.Pattern` +- `lombok.ToString` +- `net.ladenthin.llama.value.ChatResponse`, `Usage` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` if `baseUrl` lacks `http(s)` scheme. +- `IOException` if API key sent over non‑loopback plain `http`. +- `IOException` if endpoint URL parsing fails. +- `IOException` from JSON serialization in `requestBody`. + +#### Concurrency +- All fields are immutable after construction; class is thread‑safe. +- No mutable shared state; no synchronization required. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..f6f743d2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,57 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:18:09Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Provides pluggable AI back‑ends for source‑code generation, including local llama.cpp inference and OpenAI‑compatible chat completions, with configurable prompts, timing metrics, and response parsing. + +#### Purpose +- Supply AI‑generated text for code transformation requests. +- Offer multiple provider implementations (mock, local, OpenAI‑compatible). + +#### Responsibilities +- **Provider selection** – `AiGenerationProviderFactory` resolves provider keys and instantiates the appropriate `AiGenerationProvider`. +- **Prompt handling** – `OpenAiCompatibleProviderSupport` builds request payloads and validates API keys. +- **Local inference** – `LlamaCppJniAiGenerationProvider` loads GGUF models via JNI, runs chat completions, and extracts timing data. +- **Response parsing** – `AiCompletionParser` strips internal reasoning blocks from raw completions. +- **Configuration** – `LlamaCppJniConfig` holds immutable settings for llama.cpp execution. + +#### Key units +- `AiGenerationProviderFactory` – resolves provider key → concrete provider. +- `AiGenerationProvider` (interface) – `generate`, `generateWithTimings`, `close`. +- `MockAiGenerationProvider` – dummy provider for testing. +- `LlamaCppJniAiGenerationProvider` – local llama.cpp inference, lazy model loading, timing extraction. +- `OpenAiCompatibleProviderSupport` – builds OpenAI‑compatible request, validates key, parses response, computes timings. +- `AiCompletionParser` – removes leading THINKING_BLOCK markers from completions. +- `LlamaCppJniConfig` – immutable builder‑style config for llama.cpp parameters. + +#### Data flow +1. **Request creation** – `AiGenerationRequest` contains prompt key, source file, text, header. +2. **Provider selection** – `AiGenerationProviderFactory.create` chooses provider based on run or model config. +3. **Prompt resolution** – provider (or support class) obtains system/user prompts via `AiPromptSupport`. +4. **Generation** – provider’s `generate` or `generateWithTimings` is invoked: + - *Local*: `LlamaCppJniAiGenerationProvider` loads model, calls `chatComplete`, parses `ChatResponse`, extracts text and timings. + - *OpenAI*: `OpenAiCompatibleProviderSupport` builds JSON, sends HTTP request, parses `ChatResponse`, computes timings. +5. **Post‑processing** – `AiCompletionParser.parseCompletion` removes any leading reasoning block before returning final answer. + +#### Dependencies +- **Internal**: `AiPromptSupport`, `AiGenerationTimings`, `AiGenerationRequest`, `LlamaCppJniConfig`. +- **External**: `net.ladenthin.llama` (model, parameters, JSON parsing), `com.fasterxml.jackson` (JSON), `java.net`, `java.io`, `lombok`. +- **Configuration**: `AiGenerationConfig` defaults used by `LlamaCppJniConfig.Builder`. + +#### Cross‑cutting +- **Immutability**: `LlamaCppJniConfig` and `OpenAiCompatibleProviderSupport` are immutable, thread‑safe. +- **Error handling**: `IOException` for I/O or malformed responses; `IllegalArgumentException` for unknown provider keys or invalid URLs. +- **Timing**: `AiGenerationTimings` captures prompt, cache, and prediction metrics; providers expose `generateWithTimings`. +- **Logging**: Providers log prompt cache reuse and truncation warnings (not shown in summaries but implied). +- **Resource management**: `AiGenerationProvider` extends `AutoCloseable`; local provider disposes native model on `close`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..ae38d17c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,49 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:17:37Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Computes a 256‑bin byte histogram of a byte stream in two OpenCL kernel passes. + +#### Purpose +- Builds a byte histogram for image or arbitrary byte data. +- Uses two‑pass reduction: per‑group partial histograms then global reduction. + +#### Type +- OpenCL C 1.2 kernels (`__kernel` functions) in `histogram.cl`. + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms to `partial`. +- `histogram_reduce`: writes final 256‑bin histogram to `histogram`. + +#### Core logic +- **histogram_partial** + 1. Zero local bin array in parallel. + 2. Each work‑item scans input in strided fashion, atomically increments local bin for each byte. + 3. After barrier, each work‑item writes its local bin values to global `partial` at offset `group_id * BINS`. +- **histogram_reduce** + 1. Each work‑item corresponds to a bin. + 2. Sums the bin value across all `group_count` partial histograms. + 3. Stores the sum in global `histogram`. + +#### Public API +- `histogram_partial(__global const uchar *input, const uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram. +- `histogram_reduce(__global const uint *partial, const uint group_count, __global uint *histogram)` – global reduction to final histogram. + +#### Constants and configuration +- `#define BINS 256` + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- None; kernels return early if bin index exceeds `BINS` in `histogram_reduce`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..24317c26 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,37 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:18:49Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes a 256‑bin byte histogram of a byte stream using two OpenCL kernel passes. + +#### Purpose +- Build a byte histogram for image or arbitrary byte data. +- Perform two‑pass reduction: per‑group partial histograms then global reduction. + +#### Responsibilities +- **Partial histogram kernel**: scans input, atomically updates per‑group local bins, writes partial results to global memory. +- **Global reduction kernel**: aggregates per‑group partial histograms into the final 256‑bin histogram. + +#### Key units +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram kernel. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – global reduction kernel. +- `#define BINS 256` – constant defining histogram size. + +#### Data flow +1. **Input**: byte stream (`uchar *input`) and its length. +2. `histogram_partial` produces `partial` array of size `group_count * BINS`. +3. `histogram_reduce` consumes `partial` and outputs final `histogram` array of 256 bins. + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Cross-cutting +- Two‑pass reduction pattern: local accumulation followed by global aggregation. +- Atomic operations for thread‑safe bin updates. +- Use of local memory (`__local`) for per‑group bin storage. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..13775ea4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,45 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:19:05Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides a reusable byte‑level histogram generator, a lock‑free ring buffer, and small shell/Python utilities for backups and sales reporting. + +#### Purpose +- Deliver GPU‑accelerated byte histograms and a lightweight circular buffer for streaming data. +- Offer simple backup and reporting scripts for operational tasks. + +#### Responsibilities +- **GPU kernels**: compute 256‑bin histograms via two‑pass OpenCL reduction. +- **Ring buffer**: single‑producer/single‑consumer byte queue with power‑of‑two sizing. +- **Scripts**: automate directory backups and aggregate CSV sales data. + +#### Key units +- **`histogram_partial` / `histogram_reduce`** – OpenCL kernels; `BINS` constant. +- **`ringbuf_t` / `ringbuf_status_t`** – core buffer struct and status enum. +- **`ringbuf_init`, `ringbuf_write`, `ringbuf_read`** – API for buffer lifecycle and I/O. +- **`rotate_backups.sh`** – Bash script for timestamped archiving and pruning. +- **`sales_report.py`** – Python module with `parse_orders`, `revenue_by_month_and_region`, and CLI `main`. + +#### Data flow +1. **Histogram**: input byte stream → `histogram_partial` (per‑group partials) → `histogram_reduce` (final 256‑bin array). +2. **Ring buffer**: `ringbuf_init` → `ringbuf_write` (producer) → `ringbuf_read` (consumer) → status queries → `ringbuf_free`. +3. **Scripts**: + - `rotate_backups.sh`: source → tar‑gz → archive → prune old → exit. + - `sales_report.py`: CSV files → `parse_orders` → `revenue_by_month_and_region` → printed report. + +#### Dependencies +- OpenCL runtime for kernels; standard C library for ring buffer; shell utilities (`tar`, `date`, etc.) for backup; Python stdlib (`argparse`, `csv`, `decimal`) for reporting. + +#### Cross-cutting +- Power‑of‑two constraint and lock‑free design in ring buffer. +- Two‑pass reduction pattern and atomic bin updates in kernels. +- Consistent error handling via status codes and non‑zero exit codes. +- Minimal logging (echo/print) and no shared code between scripts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..8c6dedf0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,49 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:18:54Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides a lock‑free, power‑of‑two sized circular buffer for byte streams, exposing a minimal API for initialization, read/write, and space queries. + +#### Purpose +- Offer a reusable, single‑producer/single‑consumer ring buffer. +- Enable efficient byte‑level buffering without dynamic resizing. + +#### Responsibilities +- **Buffer lifecycle**: allocate, initialize, free. +- **Data movement**: write to and read from the circular buffer with wrap‑around handling. +- **Space accounting**: report used bytes and available free space. +- **Error handling**: validate capacity and report allocation failures. + +#### Key units +- `ringbuf_t` – struct holding buffer pointer, capacity, head/tail indices. +- `ringbuf_status_t` enum – `RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`. +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – allocate and set up buffer. +- `ringbuf_free(ringbuf_t *rb)` – release resources. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – copy up to `len` bytes into buffer. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – copy up to `len` bytes out of buffer. +- `ringbuf_used(const ringbuf_t *rb)` – current byte count. +- `ringbuf_free_space(const ringbuf_t *rb)` – remaining capacity. + +#### Data flow +1. **Initialization** → `ringbuf_init` validates capacity (power‑of‑two), allocates memory, sets head/tail to 0. +2. **Writing** → `ringbuf_write` copies data from source into buffer, handling up to two contiguous chunks if wrap‑around occurs, updates head. +3. **Reading** → `ringbuf_read` copies data from buffer to destination, handling wrap‑around, updates tail. +4. **Status queries** → `ringbuf_used` and `ringbuf_free_space` compute metrics via bit‑mask arithmetic. +5. **Cleanup** → `ringbuf_free` releases allocated memory. + +#### Dependencies +- Standard C library: `` (`malloc`, `free`), `` (`memcpy`), ``, ``. +- Internal header `ringbuf.h` defines types and API. + +#### Cross-cutting +- **Power‑of‑two constraint**: all capacity checks enforce this rule; non‑compliant sizes return `RINGBUF_EINVAL`. +- **Lock‑free design**: single‑producer/single‑consumer assumption; no mutexes or atomic operations required. +- **Wrap‑around logic**: both read and write functions split operations into two contiguous copies when necessary. +- **Error codes**: consistent use of `ringbuf_status_t` for initialization failures; write/read return byte counts only. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..2d637559 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,61 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:17:42Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Implements a fixed‑size circular buffer with power‑of‑two capacity, providing read/write and status utilities. + +#### Purpose +- Provides a ring buffer for byte streams. +- Supports initialization, deallocation, reading, writing, and space queries. + +#### Type +- C source file implementing `ringbuf_t` operations defined in `ringbuf.h`. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_free` deallocates internal buffer. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates buffer, sets indices to 0. +- `ringbuf_free` frees buffer and resets fields. +- `ringbuf_used` computes used bytes via wrap‑around arithmetic. +- `ringbuf_free_space` calculates available space. +- `ringbuf_write` copies up to two contiguous chunks to handle wrap‑around. +- `ringbuf_read` copies up to two contiguous chunks from buffer. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free resources. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – bytes available for writing. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write data. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read data. + +#### Constants and configuration +- `RINGBUF_EINVAL` – returned when capacity not power of two. +- `RINGBUF_ENOMEM` – returned when memory allocation fails. +- `RINGBUF_OK` – successful initialization. + +#### Dependencies +- `stdlib.h` – `malloc`, `free`. +- `string.h` – `memcpy`. +- `ringbuf.h` – type and status definitions. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` for non‑power‑of‑two capacity. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if `malloc` fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..7c8a588a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,60 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:17:47Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides a fixed‑size byte ring buffer for single‑producer/single‑consumer use. + +#### Purpose +- Implements a lock‑free circular buffer. +- Supports byte‑level read/write with capacity‑checked limits. + +#### Type +- Header (`ringbuf.h`) in C. +- Defines `ringbuf_t` struct, `ringbuf_status_t` enum, and public API functions. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes (must be power of two). +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_used` and `ringbuf_free_space` return current usage metrics. + +#### Core logic +- `ringbuf_init` validates capacity, allocates `capacity` bytes, initializes head/tail to 0. +- `ringbuf_write` copies up to `len` bytes from `src` into buffer, wrapping at `capacity`, respecting free space. +- `ringbuf_read` copies up to `len` bytes from buffer into `dst`, wrapping at `capacity`, respecting used data. +- `ringbuf_used` computes `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space` computes `capacity - 1 - ringbuf_used`. +- `ringbuf_free` releases allocated memory. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free resources. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – available space. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- `` for `size_t`. +- `` for `uint8_t`. +- Standard C library functions for memory allocation (`malloc`, `free`). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..e20f9f09 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,47 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:19:00Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> A small utility bundle that creates dated backups and produces aggregated sales reports from CSV exports. + +#### Purpose +- Automate directory backups with retention policy. +- Generate monthly revenue summaries by region from order CSVs. + +#### Responsibilities +- **Backup management** – `rotate_backups.sh` handles timestamped archiving and pruning. +- **Data aggregation** – `sales_report.py` parses CSV orders, filters by currency, aggregates revenue, and outputs a tab‑separated report. + +#### Key units +- **`rotate_backups.sh`** – Bash script that creates a `.tar.gz` archive of a source directory, names it with UTC timestamp, and deletes older archives beyond a configurable keep count. +- **`sales_report.py`** – Python module exposing: + - `parse_orders(path, currency)` – yields `Order` objects for rows matching the target currency. + - `revenue_by_month_and_region(orders)` – returns a sorted mapping of `(YYYY‑MM, region)` to total revenue (`Decimal`). + - `main(argv)` – CLI entry point that orchestrates parsing, aggregation, and printing. + +#### Data flow +1. **Backup script** + - Input: source directory, backup directory, optional keep count. + - Process: validate, tar‑compress, move to final name, list and prune older archives. + - Output: new archive file, console messages, exit status. + +2. **Sales report** + - Input: list of CSV files, target currency, minimum revenue threshold. + - Process: parse each file, filter by currency, aggregate by month/region, filter by threshold. + - Output: printed report lines, exit status. + +#### Dependencies +- **`rotate_backups.sh`** – external utilities: `tar`, `date`, `du`, `ls`, `rm`, `mv`; shell built‑ins `basename`, `dirname`. +- **`sales_report.py`** – standard library: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses`, `datetime`, `decimal`. + +#### Cross-cutting +- Both units use strict error handling: non‑zero exit codes on invalid input or missing data. +- Logging is minimal, via `echo` or `print` statements. +- No shared code; each script is self‑contained. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..c019c09b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,63 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:17:55Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates a dated, compressed backup of a directory and prunes older archives to keep only the newest N. + +#### Purpose +- Generates a timestamped `.tar.gz` backup of `SOURCE_DIR` into `BACKUP_DIR`. +- Deletes older backups, retaining only the most recent `KEEP` archives. +- Intended to be run directly as a script. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- `$1` → `SOURCE_DIR` (required). +- `$2` → `BACKUP_DIR` (required). +- `$3` → `KEEP` (optional, defaults to `7`). +- Validates `KEEP` is a positive integer. +- Checks `SOURCE_DIR` exists; creates `BACKUP_DIR` if missing. + +#### Output +- Creates file `"$BACKUP_DIR/${name}_.tar.gz"`. +- Prints creation message with size. +- Removes older archives beyond `KEEP`; prints each removal. +- Exit status `0` on success, `2` on invalid input or missing directory. + +#### Core logic +- Validate arguments and `KEEP`. +- Ensure source directory exists; create backup directory. +- Build archive name with UTC timestamp. +- Create temporary archive `"$tmp"`. +- `tar -C "$(dirname "$SOURCE_DIR")" -czf "$tmp" "$name"`. +- Move temporary to final archive. +- List archives sorted newest first. +- Delete all but the first `KEEP` entries. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR`=`"${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR`=`"${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP`=`"${3:-7}"` +- `name`=`"$(basename "$SOURCE_DIR")"` +- `archive`=`"$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp`=`"$archive.partial"` + +#### Dependencies +- External commands: `tar`, `date`, `du`, `ls`, `rm`, `mv`. +- Utilities: `basename`, `dirname`, `cut`. + +#### Errors and exit codes +- `exit 2` if `KEEP` not a positive integer. +- `exit 2` if `SOURCE_DIR` does not exist. +- `trap` ensures temporary file `$tmp` is removed on exit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..6b87cd3f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,60 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:17:59Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Generates a monthly sales report from CSV order exports, aggregating revenue by month and region in a specified currency. + +#### Purpose +- Aggregates order revenue per month and region. +- Filters by currency and minimum revenue threshold. + +#### Type +- Python script (`sales_report.py`). + +#### Input +- `csv_files`: list of CSV file paths (positional arguments). +- `--currency`: target currency code (default `EUR`). +- `--min-revenue`: minimum revenue to display (default `0`). +- CSV columns: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints tab‑separated lines: `monthregionrevenue currency`. +- Exits with code `0` on success, `1` if no orders found. + +#### Core logic +- `parse_orders(path, currency)`: + - Opens CSV, validates required columns. + - Skips rows with non‑matching currency. + - Yields `Order(order_date, region, amount)`; raises `ValueError` on parse errors. +- `revenue_by_month_and_region(orders)`: + - Sums `amount` per `(YYYY-MM, region)` key using `defaultdict(Decimal)`. + - Returns sorted dictionary of totals. +- `main(argv)`: + - Parses CLI arguments. + - Collects all orders from provided files. + - If none, prints error and exits with `1`. + - Iterates over aggregated totals, prints entries meeting `min_revenue`. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` + Parses CSV, yields orders in specified currency. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` + Aggregates revenue by month and region. +- `main(argv=None) -> int` + Entry point; processes CLI, outputs report. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` if CSV missing required columns or contains invalid data. +- `ValueError` propagated from `parse_orders` for malformed rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..bb620927 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,71 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:19:33Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A unified framework that orchestrates AI‑driven source‑code transformations, provides low‑level GPU utilities, and supplies a multi‑domain SQL persistence layer for cataloging, e‑commerce, and inventory management. + +#### Purpose +- Central AI orchestration for source‑code generation and routing. +- GPU‑accelerated byte‑level histogram and lock‑free ring buffer utilities. +- SQL data layer for library, shop, and warehouse domains. + +#### Responsibilities +- **AI Engine** – configuration, validation, provider selection, prompt construction, response parsing, and timing. +- **GPU & Buffer** – compute 256‑bin histograms, manage a single‑producer/single‑consumer ring buffer. +- **SQL Layer** – enforce business rules, audit trails, and reporting for library lending, online orders, and warehouse stock. + +#### Key units +- **Java** + - `SrcMorphConfiguration` – runtime settings bean. + - `AiGenerationConfig` – AI provider options. + - `AiConditionEvaluator` – stateless tree validator. + - `AiFactExtractor` – regex‑based fact counter. + - `AiOversizeStrategy` – enum for context‑limit handling. + - `AiGenerationProviderFactory` – resolves provider keys. + - `AiGenerationProvider` interface (`generate`, `generateWithTimings`, `close`). + - `MockAiGenerationProvider` – test stub. + - `LlamaCppJniAiGenerationProvider` – local llama.cpp inference. + - `OpenAiCompatibleProviderSupport` – request builder & parser. + - `AiCompletionParser` – strips reasoning blocks. + - `LlamaCppJniConfig` – immutable llama.cpp parameters. +- **Other (C/OpenCL)** + - `histogram_partial`, `histogram_reduce` – OpenCL kernels for 256‑bin histograms. + - `ringbuf_t`, `ringbuf_status_t` – core buffer struct & status. + - `ringbuf_init`, `ringbuf_write`, `ringbuf_read` – API. + - `rotate_backups.sh` – backup rotation script. + - `sales_report.py` – CSV sales aggregation. +- **SQL** + - **Library** – tables `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`; functions `fn_checkout_book`, `sp_return_book`, `fn_late_fee`; trigger `trg_loan_audit_fn`; views `overdue_loans`, `member_loan_stats`, `popular_books`. + - **Shop** – tables `product`, `customer_order`, `order_item`; procedure `add_order_item`. + - **Warehouse** – tables `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`; procedure `dbo.usp_SyncStock`. + +#### Data flow +1. **AI Pipeline** – configuration → file selection via `AiConditionEvaluator` → oversize handling → fact block prep → provider selection → prompt construction → generation → post‑processing. +2. **Histogram** – byte stream → `histogram_partial` → `histogram_reduce` → 256‑bin array. +3. **Ring Buffer** – `ringbuf_init` → `ringbuf_write` (producer) → `ringbuf_read` (consumer) → status checks. +4. **SQL Operations** – + - Library: checkout → `fn_checkout_book` → audit; return → `sp_return_book`. + - Shop: `add_order_item` locks product, updates stock, recalculates order total. + - Warehouse: `usp_SyncStock` merges feed into `StockLevel`, logs in `SyncLog`. + +#### Dependencies +- **Internal** – AI domain types (`AiCondition`, `AiPromptDefinition`, etc.), ring buffer structs, OpenCL kernels. +- **External** – Java standard libraries, Lombok, Jackson, llama.cpp JNI, OpenAI API, PostgreSQL/MySQL/SQL Server built‑ins, OpenCL runtime, shell utilities, Python stdlib. + +#### Cross‑cutting +- Stateless, thread‑safe utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Immutable configuration objects (`LlamaCppJniConfig`, `OpenAiCompatibleProviderSupport`). +- Unified error handling: `IllegalArgumentException` for config issues, `IOException` for I/O/response errors. +- Timing metrics via `AiGenerationTimings`. +- Resource cleanup: `AiGenerationProvider` implements `AutoCloseable`. +- Ring buffer lock‑free design with power‑of‑two sizing. +- Consistent status codes in C utilities and non‑zero exit codes in scripts. +- SQL integrity: primary keys, foreign keys, unique constraints, audit triggers, and transactional procedures. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..0c67e8e0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: DF0455B2 +- D: 2026-11-04T07:09:59Z +- T: 2026-11-04T07:19:43Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard framework orchestrates AI‑powered source‑code transformations through a Java engine that validates, configures, and routes generation requests, while pluggable provider modules supply local llama.cpp or OpenAI‑compatible back‑ends with prompt tuning and timing metrics. Low‑level GPU utilities, such as two‑pass OpenCL kernels for byte‑level histograms and a lock‑free ring buffer, support efficient data handling for backup and sales reporting scripts. A unified multi‑domain SQL persistence layer spans library cataloging, e‑commerce orders, and warehouse inventory, with dedicated schemas and stored procedures for shop, warehouse, and lending rules, enabling end‑to‑end cataloging, order processing, and inventory synchronization. + +#### Packages +- java/config — A Java library that configures, validates, and orchestrates AI‑powered source‑code generation and routing for the srcmorph engine. +- java — Enables AI‑powered source‑code generation and routing for the srcmorph engine. +- java/provider — Provides pluggable AI back‑ends for source‑code generation, including local llama.cpp inference and OpenAI‑compatible chat completions, with configurable prompts, timing metrics, and response parsing. +- other/kernels — Computes a 256‑bin byte histogram of a byte stream using two OpenCL kernel passes. +- other — Provides a reusable byte‑level histogram generator, a lock‑free ring buffer, and small shell/Python utilities for backups and sales reporting. +- other/ringbuf — Provides a lock‑free, power‑of‑two sized circular buffer for byte streams, exposing a minimal API for initialization, read/write, and space queries. +- other/scripts — A small utility bundle that creates dated backups and produces aggregated sales reports from CSV exports. +- . — A unified framework that orchestrates AI‑driven source‑code transformations, provides low‑level GPU utilities, and supplies a multi‑domain SQL persistence layer for cataloging, e‑commerce, and inventory management. +- sql/library — A PostgreSQL library system that stores catalog, member, and loan data, enforces lending rules, tracks overdue status, and supports branch‑level copy management. +- sql — A PostgreSQL‑, MySQL‑, and SQL Server‑based data layer that manages library cataloging, e‑commerce orders, and warehouse inventory, each with its own set of tables, stored procedures, and reporting views. +- sql/shop — Provides the database schema and stored procedure for a web shop’s product catalog, orders, and order line items, handling stock reservation and order total calculation. +- sql/warehouse — Keeps warehouse inventory in sync with nightly supplier feeds and records each sync run. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..117843aa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,73 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:16:44Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Defines the core tables for a library system: authors, books, members, and loans, with constraints and indexes. + +#### Purpose +- Stores library catalog and member data. +- Tracks book loans and availability. + +#### Type +- Table: `author` +- Table: `book` +- Table: `member` +- Table: `loan` +- Index: `idx_book_author` +- Index: `idx_loan_member` +- Index: `idx_loan_open` + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author (author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `member_id BIGINT NOT NULL REFERENCES member (member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` +- **Indexes** + - `idx_book_author` on `book (author_id)` + - `idx_loan_member` on `loan (member_id)` + - `idx_loan_open` on `loan (due_on)` WHERE `returned_on IS NULL` + +#### Reads +- `book.author_id` referenced by `loan.book_id`. +- `member.member_id` referenced by `loan.member_id`. + +#### Writes +- Inserts/updates/deletes on `author`, `book`, `member`, `loan`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- `author`, `book`, `member`, `loan` tables referenced by foreign keys and indexes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..68b1ba76 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,60 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:16:49Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> A set of reporting views and a materialized view for a library system, summarizing overdue loans, member loan statistics, and popular books. + +#### Purpose +- Provide read‑only reports on loan status and book popularity. +- Enable quick access to overdue loan details, member activity, and recent popular books. + +#### Type +- PostgreSQL views: `overdue_loans`, `member_loan_stats`. +- PostgreSQL materialized view: `popular_books`. +- PostgreSQL index: `idx_popular_books_id`. + +#### Schema +- **overdue_loans** + - `loan_id` integer + - `member_id` integer + - `email` text + - `title` text + - `due_on` date + - `days_overdue` integer +- **member_loan_stats** + - `member_id` integer + - `full_name` text + - `loans_total` bigint + - `loans_open` bigint + - `last_loan_on` timestamp +- **popular_books** + - `book_id` integer + - `title` text + - `author_name` text + - `times_loaned` bigint +- **idx_popular_books_id** + - Unique index on `popular_books(book_id)`. + +#### Reads +- `overdue_loans`: reads from `loan`, `member`, `book`. +- `member_loan_stats`: reads from `member`, `loan`. +- `popular_books`: reads from `loan`, `book`, `author`. + +#### Writes +- None (views and materialized view are read‑only; index creation does not write data). + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. +- Views: none. +- Functions: none. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..b0899996 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,69 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:16:53Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Handles book lending, returns, late fee calculation, and audit trail for a library system. + +#### Purpose +- Records loan events and enforces business rules for checkout and return. +- Calculates late fees. +- Maintains audit trail of loan actions. + +#### Type +- Table: `loan_audit` (PostgreSQL). +- Function: `fn_checkout_book` (plpgsql), `fn_late_fee` (sql), `trg_loan_audit_fn` (plpgsql trigger function). +- Procedure: `sp_return_book` (plpgsql). +- Trigger: `trg_loan_audit` (AFTER INSERT OR UPDATE OF returned_on ON loan). + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member` (SELECT for block status). +- `book` (SELECT for free copies). +- `loan` (SELECT for returned_on status in `sp_return_book`). +- `loan` (SELECT for audit trigger). + +#### Writes +- `book` (UPDATE copies_free decrement on checkout; increment on return). +- `loan` (INSERT new loan in `fn_checkout_book`; UPDATE returned_on in `sp_return_book`). +- `loan_audit` (INSERT on checkout and return via trigger). + +#### Relationships +- `loan_audit.loan_id -> loan.loan_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Reject if member blocked. + - Decrement `book.copies_free`; error if none. + - INSERT into `loan` with due date; RETURN new `loan_id`. + +- **sp_return_book(p_loan_id)** + - UPDATE `loan` set `returned_on` to today; capture `book_id`. + - If no row updated, error. + - Increment `book.copies_free`. + +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Multiply by 50, cap at 2000. + +- **trg_loan_audit_fn()** + - On INSERT: log `CHECKOUT`. + - On UPDATE where `returned_on` changes from NULL to non‑NULL: log `RETURN`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Functions: `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `trg_loan_audit_fn`. +- Trigger: `trg_loan_audit`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..0001240d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,69 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:17:11Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds library branches, creates a book_copy table per branch, and updates loan and member tables to reference copies and branches. + +#### Purpose +- Introduces branch hierarchy for a lending library. +- Normalizes book copies to a dedicated table with branch association. +- Updates member and loan schemas to reflect branch data. + +#### Type +- Table: `branch` +- Table: `book_copy` +- Table: `loan` (altered) +- Table: `member` (altered) +- Index: `idx_book_copy_book` + +#### Schema +- **branch** + - `branch_id SMALLSERIAL PRIMARY KEY` + - `name VARCHAR(100) NOT NULL UNIQUE` + - `city VARCHAR(100) NOT NULL` +- **book_copy** + - `copy_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book(book_id)` + - `branch_id SMALLINT NOT NULL REFERENCES branch(branch_id)` + - `barcode VARCHAR(32) NOT NULL UNIQUE` + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE','ON_LOAN','LOST'))` +- **loan** + - `copy_id BIGINT REFERENCES book_copy(copy_id)` (new column) +- **member** + - `member_since TIMESTAMP` (renamed from `joined_on`) + - `home_branch_id SMALLINT REFERENCES branch(branch_id)` (new column) + +- **idx_book_copy_book** + - `book_copy` on `book_id` + +#### Reads +- `book` (SELECT in INSERT into `book_copy`) +- `branch` (INSERT into `branch`) + +#### Writes +- `branch`: 1 row (`INSERT INTO branch VALUES ('Main','Springfield')`) +- `book_copy`: 1 INSERT statement generating `b.copies_total` rows per book (family: `INSERT INTO book_copy ... SELECT ... FROM book ... CROSS JOIN LATERAL generate_series(...)`) +- `loan`: 1 column added (no data written) +- `member`: 1 column added and updated (`UPDATE member SET home_branch_id = 1 WHERE home_branch_id IS NULL`) + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- Table `book` (referenced by `book_copy` and in INSERT SELECT) +- Table `loan` (altered) +- Table `member` (altered) +- Table `branch` (created and referenced) +- Table `book_copy` (created and referenced) + +#### Routine logic +- None (only DDL and data manipulation statements). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..a59de276 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,23 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:17:16Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Seeds initial data for a lending library: authors, books, members, and loan records. + +#### Type +Data insertion (INSERT statements) into tables: `author`, `book`, `member`, `loan`. PostgreSQL dialect. + +#### Writes +- `author`: 15 rows +- `book`: 150 rows +- `member`: 150 rows +- `loan`: 150 rows + +#### Dependencies +None beyond the target tables. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..38c00362 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,55 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:19:12Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL library system that stores catalog, member, and loan data, enforces lending rules, tracks overdue status, and supports branch‑level copy management. + +#### Purpose +- Persist core library entities (authors, books, members, loans). +- Enforce checkout/return business logic and audit trail. +- Provide reporting views for overdue loans, member activity, and popular books. +- Support multi‑branch operations with dedicated book copies. + +#### Responsibilities +- **Data Modeling** – tables for authors, books, members, loans, and later branches and book copies. +- **Business Logic** – functions and procedures for checkout, return, late fee calculation, and audit logging. +- **Reporting** – read‑only views and a materialized view summarizing overdue loans, member statistics, and popular books. +- **Migration & Seeding** – scripts to evolve schema to branch‑aware design and populate initial data. + +#### Key units +- `author`, `book`, `member`, `loan` tables – core catalog and patron data. +- `branch`, `book_copy` tables – branch hierarchy and copy tracking. +- `loan_audit` table – audit trail of checkout/return actions. +- `fn_checkout_book(p_member_id, p_book_id, p_days)` – checkout logic. +- `sp_return_book(p_loan_id)` – return logic. +- `fn_late_fee(p_due_on, p_returned_on)` – late fee calculation. +- `trg_loan_audit_fn()` – trigger function logging audit events. +- `overdue_loans`, `member_loan_stats`, `popular_books` views – reporting surfaces. + +#### Data flow +1. **Checkout**: `fn_checkout_book` checks member status, decrements `book.copies_free`, inserts a `loan`, and triggers `loan_audit` with action `CHECKOUT`. +2. **Return**: `sp_return_book` updates `loan.returned_on`, increments `book.copies_free`, and triggers `loan_audit` with action `RETURN`. +3. **Late fee**: `fn_late_fee` is called by application logic (or could be used in reports) to compute fees based on due and return dates. +4. **Reporting**: Views aggregate data from `loan`, `member`, `book`, `author`, and `book_copy` to expose overdue loans, member loan stats, and popular books. +5. **Branch migration**: `04_migration_v2.sql` introduces `branch` and `book_copy`, linking loans to specific copies and members to a home branch. + +#### Dependencies +- Internal: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. +- External: PostgreSQL built‑in functions (`now()`, `CURRENT_DATE`), standard SQL constraints and indexes. +- Views depend on the base tables and foreign key relationships. + +#### Cross-cutting +- **Constraints & Indexes**: Enforce data integrity (e.g., `copies_free <= copies_total`, `due_on > loaned_on`) and performance (`idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_book_copy_book`, `idx_popular_books_id`). +- **Error handling**: Functions raise errors when business rules are violated (e.g., blocked member, no free copies). +- **Audit trail**: Trigger `trg_loan_audit` ensures every checkout and return is logged in `loan_audit`. +- **Branch normalization**: Migration splits copies into `book_copy` with status and barcode, linking loans to specific copies and members to a home branch. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..b102d315 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,43 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:19:28Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A PostgreSQL‑, MySQL‑, and SQL Server‑based data layer that manages library cataloging, e‑commerce orders, and warehouse inventory, each with its own set of tables, stored procedures, and reporting views. + +#### Purpose +- Persist and enforce business rules for library lending, online shop orders, and warehouse stock. +- Provide audit trails, reporting, and data integrity across three distinct domains. + +#### Responsibilities +- **Library** – catalog, member, loan lifecycle, branch‑level copy tracking, overdue reporting. +- **Shop** – product catalog, order processing, stock reservation, total calculation. +- **Warehouse** – nightly supplier feed ingestion, inventory reconciliation, sync logging. + +#### Key units +- **Library**: `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`; functions `fn_checkout_book`, `sp_return_book`, `fn_late_fee`; trigger `trg_loan_audit_fn`; views `overdue_loans`, `member_loan_stats`, `popular_books`. +- **Shop**: tables `product`, `customer_order`, `order_item`; procedure `add_order_item`. +- **Warehouse**: tables `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`; procedure `dbo.usp_SyncStock`. + +#### Data flow +- **Library**: checkout → `fn_checkout_book` → loan record + audit; return → `sp_return_book` → update loan + audit; reporting views aggregate loan, member, and book data. +- **Shop**: `add_order_item` locks product, validates stock, inserts/updates `order_item`, decrements `product.stock`, recalculates `customer_order.total_cents`. +- **Warehouse**: `usp_SyncStock` aggregates new feed rows, merges into `StockLevel`, counts inserts/updates, logs summary in `SyncLog`. + +#### Dependencies +- Internal cross‑module: foreign keys among core tables (e.g., `loan.member_id → member.id`, `order_item.product_sku → product.sku`). +- External: PostgreSQL built‑ins (`now()`, `CURRENT_DATE`), MySQL ENUM, AUTO_INCREMENT, SQL Server `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. +- Shared constraints and indexes enforce data integrity and performance across all packages. + +#### Cross-cutting +- **Integrity & Constraints**: primary keys, foreign keys, unique SKU, stock limits, due date checks. +- **Audit & Logging**: library audit trigger, warehouse sync log, error handling via exceptions or error messages. +- **Concurrency**: shop procedure uses `FOR UPDATE`; warehouse merge runs in a single transaction. +- **Reporting**: library read‑only views and materialized view; shop totals recalculated on each item addition; warehouse sync log provides operational metrics. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..ef461cf6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,69 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:17:19Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Handles product catalog, customer orders, and order line items for a web shop, including stock reservation and order total calculation. + +#### Purpose +- Stores products, orders, and order line items. +- Provides a stored procedure to add an item to an order, reserve stock, and recalculate the order total. + +#### Type +- Table: `product` (MySQL 8) +- Table: `customer_order` (MySQL 8) +- Table: `order_item` (MySQL 8) +- Procedure: `add_order_item` (MySQL 8) + +#### Schema +- **product** + - `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `sku VARCHAR(40) NOT NULL` UNIQUE `uk_product_sku` + - `name VARCHAR(200) NOT NULL` + - `price_cents INT UNSIGNED NOT NULL` + - `stock INT NOT NULL DEFAULT 0` +- **customer_order** + - `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `customer_id BIGINT UNSIGNED NOT NULL` + - `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW'` + - `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` + - `total_cents INT UNSIGNED NOT NULL DEFAULT 0` + - Index `idx_order_customer` on `(customer_id, created_at)` +- **order_item** + - `order_id BIGINT UNSIGNED NOT NULL` + - `product_id INT UNSIGNED NOT NULL` + - `quantity SMALLINT UNSIGNED NOT NULL` + - `unit_price_cents INT UNSIGNED NOT NULL` + - PK `(order_id, product_id)` + - FK `fk_item_order` references `customer_order(order_id)` ON DELETE CASCADE + - FK `fk_item_product` references `product(product_id)` + +#### Reads +- `product` (SELECT product_id, price_cents WHERE sku = p_sku AND stock >= p_qty FOR UPDATE) +- `order_item` (SELECT SUM(quantity * unit_price_cents) WHERE order_id = p_order_id) + +#### Writes +- `order_item` (INSERT ... ON DUPLICATE KEY UPDATE quantity = quantity + p_qty) – 1 row per call +- `product` (UPDATE stock = stock - p_qty WHERE product_id = v_product_id) – 1 row +- `customer_order` (UPDATE total_cents = (SELECT SUM(...)) WHERE order_id = p_order_id) – 1 row + +#### Relationships +- `order_item.order_id` → `customer_order.order_id` (FK `fk_item_order`) +- `order_item.product_id` → `product.product_id` (FK `fk_item_product`) + +#### Routine logic +- Parameters: `p_order_id BIGINT UNSIGNED`, `p_sku VARCHAR(40)`, `p_qty SMALLINT UNSIGNED` +- Lookup product by SKU with sufficient stock (`FOR UPDATE`). +- If not found, raise error `'unknown SKU or not enough stock'`. +- Insert or update `order_item` quantity. +- Decrement `product.stock` by `p_qty`. +- Recalculate `customer_order.total_cents` from all items of the order. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item` +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..32327222 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,42 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:19:20Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Provides the database schema and stored procedure for a web shop’s product catalog, orders, and order line items, handling stock reservation and order total calculation. + +#### Purpose +- Persist products, customer orders, and order line items. +- Offer a stored procedure to add items to orders, reserve stock, and update totals. + +#### Responsibilities +- **Data storage**: tables for products, orders, and items. +- **Business logic**: `add_order_item` procedure that validates stock, updates quantities, reserves inventory, and recalculates order totals. +- **Integrity enforcement**: foreign keys, unique SKU constraint, and status enumeration. + +#### Key units +- **Table `product`** – holds SKU, name, price, and stock. +- **Table `customer_order`** – tracks order status, timestamps, and total amount. +- **Table `order_item`** – links orders to products with quantity and unit price. +- **Procedure `add_order_item`** – core routine for adding items to an order and managing stock. + +#### Data flow +1. Caller supplies `p_order_id`, `p_sku`, `p_qty`. +2. Procedure locks the product row (`FOR UPDATE`), checks stock. +3. Inserts or updates `order_item` with new quantity. +4. Decrements `product.stock` by `p_qty`. +5. Recalculates `customer_order.total_cents` from all items. + +#### Dependencies +- Internal: `product`, `customer_order`, `order_item` tables. +- No external functions or sequences; relies on MySQL 8 features (ENUM, AUTO_INCREMENT, `FOR UPDATE`). + +#### Cross-cutting +- **Concurrency**: uses row‑level locking (`FOR UPDATE`) to prevent race conditions on stock. +- **Error handling**: raises a single error when SKU is unknown or stock is insufficient. +- **Indexing**: `idx_order_customer` on `(customer_id, created_at)` for order retrieval; primary keys enforce uniqueness. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..d3ca94d5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,44 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:19:24Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Keeps warehouse inventory in sync with nightly supplier feeds and records each sync run. + +#### Purpose +- Aggregate supplier feed quantities into the warehouse inventory. +- Persist a log of each sync operation. + +#### Responsibilities +- **Data ingestion** – read `dbo.SupplierFeed` rows since a given timestamp. +- **Inventory update** – merge aggregated quantities into `dbo.StockLevel`. +- **Audit trail** – write a summary record to `dbo.SyncLog`. + +#### Key units +- **dbo.usp_SyncStock(@Since DATETIME2(0))** – T‑SQL procedure that performs the nightly sync. +- **dbo.StockLevel** – target table holding current on‑hand quantities per warehouse and SKU. +- **dbo.SupplierFeed** – source table containing raw feed rows. +- **dbo.SyncLog** – log table capturing start time, rows inserted/updated, and any error message. + +#### Data flow +1. `usp_SyncStock` receives a `@Since` timestamp. +2. It aggregates `SupplierFeed` rows received after `@Since` by `WarehouseId` and `Sku`. +3. A `MERGE` statement updates existing `StockLevel` rows (incrementing `OnHand`) or inserts new rows. +4. The merge’s output is captured to count inserts and updates. +5. A single row is inserted into `SyncLog` with the counts and any error message. +6. Transaction is committed; on failure, rollback and log the error. + +#### Dependencies +- **Internal** – `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. +- **SQL Server functions** – `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. +- **Transaction control** – `BEGIN TRANSACTION`, `COMMIT`, `ROLLBACK`. + +#### Cross-cutting +- All operations run within a single transaction to ensure atomicity. +- Error handling captures `ERROR_MESSAGE()` and records it in `SyncLog`. +- Timestamps use UTC (`SYSUTCDATETIME()`) for consistency across feeds. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..bf05bafb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run1/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,75 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:17:26Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Synchronises nightly stock levels from a supplier feed into the warehouse inventory and records the operation outcome. + +#### Purpose +- Updates `dbo.StockLevel` with aggregated supplier feed quantities. +- Logs each sync run in `dbo.SyncLog`. + +#### Type +- Table: `dbo.StockLevel` +- Table: `dbo.SupplierFeed` +- Table: `dbo.SyncLog` +- Procedure: `dbo.usp_SyncStock` (T‑SQL, SQL Server) + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT 0` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT SYSUTCDATETIME()` + - PK: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + - PK: `PK_SupplierFeed (FeedRowId)` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + - PK: `PK_SyncLog (SyncLogId)` + +#### Reads +- `dbo.SupplierFeed` (columns: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`) +- `dbo.StockLevel` (columns: `WarehouseId`, `Sku`, `OnHand`) + +#### Writes +- `dbo.StockLevel`: `MERGE` updates or inserts aggregated rows. +- `dbo.SyncLog`: one row per sync run; `RowsInserted` and `RowsUpdated` derived from merge output. + +#### Relationships +- None defined via foreign keys; logical join in `MERGE`: + - `dbo.StockLevel.WarehouseId, Sku -> dbo.SupplierFeed.WarehouseId, Sku` + +#### Routine logic +- **dbo.usp_SyncStock(@Since DATETIME2(0))** + - Start transaction. + - Aggregate `SupplierFeed` rows received since `@Since` by `WarehouseId, Sku`. + - `MERGE` into `StockLevel`: + - `WHEN MATCHED`: increment `OnHand` by aggregated `Quantity`, update `UpdatedAt`. + - `WHEN NOT MATCHED BY TARGET`: insert new row with `OnHand = Quantity`. + - Capture merge actions (`INSERT`/`UPDATE`) into table variable `@Changes`. + - Insert a log row into `SyncLog` with counts of inserts and updates. + - Commit; on error rollback and log error message. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()` +- Transaction control: `BEGIN TRANSACTION`, `COMMIT`, `ROLLBACK` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/meta/gpt-6-luna.json new file mode 100644 index 00000000..72c5f054 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/meta/gpt-6-luna.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:27:53Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 195.5, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 86.2, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.8, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:32:38Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 83203, + "cachedPromptTokens": 83131, + "completionTokens": 19148, + "seconds": 194.7409556 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.010413, + "costUsd": 0.016911, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/meta/gpt-oss-20b.json new file mode 100644 index 00000000..67ef4902 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/meta/gpt-oss-20b.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:32:38Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 99.3, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 60.4, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.3, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:35:20Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 84739, + "cachedPromptTokens": 36864, + "completionTokens": 16397, + "seconds": 98.5947779 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.004674, + "costUsd": 0.003527, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..a06cfc39 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,57 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:27:54Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> File indexing conditions select source files by extension, size, line count, modification time, and relative-path glob, with nested AND/OR/NOT logic. + +#### Purpose +- Evaluates `AiCondition` trees against file facts in `AiFileContext`. +- Validates condition configuration and detects whether line counts are required. + +#### Type +- `public final class AiConditionEvaluator` — class; no superclass or interfaces. + +#### Input +- `AiCondition` tree nodes and their branch values: combinators, extensions, size/line ranges, modification timestamps, and path glob. +- `AiFileContext` facts: file name, size in bytes, line count, last-modified epoch milliseconds, and relative path. + +#### Output +- `matches(...)` returns whether a file satisfies a condition. +- `validate(...)` throws on invalid configuration. +- `usesLines(...)` returns whether a tree contains a line-count condition. +- No persistent state or resource writes. + +#### Core logic +- Evaluates `and` children with all-match semantics, `or` children with any-match semantics, and `not` by negating its child. +- Evaluates leaves by filename suffix, size/line range containment, strict timestamp comparison, or relative-path glob matching. +- Validates that each node sets exactly one of nine branch/leaf fields; recursively validates combinator children. +- Requires nonempty `and`/`or` groups and extension lists; requires size/line bounds; rejects blank path globs. +- Parses modification timestamps as ISO-8601 instants and converts them to epoch milliseconds. +- Recursively checks `and`, `or`, and `not` trees to find line-count conditions. +- Delegates glob matching to `AiSourceExcludeFilter`. + +#### Public API +- `AiConditionEvaluator()` -> constructs evaluator. +- `matches(AiCondition, AiFileContext) -> boolean` — evaluates file condition. +- `validate(AiCondition) -> void` — validates condition tree. +- `usesLines(AiCondition) -> boolean` — detects line-count requirements. + +#### Dependencies +- `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext` +- `AiSourceExcludeFilter` +- `Instant`, `DateTimeParseException`, `Collections`, `List` +- `@Nullable` + +#### Exceptions / Errors +- `validate(...)` throws `IllegalArgumentException` for nodes with other than one branch, empty groups/extensions, unbounded ranges, blank globs, or invalid timestamps. +- Invalid timestamp errors wrap `DateTimeParseException`. +- `matches(...)` throws `IllegalStateException` if no branch is set; it assumes prior validation. + +#### Concurrency +- Stateless evaluator; no synchronization or mutable instance fields. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..d0f1d466 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,42 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:28:01Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Groups child AI conditions for Maven-configured `` and `` condition combinators. + +#### Purpose +- Holds the child `AiCondition` entries used as the body of an AI condition combinator. +- Supports Maven binding through a `conditions` collection field. + +#### Type +- `public class AiConditionGroup` — class; annotated with Lombok `@ToString`. + +#### Input +- `setConditions(Collection)` accepts a nullable collection of child conditions. + +#### Output +- `getConditions()` returns the nullable child-condition list. +- `setConditions(...)` stores a defensive `ArrayList` copy, or `null`. + +#### Core logic +- Stores child conditions in a nullable `List` named `conditions`. +- Copies configured collections to support Maven’s `…` binding. + +#### Public API +- `AiConditionGroup()` → `void` — creates an empty group. +- `getConditions()` → `@Nullable List` — returns child conditions. +- `setConditions(Collection)` → `void` — replaces child conditions. + +#### Dependencies +- `AiCondition` +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..cca4ce0d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,58 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:28:05Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Produces exact whole-source regex counts for configured facts, formatted for inclusion alongside AI-generated summaries. + +#### Purpose +- `AiFactExtractor` builds a deterministic facts block from `AiFactCounter` labels and regex patterns. +- Validates configured counters and patterns before use. + +#### Type +- `public final class AiFactExtractor` — final utility class; not instantiable. +- No notable type annotations. + +#### Input +- `factsBlock(counters, source)` receives a nullable list of `AiFactCounter` values and full source text. +- `validate(counters)` receives a nullable list of `AiFactCounter` values. + +#### Output +- `factsBlock` returns formatted `String`, or `""` if counters are null, empty, or contribute no entries. +- Public constants define the facts header and output separators. + +#### Core logic +- `factsBlock` skips null counters and counters with null labels or patterns. +- For each remaining counter, counts non-overlapping regex matches across the full source. +- Formats entries as `label: count`, separated by `; `; wraps them with the facts header and trailing blank line. +- `validate` checks non-null counters for a label, pattern, and compilable regex. +- `countMatches` compiles each regex and increments a count for every `Matcher.find()` match. + +#### Public API +- `FACTS_HEADER` — facts block header. +- `LABEL_COUNT_SEPARATOR` — label/count separator. +- `ENTRY_SEPARATOR` — facts entry separator. +- `FACTS_SUFFIX` — trailing blank line. +- `factsBlock(List, String) -> String` — builds exact facts block. +- `validate(List) -> void` — validates counters and regex patterns. + +#### Dependencies +- `AiFactCounter` +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for missing labels, missing patterns, or invalid regex syntax; wraps `PatternSyntaxException`. +- `factsBlock` skips null counters and null labels or patterns. +- A null `source` is not explicitly handled and can fail during regex matching. + +#### Concurrency +- Stateless and performs no I/O; no mutable shared state or synchronization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..6cdbf4c7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,101 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:28:11Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures model selection, prompt limits, sampling, reasoning, hardware, caching, and stop behavior for AI-generated project summaries. + +#### Purpose +- Carries one generation step’s settings between Maven configuration and AI provider implementations. +- Supplies defaults for llama.cpp and OpenAI-compatible generation, plus optional calibration. + +#### Type +- `public class AiGenerationConfig` — mutable JavaBean class; Lombok `@ToString`; no `equals`/`hashCode`. +- Nullable fields: model path, chat-template thinking mode, calibration. + +#### Input +- No-argument constructor; settings supplied through setters. +- Configuration covers model/provider endpoints, inference and sampling parameters, prompt trimming, hardware/cache options, reasoning, DRY repetition controls, stop strings, and calibration. +- Defaults include context size 32768, output limit 128, temperature 0.15, top-p 0.9, and API key environment-variable name empty. + +#### Output +- Stores configuration state; getters expose values and unmodifiable views of DRY sequence breakers and stop strings. +- Lombok-generated `toString()` supports build-log diagnostics; no external resources are read or written. + +#### Core logic +- Initializes instance settings from public defaults; CPU thread default is `min(4, availableProcessors())`. +- Uses sentinel defaults to defer decisions to the binding/native build: commonly `-1` for unset numeric options and empty strings for unset string options. +- Preserves tri-state thinking mode: `null` omits the chat-template kwarg; `true` and `false` are explicit settings. +- Resets nullable string/list setters to their configured empty defaults; list getters return unmodifiable views. +- Holds provider routing (`llamacpp-jni`, `openai-compatible`, `mock`), remote model, base URL, and API-key environment-variable name; stores no API key. +- Captures sampling controls (top-p, top-k, min-p, top-n-sigma, repetition penalty, DRY) and generation limits. +- Captures KV/prompt caching, GPU/CPU layer placement, device selection, batch/thread settings, and optional timing calibration. + +#### Public API +- `AiGenerationConfig()` — initialize defaults. +- `getModelPath()`/`setModelPath(String)` -> GGUF model path. +- `getContextSize()`/`setContextSize(int)` -> context window. +- `getMaxOutputTokens()`/`setMaxOutputTokens(int)` -> output-token limit. +- `getTemperature()`/`setTemperature(float)` -> sampling temperature. +- `getThreads()`/`setThreads(int)` -> inference CPU threads. +- `getCharsPerToken()`/`setCharsPerToken(int)` -> automatic input sizing ratio. +- `getMaxInputChars()`/`setMaxInputChars(int)` -> prompt input character limit. +- `isWarnOnTrim()`/`setWarnOnTrim(boolean)` -> trim warnings. +- `getTopP()`/`setTopP(float)` -> nucleus sampling threshold. +- `getTopK()`/`setTopK(int)` -> top-k sampling limit. +- `getRepeatPenalty()`/`setRepeatPenalty(float)` -> repetition penalty. +- `getMinP()`/`setMinP(float)` -> min-p threshold. +- `getTopNSigma()`/`setTopNSigma(float)` -> top-n-sigma threshold. +- `getChatTemplateEnableThinking()`/`setChatTemplateEnableThinking(Boolean)` -> thinking kwarg. +- `isCachePrompt()`/`setCachePrompt(boolean)` -> prompt-prefix caching. +- `isSwaFull()`/`setSwaFull(boolean)` -> full SWA KV cache. +- `getCacheReuse()`/`setCacheReuse(int)` -> KV prefix reuse chunk. +- `getGpuLayers()`/`setGpuLayers(int)` -> GPU layer offload. +- `getCpuMoeLayers()`/`setCpuMoeLayers(int)` -> CPU MoE layers. +- `getSeed()`/`setSeed(int)` -> generation RNG seed. +- `getCpuFfnLayers()`/`setCpuFfnLayers(int)` -> CPU FFN layers. +- `getKvUnifiedPerSlot()`/`setKvUnifiedPerSlot(int)` -> per-slot KV context cap. +- `getLazyMode()`/`setLazyMode(String)` -> tensor-read laziness. +- `getRepeatLastN()`/`setRepeatLastN(int)` -> repetition penalty window. +- `getCacheTypeK()`/`setCacheTypeK(String)` -> K-cache data type. +- `getCacheTypeV()`/`setCacheTypeV(String)` -> V-cache data type. +- `isFlashAttn()`/`setFlashAttn(boolean)` -> Flash Attention. +- `getBatchSize()`/`setBatchSize(int)` -> logical batch size. +- `getUbatchSize()`/`setUbatchSize(int)` -> physical batch size. +- `getThreadsBatch()`/`setThreadsBatch(int)` -> prompt-processing threads. +- `getMainGpu()`/`setMainGpu(int)` -> primary GPU index. +- `getDevices()`/`setDevices(String)` -> backend device selection. +- `getProvider()`/`setProvider(String)` -> per-model provider routing. +- `getRemoteModel()`/`setRemoteModel(String)` -> remote model identifier. +- `getBaseUrl()`/`setBaseUrl(String)` -> OpenAI-compatible API base URL. +- `getApiKeyEnv()`/`setApiKeyEnv(String)` -> API-key environment variable name. +- `getReasoningEffort()`/`setReasoningEffort(String)` -> reasoning-effort kwarg. +- `getReasoningBudgetTokens()`/`setReasoningBudgetTokens(int)` -> reasoning token budget. +- `getDryMultiplier()`/`setDryMultiplier(float)` -> DRY penalty multiplier. +- `getDryBase()`/`setDryBase(float)` -> DRY penalty growth base. +- `getDryAllowedLength()`/`setDryAllowedLength(int)` -> DRY unpenalized n-gram length. +- `getDryPenaltyLastN()`/`setDryPenaltyLastN(int)` -> DRY look-back window. +- `getDrySequenceBreakers()`/`setDrySequenceBreakers(List)` -> DRY reset tokens. +- `getStopStrings()`/`setStopStrings(List)` -> generation stop strings. +- `getCalibration()`/`setCalibration(AiCalibration)` -> per-machine timing calibration. + +#### Dependencies +- `AiCalibration` — optional per-machine timing data. +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`. +- `lombok.ToString`; `org.jspecify.annotations.Nullable`. +- `Runtime` — available-processor count for thread default. +- `net.ladenthin.llama.parameters.ModelParameters` — referenced in documentation for thinking kwargs. + +#### Exceptions / Errors +- No explicit exceptions or validation. +- Null model path, thinking mode, and calibration are supported. +- Null lazy mode, cache types, devices, provider, remote model, base URL, API-key environment name, and list values reset to defaults/empty lists; other values are stored without validation. + +#### Concurrency +- Mutable, unsynchronized configuration object; not thread-safe by implementation. +- List getters are unmodifiable views of mutable backing lists; setters retain a supplied non-null list reference. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..18388a7f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,44 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:28:25Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures how source files exceeding a routed model’s context window are handled: fail, sample the head, summarize chunks, or emit deterministic metadata. + +#### Purpose +- Provides the `` strategy for oversized source files. +- Defaults to aborting the build unless a routing rule selects another strategy. + +#### Type +- `public enum AiOversizeStrategy`; four strategies: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`. +- `public static final AiOversizeStrategy DEFAULT = FAIL`. + +#### Input +- `fromConfig(@Nullable String value)` accepts a configured strategy token. +- Each enum constant receives its config token through a package-private constructor. + +#### Output +- `configValue()` returns the token associated with a strategy. +- `fromConfig(...)` returns the matching strategy; null or blank input returns `DEFAULT`. + +#### Core logic +- Associates strategies with tokens: `fail`, `sample`, `mapReduce`, and `deterministic`. +- Trims configured input and matches tokens case-insensitively. +- Strategy behavior: abort; summarize trimmed file head; summarize line-boundary chunks then combine; or produce a model-free metadata and head/tail body. + +#### Public API +- `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` -> oversized-file handling options +- `DEFAULT` -> default strategy (`FAIL`) +- `configValue() -> String` — return config token +- `fromConfig(String) -> AiOversizeStrategy` — parse configured strategy + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `fromConfig` throws `IllegalArgumentException` for non-blank values that match no strategy. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..2a51562d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,81 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:28:30Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures source-file discovery, AI generation and model routing, llama.cpp fallbacks, and metadata for generated project indexes. + +#### Purpose +- `SrcMorphConfiguration` is the shared mutable configuration for a `srcmorph` run, bindable from Maven, future JSON/YAML configuration, or Java callers. +- Carries source filters, AI prompt/model/fact definitions, generation settings, and output metadata. + +#### Type +- `public class SrcMorphConfiguration` — class; annotated `@ToString`; no superclass or implemented interfaces. +- `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})` +- Public defaults: `DEFAULT_OUTPUT_DIRECTORY`, `DEFAULT_GENERATION_PROVIDER`, `DEFAULT_LLAMA_CONTEXT_SIZE`, `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS`, `DEFAULT_LLAMA_TEMPERATURE`, `DEFAULT_LLAMA_THREADS`, `DEFAULT_AI_VERSION`. + +#### Input +- No-argument constructor; initializes field defaults. +- Setters accept base/output directories, source scope and file-size filters, plan/force flags, provider, prompt/model/routing/fact definitions, llama.cpp fallback settings, version strings, and project name. +- Nullable lists and values represent optional configuration; `null` commonly means use engine defaults or no restrictions. + +#### Output +- Getter methods expose the configured values; no processing, file writes, or other side effects. +- Configuration describes `.ai.md` output location, routing inputs, generation parameters, and generated-header/index metadata. + +#### Core logic +- Initializes output directory to `src/site/ai`, provider to `mock`, llama.cpp context size to `2048`, maximum output tokens to `128`, temperature to `0.15f`, threads to `AiGenerationConfig.DEFAULT_THREADS`, and AI version to `0.0.0`. +- Leaves primitive flags and size bounds at Java defaults (`false` / `0`); other unset configuration values are `null`, except plugin version (`""`). +- Stores source subtrees, exclude globs, extensions, and exclusive-lower / inclusive-upper file-size bounds. +- Stores prompt definitions, model definitions, per-field generation rules, and reusable fact definitions for AI routing. +- Stores llama.cpp model path and inference settings as fallback configuration; model paths may be resolved relative to `modelDirectory`. +- Keeps Maven lifecycle skip flags outside this shared configuration. + +#### Public API +- `DEFAULT_OUTPUT_DIRECTORY` — default output path. +- `DEFAULT_GENERATION_PROVIDER` — default provider. +- `DEFAULT_LLAMA_CONTEXT_SIZE` — default context window. +- `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS` — default output-token limit. +- `DEFAULT_LLAMA_TEMPERATURE` — default sampling temperature. +- `DEFAULT_LLAMA_THREADS` — default inference thread count. +- `DEFAULT_AI_VERSION` — default AI logic version. +- `SrcMorphConfiguration()` — creates configuration with defaults. +- `getBaseDirectory()` / `setBaseDirectory(File)` -> project base directory. +- `getOutputDirectory()` / `setOutputDirectory(File)` -> `.ai.md` output directory. +- `isForce()` / `setForce(boolean)` -> regenerate existing fields. +- `getSubtrees()` / `setSubtrees(List)` -> source subdirectory scope. +- `getExcludes()` / `setExcludes(List)` -> excluded source globs. +- `getFileExtensions()` / `setFileExtensions(List)` -> indexed extensions. +- `getMinFileSizeBytes()` / `setMinFileSizeBytes(long)` -> exclusive lower size bound. +- `getMaxFileSizeBytes()` / `setMaxFileSizeBytes(long)` -> inclusive upper size bound. +- `isPlanOnly()` / `setPlanOnly(boolean)` -> stop after routing plan. +- `getGenerationProvider()` / `setGenerationProvider(String)` -> default generation provider. +- `getPromptDefinitions()` / `setPromptDefinitions(List)` -> prompt templates. +- `getAiDefinitions()` / `setAiDefinitions(List)` -> model definitions. +- `getModelDirectory()` / `setModelDirectory(File)` -> relative model-path base. +- `getFieldGenerations()` / `setFieldGenerations(List)` -> per-field routing rules. +- `getFactDefinitions()` / `setFactDefinitions(List)` -> reusable fact groups. +- `getLlamaModelPath()` / `setLlamaModelPath(String)` -> fallback GGUF model path. +- `getLlamaContextSize()` / `setLlamaContextSize(int)` -> fallback context window. +- `getLlamaMaxOutputTokens()` / `setLlamaMaxOutputTokens(int)` -> fallback output-token limit. +- `getLlamaTemperature()` / `setLlamaTemperature(float)` -> fallback sampling temperature. +- `getLlamaThreads()` / `setLlamaThreads(int)` -> fallback CPU thread count. +- `getPluginVersion()` / `setPluginVersion(String)` -> generated-header plugin version. +- `getAiVersion()` / `setAiVersion(String)` -> generated-header AI version. +- `getProjectName()` / `setProjectName(String)` -> aggregate index title. + +#### Dependencies +- `java.io.File`, `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition` +- `AiGenerationConfig.DEFAULT_THREADS` +- `org.jspecify.annotations.Nullable` + +#### Concurrency +- Mutable JavaBean with no synchronization; callers must coordinate concurrent mutation and access. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/package.ai.md new file mode 100644 index 00000000..8fe874d7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/config/package.ai.md @@ -0,0 +1,50 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:31:09Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> Configures source-file selection, AI fact extraction, model generation, and oversized-file handling for producing project indexes. + +#### Purpose +- Defines shared Maven-bindable settings for source discovery, AI routing and generation, and generated index metadata. +- Validates and evaluates file conditions, and formats configured source facts for AI summaries. + +#### Responsibilities +- **Source selection:** `AiConditionEvaluator` validates and evaluates nested file conditions; `AiConditionGroup` stores Maven-bound `` and `` children. +- **Fact preparation:** `AiFactExtractor` validates regex counters and formats whole-source match counts into a facts block. +- **Generation and run configuration:** `AiGenerationConfig` holds provider, model, sampling, prompt-limit, hardware, cache, reasoning, and stop settings; `SrcMorphConfiguration` collects run-wide source filters, prompts, models, routing rules, fact definitions, llama.cpp fallbacks, and output metadata. +- **Oversize policy:** `AiOversizeStrategy` parses the configured handling choice: fail, sample, map-reduce, or deterministic output. + +#### Key units +- `SrcMorphConfiguration` — shared mutable configuration for source indexing and generated `.ai.md` output. +- `AiGenerationConfig` — per-generation settings for local and OpenAI-compatible providers, including optional calibration. +- `AiConditionEvaluator` — condition-tree validation, file matching, and detection of line-count requirements. +- `AiConditionGroup` — nullable collection of child `AiCondition` entries for Maven combinators. +- `AiFactExtractor` — validation and formatting of regex-based source facts. +- `AiOversizeStrategy` — enum and config-token parser for oversized source handling (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`). + +#### Data flow +- Run configuration supplies source scope, extensions, excludes, size bounds, prompt/model definitions, field-generation rules, and reusable fact definitions. +- `AiConditionEvaluator` evaluates `AiCondition` trees against `AiFileContext` facts; path globs are delegated to `AiSourceExcludeFilter`. +- `AiFactExtractor` counts configured regex matches against full source text and produces a facts block. +- Generation settings and the selected `AiOversizeStrategy` configure model execution and handling of files beyond a routed model’s context window. + +#### Dependencies +- Condition evaluation uses `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, and `AiSourceExcludeFilter`. +- Run and generation configuration refer to `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, and `AiCalibration`. +- Uses Java collections, regex, and time parsing; Lombok `@ToString` and JSpecify nullability annotations appear across configuration types. + +#### Cross-cutting +- Most configuration types are mutable JavaBeans with no synchronization; `AiConditionEvaluator` and `AiFactExtractor` are stateless. +- Defaults and unset sentinels defer some generation choices to provider or native bindings; `SrcMorphConfiguration` supplies fallback llama.cpp settings. +- Nullable values represent optional configuration; `AiGenerationConfig` preserves tri-state chat-template thinking mode and exposes unmodifiable views for selected lists. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..b936951e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,51 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:31:26Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Converts configured source-file context into AI-generated project index content using selectable local, OpenAI-compatible, or mock generation. + +#### Purpose +- Configures source selection, facts, prompts, models, generation behavior, and oversized-file policies. +- Routes generation requests to provider backends and processes completion text and timing data. + +#### Responsibilities +- **Run configuration and source preparation:** `SrcMorphConfiguration`, condition evaluation, regex-based fact extraction, and oversized-file strategy parsing. +- **Generation settings:** `AiGenerationConfig` and `LlamaCppJniConfig` define sampling, hardware, caching, reasoning, stop strings, and provider connection options. +- **Provider selection and execution:** `AiGenerationProviderFactory` resolves the backend; providers implement generation, optional timings, and lifecycle closure. +- **Completion and request support:** `AiCompletionParser` cleans generated answers; `OpenAiCompatibleProviderSupport` builds requests and handles endpoint, API-key, error, and timing details. + +#### Key units +- `SrcMorphConfiguration` — run-wide source filters, prompts, models, routing rules, facts, and output metadata. +- `AiConditionEvaluator` — validates condition trees and matches file contexts, delegating path globs to `AiSourceExcludeFilter`. +- `AiFactExtractor` — counts configured regex matches in source text and formats a facts block. +- `AiOversizeStrategy` — parses policies for failing, sampling, map-reduce, or deterministic handling. +- `AiGenerationProvider` — pluggable `AutoCloseable` generation contract with optional timing support. +- `AiGenerationProviderFactory` — selects mock, llama.cpp JNI, or OpenAI-compatible generation. +- `LlamaCppJniAiGenerationProvider` — runs local model inference and returns parsed completion text and available metrics. +- `AiCompletionParser` — trims answers and removes a leading Gemma-4 thinking block. +- `OpenAiCompatibleProviderSupport` — prepares chat-completion request data and handles transport safeguards and response metadata. + +#### Data flow +- `SrcMorphConfiguration` supplies source scope, filters, prompt/model definitions, fact definitions, and generation settings. +- `AiConditionEvaluator` applies configured conditions to `AiFileContext`; `AiFactExtractor` derives facts from full source text. +- `AiGenerationProviderFactory` resolves the effective provider, defaulting blank selection to mock or choosing a backend by configured provider name. +- The selected provider builds or prepares a request, generates a completion, and returns text with optional timing data; completion parsing trims text and removes a leading thinking block. + +#### Dependencies +- Configuration uses `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, `AiSourceExcludeFilter`, and definitions for prompts, models, fields, facts, and calibration. +- Providers use `AiGenerationRequest`, `AiGenerationTimings`, and `AiPromptSupport`. +- Local inference depends on llama.cpp JNI model and parameter types, `LlamaCppJniProviderSupport`, and response parsing utilities. +- OpenAI-compatible request support uses Jackson, `ChatResponse`, `Usage`, and an injected environment-variable lookup. + +#### Cross-cutting +- Configuration types are mostly mutable JavaBeans; `LlamaCppJniConfig` is immutable after construction and built with a single-threaded builder. +- Provider generation exposes `IOException`; an unterminated leading thinking block also produces `IOException`. +- The local model is lazily initialized and cached without synchronization, so concurrent first calls may race. +- OpenAI-compatible support restricts base URLs to HTTP(S) and prevents configured API keys from being sent over plain HTTP to non-loopback hosts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..5bf4e213 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,48 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:28:43Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Removes leading Gemma-4 reasoning blocks from model completions so only the answer is stored in AI index files. + +#### Purpose +- Cleans raw LLM completion text before it is persisted. +- Preserves marker text when it appears outside a leading thinking block. + +#### Type +- `public class AiCompletionParser` — class; non-final; annotated `@ToString`. + +#### Input +- `parseCompletion(String response)` consumes raw completion text; `null` is allowed. +- Uses static Gemma-4 markers `THINKING_BLOCK_START_MARKER` and `THINKING_BLOCK_END_MARKER`. + +#### Output +- Returns trimmed answer text; returns `""` for `null`. +- Does not mutate state or write resources. + +#### Core logic +- Trims the response; if it does not start with `<|channel>thought`, returns it unchanged apart from trimming. +- For a leading thinking block, finds the first `` after the start marker and returns trimmed text following it. +- Throws `IOException` when a leading thinking block has no closing marker. + +#### Public API +- `AiCompletionParser()` — creates parser. +- `parseCompletion(String) -> String` — strips leading thinking block. +- `THINKING_BLOCK_START_MARKER` — opening token constant. +- `THINKING_BLOCK_END_MARKER` — closing token constant. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `parseCompletion` throws `IOException` if the leading thinking block lacks its closing marker; message advises increasing `maxOutputTokens` and includes response length. +- `null` input becomes an empty string; output is never `null`. + +#### Concurrency +- Stateless; no mutable instance fields. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..efa2f582 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,46 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:28:48Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Generates text from source-aware AI requests, optionally reporting model performance for calibration. + +#### Purpose +- Defines a pluggable AI generation backend for local models or test mocks. +- Provides an optional timing result for calibration workflows. + +#### Type +- `AiGenerationProvider` — interface; extends `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest)` and `generateWithTimings(AiGenerationRequest)` consume a request containing a prompt key, source file, source text, and current header. + +#### Output +- Generation methods return text; text may be blank but is documented as never `null`. +- Default `generateWithTimings` returns `AiGenerationTimings` with generated text and zero timing rates/values. +- Default `close()` has no side effects. + +#### Core logic +- `generate` is the provider contract for producing text with default sampling parameters. +- `generateWithTimings` delegates to `generate` and supplies zero timing values unless overridden. +- `close` is a no-op unless overridden. + +#### Public API +- `generate(AiGenerationRequest)` -> `String` — generate text. +- `generateWithTimings(AiGenerationRequest)` -> `AiGenerationTimings` — generate text with timing data. +- `close()` -> `void` — close provider resources. + +#### Dependencies +- `AiGenerationRequest` +- `AiGenerationTimings` +- `AutoCloseable` +- `IOException` + +#### Exceptions / Errors +- Generation methods declare `IOException` when the underlying provider fails. +- Generated text is documented as non-null; it may be blank. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..c44b22ad --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,56 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:28:52Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Selects the configured AI text-generation backend for a run, allowing a model-level provider override and defaulting to deterministic mock generation. + +#### Purpose +- Resolves the effective provider key from run and model configuration. +- Creates mock, llama.cpp JNI, or OpenAI-compatible generation providers. + +#### Type +- `public class AiGenerationProviderFactory` — class; annotated `@ToString`. + +#### Input +- `create(providerName, llamaConfig, promptSupport)` consumes the run provider key, model configuration, and prompt lookup support. +- `effectiveProvider(runProvider, modelProvider)` accepts nullable provider keys. +- Holds a `Java8CompatibilityHelper` instance for blank-key checks. + +#### Output +- Returns a newly created `AiGenerationProvider`. +- `effectiveProvider` returns the trimmed model provider when nonblank; otherwise the run provider. + +#### Core logic +- `effectiveProvider` prefers a non-null, nonblank model provider; trims the selected model key. +- `create` resolves the model-level override, then defaults null or blank keys to `MockAiGenerationProvider`. +- Dispatches `mock` to `MockAiGenerationProvider`, `llamacpp-jni` to `LlamaCppJniAiGenerationProvider`, and `openai-compatible` to `OpenAiCompatibleAiGenerationProvider`. +- Throws `IllegalArgumentException` for unrecognized provider keys. + +#### Public API +- `AiGenerationProviderFactory()` -> constructor; initializes factory. +- `PROVIDER_MOCK` -> `String`; mock provider key. +- `PROVIDER_LLAMACPP_JNI` -> `String`; llama.cpp JNI provider key. +- `PROVIDER_OPENAI_COMPATIBLE` -> `String`; OpenAI-compatible provider key. +- `effectiveProvider(String, String)` -> `@Nullable String`; resolves model/run provider. +- `create(String, LlamaCppJniConfig, AiPromptSupport)` -> `AiGenerationProvider`; instantiates selected provider. + +#### Dependencies +- `AiGenerationProvider` +- `MockAiGenerationProvider` +- `LlamaCppJniAiGenerationProvider` +- `OpenAiCompatibleAiGenerationProvider` +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `Java8CompatibilityHelper` +- `@Nullable` +- Lombok `@ToString` + +#### Exceptions / Errors +- Throws `IllegalArgumentException` with the unsupported provider key when no provider matches. +- Null or blank effective provider selects the mock provider. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..e8e8c162 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,61 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:28:59Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Generates AI completions from locally hosted GGUF models through llama.cpp, with configurable inference, cache reuse, and throughput reporting. + +#### Purpose +- Provides `AiGenerationProvider` completions using a lazily loaded local llama.cpp model. +- Exposes parsed completion text and model-reported generation timings. + +#### Type +- `public final class LlamaCppJniAiGenerationProvider` — class; implements `AiGenerationProvider`, `AutoCloseable`. +- Annotated `@ToString`; Lombok excludes the native model handle and provider support from rendered output. + +#### Input +- Constructor receives `LlamaCppJniConfig` and `AiPromptSupport`; rejects null values. +- `generate` and `generateWithTimings` receive `AiGenerationRequest`. +- Model initialization reads configuration for model path, context, threads, GPU/CPU placement, KV cache, attention, batching, devices, and lazy loading. +- `LlamaCppJniProviderSupport` builds chat-template kwargs and inference parameters from configuration and requests. + +#### Output +- `generate` returns parsed completion text; may log warnings for truncated answers and prompt-cache reuse. +- `generateWithTimings` returns `AiGenerationTimings` containing completion text, prompt/cache/prediction token counts, and throughput rates. +- `close` closes the loaded native model if present. + +#### Core logic +- Loads and caches `LlamaModel` on first inference; configures `ModelParameters` with `ReasoningFormat.AUTO` and chat-template kwargs. +- Applies optional settings only when their configured values meet the relevant guards; creates the native model and stores its handle. +- Builds inference parameters through `LlamaCppJniProviderSupport`, runs `chatComplete`, and parses the full response with `ChatResponseParser`. +- `generate` warns on truncation, logs prompt-cache reuse, then parses the first response content with `AiCompletionParser`. +- `generateWithTimings` returns zeroed rates/counts when response timings are absent; otherwise reports prompt tokens, cache tokens, predicted tokens, and measured rates. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport)` — construct provider with lazy model loading. +- `generate(AiGenerationRequest) -> String` — generate completion text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` — generate completion and timing metrics. +- `close() -> void` — close loaded model. + +#### Dependencies +- `AiGenerationProvider`, `AiGenerationRequest`, `AiGenerationTimings` +- `LlamaCppJniConfig`, `LlamaCppJniProviderSupport` +- `LlamaModel`, `ModelParameters`, `FlashAttn`, `ReasoningFormat` +- `ChatResponseParser`, `ChatResponse`, `Timings` +- `AiCompletionParser`, `AiPromptSupport`, `Java8CompatibilityHelper` +- `IOException`, `Map`, `Objects`, Lombok `ToString`, JSpecify `Nullable` + +#### Exceptions / Errors +- Constructor throws `NullPointerException` for null configuration or prompt support. +- `generate` declares `IOException`; `generateWithTimings` does not declare checked exceptions. +- Native model loading, inference, response parsing, and model close may fail through unchecked exceptions. +- Missing response timings produce zero-valued metrics. + +#### Concurrency +- Lazy model initialization and cached model access are unsynchronized; concurrent first calls may race. +- No other synchronization or thread-safety guarantees are declared. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..2605faed --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,75 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:29:07Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures local llama.cpp and OpenAI-compatible model generation, including sampling, hardware, caching, reasoning, and stop controls. + +#### Purpose +- Carries model path and generation/provider settings in an immutable configuration. +- Applies `AiGenerationConfig` defaults through a fluent builder. + +#### Type +- `public final class LlamaCppJniConfig`; annotated `@ConvertToRecord`, Lombok `@ToString`, `@EqualsAndHashCode`. +- Nested `public static final class Builder`. +- No superclass or implemented interfaces. + +#### Input +- `builder(String modelPath)` requires a non-null GGUF model path. +- Builder setters accept generation sampling, thread, GPU, KV-cache, provider, reasoning, DRY, and stop-string values. +- Defaults come from `AiGenerationConfig.DEFAULT_*`; list defaults are empty lists. + +#### Output +- Immutable configuration with 41 fields and record-style accessors. +- `drySequenceBreakers()` and `stopStrings()` return unmodifiable views. +- Lombok generates `equals`, `hashCode`, and `toString` over all fields. + +#### Core logic +- `LlamaCppJniConfig.builder(modelPath)` creates a builder initialized with defaults. +- Builder setters replace configured values and return the builder; nullable string/list inputs restore defaults when null. +- `build()` copies builder state into the immutable configuration. +- Nullable `chatTemplateEnableThinking` preserves unset state; null list inputs become empty lists. +- Constructor performs no normalization; list accessors wrap the stored lists as unmodifiable views. + +#### Public API +- `builder(String) -> Builder` — start configuration. +- `modelPath() -> String` — GGUF path; `contextSize() -> int` — context window; `maxOutputTokens() -> int` — output limit. +- `temperature() -> float` — sampling temperature; `threads() -> int` — CPU threads; `topP() -> float` — nucleus threshold; `topK() -> int` — top-k limit. +- `minP() -> float` — min-p threshold; `topNSigma() -> float` — top-n-sigma threshold; `repeatPenalty() -> float` — repetition penalty. +- `chatTemplateEnableThinking() -> @Nullable Boolean` — optional thinking mode; `cachePrompt() -> boolean` — prompt caching; `swaFull() -> boolean` — full SWA KV cache. +- `cacheReuse() -> int` — KV prefix reuse; `gpuLayers() -> int` — GPU offload layers; `seed() -> int` — generation RNG seed. +- `cpuMoeLayers() -> int` — CPU MoE layers; `cpuFfnLayers() -> int` — CPU FFN layers; `kvUnifiedPerSlot() -> int` — per-slot KV cap. +- `lazyMode() -> String` — tensor-read laziness; `repeatLastN() -> int` — repetition window; `cacheTypeK() -> String` — K-cache type; `cacheTypeV() -> String` — V-cache type. +- `flashAttn() -> boolean` — Flash Attention; `batchSize() -> int` — logical batch size; `ubatchSize() -> int` — physical batch size. +- `threadsBatch() -> int` — batch-processing threads; `mainGpu() -> int` — primary GPU; `devices() -> String` — device selection. +- `provider() -> String` — provider choice; `remoteModel() -> String` — remote model ID; `baseUrl() -> String` — API base URL; `apiKeyEnv() -> String` — API-key environment variable name. +- `reasoningEffort() -> String` — reasoning effort; `reasoningBudgetTokens() -> int` — reasoning budget. +- `dryMultiplier() -> float` — DRY multiplier; `dryBase() -> float` — DRY base; `dryAllowedLength() -> int` — DRY allowed length; `dryPenaltyLastN() -> int` — DRY look-back window. +- `drySequenceBreakers() -> List` — DRY sequence breakers; `stopStrings() -> List` — stop strings. +- `Builder.contextSize(int) -> Builder`, `maxOutputTokens(int) -> Builder`, `temperature(float) -> Builder`, `threads(int) -> Builder`, `topP(float) -> Builder`, `topK(int) -> Builder`, `minP(float) -> Builder`, `topNSigma(float) -> Builder`, `repeatPenalty(float) -> Builder` — set generation sampling controls. +- `Builder.chatTemplateEnableThinking(@Nullable Boolean) -> Builder` — set optional thinking mode; `cachePrompt(boolean) -> Builder`, `swaFull(boolean) -> Builder`, `cacheReuse(int) -> Builder` — set cache controls. +- `Builder.gpuLayers(int) -> Builder`, `seed(int) -> Builder`, `cpuMoeLayers(int) -> Builder`, `cpuFfnLayers(int) -> Builder`, `kvUnifiedPerSlot(int) -> Builder` — set hardware and KV controls. +- `Builder.lazyMode(String) -> Builder`, `repeatLastN(int) -> Builder`, `cacheTypeK(String) -> Builder`, `cacheTypeV(String) -> Builder`, `flashAttn(boolean) -> Builder` — set inference controls. +- `Builder.batchSize(int) -> Builder`, `ubatchSize(int) -> Builder`, `threadsBatch(int) -> Builder`, `mainGpu(int) -> Builder`, `devices(String) -> Builder` — set batch and device controls. +- `Builder.provider(String) -> Builder`, `remoteModel(String) -> Builder`, `baseUrl(String) -> Builder`, `apiKeyEnv(String) -> Builder` — set provider connection options. +- `Builder.reasoningEffort(String) -> Builder`, `reasoningBudgetTokens(int) -> Builder` — set reasoning controls. +- `Builder.dryMultiplier(float) -> Builder`, `dryBase(float) -> Builder`, `dryAllowedLength(int) -> Builder`, `dryPenaltyLastN(int) -> Builder`, `drySequenceBreakers(List) -> Builder` — set DRY sampling controls. +- `Builder.stopStrings(List) -> Builder` — set stop strings; `Builder.build() -> LlamaCppJniConfig` — create immutable config. + +#### Dependencies +- `AiGenerationConfig`; `ConvertToRecord`; Lombok `EqualsAndHashCode`, `ToString`; JSpecify `Nullable`. +- Java `Collections`, `List`, `Objects`. + +#### Exceptions / Errors +- `builder(null)` throws `NullPointerException` via `Objects.requireNonNull`, with message `modelPath`. +- Null string/list setter inputs restore their corresponding defaults; nullable thinking mode remains nullable. +- Numeric values are not validated. + +#### Concurrency +- Configuration fields are final; configuration is immutable after construction. +- Builder is not thread-safe and is intended for single-threaded use. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..147b7e8a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,120 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:29:21Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> OpenAI-compatible chat requests are built from source files and model settings, while API keys are protected from cleartext transmission to non-local servers and response metadata is converted into generation timings. + +#### Purpose +- Prepares network-independent request data and policy checks for OpenAI-compatible model calls. +- Formats HTTP errors and derives token counts and decode rates from chat responses. + +#### Type +- `final class OpenAiCompatibleProviderSupport` — package-private; no superclass or implemented interfaces. +- `@ToString`; `promptSupport` and `environment` are excluded from generated `toString`. +- Static Jackson `ObjectMapper`; instance fields hold `LlamaCppJniConfig`, prompt support, environment lookup, and Java 8 compatibility helper. + +#### Input +- Constructor: `LlamaCppJniConfig`, `AiPromptSupport`, and environment-variable lookup `Function`. +- `requestBody`: `AiGenerationRequest`; reads prompt key, source file/text, and model/sampling settings from config. +- `endpoint`, `apiKey`: config base URL and API-key environment-variable name; `apiKey` invokes the injected environment lookup. +- `apiKeyFor`: endpoint URL. +- `isLoopbackHost`: host string; `isSuccess`: HTTP status. +- `errorMessage`: endpoint, status, error-body text. +- `timings`: completion text, `ChatResponse`, elapsed seconds. + +#### Output +- Produces serialized JSON for a non-streaming chat-completions request. +- Produces normalized chat-completions endpoint and trimmed API key, or `null` when no key is configured. +- Produces loopback and HTTP-success predicates, formatted error text, and `AiGenerationTimings`. +- No network calls or resource writes. + +#### Core logic +- `requestBody` creates system and user messages from `AiPromptSupport`, then writes `max_tokens`, `temperature`, `top_p`, `repetition_penalty`, and `stream=false`. +- Adds `model` and `reasoning.effort` only when non-blank; adds `top_k` and `min_p` only when positive; adds `seed` when nonnegative; adds `stop` only when configured list is non-empty. +- `endpoint` trims `baseUrl`, accepts only `http://` or `https://`, strips trailing slashes, then appends `/chat/completions`. +- `apiKey` resolves the configured environment variable and returns its trimmed non-blank value. +- `apiKeyFor` allows a configured key over HTTPS or plain HTTP to loopback only; rejects plain HTTP to other hosts before transmission. +- `isLoopbackHost` accepts exact lowercase `localhost`, IPv4 literals matching `127.d.d.d` with 1–3 digits per octet, and `[::1]`. +- `isSuccess` accepts statuses 200–299; `errorMessage` includes endpoint, status, and at most 500 body characters, appending `...` when truncated. +- `timings` reads completion, prompt, and cached token counts; computes completion tokens per elapsed second when seconds are positive, and sets prefill rate to zero. + +#### Public API +- No public or protected members; all declared members are package-private or private. + +#### Dependencies +- `LlamaCppJniConfig`, `AiPromptSupport`, `AiGenerationRequest`, `AiGenerationTimings`. +- `ChatResponse`, `Usage`, `Java8CompatibilityHelper`. +- Jackson `ObjectMapper`, `ObjectNode`, `ArrayNode`; Lombok `@ToString`; JSpecify `@Nullable`. +- Java `IOException`, `URL`, `List`, `Objects`, `Function`, `Pattern`. + +#### Exceptions / Errors +- Constructor rejects null config, prompt support, or environment lookup via `Objects.requireNonNull`. +- `requestBody` propagates `IOException` from JSON serialization. +- `endpoint` throws `IllegalArgumentException` for non-HTTP(S) base URLs. +- `apiKeyFor` propagates URL parsing `IOException`; rejects a key over non-loopback plain HTTP with `IOException`. +- Error excerpt truncation uses body length; assumes non-null body. + +#### Concurrency +- No synchronization or mutable request state; config and collaborators are final references. +- Shared static `ObjectMapper` is reused for request serialization. + +> OpenAI-compatible chat requests are assembled from source files and model settings, API keys are restricted from cleartext transmission to non-local servers, and response metadata is converted into generation timings. + +#### Purpose +- Prepares request bodies, endpoints, API-key policy, HTTP status/error handling, and timing data for OpenAI-compatible generation. +- Keeps these network-independent responsibilities separate from provider socket handling. + +#### Type +- `final class OpenAiCompatibleProviderSupport` — package-private; no explicit superclass or implemented interfaces. +- Annotated `@ToString`; `promptSupport` and `environment` are excluded. +- Holds `LlamaCppJniConfig`, `AiPromptSupport`, environment lookup, and `Java8CompatibilityHelper`. + +#### Input +- Constructor receives model config, prompt support, and an environment-variable lookup function. +- `requestBody` receives `AiGenerationRequest`; reads prompt key, source file/text, and model sampling settings. +- `endpoint` and `apiKey` read base URL and API-key environment-variable name from config. +- `apiKeyFor` receives an endpoint URL; `isLoopbackHost` receives a host; `isSuccess` receives an HTTP status. +- `errorMessage` receives endpoint, status, and response body. +- `timings` receives completion text, `ChatResponse`, and elapsed seconds. + +#### Output +- Serializes a non-streaming chat-completions JSON request. +- Returns normalized endpoint and trimmed API key, or `null` when no key is configured. +- Returns HTTP/loopback predicates, formatted error text, and `AiGenerationTimings`. +- Performs no network I/O or resource writes. + +#### Core logic +- `requestBody` creates system and user messages using `AiPromptSupport`, then writes `max_tokens`, `temperature`, `top_p`, `repetition_penalty`, and `stream=false`. +- Includes `model` and `reasoning.effort` when non-blank; `top_k` and `min_p` when positive; `seed` when nonnegative; and `stop` when non-empty. +- `endpoint` trims `baseUrl`, accepts only HTTP or HTTPS, removes trailing slashes, and appends `/chat/completions`. +- `apiKey` resolves the configured environment variable and returns its trimmed, non-blank value. +- `apiKeyFor` permits a key over HTTPS or plain HTTP to loopback only; rejects sending it over plain HTTP to other hosts. +- `isLoopbackHost` recognizes exact lowercase `localhost`, IPv4 addresses matching `127.d.d.d` with 1–3 digits per octet, and `[::1]`. +- `isSuccess` recognizes status codes 200–299. `errorMessage` includes up to 500 body characters and appends `...` when truncated. +- `timings` reads completion, prompt, and cached token counts; computes completion tokens per elapsed second when positive, and sets prefill rate to zero. + +#### Public API +- No public or protected members. + +#### Dependencies +- `LlamaCppJniConfig`, `AiPromptSupport`, `AiGenerationRequest`, `AiGenerationTimings`. +- `ChatResponse`, `Usage`, `Java8CompatibilityHelper`. +- Jackson `ObjectMapper`, `ObjectNode`, `ArrayNode`; Lombok `@ToString`; JSpecify `@Nullable`. +- Java `IOException`, `URL`, `List`, `Objects`, `Function`, `Pattern`. + +#### Exceptions / Errors +- Constructor rejects null config, prompt support, or environment lookup. +- `requestBody` may throw `IOException` during serialization. +- `endpoint` throws `IllegalArgumentException` for a base URL that is not HTTP(S). +- `apiKeyFor` may throw `IOException` when URL parsing fails or a configured key would be sent over plain HTTP to a non-loopback host. +- `errorMessage` assumes a non-null body. + +#### Concurrency +- No synchronization or mutable request state; config and collaborator references are final. +- Reuses a static `ObjectMapper`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/package.ai.md new file mode 100644 index 00000000..871e574e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/java/provider/package.ai.md @@ -0,0 +1,53 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:31:16Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Generates source-aware AI completions through selectable mock, local llama.cpp, or OpenAI-compatible backends, with completion cleanup and optional performance metrics. + +#### Purpose +- Defines and configures AI text-generation providers for requests built from prompt keys, source files, source text, and current headers. +- Supports local-model inference and OpenAI-compatible request preparation, plus completion parsing and generation timing data. + +#### Responsibilities +- **Provider selection and contract:** `AiGenerationProviderFactory` resolves model-level overrides and creates mock, llama.cpp JNI, or OpenAI-compatible providers; `AiGenerationProvider` defines generation, optional timings, and lifecycle closure. +- **Local inference:** `LlamaCppJniAiGenerationProvider` lazily loads and reuses a configured GGUF model, runs chat completion, parses the answer, and reports available token and throughput metrics. +- **Provider configuration:** `LlamaCppJniConfig` immutably collects model, sampling, hardware, caching, reasoning, provider-connection, DRY, and stop-string settings. +- **Completion cleanup:** `AiCompletionParser` strips a leading Gemma-4 thinking block and returns trimmed answer text. +- **OpenAI-compatible request support:** `OpenAiCompatibleProviderSupport` builds chat-completion request JSON, normalizes endpoints, applies API-key transport safeguards, formats HTTP errors, and derives timing data. + +#### Key units +- `AiGenerationProvider` — pluggable `AutoCloseable` generation interface with a default zero-timing implementation. +- `AiGenerationProviderFactory` — selects a provider using run configuration and an optional model-level provider override. +- `LlamaCppJniAiGenerationProvider` — performs local llama.cpp JNI chat inference and parses generated completions. +- `LlamaCppJniConfig` — immutable configuration with a fluent builder for inference and provider settings. +- `AiCompletionParser` — removes a leading reasoning block, throwing `IOException` if it is unterminated. +- `OpenAiCompatibleProviderSupport` — package-private helper for OpenAI-compatible request data, API-key policy, errors, and timings. + +#### Data flow +- `AiGenerationProviderFactory` resolves the effective provider; null or blank selection defaults to `MockAiGenerationProvider`, while `llamacpp-jni` selects `LlamaCppJniAiGenerationProvider` and `openai-compatible` selects the OpenAI-compatible provider. +- The local provider combines `AiGenerationRequest`, `LlamaCppJniConfig`, and `AiPromptSupport` to build inference parameters, invokes `chatComplete`, parses the response, and returns completion text or timing data. +- OpenAI-compatible support combines request and configuration data into non-streaming chat-completions JSON; it also prepares endpoint and API-key information and maps response metadata into `AiGenerationTimings`. +- `AiCompletionParser` trims generated text and removes a leading Gemma-4 thinking block before the answer is returned. + +#### Dependencies +- Request and result types: `AiGenerationRequest`, `AiGenerationTimings`; prompt construction: `AiPromptSupport`. +- Local inference: `LlamaCppJniProviderSupport`, llama.cpp `LlamaModel` and parameter types, `ChatResponseParser`, and response timing data. +- OpenAI-compatible support: Jackson JSON nodes, `ChatResponse` and `Usage`, and an injected environment-variable lookup. +- Configuration defaults and compatibility checks use `AiGenerationConfig` and `Java8CompatibilityHelper`. + +#### Cross-cutting +- `LlamaCppJniConfig` is immutable after construction; its builder is intended for single-threaded use, and numeric values are not validated. +- The llama.cpp model is initialized lazily and cached without synchronization; concurrent first calls may race. +- Provider generation methods declare `IOException` in the interface; the completion parser also throws `IOException` for an unterminated leading thinking block. +- OpenAI-compatible support accepts only HTTP(S) base URLs and prevents configured API keys from being sent over plain HTTP to non-loopback hosts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..644b1f57 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/kernels/histogram.cl.ai.md @@ -0,0 +1,48 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:30:29Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Counts the frequency of each byte value in an image or byte stream using a two-pass 256-bin histogram. + +#### Purpose +- Computes a byte-frequency histogram by combining per-work-group counts. +- Supports input buffers of arbitrary length. + +#### Type +- OpenCL C 1.2 kernel source. + +#### Input +- `histogram_partial`: `input` byte buffer, `length`, `partial` output buffer, and caller-provided `local_bins` local-memory buffer. +- `histogram_reduce`: `partial` buffer and `group_count`. + +#### Output +- `histogram_partial` writes one 256-counter partial histogram per work-group to `partial`. +- `histogram_reduce` writes the final 256-bin counts to `histogram`. + +#### Core logic +- `histogram_partial` initializes local counters across work-items, then synchronizes the work-group. +- Work-items traverse input indices in global-size strides and atomically increment the local counter for each byte value. +- After a second local-memory barrier, work-items write local counters to the work-group’s slice of `partial`. +- `histogram_reduce` assigns one work-item per bin, sums that bin across all partial histograms, and stores the result; work-items with bin indices outside the 256-bin range return. + +#### Public API +- `histogram_partial(input, length, partial, local_bins) -> void` — builds per-group counts. +- `histogram_reduce(partial, group_count, histogram) -> void` — combines per-group counts. + +#### Constants and configuration +- `BINS = 256`. + +#### Dependencies +- OpenCL types: `uchar`, `uint`. +- OpenCL built-ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `barrier`, `atomic_inc`. +- OpenCL flag: `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- `histogram_reduce` returns without writing when the global ID is `>= BINS`. +- No explicit validation of buffer sizes, `length`, or `group_count`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/kernels/package.ai.md new file mode 100644 index 00000000..4c7df213 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/kernels/package.ai.md @@ -0,0 +1,35 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:31:33Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes a 256-bin frequency distribution for byte data, combining per-work-group counts into a final histogram. + +#### Purpose +- Count occurrences of each byte value in an input buffer. +- Support arbitrary input lengths through partial histograms and a reduction pass. + +#### Responsibilities +- Build per-work-group byte counts using local-memory bins and atomic increments. +- Sum partial counts across work-groups to produce the final histogram. + +#### Key units +- `histogram_partial` — generates one 256-bin partial histogram per work-group. +- `histogram_reduce` — combines partial histograms into 256 final counts. +- `BINS` — defines the histogram size as 256. + +#### Data flow +- `input` bytes and `length` feed `histogram_partial`, which writes per-group counts to `partial`. +- `histogram_reduce` reads `partial` and `group_count`, then writes the final counts to `histogram`. + +#### Dependencies +- OpenCL C 1.2 types, work-item and group built-ins, barriers, and `atomic_inc`. + +#### Cross-cutting +- Uses local-memory atomics and work-group barriers for parallel counting. +- Buffer sizes, `length`, and `group_count` are not explicitly validated. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..40c3b8d3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,52 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:31:48Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides low-level byte processing and buffering utilities alongside operational backup rotation and regional sales reporting. + +#### Purpose +- Compute byte-frequency histograms and transfer byte streams through a bounded circular buffer. +- Automate compressed backup retention and summarize qualifying monthly sales revenue by region. + +#### Responsibilities +- **Parallel byte analysis (`kernels/`):** count byte values into 256-bin histograms using per-work-group partial counts and reduction. +- **Byte-stream buffering (`ringbuf/`):** manage fixed-capacity storage with partial reads and writes, wraparound, and occupancy queries. +- **Operational scripts (`scripts/`):** create and rotate timestamped backups; validate order CSV data, aggregate revenue, and print filtered reports. + +#### Key units +- `histogram_partial` / `histogram_reduce` — build work-group byte counts and combine them into a final 256-bin histogram. +- `BINS` — defines the histogram size as 256. +- `ringbuf_t` — holds ring-buffer storage, capacity, and producer/consumer indices. +- `ringbuf_init`, `ringbuf_free` — allocate and initialize or release and reset ring-buffer state. +- `ringbuf_write`, `ringbuf_read` — transfer available bytes, including across the storage boundary. +- `ringbuf_used`, `ringbuf_free_space` — report buffered bytes and writable space. +- `rotate_backups.sh` — create a UTC-dated compressed archive and enforce an archive-retention limit. +- `Order` — frozen record for an order date, region, and amount. +- `parse_orders(path, currency)` — yield validated orders matching a selected currency. +- `revenue_by_month_and_region(orders)` — aggregate sorted revenue totals by month and region. +- `main(argv=None)` — parse sales-report options and print qualifying totals. + +#### Data flow +- **Histogram:** input bytes and length → per-work-group partial histograms → reduction → final 256-bin counts. +- **Ring buffer:** initialization sets indices to zero; writes advance `head`, reads advance `tail`, and occupancy limits transfers; free releases storage. +- **Backups:** source directory → temporary archive → completed UTC-dated `.tar.gz` → retention cleanup. +- **Sales reporting:** CSV files → column, currency, and row validation → `Order` records → monthly regional aggregation → threshold filtering → tab-separated output. + +#### Dependencies +- Histogram kernels use OpenCL C 1.2 work-item and group built-ins, local-memory atomics, and barriers. +- Ring-buffer implementation uses `ringbuf.h`, standard allocation and memory-copy facilities, and standard size and byte types. +- Backup rotation uses Bash and external `tar`, `date`, `ls`, and `rm` commands. +- Sales reporting uses Python standard-library CSV, date, decimal, argument-parsing, and aggregation facilities. + +#### Cross-cutting +- Ring-buffer capacity must be a power of two; one slot is reserved to distinguish full from empty. Initialization reports invalid capacity or allocation failure. +- Histogram buffer sizes and group counts are not explicitly validated; the ring-buffer API provides no explicit null-pointer checks. +- Backup rotation uses strict Bash mode and an exit trap to clean up partial archives; sales amounts use `Decimal` and invalid matching-row data produces path- and line-aware errors. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/ringbuf/package.ai.md new file mode 100644 index 00000000..e01b00f4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/ringbuf/package.ai.md @@ -0,0 +1,43 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:31:37Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides bounded byte-stream buffering for producer-consumer transfer, allowing partial reads and writes across a fixed-capacity circular storage area. + +#### Purpose +- Initialize, use, query, and release a fixed-capacity byte ring buffer. +- Support single-producer, single-consumer byte streams with usable capacity of `capacity - 1`. + +#### Responsibilities +- **Buffer lifecycle and validation:** allocate storage for power-of-two capacities and reset or release buffer state. +- **Byte transfer:** perform bounded, partial reads and writes, including copies that wrap around the storage boundary. +- **Capacity queries:** report buffered bytes and writable space. + +#### Key units +- `ringbuf_t` — stores byte storage, capacity, producer `head`, and consumer `tail`. +- `ringbuf_status_t` — reports initialization success or failure. +- `ringbuf_init` — validates capacity and allocates and initializes the buffer. +- `ringbuf_free` — releases storage and resets buffer fields. +- `ringbuf_write` / `ringbuf_read` — transfer up to the available space or data and return bytes transferred. +- `ringbuf_used` / `ringbuf_free_space` — report occupancy and writable capacity. + +#### Data flow +- `ringbuf_init` allocates storage and sets both indices to zero; writes advance `head`, and reads advance `tail`. +- Occupancy and available space determine transfer limits; wrapped transfers are split at the allocation boundary. +- `ringbuf_free` releases storage and resets the buffer state. + +#### Dependencies +- `ringbuf.c` uses `ringbuf.h`, `` for allocation, and `` for copying. +- `ringbuf.h` uses `` and `` for `size_t` and `uint8_t`. + +#### Cross-cutting +- Power-of-two capacity enables masked index wraparound; one slot remains reserved to distinguish full from empty. +- Initialization returns `RINGBUF_EINVAL` for zero or non-power-of-two capacity and `RINGBUF_ENOMEM` on allocation failure. +- The API describes a single-producer, single-consumer buffer; no explicit null-pointer checks are provided. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..1cfc1310 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,60 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:30:35Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides bounded FIFO byte buffering with wraparound for producer-consumer data transfer. + +#### Purpose +- Implements a dynamically allocated ring buffer for writing and reading byte sequences. +- Reserves one slot to distinguish full from empty, so usable capacity is `capacity - 1`. + +#### Type +- C implementation file; defines `ringbuf_init`, `ringbuf_free`, `ringbuf_used`, `ringbuf_free_space`, `ringbuf_write`, and `ringbuf_read` for `ringbuf_t`. + +#### Input +- `ringbuf_init`: buffer pointer `rb` and requested `capacity`. +- `ringbuf_write`: buffer `rb`, source byte pointer `src`, and requested length `len`. +- `ringbuf_read`: buffer `rb`, destination byte pointer `dst`, and requested length `len`. +- Buffer state: `data`, `capacity`, `head`, and `tail`, as accessed through `ringbuf_t`. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`; initializes allocated storage and indices on success. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. +- `ringbuf_write` and `ringbuf_read` return the number of bytes transferred. +- `ringbuf_free` releases storage and resets buffer fields. + +#### Core logic +- `ringbuf_init` accepts only nonzero power-of-two capacities; allocates `capacity` bytes and initializes `head` and `tail` to zero. +- `ringbuf_used` computes occupancy as `(head - tail) & (capacity - 1)`; `ringbuf_free_space` subtracts occupancy and the reserved slot from capacity. +- `ringbuf_write` copies at most the available space, splitting the copy at the end of the allocation if it wraps; advances `head` with a capacity mask. +- `ringbuf_read` copies at most the available data, likewise splitting at wraparound; advances `tail` with a capacity mask. +- `ringbuf_free` frees the allocation and resets `data`, `capacity`, `head`, and `tail`. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — allocate and initialize buffer +- `ringbuf_free(ringbuf_t *rb) -> void` — release and reset buffer +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report buffered bytes +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report writable bytes +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — append bytes +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — consume bytes + +#### Constants and configuration +- `RINGBUF_EINVAL` — returned for zero or non-power-of-two capacity. +- `RINGBUF_ENOMEM` — returned when allocation fails. +- `RINGBUF_OK` — returned after successful initialization. + +#### Dependencies +- `"ringbuf.h"` — `ringbuf_t`, `ringbuf_status_t`, status codes, and declarations. +- `` — `malloc`, `free`. +- `` — `memcpy`. +- `uint8_t`, `size_t`. + +#### Exceptions / Errors +- Invalid capacity returns `RINGBUF_EINVAL`; allocation failure returns `RINGBUF_ENOMEM`. +- No explicit null-pointer checks for `rb`, `src`, or `dst`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..48467160 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,61 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:30:44Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Stores and retrieves byte streams through a fixed-capacity buffer shared by one producer and one consumer. + +#### Purpose +- Declares the API and data types for a single-producer, single-consumer byte ring buffer. +- Supports bounded writes and reads, plus queries for used and free capacity. + +#### Type +- C header `ringbuf.h`, with C++ linkage guards. +- `ringbuf_t`: struct containing the byte storage pointer, capacity, and producer/consumer indices. +- `ringbuf_status_t`: enum of initialization status codes. + +#### Input +- `ringbuf_init`: ring buffer pointer and requested capacity. +- `ringbuf_write`: ring buffer, source byte pointer, and requested length. +- `ringbuf_read`: ring buffer, destination byte pointer, and requested length. +- `ringbuf_used` / `ringbuf_free_space`: ring buffer pointer. +- Capacity must be a power of two; one slot is reserved, so usable capacity is `capacity - 1`. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`. +- `ringbuf_write` and `ringbuf_read` return the number of bytes actually copied. +- Usage queries return byte counts. +- `ringbuf_free` releases the buffer’s resources. + +#### Core logic +- Declares fixed-capacity byte storage with `head` as the next producer write index and `tail` as the next consumer read index. +- Provides partial read/write operations that copy up to the requested length. +- Exposes queries for occupied and available space. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — initialize buffer +- `ringbuf_free(ringbuf_t *rb) -> void` — release buffer +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — write available bytes +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — read available bytes +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report occupied bytes +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report available bytes + +#### Constants and configuration +- `RINGBUF_H`: include guard. +- `RINGBUF_OK = 0`: successful status. +- `RINGBUF_EINVAL = -1`: zero or non-power-of-two capacity. +- `RINGBUF_ENOMEM = -2`: allocation failure. + +#### Dependencies +- ``: `size_t`. +- ``: `uint8_t`. +- C++ linkage guards: `__cplusplus`, `extern "C"`. + +#### Exceptions / Errors +- `ringbuf_init` reports invalid capacity with `RINGBUF_EINVAL`. +- `ringbuf_init` reports allocation failure with `RINGBUF_ENOMEM`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/scripts/package.ai.md new file mode 100644 index 00000000..5046ac8b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/scripts/package.ai.md @@ -0,0 +1,40 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:31:43Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides lightweight operational scripts for rotating compressed backups and reporting monthly regional sales revenue from CSV order data. + +#### Purpose +- Automates timestamped directory backups with configurable archive retention. +- Converts matching-currency order CSVs into filtered monthly revenue summaries by region. + +#### Responsibilities +- **Backup rotation:** `rotate_backups.sh` validates inputs, creates a compressed archive, and removes older matching archives beyond the retention limit. +- **Sales reporting:** `sales_report.py` parses order exports, aggregates revenue by month and region, and prints totals meeting a minimum threshold. + +#### Key units +- `rotate_backups.sh` — creates a UTC-dated `.tar.gz` backup and retains the newest configured count. +- `Order` — frozen record containing an order date, region, and amount. +- `parse_orders(path, currency)` — yields validated orders matching the selected currency from a CSV. +- `revenue_by_month_and_region(orders)` — returns sorted revenue totals keyed by month and region. +- `main(argv=None)` — parses report options and prints the sales summary. + +#### Data flow +- Backup: source directory → temporary archive → completed timestamped archive in the backup directory → retention cleanup. +- Reporting: CSV files → required-column and currency checks → `Order` records → monthly regional aggregation → minimum-revenue filtering and tab-separated output. + +#### Dependencies +- Backup rotation uses Bash and external commands including `tar`, `date`, `ls`, and `rm`. +- Sales reporting uses Python standard-library CSV, date, decimal, argument-parsing, and aggregation facilities. + +#### Cross-cutting +- Both scripts are command-line utilities with configurable inputs and defaults. +- Backup rotation uses strict Bash mode and an exit trap to clean up partial archives. +- Sales amounts use `Decimal`; CSV validation and invalid matching-row data produce path- and line-aware errors. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..a035866b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,60 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:30:50Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates timestamped compressed backups of a directory and removes older archives beyond the configured retention count. + +#### Purpose +- Back up one source directory as a dated `.tar.gz` archive and retain only the newest configured number. +- Run directly as `rotate_backups.sh`; not a sourced library. + +#### Type +- Bash, from `#!/usr/bin/env bash`. +- Strict mode: `set -euo pipefail`. + +#### Input +- Positional argument `$1` → `SOURCE_DIR`; required source directory. +- Positional argument `$2` → `BACKUP_DIR`; required backup destination. +- Positional argument `$3` → `KEEP`; optional retention count, default `7`. +- Reads the contents of `SOURCE_DIR` and lists matching archives in `BACKUP_DIR`. + +#### Output +- Creates `BACKUP_DIR` if needed. +- Writes a UTC-timestamped `${name}_YYYYMMDDTHHMMSSZ.tar.gz` archive there; prints its path and human-readable size. +- Deletes archives beyond the newest `KEEP` matching archives; prints each removed path. +- Exits `2` for an invalid `KEEP` value or missing `SOURCE_DIR`. With `set -e`, failures of other commands also terminate the script. + +#### Core logic +- Requires `SOURCE_DIR` and `BACKUP_DIR`; sets `KEEP` to its argument or `7`. +- Validates `KEEP` as a positive integer; checks that `SOURCE_DIR` is a directory. +- Creates `BACKUP_DIR`, derives the source directory’s basename, and builds a UTC-dated archive path and `.partial` temporary path. +- Installs an `EXIT` trap to remove the temporary archive. +- Archives the source directory from its parent directory, then renames the completed temporary archive and prints its size. +- Lists matching archives newest first and removes entries after the first `KEEP`. + +#### Constants and configuration +- `SOURCE_DIR="${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR="${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP="${3:-7}"` +- `name="$(basename "$SOURCE_DIR")"` +- `archive="$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp="$archive.partial"` +- `archives` = array populated from `ls -1t "$BACKUP_DIR/${name}"_*.tar.gz` +- `old` = each archive selected for deletion by `"${archives[@]:$KEEP}"` + +#### Dependencies +- External commands: `basename`, `date`, `mkdir`, `tar`, `mv`, `echo`, `du`, `cut`, `ls`, `rm`. +- Bash builtin: `mapfile`. +- Archive input: `SOURCE_DIR`; archive destination and retention search: `BACKUP_DIR`. + +#### Errors and exit codes +- Exit `2` if `KEEP` is not a positive integer or `SOURCE_DIR` is not a directory. +- Required-argument expansion fails when `$1` or `$2` is missing; `set -u` and `set -e` make this terminate. +- `EXIT` trap runs `rm -f "$tmp"` to clean up the partial archive. +- No retries or timeouts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..155a6ad8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/other/scripts/sales_report.py.ai.md @@ -0,0 +1,57 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:31:01Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Aggregates CSV order amounts into monthly revenue totals by region for a selected currency, with an optional minimum-revenue filter. + +#### Purpose +- Reads one or more order CSV exports and reports revenue by month and region. +- Skips orders in other currencies and filters displayed totals by minimum revenue. + +#### Type +- Python script; defines frozen `Order` dataclass. + +#### Input +- `parse_orders(path, currency)`: CSV path and currency code; requires `order_date`, `region`, `amount`, and `currency` columns. +- `revenue_by_month_and_region(orders)`: iterable of `Order` instances. +- `main(argv=None)`: command-line arguments. +- CLI: one or more positional `csv_files`; `--currency` defaults to `EUR`; `--min-revenue` is a `Decimal` defaulting to `Decimal("0")`. +- CSV rows supply ISO-formatted `order_date`, `region`, `amount`, and `currency`. + +#### Output +- Prints tab-separated month, region, and revenue formatted to two decimal places with the selected currency. +- Prints `no orders found` to stderr and returns `1` if no matching orders exist; otherwise returns `0`. +- `parse_orders` yields `Order` records; `revenue_by_month_and_region` returns a sorted dictionary keyed by `(month, region)`. + +#### Core logic +- `parse_orders` opens each CSV as UTF-8 with newline handling, validates required headers, and skips rows whose currency does not match. +- Converts matching rows into `Order` values: parses dates with `date.fromisoformat`, strips region whitespace, and parses amounts as `Decimal`. +- Aggregates amounts by `YYYY-MM` and region, then returns totals ordered by key. +- `main` combines orders across input files, reports an empty result to stderr, and prints totals meeting `--min-revenue`. +- Script entry point exits with `main()`’s status. + +#### Public API +- `Order(order_date, region, amount)` → `Order`; immutable order date, region, and amount. +- `parse_orders(path, currency)` → generator of `Order`; yields matching-currency CSV orders. +- `revenue_by_month_and_region(orders)` → `dict`; aggregates and sorts revenue totals. +- `main(argv=None)` → `int`; parses CLI and prints report. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` +- `--currency`: default `EUR`. +- `--min-revenue`: default `Decimal("0")`. + +#### Dependencies +- Standard library: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. +- Calls: `open`, `csv.DictReader`, `date.fromisoformat`, `Decimal`, `enumerate`, `defaultdict`, `dict`, `sorted`, `ArgumentParser.add_argument`, `parse_args`, `print`, `sys.exit`. + +#### Exceptions / Errors +- `parse_orders` raises `ValueError` naming the CSV path and missing required columns when headers are absent. +- Invalid matching-row date or amount raises `ValueError` with path and line number, chained from `ValueError` or `InvalidOperation`. +- File-opening and CSV-reading errors are not caught. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..5d4c1228 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/package.ai.md @@ -0,0 +1,56 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:32:24Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> Provides AI-assisted project indexing alongside byte-processing utilities, operational reporting, and database workflows for lending, order fulfillment, and stock synchronization. + +#### Purpose +- Configure and execute AI generation for project-index content using mock, local llama.cpp, or OpenAI-compatible providers. +- Supply supporting utilities and business operations for byte analysis, backup and sales reporting, library lending, shop orders, and warehouse inventory. + +#### Responsibilities +- **AI index generation (`java/`):** Configure source scope, conditions, facts, prompts, models, and oversized-file policies; select providers, generate completions, and parse output. +- **Byte utilities (`other/`):** Compute 256-bin byte histograms and provide bounded circular-buffer reads and writes. +- **Operational scripts (`other/`):** Create and rotate compressed backups; validate order CSV data and report monthly regional revenue. +- **Library lending (`sql/library/`):** Maintain catalogue, members, branches, copies, loans, audit events, checkout/return operations, fees, and reports. +- **Shop orders (`sql/shop/`):** Manage products and customer order lines, reserve inventory, and recalculate order totals. +- **Warehouse synchronization (`sql/warehouse/`):** Aggregate supplier-feed quantities into stock levels and record synchronization outcomes. + +#### Key units +- `SrcMorphConfiguration` — defines AI run scope, prompts, models, routing rules, facts, and output metadata. +- `AiConditionEvaluator`, `AiFactExtractor`, `AiOversizeStrategy` — evaluate file-context conditions, derive source facts, and parse oversized-file policies. +- `AiGenerationProvider`, `AiGenerationProviderFactory` — define the generation contract and select mock, llama.cpp JNI, or OpenAI-compatible backends. +- `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport`, `AiCompletionParser` — run local inference, prepare and safeguard compatible API requests, and clean completion text. +- `histogram_partial`, `histogram_reduce`, `BINS` — compute and combine byte counts into a 256-bin histogram. +- `ringbuf_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read` — manage fixed-capacity circular byte storage and transfers. +- `rotate_backups.sh`, `parse_orders`, `revenue_by_month_and_region` — rotate dated archives and validate and aggregate sales data. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee` — handle library checkout, returns, and overdue fees. +- `overdue_loans`, `member_loan_stats`, `popular_books` — report overdue loans, member activity, and popular titles. +- `add_order_item` — add or increment a shop order line while checking and reserving product stock. +- `dbo.usp_SyncStock`, `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog` — synchronize supplier quantities into warehouse stock and record outcomes. + +#### Data flow +- AI configuration scopes and prepares source context; condition evaluation and fact extraction feed the selected provider, whose completion is parsed and returned with optional timings. +- Histogram input bytes become work-group partial counts and then a final histogram; ring-buffer writes and reads advance producer and consumer indices within capacity. +- Backup scripts archive a source directory and prune retained archives; sales scripts validate CSV rows, aggregate `Order` records by month and region, then filter and print totals. +- Library checkout and return operations update loan and inventory state and record audit events; reports derive lending activity from catalogue, member, and loan data. +- Shop item addition validates SKU and stock, updates order lines, decrements inventory, and recalculates totals; warehouse synchronization aggregates eligible feed rows, merges stock, and logs success or failure. + +#### Dependencies +- AI generation uses `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, configuration and file-context types, llama.cpp JNI support, Jackson, and OpenAI-compatible response types. +- Histogram kernels use OpenCL C 1.2; the ring buffer uses standard allocation and memory-copy facilities. Backup rotation uses Bash and system utilities; sales reporting uses Python standard-library modules. +- SQL workflows use PostgreSQL library objects, MySQL 8 shop objects, and SQL Server warehouse objects, with relational records linked through foreign keys and domain relationships. + +#### Cross-cutting +- AI configuration is mostly mutable JavaBeans; provider generation exposes `IOException`, and lazy local-model initialization is unsynchronized. +- OpenAI-compatible requests restrict base URLs to HTTP(S) and protect API keys from transmission over plain HTTP to non-loopback hosts. +- Ring-buffer capacity must be a power of two with one slot reserved; sales amounts use `Decimal` and invalid matching rows produce path- and line-aware errors. +- SQL constraints and indexes enforce relationships and domain checks; library loans and warehouse synchronization retain audit or operational records, while warehouse failures roll back, log, and rethrow. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..7d01edb3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 1345C900 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:32:36Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project combines AI-assisted source indexing—configured file selection, fact extraction, and model generation through selectable local, OpenAI-compatible, or mock providers—with byte-processing utilities, including a bounded ring buffer and a 256-bin byte histogram. Its SQL workflows manage library lending and auditing, web-shop orders and stock reservations, and warehouse inventory synchronization. Operational scripts support compressed-backup rotation and regional sales reporting. + +#### Packages +- java/config — Configures source-file selection, AI fact extraction, model generation, and oversized-file handling for producing project indexes. +- java — Converts configured source-file context into AI-generated project index content using selectable local, OpenAI-compatible, or mock generation. +- java/provider — Generates source-aware AI completions through selectable mock, local llama.cpp, or OpenAI-compatible backends, with completion cleanup and optional performance metrics. +- other/kernels — Computes a 256-bin frequency distribution for byte data, combining per-work-group counts into a final histogram. +- other — Provides low-level byte processing and buffering utilities alongside operational backup rotation and regional sales reporting. +- other/ringbuf — Provides bounded byte-stream buffering for producer-consumer transfer, allowing partial reads and writes across a fixed-capacity circular storage area. +- other/scripts — Provides lightweight operational scripts for rotating compressed backups and reporting monthly regional sales revenue from CSV order data. +- . — Provides AI-assisted project indexing alongside byte-processing utilities, operational reporting, and database workflows for lending, order fulfillment, and stock synchronization. +- sql/library — Manages a lending library’s catalogue, memberships, physical copy inventory, book loans, overdue reporting, and loan auditing. +- sql — Implements database workflows for library lending, web-shop order fulfillment, and warehouse stock synchronization. +- sql/shop — Maintains web-shop product inventory and customer orders, including adding order items, reserving stock, and recalculating order totals. +- sql/warehouse — Synchronizes warehouse on-hand inventory from recent supplier-feed quantities and records each synchronization’s outcome. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..a8c01890 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/01_schema.sql.ai.md @@ -0,0 +1,60 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:29:37Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models authors, books, library members, and loans, with copy availability and loan-date constraints. + +#### Purpose +- Defines the core lending-library schema for catalog, membership, and loan records. +- Enforces book-copy counts, loan due dates, and links between books, authors, members, and loans. + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- `author` + - `author_id BIGSERIAL` — primary key (unnamed constraint). + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT` — `CHECK (birth_year BETWEEN 1000 AND 2100)` (unnamed constraint). + - `country_code CHAR(2)` +- `book` + - `book_id BIGSERIAL` — primary key (unnamed constraint). + - `isbn VARCHAR(17) NOT NULL UNIQUE` (unnamed constraint). + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL` — references `author(author_id)` (unnamed constraint). + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1` — `CHECK (copies_total >= 0)` (unnamed constraint). + - `copies_free INTEGER NOT NULL DEFAULT 1` — `CHECK (copies_free >= 0)` (unnamed constraint). + - `book_free_le_total CHECK (copies_free <= copies_total)` +- `member` + - `member_id BIGSERIAL` — primary key (unnamed constraint). + - `email VARCHAR(254) NOT NULL UNIQUE` (unnamed constraint). + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` +- `loan` + - `loan_id BIGSERIAL` — primary key (unnamed constraint). + - `book_id BIGINT NOT NULL` — references `book(book_id)` (unnamed constraint). + - `member_id BIGINT NOT NULL` — references `member(member_id) ON DELETE CASCADE` (unnamed constraint). + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `loan_due_after_loan CHECK (due_on > loaned_on)` +- Indexes: + - `idx_book_author` on `book(author_id)`; default method. + - `idx_loan_member` on `loan(member_id)`; default method. + - `idx_loan_open` on `loan(due_on)`; default method; partial predicate `returned_on IS NULL`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (delete cascades from `member`) + +#### Dependencies +- `author`, `book`, `member`, and `loan` tables reference one another as listed above. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..44cb518c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/02_views.sql.ai.md @@ -0,0 +1,40 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:29:44Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Provides lending-library reports for overdue loans, member borrowing activity, and books with at least five loans in the past year. + +#### Purpose +- `overdue_loans` identifies unreturned loans past their due date and calculates days overdue. +- `member_loan_stats` summarizes borrowing per member; `popular_books` reports frequently loaned books from the past 365 days. + +#### Type +- PostgreSQL: views `overdue_loans`, `member_loan_stats`; materialized view `popular_books`; index `idx_popular_books_id`. + +#### Schema +- `overdue_loans` (view): `loan_id`, `member_id`, `email`, `title`, `due_on`, `days_overdue` (`CURRENT_DATE - due_on`). +- `member_loan_stats` (view): `member_id`, `full_name`, `loans_total`, `loans_open`, `last_loan_on`. +- `popular_books` (materialized view): `book_id`, `title`, `author_name`, `times_loaned`. +- Index `idx_popular_books_id`: unique, on `popular_books (book_id)`. + +#### Reads +- `overdue_loans`: `loan.loan_id`, `loan.member_id`, `loan.book_id`, `loan.due_on`, `loan.returned_on`; `member.member_id`, `member.email`; `book.book_id`, `book.title`. +- `member_loan_stats`: `member.member_id`, `member.full_name`; `loan.loan_id`, `loan.member_id`, `loan.returned_on`, `loan.loaned_on`. +- `popular_books`: `loan.book_id`, `loan.loaned_on`; `book.book_id`, `book.title`, `book.author_id`; `author.author_id`, `author.full_name`. + +#### Writes +- Creates materialized view `popular_books` from its query; creates unique index `idx_popular_books_id` on `popular_books`. + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..60bd16a1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/03_routines.sql.ai.md @@ -0,0 +1,56 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:29:50Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Implements library book checkout and return, calculates overdue fees, and records loan checkout/return events for auditing. + +#### Purpose +- Prevents blocked members or unavailable books from checking out; updates inventory and loan records. +- Calculates capped late fees and audits loan creation and return. + +#### Type +- PostgreSQL: table, function, procedure, trigger function, trigger. +- `fn_checkout_book(p_member_id BIGINT, p_book_id BIGINT, p_days INTEGER DEFAULT 21) RETURNS BIGINT` +- `sp_return_book(p_loan_id BIGINT)` +- `fn_late_fee(p_due_on DATE, p_returned_on DATE) RETURNS INTEGER` (`IMMUTABLE`) +- `trg_loan_audit_fn() RETURNS TRIGGER` +- `trg_loan_audit`: row-level `AFTER INSERT OR UPDATE OF returned_on` trigger on `loan`. + +#### Schema +- `loan_audit` + - `audit_id BIGSERIAL` — primary key, `NOT NULL`; constraint `loan_audit_pkey` (backing primary-key index). + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL` — CHECK `loan_audit_action_check`: value is `CHECKOUT` or `RETURN`. + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member.member_id`, `member.is_blocked` — checkout blocked-member check. +- `book.book_id`, `book.copies_free` — checkout availability; return inventory update. +- `loan.loan_id`, `loan.returned_on`, `loan.book_id` — return processing. +- `CURRENT_DATE`; `fn_late_fee` also uses `p_due_on`, `p_returned_on`. + +#### Writes +- `book.copies_free` — checkout decrements when a copy is available; return increments. +- `loan`: checkout inserts `book_id`, `member_id`, `due_on` (1 row per successful call); return updates `returned_on`. +- `loan_audit`: trigger inserts `loan_id`, `action` (1 row for an `INSERT` event as `CHECKOUT`; 1 row when `returned_on` changes from NULL to non-NULL as `RETURN`). + +#### Relationships +- `loan_audit.loan_id -> loan.loan_id` — audit association; no foreign key declared. +- `loan.book_id -> book.book_id` — checkout/return inventory association. +- `loan.member_id -> member.member_id` — checkout membership association. + +#### Routine logic +- `fn_checkout_book`: rejects blocked members and books without free copies; decrements inventory, inserts a loan due `p_days` after `CURRENT_DATE`, returns `loan_id`. +- `sp_return_book`: marks an unreturned loan returned on `CURRENT_DATE`; errors for unknown/already-returned loans; restores one free copy. +- `fn_late_fee`: computes overdue days using `p_returned_on` or `CURRENT_DATE`, floors at zero, charges 50 cents per day, caps at 2000 cents. +- `trg_loan_audit_fn`: inserts a `CHECKOUT` audit record on loan insertion or a `RETURN` record on first transition to returned; returns `NEW`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Built-ins: `now()`, `CURRENT_DATE`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..4521a2b7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,55 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:30:01Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds branch-aware physical book copies to the lending library, assigns existing copies and members to the main branch, and retires book-level copy counters. + +#### Purpose +- Introduces branches and per-copy inventory with barcode and availability status. +- Migrates existing copy and member data to the main branch; adds a copy reference to loans and removes book-level copy counters. + +#### Type +- PostgreSQL schema migration. + +#### Schema +- `branch` + - `branch_id SMALLSERIAL` — primary key (unnamed constraint). + - `name VARCHAR(100) NOT NULL` — UNIQUE (unnamed constraint). + - `city VARCHAR(100) NOT NULL`. +- `book_copy` + - `copy_id BIGSERIAL` — primary key (unnamed constraint). + - `book_id BIGINT NOT NULL` — FK to `book.book_id` (unnamed constraint). + - `branch_id SMALLINT NOT NULL` — FK to `branch.branch_id` (unnamed constraint). + - `barcode VARCHAR(32) NOT NULL` — UNIQUE (unnamed constraint). + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE'` — CHECK `status IN ('AVAILABLE', 'ON_LOAN', 'LOST')` (unnamed constraint). +- `loan`: adds `copy_id BIGINT`, FK to `book_copy.copy_id` (unnamed constraint). +- `member`: renames `joined_on` to `member_since`; adds `home_branch_id SMALLINT`, FK to `branch.branch_id` (unnamed constraint). +- `book`: drops constraint `book_free_le_total`; drops columns `copies_free`, `copies_total`. +- Index `idx_book_copy_book`: on `book_copy (book_id)`, default method and operator class. + +#### Reads +- `book`: `book_id`, `isbn`, `copies_total`, `copies_free` in the copy migration query. +- `member`: `home_branch_id` in the update predicate. + +#### Writes +- `branch`: 1 row inserted (`Main`, `Springfield`). +- `book_copy`: 1 `INSERT ... SELECT`; creates one row per generated copy for each book, with barcode from `isbn` and sequence number, and status determined by `copies_free`. +- `loan`: adds `copy_id` column. +- `member`: renames `joined_on` to `member_since`; adds `home_branch_id`; updates rows where it is NULL to `1`. +- `book`: drops `book_free_le_total`, `copies_free`, and `copies_total`. + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- Tables: `book`, `loan`, `member`. +- PostgreSQL function: `generate_series`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..fa174af6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,28 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:30:08Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Seeds a lending-library catalogue, its authors and members, and historical book-loan records. + +#### Purpose +- Populate sample author, book, member, and loan data in a transaction. + +#### Type +- DML script; PostgreSQL. + +#### Writes +- `author`: 15 single-row `INSERT`s = 15 rows; `author_id` 1–15. +- `book`: 110 single-row `INSERT`s = 110 rows; `book_id` 1–110. +- `member`: 50 single-row `INSERT`s = 50 rows; `member_id` 1–50. +- `loan`: 150 single-row `INSERT`s = 150 rows; `loan_id` 1–150. + +#### Relationships +- Seeded references: `book.author_id -> author.author_id` +- Seeded references: `loan.book_id -> book.book_id` +- Seeded references: `loan.member_id -> member.member_id` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/package.ai.md new file mode 100644 index 00000000..4f10b86c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/library/package.ai.md @@ -0,0 +1,55 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:31:57Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> Manages a lending library’s catalogue, memberships, physical copy inventory, book loans, overdue reporting, and loan auditing. + +#### Purpose +- Defines and populates a PostgreSQL lending-library database, with schema migration from book-level copy counts to branch-aware physical copies. +- Supports checkout and return operations, late-fee calculation, audit records, and borrowing reports. + +#### Responsibilities +- **Catalogue and membership:** Store authors, books, members, and their relationships; enforce identifying fields and data constraints. +- **Loan operations and auditing:** Validate checkout eligibility and availability, process returns, update inventory, calculate late fees, and record checkout/return events. +- **Inventory migration:** Add branches and individually barcoded `book_copy` records; associate members with a home branch and loans with copies; retire book-level copy counters. +- **Reporting:** Provide overdue-loan and member-activity views, plus a materialized report of books loaned at least five times in the past year. +- **Sample data:** Seed authors, books, members, and historical loans in a transaction. + +#### Key units +- `author`, `book`, `member`, `loan` — core catalogue, membership, and lending tables. +- `branch`, `book_copy` — branch locations and physical copies with barcode and availability status. +- `loan_audit` — records checkout and return actions with timestamps. +- `fn_checkout_book(p_member_id, p_book_id, p_days)` — rejects blocked members or unavailable books, decrements available inventory, creates a loan, and returns its ID. +- `sp_return_book(p_loan_id)` — marks an open loan returned and restores inventory; errors for unknown or already-returned loans. +- `fn_late_fee(p_due_on, p_returned_on)` — calculates overdue fees at 50 cents per day, capped at 2000 cents. +- `trg_loan_audit_fn`, `trg_loan_audit` — create audit records for loan insertion and first transition to returned. +- `overdue_loans` — lists open overdue loans and calculates days overdue. +- `member_loan_stats` — summarizes total/open loans and most recent loan date per member. +- `popular_books` — materialized report of books with at least five loans in the past 365 days. + +#### Data flow +- Seeded authors and books supply the catalogue; members and loans reference those records. +- Checkout checks member and inventory state, then inserts a loan; the audit trigger records checkout. Return updates the loan, restores inventory, and triggers a return audit record. +- Reporting views derive overdue and member activity from `loan`, `member`, and `book`; `popular_books` aggregates recent loan activity with book and author details. +- Migration creates a `Main` branch, generates per-book `book_copy` rows from existing copy counts, assigns members to that branch, adds loan-to-copy references, and removes book-level copy counters. + +#### Dependencies +- Internal relationships connect `book` to `author`, `loan` to `book` and `member`, and migrated `book_copy` and `member` records to `branch`. +- Reporting reads `loan`, `member`, `book`, and `author`; routines operate on `member`, `book`, `loan`, and `loan_audit`. +- PostgreSQL built-ins include `CURRENT_DATE`, `now()`, and migration function `generate_series`. + +#### Cross-cutting +- Primary keys, foreign keys, uniqueness, and checks constrain identifiers, copy status/counts, author birth years, and loan due dates. +- `member` deletion cascades to associated loans; `idx_loan_open` supports lookup of unreturned loans by due date. +- `popular_books` is materialized and has a unique index on `book_id`; `fn_late_fee` is immutable. +- Checkout and return inventory behavior is represented in the routines against book-level counters; the migration later removes those counters in favor of physical copies. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/package.ai.md new file mode 100644 index 00000000..27ba39ad --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/package.ai.md @@ -0,0 +1,45 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:32:17Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> Implements database workflows for library lending, web-shop order fulfillment, and warehouse stock synchronization. + +#### Purpose +- Defines schemas and operational routines for three business domains: borrowing and library inventory, product orders and stock reservation, and supplier-driven warehouse replenishment. +- Provides reporting, auditing, and synchronization outcome records alongside transactional data updates. + +#### Responsibilities +- **Library lending (`library/`):** Manage catalogue, members, branch-aware physical copies, loans, checkout and return, late fees, audit events, and borrowing reports; include migration and sample-data scripts. +- **Shop orders (`shop/`):** Manage products, customer orders, and order lines; validate stock, reserve inventory when adding items, and recalculate order totals. +- **Warehouse inventory (`warehouse/`):** Aggregate recent supplier-feed quantities into warehouse/SKU stock levels and log synchronization results or errors. + +#### Key units +- `author`, `book`, `member`, `branch`, `book_copy`, `loan`, `loan_audit` — library catalogue, membership, physical inventory, lending, and audit records. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee` — library checkout, return, and overdue-fee operations. +- `overdue_loans`, `member_loan_stats`, `popular_books` — library overdue, member-activity, and popular-title reports. +- `product`, `customer_order`, `order_item`, `add_order_item` — shop inventory and order-line model with stock reservation and total recalculation. +- `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog`, `dbo.usp_SyncStock` — warehouse input feed, current stock, synchronization log, and sync procedure. + +#### Data flow +- Library checkout validates member and inventory state, creates a loan, and triggers audit recording; return updates the loan and inventory and records the return. Views and the materialized report derive lending activity from catalogue, member, and loan data. +- Shop `add_order_item` finds a product by SKU, checks available stock, inserts or increments an order line, decrements stock, and recalculates the order total. +- Warehouse `dbo.usp_SyncStock` filters supplier rows by `@Since`, aggregates quantities by warehouse and SKU, merges totals into stock levels, and logs counts; on failure it rolls back, logs the error, and rethrows. + +#### Dependencies +- Library relationships connect books to authors, loans to members and books, and migrated copies and members to branches; reporting and routines use these records. +- Shop order lines reference `customer_order` and `product`; order deletion cascades to its lines. +- Warehouse synchronization reads `dbo.SupplierFeed`, merges into `dbo.StockLevel` by warehouse and SKU, and writes `dbo.SyncLog`. +- The package contains PostgreSQL library scripts, MySQL 8 shop objects, and SQL Server warehouse objects. + +#### Cross-cutting +- Relational constraints, foreign keys, indexes, and domain checks enforce valid identifiers, relationships, and statuses. +- Operational errors are handled explicitly: shop item addition signals unknown SKU or insufficient stock; warehouse sync rolls back and records an error before rethrowing. +- Auditing and operational records capture library loan events and warehouse synchronization outcomes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..f48e2ac3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,66 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:30:12Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models web-shop products, customer orders, and order lines, with a procedure that adds an item, reserves stock, and refreshes the order total. + +#### Purpose +- Defines product inventory, customer orders, and order-item records. +- Adds `add_order_item` to add or increase an order line while decrementing stock and recalculating the order total. + +#### Type +- MySQL 8 tables: `product`, `customer_order`, `order_item`; procedure: `add_order_item`. +- `customer_order.status` enum: `NEW`, `PAID`, `SHIPPED`, `CANCELLED`. + +#### Schema +- `product` + - `product_id INT UNSIGNED` — `NOT NULL`, `AUTO_INCREMENT`, primary key. + - `sku VARCHAR(40)` — `NOT NULL`, unique key `uk_product_sku`. + - `name VARCHAR(200)` — `NOT NULL`. + - `price_cents INT UNSIGNED` — `NOT NULL`. + - `stock INT` — `NOT NULL`, `DEFAULT 0`. +- `customer_order` + - `order_id BIGINT UNSIGNED` — `NOT NULL`, `AUTO_INCREMENT`, primary key. + - `customer_id BIGINT UNSIGNED` — `NOT NULL`. + - `status ENUM('NEW', 'PAID', 'SHIPPED', 'CANCELLED')` — `NOT NULL`, `DEFAULT 'NEW'`. + - `created_at DATETIME` — `NOT NULL`, `DEFAULT CURRENT_TIMESTAMP`. + - `total_cents INT UNSIGNED` — `NOT NULL`, `DEFAULT 0`. +- `order_item` + - `order_id BIGINT UNSIGNED` — `NOT NULL`, part of primary key; FK `fk_item_order` references `customer_order.order_id`, `ON DELETE CASCADE`. + - `product_id INT UNSIGNED` — `NOT NULL`, part of primary key; FK `fk_item_product` references `product.product_id`. + - `quantity SMALLINT UNSIGNED` — `NOT NULL`. + - `unit_price_cents INT UNSIGNED` — `NOT NULL`. +- Indexes: + - Primary key on `product.product_id`. + - `uk_product_sku` — unique index on `product(sku)`. + - Primary key on `customer_order.order_id`. + - `idx_order_customer` — index on `customer_order(customer_id, created_at)`. + - Primary key on `order_item(order_id, product_id)`. + +#### Reads +- `product`: `product_id`, `price_cents`, `sku`, `stock`. +- `order_item`: `order_id`, `quantity`, `unit_price_cents`. + +#### Writes +- `order_item`: insert `order_id`, `product_id`, `quantity`, `unit_price_cents`; on duplicate key, increment `quantity`. +- `product`: update `stock` by subtracting `p_qty`. +- `customer_order`: update `total_cents` from the sum of `quantity * unit_price_cents` for the specified order. + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (`fk_item_order`, cascade on delete). +- `order_item.product_id -> product.product_id` (`fk_item_product`). + +#### Routine logic +- `add_order_item(p_order_id BIGINT UNSIGNED, p_sku VARCHAR(40), p_qty SMALLINT UNSIGNED)`; all parameters are `IN`. +- Locks the matching product row where `sku = p_sku` and `stock >= p_qty`; retrieves its ID and price. +- Signals SQLSTATE `45000` with message `unknown SKU or not enough stock` if no product is found. +- Inserts an order line or increments its existing quantity; decrements product stock; recalculates the order total. + +#### Dependencies +- Tables: `product`, `order_item`, `customer_order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/shop/package.ai.md new file mode 100644 index 00000000..c82016fa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/shop/package.ai.md @@ -0,0 +1,41 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:32:05Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Maintains web-shop product inventory and customer orders, including adding order items, reserving stock, and recalculating order totals. + +#### Purpose +- Defines the product, order, and order-line data model. +- Provides `add_order_item` to add or increase an order line while updating inventory and the order total. + +#### Responsibilities +- **Inventory:** Store product SKUs, prices, and stock; enforce unique SKUs. +- **Order management:** Store customer orders, status, creation time, and total. +- **Order lines:** Record quantities and unit prices, linking products to orders. +- **Item addition:** Validate SKU and available stock, update the line and inventory, then refresh the order total. + +#### Key units +- `product` — product SKU, name, price, and stock. +- `customer_order` — customer order status, timestamp, and total. +- `order_item` — per-product quantities and unit prices within an order. +- `add_order_item` — adds or increments an order line, decrements stock, and recalculates the order total. + +#### Data flow +- `add_order_item` finds and locks a product by SKU with sufficient stock; if none is found, it signals SQLSTATE `45000`. +- It inserts the order line or increments its quantity, subtracts the requested quantity from product stock, and updates `customer_order.total_cents` from the order’s lines. + +#### Dependencies +- `order_item.order_id` references `customer_order.order_id` with cascade on order deletion. +- `order_item.product_id` references `product.product_id`. +- `customer_order` is indexed by `(customer_id, created_at)`; `product.sku` has a unique index. + +#### Cross-cutting +- Uses MySQL 8 tables, foreign keys, indexes, and a stored procedure. +- `customer_order.status` is constrained to `NEW`, `PAID`, `SHIPPED`, or `CANCELLED`. +- `add_order_item` reports unknown SKU or insufficient stock with SQLSTATE `45000` and message `unknown SKU or not enough stock`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/warehouse/package.ai.md new file mode 100644 index 00000000..8a038074 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/warehouse/package.ai.md @@ -0,0 +1,41 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:32:11Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Synchronizes warehouse on-hand inventory from recent supplier-feed quantities and records each synchronization’s outcome. + +#### Purpose +- Apply aggregated supplier quantities to warehouse/SKU stock levels for feed rows received since a specified timestamp. +- Record inserted and updated row counts on success, or the synchronization error on failure. + +#### Responsibilities +- Aggregate recent `dbo.SupplierFeed` quantities by `WarehouseId` and `Sku`. +- Insert new `dbo.StockLevel` rows or add quantities to existing stock, updating timestamps. +- Log synchronization results in `dbo.SyncLog`. + +#### Key units +- `dbo.usp_SyncStock(@Since)` — runs the feed aggregation, stock merge, and result logging. +- `dbo.StockLevel` — stores on-hand quantities keyed by warehouse and SKU. +- `dbo.SupplierFeed` — stores supplier quantities and their received timestamps. +- `dbo.SyncLog` — stores synchronization start time, inserted/updated counts, and optional error message. +- `@Changes` — captures merge actions used to calculate success-log counts. + +#### Data flow +- Filter `dbo.SupplierFeed` on `ReceivedAt >= @Since` and sum `Quantity` per warehouse/SKU. +- Merge aggregated totals into `dbo.StockLevel`: add quantities to matches or insert unmatched stock rows. +- Count merge inserts and updates through `@Changes`, then write a success row to `dbo.SyncLog`. +- On failure, roll back if needed, log `ERROR_MESSAGE()` with zero counts, and rethrow. + +#### Dependencies +- `dbo.usp_SyncStock` reads `dbo.SupplierFeed` and `dbo.StockLevel`, and writes `dbo.StockLevel` and `dbo.SyncLog`. +- Stock rows are matched by `WarehouseId` and `Sku`. + +#### Cross-cutting +- Synchronization runs in a transaction and rolls back on failure before error logging. +- Start time uses UTC; `dbo.StockLevel.UpdatedAt` defaults to `SYSUTCDATETIME()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..677309ac --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,64 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:30:21Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Aggregates recent supplier quantities by warehouse and SKU, applies them to on-hand inventory, and records synchronization results or errors. + +#### Purpose +- Synchronize `dbo.StockLevel` from supplier-feed rows received since a supplied timestamp. +- Log inserted and updated inventory-row counts, or the error if synchronization fails. + +#### Type +- T-SQL (SQL Server): tables `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`; procedure `dbo.usp_SyncStock`. + +#### Schema +- `dbo.StockLevel` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT (0)`; constraint `DF_StockLevel_OnHand` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())`; constraint `DF_StockLevel_UpdatedAt` + - Primary key `PK_StockLevel` (`WarehouseId`, `Sku`) +- `dbo.SupplierFeed` + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL`; primary key constraint `PK_SupplierFeed` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` +- `dbo.SyncLog` + - `SyncLogId INT IDENTITY(1,1) NOT NULL`; primary key constraint `PK_SyncLog` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` +- No explicit indexes created; primary-key constraints are declared on all three tables. + +#### Reads +- `dbo.SupplierFeed`: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`; filters by `ReceivedAt >= @Since` and aggregates `Quantity` by warehouse and SKU. +- `dbo.StockLevel`: `WarehouseId`, `Sku`, `OnHand` for matching and update calculations. +- `@Changes`: `MergeAction` for log counts. + +#### Writes +- `dbo.StockLevel`: `MERGE` inserts `WarehouseId`, `Sku`, `OnHand` for unmatched rows; updates `OnHand`, `UpdatedAt` for matched rows. Runtime-dependent row counts. +- `dbo.SyncLog`: success `INSERT` writes `StartedAt`, `RowsInserted`, `RowsUpdated` (one row); error `INSERT` writes those columns plus `ErrorMessage` (one row). +- `@Changes`: `MERGE OUTPUT` writes each merge action. + +#### Relationships +- Merge match: `dbo.StockLevel.WarehouseId -> source.WarehouseId`; `dbo.StockLevel.Sku -> source.Sku` (source aggregated from `dbo.SupplierFeed`). + +#### Routine logic +- `dbo.usp_SyncStock(@Since DATETIME2(0))` +- Captures UTC start time; begins a transaction. +- Aggregates feed quantities received since `@Since`; merges totals into stock, adding quantities to existing `OnHand` or inserting new stock rows. +- Logs merge insert/update counts and commits. +- On failure, rolls back if needed, logs `ERROR_MESSAGE()` with zero counts, then rethrows. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..9e7d5b5e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,55 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:32:39Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Evaluates and validates file‑selection conditions for the source‑morph indexer. + +#### Purpose +- Checks if a file satisfies an `AiCondition` tree. +- Validates condition trees for correctness. +- Detects if line counting is required. + +#### Type +`final class AiConditionEvaluator` – public, no inheritance, no interfaces. + +#### Input +- `AiCondition` tree (root node). +- `AiFileContext` providing file facts (name, size, lines, timestamps, path). + +#### Output +- `boolean` from `matches` and `usesLines`. +- Exceptions (`IllegalArgumentException`, `IllegalStateException`) on invalid trees or parsing errors. + +#### Core logic +- `matches`: recursively evaluates `and`, `or`, `not`, and leaf conditions (`extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, `pathGlob`). Uses helper methods for extensions, glob matching, and epoch parsing. +- `validate`: ensures each node sets exactly one branch/leaf; checks non‑empty lists, bounds, and valid ISO‑8601 dates. +- `usesLines`: traverses tree to find any `lines` condition, enabling lazy line counting. +- `validateGroup`: ensures combinator groups have at least one child and validates each child. +- `branchCount`: counts non‑null branch/leaf fields to enforce single‑branch rule. +- `matchesExtension`: checks file name suffix against allowed extensions. +- `globMatches`: uses `AiSourceExcludeFilter` to test path glob. +- `parseEpochMilli`: parses ISO‑8601 instant to epoch milliseconds, throws on failure. + +#### Public API +- `matches(AiCondition, AiFileContext) -> boolean` – evaluate condition tree. +- `validate(AiCondition) -> void` – throw if tree invalid. +- `usesLines(AiCondition) -> boolean` – detect line‑count requirement. + +#### Dependencies +- `java.time.Instant`, `java.time.format.DateTimeParseException` +- `java.util.Collections`, `java.util.List` +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` for misconfigured nodes, empty lists, missing bounds, blank glob, or invalid ISO‑8601. +- `IllegalStateException` if a node sets more than one branch/leaf. + +#### Concurrency +- Stateless; all methods are thread‑safe. No shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..8cb61e9f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,47 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:32:47Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> A container for child AI conditions used by `` / `` combinators in AI configuration. + +#### Purpose +- Holds a list of child `AiCondition` objects for logical combinators. + +#### Type +`public class AiConditionGroup` – class, public, no generics, annotated `@ToString`, `@SuppressWarnings({"NullAway.Init","initialization.fields.uninitialized"})`. + +#### Input +- Constructor: no parameters. +- `setConditions(Collection conditions)` – accepts a collection of `AiCondition`, may be `null`. + +#### Output +- `getConditions()` returns the internal `List` or `null`. +- Internal state: `private @Nullable List conditions` (defensively copied on set). + +#### Core logic +- `setConditions` copies the provided collection into a new `ArrayList` if not `null`; otherwise sets field to `null`. +- `getConditions` simply returns the stored list reference. + +#### Public API +- `AiConditionGroup()` – create empty group. +- `List getConditions()` – retrieve child conditions. +- `void setConditions(Collection conditions)` – set child conditions. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCondition` + +#### Exceptions / Errors +- No checked exceptions thrown. +- `setConditions` handles `null` gracefully. + +#### Concurrency +- No synchronization; class is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..c4b51ad8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,47 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:32:49Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Generates a deterministic “facts” block summarizing exact regex match counts for AI summaries. + +#### Purpose +- Provides exact, language‑agnostic counts of source elements. +- Prepends counts to AI output on oversize paths. + +#### Type +`final class AiFactExtractor` – utility class, no instances. + +#### Input +- `List counters` (nullable, may contain nulls). +- `String source` – full source text. + +#### Output +- `String` facts block ending with a blank line, or empty string if no counters. + +#### Core logic +- `factsBlock`: iterate counters, skip null or missing label/pattern, append `label: count` separated by `; `. Count via `countMatches`. Prefix with header and suffix. +- `validate`: ensure each counter has non‑null label/pattern; compile pattern to catch syntax errors; throw `IllegalArgumentException` on failure. +- `countMatches`: compile regex, iterate `Matcher.find()` to count non‑overlapping matches. + +#### Public API +- `factsBlock(List, String) -> String` – build facts block. +- `validate(List) -> void` – validate counters. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` from `validate` on missing label/pattern or invalid regex. + +#### Concurrency +- Stateless, thread‑safe; all methods are static and use local variables. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..2f620cad --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,142 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:32:51Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> A mutable bean that holds all AI‑generation parameters for a single model run, exposing getters/setters for configuration and default constants. + +#### Purpose +- Stores AI generation settings (model path, sampling, prompt limits, GPU/offload, provider details). +- Serves as data transfer object between Maven plugin configuration and AI provider implementations. + +#### Type +`public class AiGenerationConfig` +- Class, mutable JavaBean. +- Annotated `@ToString` (Lombok). +- Suppresses null‑away warnings. + +#### Input +- Constructor: no arguments. +- Setters for all fields (e.g., `setModelPath`, `setContextSize`, `setTemperature`, …). +- `setDrySequenceBreakers`, `setStopStrings`, `setCalibration` accept lists or nullable values. + +#### Output +- Getters return current configuration values (e.g., `getModelPath`, `getContextSize`, `getTemperature`, …). +- `getDrySequenceBreakers` and `getStopStrings` return unmodifiable lists. +- `getCalibration` returns optional calibration. + +#### Core logic +- Defines numerous `public static final` defaults for context size, output tokens, temperature, threads, sampling thresholds, GPU/offload settings, cache types, batch sizes, device selection, provider, API key, DRY knobs, etc. +- Each setter assigns the provided value, sometimes normalizing `null` to a default (e.g., `setLazyMode`, `setCacheTypeK`). +- No additional computation; configuration is purely stored. + +#### Public API +- `AiGenerationConfig()` → constructor +- `String getModelPath()` → model file path +- `void setModelPath(String)` → set model path +- `int getContextSize()` → context window size +- `void setContextSize(int)` → set context size +- `int getMaxOutputTokens()` → max output tokens +- `void setMaxOutputTokens(int)` → set max output tokens +- `float getTemperature()` → sampling temperature +- `void setTemperature(float)` → set temperature +- `int getThreads()` → CPU thread count +- `void setThreads(int)` → set threads +- `int getCharsPerToken()` → chars per token ratio +- `void setCharsPerToken(int)` → set chars per token +- `int getMaxInputChars()` → max input characters +- `void setMaxInputChars(int)` → set max input chars +- `boolean isWarnOnTrim()` → trim warning flag +- `void setWarnOnTrim(boolean)` → set trim warning flag +- `float getTopP()` → nucleus sampling threshold +- `void setTopP(float)` → set top‑p +- `int getTopK()` → top‑k limit +- `void setTopK(int)` → set top‑k +- `float getMinP()` → min‑p threshold +- `void setMinP(float)` → set min‑p +- `float getTopNSigma()` → top‑n‑sigma threshold +- `void setTopNSigma(float)` → set top‑n‑sigma +- `float getRepeatPenalty()` → repetition penalty +- `void setRepeatPenalty(float)` → set repeat penalty +- `Boolean getChatTemplateEnableThinking()` → chat‑template thinking mode +- `void setChatTemplateEnableThinking(Boolean)` → set chat‑template thinking mode +- `boolean isCachePrompt()` → prompt‑caching flag +- `boolean isSwaFull()` → full‑SWA flag +- `void setSwaFull(boolean)` → set full‑SWA flag +- `int getCacheReuse()` → cache‑reuse chunk size +- `void setCacheReuse(int)` → set cache‑reuse +- `int getGpuLayers()` → GPU offload layers +- `void setGpuLayers(int)` → set GPU layers +- `int getCpuMoeLayers()` → CPU MoE layers +- `void setCpuMoeLayers(int)` → set CPU MoE layers +- `int getSeed()` → RNG seed +- `void setSeed(int)` → set seed +- `int getCpuFfnLayers()` → CPU FFN layers +- `void setCpuFfnLayers(int)` → set CPU FFN layers +- `int getKvUnifiedPerSlot()` → KV unified per‑slot cap +- `void setKvUnifiedPerSlot(int)` → set KV cap +- `String getLazyMode()` → tensor‑read laziness +- `void setLazyMode(String)` → set lazy mode +- `int getRepeatLastN()` → repeat‑penalty window +- `void setRepeatLastN(int)` → set repeat‑penalty window +- `String getCacheTypeK()` → KV cache type K +- `void setCacheTypeK(String)` → set cache type K +- `String getCacheTypeV()` → KV cache type V +- `void setCacheTypeV(String)` → set cache type V +- `boolean isFlashAttn()` → Flash Attention flag +- `void setFlashAttn(boolean)` → set Flash Attention +- `int getBatchSize()` → logical batch size +- `void setBatchSize(int)` → set batch size +- `int getUbatchSize()` → physical batch size +- `void setUbatchSize(int)` → set ubatch size +- `int getThreadsBatch()` → batch thread count +- `void setThreadsBatch(int)` → set batch threads +- `int getMainGpu()` → primary GPU index +- `void setMainGpu(int)` → set main GPU +- `String getDevices()` → device list +- `void setDevices(String)` → set devices +- `String getProvider()` → AI provider +- `void setProvider(String)` → set provider +- `String getRemoteModel()` → remote model ID +- `void setRemoteModel(String)` → set remote model +- `String getBaseUrl()` → base URL +- `void setBaseUrl(String)` → set base URL +- `String getApiKeyEnv()` → API key env var name +- `void setApiKeyEnv(String)` → set API key env var +- `String getReasoningEffort()` → reasoning effort level +- `void setReasoningEffort(String)` → set reasoning effort +- `int getReasoningBudgetTokens()` → reasoning budget +- `void setReasoningBudgetTokens(int)` → set reasoning budget +- `float getDryMultiplier()` → DRY multiplier +- `void setDryMultiplier(float)` → set DRY multiplier +- `float getDryBase()` → DRY base +- `void setDryBase(float)` → set DRY base +- `int getDryAllowedLength()` → DRY allowed length +- `void setDryAllowedLength(int)` → set DRY allowed length +- `int getDryPenaltyLastN()` → DRY penalty window +- `void setDryPenaltyLastN(int)` → set DRY penalty window +- `List getDrySequenceBreakers()` → DRY sequence breakers +- `void setDrySequenceBreakers(List)` → set DRY sequence breakers +- `List getStopStrings()` → stop strings +- `void setStopStrings(List)` → set stop strings +- `AiCalibration getCalibration()` → calibration +- `void setCalibration(AiCalibration)` → set calibration + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`. +- `lombok.ToString`. +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.config.AiCalibration`. + +#### Exceptions / Errors +- No checked exceptions thrown. +- Setters accept `null` for nullable fields, normalizing to defaults. + +#### Concurrency +- No synchronization; the bean is intended for single‑threaded configuration use. +- Immutable lists returned via `Collections.unmodifiableList`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..4a47be7e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,50 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:33:01Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Defines how to handle source files that exceed the model’s context window during routing. + +#### Purpose +- Controls oversized file handling per routing rule. +- Offers abort, sample, map‑reduce, or deterministic strategies. + +#### Type +`public enum AiOversizeStrategy` +- constants: FAIL, SAMPLE, MAP_REDUCE, DETERMINISTIC +- field: `private final String configValue` +- field: `public static final AiOversizeStrategy DEFAULT = FAIL` +- constructor: `AiOversizeStrategy(String)` +- methods: `String configValue()` +- static method: `AiOversizeStrategy fromConfig(String)` + +#### Input +- `configValue` string per constant. +- `fromConfig` receives a nullable `String` value from `` config. + +#### Output +- `configValue()` returns the strategy’s config token. +- `fromConfig` returns the matching `AiOversizeStrategy` or throws `IllegalArgumentException` for unknown tokens. + +#### Core logic +- `fromConfig` trims input, defaults to `DEFAULT` if null/blank. +- Iterates over `values()` comparing `configValue` case‑insensitively. +- Throws `IllegalArgumentException` with message listing valid tokens if no match. + +#### Public API +- `configValue() -> String` returns strategy token. +- `fromConfig(String) -> AiOversizeStrategy` parses config value. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` when config value is non‑blank and unrecognized. + +#### Concurrency +- Immutable enum; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..f9eaa31d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,99 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:33:03Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> A mutable configuration bean that aggregates all parameters required for a srcmorph run, mirroring Maven plugin fields for cross‑surface binding. + +#### Purpose +- Holds runtime settings for AI‑powered source generation. +- Serves as a single source of truth for Maven, JSON/YAML, or programmatic configuration. + +#### Type +`public class SrcMorphConfiguration` – mutable JavaBean, Lombok `@ToString`, no special modifiers. + +#### Input +- Constructor: no arguments, defaults applied. +- Fields set via public setters or reflection (Maven, Jackson, etc.). +- Dependencies: `File`, `List`, `AiPromptDefinition`, `Nullable` annotation. + +#### Output +- Getter methods expose current configuration. +- Mutated fields updated by setters. +- No external resources written directly. + +#### Core logic +- Provides default constants for output directory, generation provider, llama.cpp settings, and AI version. +- Stores optional lists (`subtrees`, `excludes`, `fileExtensions`, `promptDefinitions`, `aiDefinitions`, `fieldGenerations`, `factDefinitions`). +- Tracks size bounds (`minFileSizeBytes`, `maxFileSizeBytes`). +- Flags for force regeneration and plan‑only mode. +- Holds paths for model directory and llama.cpp model file. +- Records plugin and AI logic versions, and optional project title. + +#### Public API +- `File getBaseDirectory() -> base directory` +- `void setBaseDirectory(File) -> set base directory` +- `File getOutputDirectory() -> output dir` +- `void setOutputDirectory(File) -> set output dir` +- `boolean isForce() -> force flag` +- `void setForce(boolean) -> set force flag` +- `List getSubtrees() -> subtrees` +- `void setSubtrees(List) -> set subtrees` +- `List getExcludes() -> excludes` +- `void setExcludes(List) -> set excludes` +- `List getFileExtensions() -> extensions` +- `void setFileExtensions(List) -> set extensions` +- `long getMinFileSizeBytes() -> min size` +- `void setMinFileSizeBytes(long) -> set min size` +- `long getMaxFileSizeBytes() -> max size` +- `void setMaxFileSizeBytes(long) -> set max size` +- `boolean isPlanOnly() -> plan‑only flag` +- `void setPlanOnly(boolean) -> set plan‑only flag` +- `String getGenerationProvider() -> provider name` +- `void setGenerationProvider(String) -> set provider` +- `List getPromptDefinitions() -> prompts` +- `void setPromptDefinitions(List) -> set prompts` +- `List getAiDefinitions() -> model defs` +- `void setAiDefinitions(List) -> set model defs` +- `File getModelDirectory() -> model dir` +- `void setModelDirectory(File) -> set model dir` +- `List getFieldGenerations() -> field rules` +- `void setFieldGenerations(List) -> set field rules` +- `List getFactDefinitions() -> fact groups` +- `void setFactDefinitions(List) -> set fact groups` +- `String getLlamaModelPath() -> llama model path` +- `void setLlamaModelPath(String) -> set llama model path` +- `int getLlamaContextSize() -> context size` +- `void setLlamaContextSize(int) -> set context size` +- `int getLlamaMaxOutputTokens() -> max tokens` +- `void setLlamaMaxOutputTokens(int) -> set max tokens` +- `float getLlamaTemperature() -> temperature` +- `void setLlamaTemperature(float) -> set temperature` +- `int getLlamaThreads() -> thread count` +- `void setLlamaThreads(int) -> set thread count` +- `String getPluginVersion() -> plugin version` +- `void setPluginVersion(String) -> set plugin version` +- `String getAiVersion() -> AI logic version` +- `void setAiVersion(String) -> set AI logic version` +- `String getProjectName() -> project title` +- `void setProjectName(String) -> set project title` + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `org.jspecify.annotations.Nullable` +- Referenced types: `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiGenerationConfig` + +#### Exceptions / Errors +- No checked exceptions thrown. +- Null values allowed for optional fields; `@Nullable` indicates permissible nulls. + +#### Concurrency +- No synchronization; intended for single‑threaded configuration assembly. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..d6d38493 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,51 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:34:18Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> A Java library that powers AI‑driven source‑code generation, providing configuration, condition evaluation, fact extraction, and oversized‑file handling for a Maven‑style plugin. + +#### Purpose +- Configure and run AI‑powered source‑generation workflows. +- Evaluate file‑selection rules, extract deterministic facts, and manage oversized source files. + +#### Responsibilities +- **Configuration** – `SrcMorphConfiguration`, `AiGenerationConfig`, `AiOversizeStrategy`. +- **Condition evaluation** – `AiConditionEvaluator`, `AiConditionGroup`. +- **Fact extraction** – `AiFactExtractor`. +- **Oversize handling** – `AiOversizeStrategy` enum. + +#### Key units +- `SrcMorphConfiguration` – mutable bean aggregating all runtime settings (paths, file filters, AI provider, model definitions, prompts, field rules, fact groups). +- `AiGenerationConfig` – bean holding AI provider parameters (model path, context size, sampling, GPU/offload, cache, DRY, etc.). +- `AiOversizeStrategy` – enum with `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`; parses config tokens. +- `AiConditionEvaluator` – stateless class that validates and evaluates `AiCondition` trees against `AiFileContext`. +- `AiConditionGroup` – container for child `AiCondition` objects used by ``/`` combinators. +- `AiFactExtractor` – utility that builds a deterministic facts block from regex counters. + +#### Data flow +1. **Configuration**: `SrcMorphConfiguration` is populated (Maven, JSON/YAML, or programmatically). +2. **Condition tree**: `AiConditionEvaluator` validates the tree and checks each file via `AiFileContext`. +3. **Fact extraction**: `AiFactExtractor.factsBlock` generates a facts header for oversized files. +4. **Oversize strategy**: `AiOversizeStrategy.fromConfig` selects handling logic for files exceeding the model context window. +5. **Generation**: `AiGenerationConfig` supplies runtime parameters to the AI provider. + +#### Dependencies +- **Internal**: `AiCondition`, `AiFileContext`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`. +- **External**: `java.time`, `java.util`, `java.util.regex`, `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`, Lombok (`@ToString`), `org.jspecify.annotations.Nullable`. + +#### Cross‑cutting +- **Thread safety**: `AiConditionEvaluator` and `AiFactExtractor` are stateless and thread‑safe; configuration beans are not synchronized. +- **Validation**: `AiConditionEvaluator.validate` and `AiFactExtractor.validate` enforce structural correctness and regex syntax. +- **Immutable lists**: `AiGenerationConfig` exposes unmodifiable lists for DRY breakers and stop strings. +- **Error handling**: `IllegalArgumentException` for misconfigured trees, unknown oversize tokens, or invalid regex patterns; `IllegalStateException` for node conflicts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..d0fb08fc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,60 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:34:29Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A Java framework that orchestrates AI‑driven source‑code generation, from configuration and rule evaluation to provider‑agnostic model execution and response handling. + +#### Purpose +- Centralize AI‑powered code transformation workflows. +- Manage configuration, file‑selection logic, fact extraction, and oversized‑file strategies. +- Abstract multiple AI back‑ends (local llama.cpp, OpenAI‑compatible services) and provide unified request/response handling. + +#### Responsibilities +- **Configuration & Validation** – `SrcMorphConfiguration`, `AiGenerationConfig`, `AiOversizeStrategy`, `AiConditionEvaluator`. +- **Rule & Fact Processing** – `AiConditionGroup`, `AiFactExtractor`. +- **Provider Management** – `AiGenerationProviderFactory`, `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport`. +- **Response Parsing** – `AiCompletionParser`. +- **Performance & Error Handling** – `AiGenerationTimings`, exception handling across providers. + +#### Key units +- `SrcMorphConfiguration` – mutable bean aggregating paths, filters, AI provider, model definitions, prompts, field rules, fact groups. +- `AiGenerationConfig` – immutable bean with provider parameters (model path, context size, sampling, GPU/offload, cache, DRY, etc.). +- `AiOversizeStrategy` – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`) selecting oversize handling logic. +- `AiConditionEvaluator` – stateless validator/evaluator for `AiCondition` trees against `AiFileContext`. +- `AiFactExtractor` – builds deterministic facts block from regex counters. +- `AiGenerationProviderFactory` – resolves provider key and instantiates `AiGenerationProvider`. +- `LlamaCppJniAiGenerationProvider` – local llama.cpp JNI implementation. +- `OpenAiCompatibleProviderSupport` – HTTP client for OpenAI‑compatible APIs. +- `AiCompletionParser` – strips internal reasoning blocks from LLM outputs. +- `LlamaCppJniConfig` – immutable builder‑style record for llama.cpp parameters. +- `AiGenerationTimings` – captures latency metrics for local and remote calls. + +#### Data flow +1. **Setup**: `SrcMorphConfiguration` is populated (Maven, JSON/YAML, or programmatically). +2. **Rule Validation**: `AiConditionEvaluator.validate` checks the condition tree; `AiConditionEvaluator.evaluate` applies it to each file via `AiFileContext`. +3. **Fact Header**: `AiFactExtractor.factsBlock` generates a deterministic facts block for oversized files. +4. **Oversize Decision**: `AiOversizeStrategy.fromConfig` selects handling logic for files exceeding the model context window. +5. **Provider Selection**: `AiGenerationProviderFactory.create` resolves the effective provider key and returns an `AiGenerationProvider`. +6. **Request Construction**: Caller builds an `AiGenerationRequest` (prompt key, source file, text, header). +7. **Generation**: + - *Local*: `LlamaCppJniAiGenerationProvider.generate` loads the GGUF model, runs `chatComplete`, parses JSON, returns text and timings. + - *Remote*: `OpenAiCompatibleProviderSupport` builds the HTTP body, sends the request, parses `ChatResponse`, and records timings. +8. **Post‑processing**: `AiCompletionParser.parseCompletion` removes reasoning blocks, yielding the final answer. + +#### Dependencies +- **Internal**: `AiCondition`, `AiFileContext`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`, `AiPromptSupport`, `AiGenerationRequest`, `Java8CompatibilityHelper`. +- **External**: `java.time`, `java.util`, `java.util.regex`, `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`, Lombok (`@ToString`), `org.jspecify.annotations.Nullable`, `net.ladenthin.llama` (model, args, JSON parsing), `com.fasterxml.jackson` (JSON), `java.net`, `java.io`. + +#### Cross‑cutting +- **Thread safety**: `AiConditionEvaluator`, `AiFactExtractor`, `AiCompletionParser`, and immutable config objects (`LlamaCppJniConfig`) are stateless and thread‑safe. +- **Validation**: Structural checks in `AiConditionEvaluator.validate` and regex validation in `AiFactExtractor.validate`. +- **Immutability**: `AiGenerationConfig` exposes unmodifiable lists for DRY breakers and stop strings. +- **Error handling**: `IllegalArgumentException` for misconfigurations; `IllegalStateException` for node conflicts; `IOException` for provider‑level issues. +- **Performance metrics**: `AiGenerationTimings` captures latency for both local and remote providers, enabling profiling and optimization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..199f1e48 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,46 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:33:10Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Strips Gemma‑4 style chain‑of‑thought blocks from LLM completions, returning only the final answer. + +#### Purpose +- Extracts the model’s answer from raw completion text. +- Removes internal reasoning blocks before persisting to an AI index. + +#### Type +`public class AiCompletionParser` – class, non‑final, annotated `@ToString`. + +#### Input +- `parseCompletion(String response)` – raw LLM completion, may be `null`. + +#### Output +- `parseCompletion` returns a non‑null trimmed answer string. +- Throws `IOException` if a thinking block starts but no closing marker appears. + +#### Core logic +- If `response` is `null`, return empty string. +- Trim whitespace; if it does not start with `THINKING_BLOCK_START_MARKER`, return trimmed text. +- Remove the leading marker, locate the first `THINKING_BLOCK_END_MARKER`. +- If the end marker is missing, throw `IOException` with a detailed message. +- Return the substring after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` – constructor, no-op. +- `String parseCompletion(String response) throws IOException` – clean answer extraction. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `IOException` when a thinking block starts but ends abruptly (token budget exhausted). + +#### Concurrency +- Stateless; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..a2886151 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,48 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:33:12Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Provides a pluggable AI backend that generates text for a generation request. + +#### Purpose +- Supplies generated text for AI transformation tasks. +- Supports optional timing metrics for calibration. + +#### Type +`public interface AiGenerationProvider` – interface, extends `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest request)` – receives a request with prompt key, source file, source text, and current header. +- `generateWithTimings(AiGenerationRequest request)` – same request, returns text plus timing data. + +#### Output +- `generate` returns a non‑null `String` (may be blank). +- `generateWithTimings` returns an `AiGenerationTimings` containing generated text and timing metrics. +- `close` performs no action by default. + +#### Core logic +- `generate` is abstract; concrete providers implement text generation. +- `generateWithTimings` delegates to `generate`, wraps result in `AiGenerationTimings` with zeroed timing fields. +- `close` is a no‑op default implementation. + +#### Public API +- `generate(AiGenerationRequest) -> String` – produce text for request. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – produce text with timing. +- `close() -> void` – close provider resources. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.document.AiGenerationTimings` + +#### Exceptions / Errors +- `generate` and `generateWithTimings` throw `IOException` if provider fails. + +#### Concurrency +- No explicit synchronization; implementations may manage thread safety. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..b999af96 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,66 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:33:14Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Instantiates AI generation providers based on a provider key or model configuration. + +#### Purpose +- Supplies an `AiGenerationProvider` instance for a run or model. +- Resolves provider key via `effectiveProvider`. + +#### Type +`public class AiGenerationProviderFactory` +- Modifiers: public +- Annotations: `@ToString` +- No superclass or interfaces. + +#### Input +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` + - `providerName`: run‑level provider key (may be null/blank). + - `llamaConfig`: model configuration, provides `provider()` key. + - `promptSupport`: lookup support for prompts. + +#### Output +- Returns a concrete `AiGenerationProvider` instance: + - `MockAiGenerationProvider` for mock or blank keys. + - `LlamaCppJniAiGenerationProvider` for `llamacpp-jni`. + - `OpenAiCompatibleAiGenerationProvider` for `openai-compatible`. +- Throws `IllegalArgumentException` for unknown keys. + +#### Core logic +- `effectiveProvider` selects the non‑blank provider key, preferring the model’s key over the run’s. +- `create`: + 1. Determine effective key via `effectiveProvider`. + 2. If key is null or blank, return `MockAiGenerationProvider`. + 3. Switch on key: + - `mock`: return `MockAiGenerationProvider`. + - `llamacpp-jni`: instantiate `LlamaCppJniAiGenerationProvider` with config and prompt support. + - `openai-compatible`: instantiate `OpenAiCompatibleAiGenerationProvider` with config and prompt support. + - default: throw `IllegalArgumentException`. + +#### Public API +- `AiGenerationProviderFactory()` → no-op constructor. +- `static @Nullable String effectiveProvider(String runProvider, String modelProvider)` → resolve provider key. +- `AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` → instantiate provider. + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.provider.MockAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.OpenAiCompatibleAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniConfig` + +#### Exceptions / Errors +- `IllegalArgumentException` when provider key is unrecognised. + +#### Concurrency +- No explicit synchronization; instance fields are immutable after construction. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..32131fe7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,55 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:33:18Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Provides local GGUF model inference via llama.cpp for AI text generation. + +#### Purpose +- Implements `AiGenerationProvider` using native llama.cpp. +- Lazily loads and caches a `LlamaModel` for repeated requests. +- Parses chat responses and exposes timings. + +#### Type +`final class LlamaCppJniAiGenerationProvider implements AiGenerationProvider, AutoCloseable` +- Lombok `@ToString` (excludes native handle). +- Fields: `config`, `model`, `promptSupport`, `support`, `completionParser`, `chatResponseParser`, `compatibilityHelper`. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate(AiGenerationRequest request)` / `generateWithTimings(AiGenerationRequest request)` consume request data. +- `model()` builds `ModelParameters` from `config` and `support`. + +#### Output +- `generate` returns generated text string. +- `generateWithTimings` returns `AiGenerationTimings` with text, token counts, and throughput. +- `close` releases native `LlamaModel`. + +#### Core logic +- Lazy initialization of `LlamaModel` in `model()`: builds `ModelParameters` with config options (context, threads, GPU layers, KV cache, flash attention, quantization, batch sizes, device selection). +- `generate`: runs `chatResponse`, warns on truncation, logs cache reuse, parses completion text. +- `chatResponse`: calls `model().chatComplete` with inference parameters from `support`, parses JSON via `ChatResponseParser`. +- `generateWithTimings`: obtains `ChatResponse`, extracts text and `Timings`, constructs `AiGenerationTimings` with prompt/cache/predicted metrics. +- `close`: closes native model if loaded. + +#### Public API +- `generate(AiGenerationRequest request) -> String` – produce text. +- `generateWithTimings(AiGenerationRequest request) -> AiGenerationTimings` – produce text with metrics. +- `close() -> void` – release native resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.args.*`, `net.ladenthin.llama.json.ChatResponseParser`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.*`, `net.ladenthin.srcmorph.document.AiGenerationRequest`, `net.ladenthin.srcmorph.prompt.AiPromptSupport`, `net.ladenthin.srcmorph.support.Java8CompatibilityHelper`, `org.jspecify.annotations.Nullable`, Lombok `@ToString`. + +#### Exceptions / Errors +- `generate` declares `throws IOException`. +- `model()` may throw unchecked exceptions from native calls. +- `close` handles null model gracefully. + +#### Concurrency +- Single‑threaded usage implied; no explicit synchronization. +- `model` is lazily initialized without double‑checked locking; safe in single‑threaded context. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..70536d69 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,101 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:33:21Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Builds an immutable configuration for llama.cpp JNI provider, exposing all model‑level and runtime options. + +#### Purpose +- Holds all llama.cpp JNI parameters. +- Provides a fluent builder with defaults from `AiGenerationConfig`. + +#### Type +`final class LlamaCppJniConfig` +- Immutable, record‑style value type. +- Annotated `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. +- 41 private final fields. + +#### Input +- `Builder` instance supplied to private constructor. +- Builder fields initialized from `AiGenerationConfig.DEFAULT_*` or caller values. +- `modelPath` required via `builder(String)`. + +#### Output +- Immutable `LlamaCppJniConfig` instance. +- Getter methods expose each field. +- `drySequenceBreakers()` and `stopStrings()` return unmodifiable lists. + +#### Core logic +- Private constructor copies all 41 builder fields. +- `builder(String)` creates a new `Builder` with required `modelPath`. +- Each builder setter assigns a value and returns `this`. +- `build()` returns a new `LlamaCppJniConfig` from the builder. + +#### Public API +- `static Builder builder(String modelPath) -> Builder` – start building. +- Getters: + - `modelPath()` → model file path + - `contextSize()` → context window size + - `maxOutputTokens()` → max output tokens + - `temperature()` → sampling temperature + - `threads()` → CPU thread count + - `topP()` → nucleus‑sampling threshold + - `topK()` → top‑k limit + - `minP()` → min‑p threshold + - `topNSigma()` → top‑n‑sigma threshold + - `repeatPenalty()` → repetition penalty + - `chatTemplateEnableThinking()` → chat‑template thinking flag (nullable) + - `cachePrompt()` → prompt caching enabled + - `swaFull()` → full SWA cache kept + - `cacheReuse()` → KV prefix‑reuse chunk size + - `gpuLayers()` → GPU layers offloaded + - `seed()` → RNG seed + - `cpuMoeLayers()` → CPU MoE layers + - `cpuFfnLayers()` → CPU FFN layers + - `kvUnifiedPerSlot()` → per‑slot KV cap + - `lazyMode()` → tensor‑read laziness + - `repeatLastN()` → repeat‑penalty window + - `cacheTypeK()` → KV cache type K + - `cacheTypeV()` → KV cache type V + - `flashAttn()` → Flash Attention enabled + - `batchSize()` → logical batch size + - `ubatchSize()` → physical batch size + - `threadsBatch()` → batch thread count + - `mainGpu()` → primary GPU index + - `devices()` → device selection + - `provider()` → AI provider name + - `remoteModel()` → remote model ID + - `baseUrl()` → OpenAI‑compatible base URL + - `apiKeyEnv()` → API key environment variable name + - `reasoningEffort()` → reasoning‑effort value + - `reasoningBudgetTokens()` → reasoning token budget + - `dryMultiplier()` → DRY multiplier + - `dryBase()` → DRY base + - `dryAllowedLength()` → DRY allowed length + - `dryPenaltyLastN()` → DRY penalty look‑back + - `drySequenceBreakers()` → unmodifiable list of DRY breakers + - `stopStrings()` → unmodifiable list of stop strings + +- `Builder` methods: + - 37 setters (`contextSize`, `maxOutputTokens`, `temperature`, `threads`, `topP`, `topK`, `minP`, `topNSigma`, `repeatPenalty`, `chatTemplateEnableThinking`, `cachePrompt`, `swaFull`, `cacheReuse`, `gpuLayers`, `seed`, `cpuMoeLayers`, `cpuFfnLayers`, `kvUnifiedPerSlot`, `lazyMode`, `repeatLastN`, `cacheTypeK`, `cacheTypeV`, `flashAttn`, `batchSize`, `ubatchSize`, `threadsBatch`, `mainGpu`, `devices`, `provider`, `remoteModel`, `baseUrl`, `apiKeyEnv`, `reasoningEffort`, `reasoningBudgetTokens`, `dryMultiplier`, `dryBase`, `dryAllowedLength`, `dryPenaltyLastN`, `drySequenceBreakers`, `stopStrings`). + - `build()` → `LlamaCppJniConfig`. + +#### Dependencies +- `net.ladenthin.srcmorph.config.AiGenerationConfig` for default constants. +- `net.ladenthin.srcmorph.support.ConvertToRecord`. +- `org.jspecify.annotations.Nullable`. +- `java.util.*` (Collections, List, Objects). +- Lombok annotations (`@EqualsAndHashCode`, `@ToString`). + +#### Exceptions / Errors +- `builder(String)` throws `NullPointerException` if `modelPath` is `null`. +- `Builder` constructor uses `Objects.requireNonNull` for `modelPath`. + +#### Concurrency +- Immutable after construction; thread‑safe. +- Builder is not thread‑safe; intended for single‑thread use. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..6436dc8d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,77 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:33:29Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Builds the JSON request, endpoint, and key handling for an OpenAI‑compatible chat‑completion provider, and interprets responses and errors. + +#### Purpose +- Constructs chat‑completion request bodies. +- Validates and builds endpoint URLs. +- Retrieves and secures API keys. +- Parses success status and error messages. +- Computes generation timings. + +#### Type +`final class OpenAiCompatibleProviderSupport` – class, final, no inheritance, no interfaces. + +#### Input +- `LlamaCppJniConfig config` – model URL, key env, sampling knobs. +- `AiPromptSupport promptSupport` – system/user prompt templates. +- `Function environment` – env var lookup. +- `AiGenerationRequest request` – source file and text. +- `String endpoint` – URL for key validation. +- `String endpoint, int status, String body` – for error message. +- `String text, ChatResponse response, double seconds` – for timings. + +#### Output +- JSON string body (`requestBody`). +- Endpoint URL (`endpoint`). +- Optional trimmed API key (`apiKey`, `apiKeyFor`). +- Boolean success flag (`isSuccess`). +- Error message string (`errorMessage`). +- `AiGenerationTimings` object (`timings`). + +#### Core logic +- `requestBody`: builds JSON with model, messages, token limits, temperature, top‑p, top‑k, min‑p, repetition penalty, seed, stop strings, reasoning effort, stream flag. +- `endpoint`: trims base URL, ensures http/https scheme, removes trailing slashes, appends `/chat/completions`. +- `apiKey`: reads env var, trims, returns null if unset or blank. +- `apiKeyFor`: ensures key is only sent over https or to loopback hosts; otherwise throws `IOException`. +- `isLoopbackHost`: checks host against `localhost`, IPv4 127.x.x.x, or `[::1]`. +- `isSuccess`: true for 200–299. +- `errorMessage`: truncates body to 500 chars, appends ellipsis, formats message. +- `timings`: calculates completion tokens, decode rate, constructs `AiGenerationTimings`. + +#### Public API +- `requestBody(AiGenerationRequest) -> String` – build request JSON. +- `endpoint() -> String` – build chat‑completion URL. +- `apiKey() -> @Nullable String` – fetch API key. +- `apiKeyFor(String) -> @Nullable String` – secure key for endpoint. +- `isLoopbackHost(String) -> boolean` – check loopback host. +- `isSuccess(int) -> boolean` – check HTTP success. +- `errorMessage(String, int, String) -> String` – format error. +- `timings(String, ChatResponse, double) -> AiGenerationTimings` – compute timings. + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper`, `ArrayNode`, `ObjectNode` +- `java.io.IOException`, `java.net.URL` +- `java.util.List`, `java.util.Objects`, `java.util.function.Function`, `java.util.regex.Pattern` +- `lombok.ToString` +- `net.ladenthin.llama.value.ChatResponse`, `net.ladenthin.llama.value.Usage` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` if `baseUrl` lacks http/https scheme. +- `IOException` if API key sent over insecure non‑loopback HTTP or URL parsing fails. +- `IOException` in `requestBody` if JSON serialization fails. + +#### Concurrency +- All fields are immutable after construction; thread‑safe. No mutable shared state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..ac842579 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,55 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:34:24Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> A framework for configuring, selecting, and executing AI text‑generation back‑ends—whether local llama.cpp or OpenAI‑compatible services—while parsing responses, handling errors, and measuring performance. + +#### Purpose +- Provide a pluggable AI generation layer for source‑code transformation tasks. +- Abstract model configuration, request construction, and result parsing across multiple providers. + +#### Responsibilities +- **Provider selection & instantiation** – `AiGenerationProviderFactory` resolves the effective provider key and creates the appropriate `AiGenerationProvider`. +- **Local inference** – `LlamaCppJniAiGenerationProvider` loads a GGUF model via JNI, runs chat completions, and reports timings. +- **Remote inference** – `OpenAiCompatibleProviderSupport` builds HTTP requests, validates endpoints, secures API keys, and interprets responses. +- **Response cleaning** – `AiCompletionParser` strips internal reasoning blocks from LLM outputs. +- **Configuration** – `LlamaCppJniConfig` holds all llama.cpp parameters in an immutable, builder‑style record. + +#### Key units +- `AiGenerationProviderFactory` – resolves provider key, creates `AiGenerationProvider`. +- `LlamaCppJniAiGenerationProvider` – implements `AiGenerationProvider` for llama.cpp JNI. +- `OpenAiCompatibleProviderSupport` – constructs OpenAI‑compatible chat‑completion requests and parses responses. +- `AiCompletionParser` – extracts final answer from raw completion text. +- `LlamaCppJniConfig` – immutable config record for llama.cpp provider. + +#### Data flow +1. **Configuration**: `LlamaCppJniConfig` built via builder, passed to factory. +2. **Provider creation**: `AiGenerationProviderFactory.create(...)` selects provider key → returns `AiGenerationProvider`. +3. **Request**: Caller builds `AiGenerationRequest` (prompt key, source file, text, header). +4. **Generation**: + - *Local*: `LlamaCppJniAiGenerationProvider.generate(...)` loads model, runs `chatComplete`, parses JSON, returns text and timings. + - *Remote*: `OpenAiCompatibleProviderSupport` builds JSON body, endpoint, API key, sends HTTP request, parses `ChatResponse`, computes `AiGenerationTimings`. +5. **Post‑processing**: `AiCompletionParser.parseCompletion(...)` removes thinking blocks, yielding clean answer. + +#### Dependencies +- **Internal**: `AiPromptSupport`, `AiGenerationRequest`, `AiGenerationTimings`, `Java8CompatibilityHelper`. +- **External**: `net.ladenthin.llama` (model, args, JSON parsing), `com.fasterxml.jackson` (JSON), `java.net`, `java.io`, `lombok`. +- **Provider‑specific**: `MockAiGenerationProvider` for testing, `OpenAiCompatibleAiGenerationProvider` for OpenAI‑compatible APIs. + +#### Cross‑cutting +- Immutable configuration objects (`LlamaCppJniConfig`) ensure thread safety. +- `AiCompletionParser` is stateless and reusable across providers. +- Error handling: `IOException` for missing keys, malformed responses, or abrupt reasoning blocks. +- Timing metrics exposed via `AiGenerationTimings` for both local and remote providers. +- Provider factory uses `effectiveProvider` to merge run‑level and model‑level keys. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..f5f1fbb7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,49 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:33:59Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Computes a 256‑bin byte histogram of an input byte stream in two OpenCL kernel passes. + +#### Purpose +- Builds a byte histogram for image or generic byte data. +- Splits work into two passes: local partial histograms and global reduction. + +#### Type +- OpenCL C 1.2 kernels (`__kernel` functions) in a single source file. + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms to `partial`. +- `histogram_reduce`: writes final 256‑bin histogram to `histogram`. + +#### Core logic +- **histogram_partial** + 1. Zero local bin array in parallel. + 2. Each work‑item scans input in strided fashion, atomically increments local bin for each byte. + 3. After barrier, each work‑item writes its local bin values to the global `partial` buffer at offset `group_id * BINS`. +- **histogram_reduce** + 1. Each work‑item corresponds to a histogram bin. + 2. Sums the bin value across all partial histograms (`group_count` groups). + 3. Stores the sum in the final `histogram` array. + +#### Public API +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – compute per‑group partial histograms. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – reduce partials into final histogram. + +#### Constants and configuration +- `#define BINS 256` – number of histogram bins. + +#### Dependencies +- OpenCL built‑in functions: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- No explicit error handling; kernels return early if `bin >= BINS` in `histogram_reduce`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..e672b009 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,39 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:34:35Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes a 256‑bin byte histogram of an input byte stream using two OpenCL kernel passes. + +#### Purpose +- Build a byte histogram for image or generic byte data. +- Split work into local partial histograms and a global reduction. + +#### Responsibilities +- **Partial histogram generation** – `histogram_partial` kernel creates per‑group partial histograms. +- **Global reduction** – `histogram_reduce` kernel aggregates partials into the final 256‑bin histogram. + +#### Key units +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – computes per‑group partial histograms. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – reduces partial histograms into the final result. +- `#define BINS 256` – constant for histogram bin count. + +#### Data flow +1. Host enqueues `histogram_partial` with input data, length, a global `partial` buffer, and local memory for bins. +2. Each work‑group builds a local histogram, writes it to `partial` at an offset based on `group_id`. +3. Host enqueues `histogram_reduce` with the `partial` buffer, number of groups, and a global `histogram` buffer. +4. Kernel sums each bin across all partial histograms and writes the final counts to `histogram`. + +#### Dependencies +- OpenCL 1.2 built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. +- Requires a global buffer sized `group_count * BINS` for partial results and a 256‑element global buffer for the final histogram. + +#### Cross-cutting +- Uses atomic increments for thread‑safe bin updates. +- Relies on local memory for per‑group histograms to reduce global memory traffic. +- No explicit error handling; kernels exit early if a bin index exceeds `BINS`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..730fb08f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,53 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:34:45Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides a lightweight, high‑performance byte‑stream processing toolkit: a GPU‑accelerated histogram builder, a lock‑free ring buffer, and command‑line utilities for data backup and revenue reporting. + +#### Purpose +- Deliver efficient byte‑level data structures and algorithms for embedded or high‑throughput systems. +- Offer reusable utilities for backup and reporting in operational scripts. + +#### Responsibilities +- **GPU histogram computation** – split work into per‑group partial histograms and a global reduction. +- **Lock‑free ring buffer** – single‑producer/single‑consumer byte stream with power‑of‑two sizing. +- **Backup & reporting scripts** – automated tarball rotation and CSV‑based revenue aggregation. + +#### Key units +- **OpenCL kernels** + - `histogram_partial` – builds per‑group 256‑bin histograms. + - `histogram_reduce` – aggregates partials into final 256‑bin histogram. + - `#define BINS 256` – bin count constant. +- **Ring buffer API** + - `ringbuf_t` – buffer struct (ptr, capacity, head, tail). + - `ringbuf_status_t` – status enum (`OK`, `EINVAL`, `ENOMEM`). + - `ringbuf_init`, `ringbuf_free`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space`. +- **Scripts** + - `rotate_backups.sh` – tar.gz backup with retention. + - `sales_report.py` – `parse_orders`, `revenue_by_month_and_region`, `main`. + +#### Data flow +1. **Histogram** – host enqueues `histogram_partial` → per‑group local histograms written to global `partial` buffer → host enqueues `histogram_reduce` → final 256‑bin histogram produced. +2. **Ring buffer** – `ringbuf_init` allocates array → `ringbuf_write` copies producer data, advances head → `ringbuf_read` copies consumer data, advances tail → metrics via `ringbuf_used`/`ringbuf_free_space`. +3. **Scripts** – `rotate_backups.sh` creates timestamped tarball, moves to backup dir, prunes old archives; `sales_report.py` parses CSV, filters by currency, aggregates revenue by month/region, outputs TSV. + +#### Dependencies +- **OpenCL** – 1.2 built‑ins (`get_local_id`, `atomic_inc`, etc.). +- **C standard library** – ``, ``, ``, ``. +- **Shell utilities** – `tar`, `date`, `du`, `ls`, `mkdir`, `mv`, `rm`. +- **Python modules** – `argparse`, `csv`, `collections.defaultdict`, `dataclasses`, `datetime`, `decimal`. + +#### Cross-cutting +- Power‑of‑two sizing and bitwise masking in ring buffer for efficient wrap‑around. +- Single‑threaded producer/consumer assumption; no locks. +- Atomic increments in kernels for thread‑safe bin updates. +- Consistent error codes (`ringbuf_status_t`, script exit codes). +- Minimal, clear APIs and command‑line interfaces. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..b309ca61 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,49 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:34:38Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> A lock‑free, power‑of‑two sized circular buffer for byte streams, exposing a minimal API for initialization, bulk read/write, and usage metrics. + +#### Purpose +- Provide a single‑producer/single‑consumer ring buffer. +- Offer non‑blocking read/write with minimal overhead. + +#### Responsibilities +- **Memory management** – allocate/deallocate the underlying byte array. +- **Data movement** – copy data into/out of the buffer, handling wrap‑around. +- **State tracking** – expose used bytes and free space via helper functions. +- **Error handling** – validate capacity and report allocation failures. + +#### Key units +- `ringbuf_t` – struct holding buffer pointer, capacity, head/tail indices. +- `ringbuf_status_t` – enum (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – create buffer. +- `ringbuf_free(ringbuf_t *rb)` – release resources. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – bulk write. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – bulk read. +- `ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `ringbuf_free_space(const ringbuf_t *rb)` – available capacity. + +#### Data flow +1. **Initialization** – caller supplies capacity; `ringbuf_init` allocates array, sets indices to zero. +2. **Write** – producer calls `ringbuf_write`; data copied into buffer, head advanced modulo capacity. +3. **Read** – consumer calls `ringbuf_read`; data copied out, tail advanced modulo capacity. +4. **Metrics** – `ringbuf_used` and `ringbuf_free_space` compute values from head/tail. +5. **Cleanup** – `ringbuf_free` frees the array. + +#### Dependencies +- Standard C headers: ``, ``, ``, ``. +- Internal: `ringbuf.h` defines types and constants used by `ringbuf.c`. + +#### Cross-cutting +- **Power‑of‑two constraint** – all size calculations use bitwise masking for efficiency. +- **Single‑threaded assumption** – no locks; relies on single‑producer/single‑consumer usage. +- **Error codes** – consistent `ringbuf_status_t` return values for init failures. +- **Minimal API surface** – only essential functions exposed, keeping the interface lightweight. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..50e25847 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,59 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:34:02Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides a power‑of‑two sized circular buffer with read/write and memory management. + +#### Purpose +- Implements a fixed‑size ring buffer for byte streams. +- Supports initialization, deallocation, querying usage, and bulk read/write. + +#### Type +- C source file (`ringbuf.c`) implementing functions for the `ringbuf_t` struct defined in `ringbuf.h`. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_free` releases allocated memory. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates memory, sets indices to zero. +- `ringbuf_free` frees memory and resets fields. +- `ringbuf_used` computes bytes currently stored using modulo arithmetic. +- `ringbuf_free_space` calculates remaining capacity. +- `ringbuf_write` writes up to two contiguous chunks to handle wrap‑around. +- `ringbuf_read` reads up to two contiguous chunks similarly. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free buffer. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes in buffer. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – bytes available. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write data. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read data. + +#### Constants and configuration +- None defined in this file. + +#### Dependencies +- `` – `malloc`, `free`. +- `` – `memcpy`. +- `"ringbuf.h"` – type and status definitions. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity not power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` on allocation failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..807ae790 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,59 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:34:04Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides a fixed‑size byte ring buffer for single‑producer/single‑consumer use. + +#### Purpose +- Implements a lock‑free ring buffer with power‑of‑two capacity. +- Supports non‑blocking write/read operations. + +#### Type +- Header file (`ringbuf.h`) in C (C99). +- Declares `ringbuf_t` struct, `ringbuf_status_t` enum, and public API functions. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_used` and `ringbuf_free_space` return current usage metrics. + +#### Core logic +- `ringbuf_init` validates capacity (non‑zero, power of two), allocates data array, initializes head/tail to 0. +- `ringbuf_write` copies up to `len` bytes from `src` into buffer, wrapping at capacity, updates `head`. +- `ringbuf_read` copies up to `len` bytes from buffer into `dst`, wrapping at capacity, updates `tail`. +- `ringbuf_used` computes `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space` computes `capacity - 1 - ringbuf_used`. +- `ringbuf_free` frees allocated data. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free resources. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – available space. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- ``, ``. +- Uses `size_t`, `uint8_t`. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..8be8e8cd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,41 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:34:42Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides utilities for backing up directories and generating monthly revenue reports from order CSVs. + +#### Purpose +- Automate directory backups with retention policy. +- Produce revenue summaries per month and region from CSV order exports. + +#### Responsibilities +- **Backup Management** – create timestamped tar.gz archives, prune old backups. +- **Data Processing** – parse CSV orders, filter by currency, aggregate revenue, output reports. + +#### Key units +- `rotate_backups.sh` – Bash script that creates a compressed backup of a source directory, keeps only the newest N archives, and cleans up old ones. +- `sales_report.py` – Python module exposing: + - `parse_orders(path, currency)` – yields `Order` dataclass instances from a CSV. + - `revenue_by_month_and_region(orders)` – aggregates revenue by `(YYYY‑MM, region)`. + - `main(argv)` – CLI entry point that parses arguments, collects orders, and prints a tab‑separated report. + +#### Data flow +1. **Backup**: `rotate_backups.sh` receives source and backup directories, validates inputs, creates a tarball named with UTC timestamp, moves it to the backup directory, lists existing archives, and deletes those beyond the configured keep count. +2. **Reporting**: `sales_report.py` reads CSV files supplied on the command line, parses each row into an `Order`, filters by the specified currency, aggregates amounts by month and region, then prints rows that meet the minimum revenue threshold. + +#### Dependencies +- **Shell**: `tar`, `date`, `du`, `ls`, `mkdir`, `mv`, `rm`. +- **Python**: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Cross-cutting +- Both utilities enforce strict input validation and provide clear exit codes (`0` success, non‑zero for errors). +- Error handling is explicit: missing arguments, invalid data, or missing columns raise informative exceptions or exit codes. +- Configuration is minimal and exposed via command‑line arguments (`KEEP`, `--currency`, `--min-revenue`). +- Output is human‑readable: backup script prints creation/removal messages; report script outputs tab‑separated lines. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..c296153e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,62 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:34:11Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates a dated, compressed backup of a directory and prunes older archives, keeping only the newest N. + +#### Purpose +- Backup a specified directory. +- Keep only the most recent `KEEP` archives. + +#### Type +- `bash` +- `set -euo pipefail` + +#### Input +- `$1` → `SOURCE_DIR` (required) +- `$2` → `BACKUP_DIR` (required) +- `$3` → `KEEP` (optional, default `7`) + +#### Output +- Writes a compressed tarball `archive` in `BACKUP_DIR`. +- Deletes older tarballs beyond the `KEEP` count. +- Prints creation and removal messages. +- Exits with status `0` on success, `2` on argument or validation errors. + +#### Core logic +- Validate `KEEP` is a positive integer. +- Ensure `SOURCE_DIR` exists; create `BACKUP_DIR`. +- Build `archive` name with UTC timestamp. +- Create temporary tarball `tmp`; move to final `archive`. +- List existing archives sorted newest first. +- Remove archives beyond the first `KEEP` entries. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR`=`"${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR`=`"${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP`=`"${3:-7}"` +- `name`=`"$(basename "$SOURCE_DIR")"` +- `archive`=`"$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp`=`"$archive.partial"` + +#### Dependencies +- `tar` +- `date` +- `du` +- `ls` +- `mkdir` +- `mv` +- `rm` + +#### Errors and exit codes +- `2`: Missing arguments, invalid `KEEP`, or non‑existent `SOURCE_DIR`. +- `EXIT` trap removes temporary file `tmp`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..f3baeb69 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,61 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:34:14Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Generates monthly revenue reports from CSV order exports, filtering by currency and minimum revenue. + +#### Purpose +- Produce revenue per month and region from order CSVs. +- Filter by currency and minimum revenue threshold. + +#### Type +- Python script (`.py`). + +#### Input +- `csv_files`: list of CSV file paths (positional arguments). +- `--currency`: target currency code (default `EUR`). +- `--min-revenue`: minimum revenue to display (default `0`). +- CSV columns: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints tab‑separated lines: `monthregionrevenue currency`. +- Exits with code `0` on success, `1` if no orders found. + +#### Core logic +- `parse_orders(path, currency)`: + - Open CSV, validate required columns. + - Skip rows with non‑matching currency. + - Convert `order_date` to `date`, `amount` to `Decimal`. + - Yield `Order` dataclass instances. +- `revenue_by_month_and_region(orders)`: + - Aggregate amounts by `(YYYY-MM, region)` using `defaultdict(Decimal)`. + - Return sorted dictionary of totals. +- `main(argv)`: + - Parse CLI arguments. + - Collect all orders from provided files. + - If none, print error and exit `1`. + - Iterate aggregated totals; print those meeting `min_revenue`. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` + Parses CSV, yields orders in specified currency. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` + Aggregates revenue per month and region. +- `main(argv=None) -> int` + CLI entry point; processes arguments, outputs report. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` if CSV missing required columns or contains invalid data. +- `ValueError` propagated from `parse_orders` for malformed rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..8fae1ec8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,65 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:35:13Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A framework for orchestrating AI‑driven source‑code transformations, coupled with a lightweight byte‑stream toolkit and a multi‑tenant SQL data platform for library, shop, and warehouse domains. + +#### Purpose +- Centralize AI‑powered code generation workflows and provider abstraction. +- Offer high‑performance byte‑level utilities (GPU histograms, lock‑free ring buffer, backup/report scripts). +- Persist and enforce business rules across library, shop, and warehouse domains with reporting and audit. + +#### Responsibilities +- **AI Generation Engine** – configuration, rule evaluation, fact extraction, oversize handling, provider selection, request/response parsing, performance metrics. +- **Byte‑Stream Toolkit** – GPU histogram kernels, lock‑free ring buffer API, backup rotation, revenue reporting scripts. +- **SQL Data Platform** – library catalog and loan management, shop order lifecycle, warehouse inventory sync, audit trails, reporting views. + +#### Key units +- **Java AI Core** + - `SrcMorphConfiguration` (mutable config bean) + - `AiGenerationConfig` (immutable provider settings) + - `AiOversizeStrategy` (enum) + - `AiConditionEvaluator` (stateless validator) + - `AiFactExtractor` (regex‑based facts block) + - `AiGenerationProviderFactory` (factory) + - `LlamaCppJniAiGenerationProvider` (local llama.cpp JNI) + - `OpenAiCompatibleProviderSupport` (HTTP client) + - `AiCompletionParser` (reasoning block stripper) + - `AiGenerationTimings` (latency metrics) +- **Other Toolkit** + - OpenCL kernels: `histogram_partial`, `histogram_reduce` + - Ring buffer API: `ringbuf_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read`, etc. + - Scripts: `rotate_backups.sh`, `sales_report.py` +- **SQL Platform** + - Library: tables (`author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`), functions (`fn_checkout_book`, `fn_late_fee`), procedure (`sp_return_book`), trigger (`trg_loan_audit`), views (`overdue_loans`, `member_loan_stats`, `popular_books`) + - Shop: tables (`product`, `customer_order`, `order_item`), procedure (`add_order_item`) + - Warehouse: tables (`dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`), procedure (`dbo.usp_SyncStock`) + +#### Data flow +- **AI Engine**: configuration → rule validation → fact header → oversize decision → provider selection → request construction → local/remote generation → post‑processing → final code output. +- **Toolkit**: GPU histogram kernels process data → ring buffer streams bytes → backup script rotates archives → sales script aggregates CSV revenue. +- **SQL Platform**: + - Library: checkout → loan insert + audit → return → audit; late fee calculation on demand. + - Shop: add order item locks product, updates stock, recalculates order total. + - Warehouse: sync procedure merges supplier feed into stock levels, logs sync results. + +#### Dependencies +- **Internal**: AI core depends on `AiCondition`, `AiFileContext`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`, `AiPromptSupport`, `AiGenerationRequest`. +- **External**: Java standard libs, Lombok, Jackson, OpenAI/llama.cpp libraries, OpenCL, C stdlib, shell utilities, Python modules. +- **SQL**: PostgreSQL/MySQL/SQL Server built‑ins, row‑locking, system functions, indexes for performance. + +#### Cross‑cutting +- Thread‑safe, stateless components (`AiConditionEvaluator`, `AiFactExtractor`, `AiCompletionParser`, immutable configs). +- Validation and error handling via `IllegalArgumentException`, `IllegalStateException`, `IOException`. +- Performance metrics captured in `AiGenerationTimings`. +- Ring buffer uses power‑of‑two sizing and bitwise masking; GPU kernels use atomic increments. +- Audit and transaction consistency across library, shop, and warehouse procedures. +- Consistent error codes and exit conventions in scripts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..927a65d3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: E566E225 +- D: 2026-11-04T07:27:53Z +- T: 2026-11-04T07:35:18Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project orchestrates AI‑driven source‑code transformations through a Java framework that handles configuration, rule evaluation, and provider‑agnostic model execution, while a dedicated provider package selects and executes back‑ends such as llama.cpp or OpenAI services and parses responses. A lightweight byte‑stream toolkit, featuring GPU‑accelerated histogram kernels, a lock‑free ring buffer, and command‑line utilities, supports high‑performance data processing and backup tasks. The multi‑tenant SQL platform manages library, shop, and warehouse domains, with PostgreSQL for catalog and loan logic, MySQL for e‑commerce orders and inventory, and nightly syncs for warehouse stock. Together, these subsystems enable automated code generation, efficient data handling, and robust domain‑specific data management. + +#### Packages +- java/config — A Java library that powers AI‑driven source‑code generation, providing configuration, condition evaluation, fact extraction, and oversized‑file handling for a Maven‑style plugin. +- java — A Java framework that orchestrates AI‑driven source‑code generation, from configuration and rule evaluation to provider‑agnostic model execution and response handling. +- java/provider — A framework for configuring, selecting, and executing AI text‑generation back‑ends—whether local llama.cpp or OpenAI‑compatible services—while parsing responses, handling errors, and measuring performance. +- other/kernels — Computes a 256‑bin byte histogram of an input byte stream using two OpenCL kernel passes. +- other — Provides a lightweight, high‑performance byte‑stream processing toolkit: a GPU‑accelerated histogram builder, a lock‑free ring buffer, and command‑line utilities for data backup and revenue reporting. +- other/ringbuf — A lock‑free, power‑of‑two sized circular buffer for byte streams, exposing a minimal API for initialization, bulk read/write, and usage metrics. +- other/scripts — Provides utilities for backing up directories and generating monthly revenue reports from order CSVs. +- . — A framework for orchestrating AI‑driven source‑code transformations, coupled with a lightweight byte‑stream toolkit and a multi‑tenant SQL data platform for library, shop, and warehouse domains. +- sql/library — A PostgreSQL‑based library management system that stores catalog, member, and loan data, supports checkout/return logic, tracks late fees, and provides reporting views for overdue loans, member activity, and popular titles. +- sql — A multi‑tenant data platform that manages library catalogs, e‑commerce orders, and warehouse inventory, each with its own SQL schema, business logic, and reporting layers. +- sql/shop — Provides a MySQL 8 schema and stored procedure for managing products, orders, and order items in a web shop, including stock reservation and order total calculation. +- sql/warehouse — Keeps the warehouse inventory in sync with nightly supplier feeds and records each sync run. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..9487664e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,68 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:33:35Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Defines core tables for a lending library: authors, books, members, and loans, with constraints and indexes. + +#### Purpose +- Store library catalog and member data. +- Track book loans and availability. + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author (author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `member_id BIGINT NOT NULL REFERENCES member (member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` +- **Indexes** + - `idx_book_author ON book (author_id)` + - `idx_loan_member ON loan (member_id)` + - `idx_loan_open ON loan (due_on) WHERE returned_on IS NULL` + +#### Reads +- `author` (via foreign key in `book`) +- `book` (via foreign key in `loan`) +- `member` (via foreign key in `loan`) + +#### Writes +- Inserts/updates/deletes on `author`, `book`, `member`, `loan` tables as per application operations. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- `author`, `book`, `member`, `loan` tables referenced by foreign keys and indexes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..dd9c562a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,65 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:33:38Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Provides reporting views for a lending library, including overdue loans, member loan statistics, and popular books. + +#### Purpose +- Exposes aggregated loan data for reporting. +- Highlights overdue loans, member activity, and recent popular books. + +#### Type +- PostgreSQL views and materialized view. +- Index: `idx_popular_books_id` on `popular_books`. + +#### Schema +- **overdue_loans** + - `loan_id` integer + - `member_id` integer + - `email` text + - `title` text + - `due_on` date + - `days_overdue` integer +- **member_loan_stats** + - `member_id` integer + - `full_name` text + - `loans_total` bigint + - `loans_open` bigint + - `last_loan_on` timestamp +- **popular_books** + - `book_id` integer + - `title` text + - `author_name` text + - `times_loaned` bigint + - Index: `idx_popular_books_id` (UNIQUE, btree on `book_id`) + +#### Reads +- `loan` (all columns used: `loan_id`, `member_id`, `book_id`, `due_on`, `returned_on`, `loaned_on`) +- `member` (`member_id`, `email`, `full_name`) +- `book` (`book_id`, `title`, `author_id`) +- `author` (`author_id`, `full_name`) + +#### Writes +- None (views and materialized view are read‑only). + +#### Relationships +- `overdue_loans`: `loan.member_id -> member.member_id`, `loan.book_id -> book.book_id` +- `member_loan_stats`: `loan.member_id -> member.member_id` +- `popular_books`: `loan.book_id -> book.book_id`, `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author` +- Views: none +- Functions: none +- Sequences: none + +#### Routine logic +- `overdue_loans`: selects loans not returned and past due, calculates days overdue. +- `member_loan_stats`: aggregates total loans, open loans, and last loan date per member. +- `popular_books`: counts loans in the past year per book, filters for at least 5 loans, joins author name. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..e12df2a7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,69 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:33:42Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> A PostgreSQL library system that manages book loans, returns, late fees, and audit trails. + +#### Purpose +- Handles checkout and return of books. +- Calculates late fees. +- Records audit events for loan actions. + +#### Type +- Table: `loan_audit` +- Function: `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn` +- Procedure: `sp_return_book` +- Trigger: `trg_loan_audit` + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member` (`member_id`, `is_blocked`) +- `book` (`book_id`, `copies_free`) +- `loan` (`loan_id`, `returned_on`, `book_id`) + +#### Writes +- `book` (`copies_free` decremented by 1 on checkout; incremented by 1 on return) +- `loan` (INSERT new loan; UPDATE `returned_on` on return) +- `loan_audit` (INSERT audit rows on checkout and return) + +#### Relationships +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` +- `loan_audit.loan_id -> loan.loan_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Verify member not blocked. + - Decrement `copies_free` if available. + - Insert new loan with `due_on = CURRENT_DATE + p_days`. + - Return new `loan_id`. + +- **sp_return_book(p_loan_id)** + - Update loan `returned_on = CURRENT_DATE` where not already returned. + - Retrieve `book_id`; if none, raise exception. + - Increment `copies_free` for that book. + +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Multiply by 50 cents, cap at 2000 cents. + +- **trg_loan_audit_fn()** + - On INSERT: log `CHECKOUT`. + - On UPDATE where `returned_on` changes from NULL to non‑NULL: log `RETURN`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit` +- Functions: `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn` +- Trigger: `trg_loan_audit` on `loan` table. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..f6540cd6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,74 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:33:45Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds library branches, creates a book_copy table per branch, moves copy data, and updates member and loan tables. + +#### Purpose +- Introduce branch hierarchy and per‑branch book copies. +- Migrate existing copy counts into book_copy rows. +- Update member and loan schemas to reference branches and copies. + +#### Type +- Table: `branch` +- Table: `book_copy` +- Table: `loan` (altered) +- Table: `member` (altered) +- Index: `idx_book_copy_book` + +#### Schema +**branch** +- `branch_id SMALLSERIAL PRIMARY KEY` +- `name VARCHAR(100) NOT NULL UNIQUE` +- `city VARCHAR(100) NOT NULL` + +**book_copy** +- `copy_id BIGSERIAL PRIMARY KEY` +- `book_id BIGINT NOT NULL REFERENCES book(book_id)` +- `branch_id SMALLINT NOT NULL REFERENCES branch(branch_id)` +- `barcode VARCHAR(32) NOT NULL UNIQUE` +- `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE','ON_LOAN','LOST'))` + +**loan** (altered) +- `copy_id BIGINT REFERENCES book_copy(copy_id)` + +**member** (altered) +- `member_since DATE` (renamed from `joined_on`) +- `home_branch_id SMALLINT REFERENCES branch(branch_id)` + +**Indexes** +- `idx_book_copy_book` ON `book_copy(book_id)` + +#### Reads +- `book` (SELECT book_id, isbn, copies_free, copies_total) +- `branch` (INSERT default branch) +- `member` (UPDATE home_branch_id where NULL) + +#### Writes +- `branch`: 1 row (`Main`, `Springfield`) +- `book_copy`: 1 + 1 = 2 INSERT statements + - First INSERT: 1 row (default branch) + - Second INSERT: `b.copies_total` rows per book (family) +- `loan`: 1 column added (no data written) +- `member`: 1 column added, 1 UPDATE setting `home_branch_id` to 1 where NULL +- `book`: columns `copies_free`, `copies_total` dropped; constraint `book_free_le_total` dropped + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- Table `book` (existing) +- Table `loan` (existing) +- Table `member` (existing) +- Table `book_copy` (new) +- Table `branch` (new) +- Index `idx_book_copy_book` (new) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..2dfa0d68 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,62 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:33:48Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Seed data for a lending library: authors, books, members, and loan records. + +#### Purpose +- Populate the `author`, `book`, `member`, and `loan` tables with initial data for testing or demo purposes. + +#### Type +- PostgreSQL data‑insertion script (no schema objects created). + +#### Schema +- **author** + - `author_id` integer PK + - `full_name` text NOT NULL + - `birth_year` integer + - `country_code` char(2) NOT NULL +- **book** + - `book_id` integer PK + - `isbn` text NOT NULL + - `title` text NOT NULL + - `author_id` integer NOT NULL FK → `author.author_id` + - `published_year` integer + - `copies_total` integer NOT NULL + - `copies_free` integer NOT NULL +- **member** + - `member_id` integer PK + - `email` text NOT NULL + - `full_name` text NOT NULL + - `joined_on` date NOT NULL + - `is_blocked` boolean NOT NULL +- **loan** + - `loan_id` integer PK + - `book_id` integer NOT NULL FK → `book.book_id` + - `member_id` integer NOT NULL FK → `member.member_id` + - `loaned_on` date NOT NULL + - `due_on` date NOT NULL + - `returned_on` date + +#### Reads +- None (only INSERT statements). + +#### Writes +- `author`: 15 rows +- `book`: 150 rows +- `member`: 50 rows +- `loan`: 150 rows + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- Tables referenced: `author`, `book`, `member`, `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..d92a3970 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,60 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:34:49Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL‑based library management system that stores catalog, member, and loan data, supports checkout/return logic, tracks late fees, and provides reporting views for overdue loans, member activity, and popular titles. + +#### Purpose +- Persist library catalog, member, and loan information. +- Enforce business rules for borrowing, returning, and late fee calculation. +- Offer read‑only reporting views for operational insight. + +#### Responsibilities +- **Data definition** – core tables (`author`, `book`, `member`, `loan`) and later branch‑specific tables (`branch`, `book_copy`). +- **Business logic** – checkout, return, late‑fee calculation, and audit trail via functions, procedures, and triggers. +- **Reporting** – views (`overdue_loans`, `member_loan_stats`, `popular_books`) and materialized view for popular books. +- **Migration & seeding** – schema evolution to branch‑based copies and initial data population. + +#### Key units +- **Tables** + - `author`, `book`, `member`, `loan` – core library entities. + - `branch`, `book_copy` – branch hierarchy and per‑copy tracking. + - `loan_audit` – audit trail of checkout/return actions. +- **Functions** + - `fn_checkout_book(member_id, book_id, days)` – validates, updates inventory, inserts loan. + - `fn_late_fee(due_on, returned_on)` – computes overdue fee capped at 2000 cents. +- **Procedure** + - `sp_return_book(loan_id)` – marks loan returned, restores copy count. +- **Trigger** + - `trg_loan_audit` → `trg_loan_audit_fn()` – logs audit rows on INSERT/UPDATE of `loan`. +- **Views** + - `overdue_loans` – unreturned loans past due. + - `member_loan_stats` – per‑member loan totals and last activity. + - `popular_books` – books loaned ≥5 times in the past year. + +#### Data flow +1. **Checkout**: `fn_checkout_book` → checks `member.is_blocked`, decrements `book.copies_free`, inserts `loan`, logs audit. +2. **Return**: `sp_return_book` → updates `loan.returned_on`, increments `book.copies_free`, logs audit. +3. **Late fee**: `fn_late_fee` called by application or reporting to calculate fees. +4. **Reporting**: Views aggregate `loan`, `member`, `book`, `author` data for dashboards. + +#### Dependencies +- **Internal** – `member`, `book`, `loan`, `author`, `branch`, `book_copy`, `loan_audit`. +- **External** – PostgreSQL built‑in functions (`now()`, `CURRENT_DATE`, `COALESCE`). +- **Indexes** – `idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_book_copy_book`, `idx_popular_books_id`. + +#### Cross-cutting +- **Constraints & checks** – enforce data integrity (`copies_free <= copies_total`, `due_on > loaned_on`, status enum). +- **Audit pattern** – single audit table with action enum and timestamp, populated by a trigger. +- **Branch‑aware migration** – `04_migration_v2.sql` moves copy counts into `book_copy` rows, updates foreign keys to reference copies instead of book totals. +- **Seeding** – `05_seed_data.sql` populates all core tables for demo/testing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..9ef1b93d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,59 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:35:02Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A multi‑tenant data platform that manages library catalogs, e‑commerce orders, and warehouse inventory, each with its own SQL schema, business logic, and reporting layers. + +#### Purpose +- Persist and enforce business rules for library loans, shop orders, and warehouse stock. +- Provide read‑only reporting views and audit trails for operational insight. +- Synchronize external supplier feeds into warehouse inventory. + +#### Responsibilities +- **Library** – catalog, member, loan lifecycle, late‑fee calculation, audit, reporting. +- **Shop** – product catalog, order lifecycle, line‑item management, stock reservation, total calculation. +- **Warehouse** – nightly feed ingestion, inventory merge, sync audit logging. + +#### Key units +- **Library** + - Tables: `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`. + - Functions: `fn_checkout_book`, `fn_late_fee`. + - Procedure: `sp_return_book`. + - Trigger: `trg_loan_audit` → `trg_loan_audit_fn()`. + - Views: `overdue_loans`, `member_loan_stats`, `popular_books`. +- **Shop** + - Tables: `product`, `customer_order`, `order_item`. + - Procedure: `add_order_item`. +- **Warehouse** + - Tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. + - Procedure: `dbo.usp_SyncStock`. + +#### Data flow +1. **Library** + - `fn_checkout_book` validates member, updates `book.copies_free`, inserts `loan`, trigger logs to `loan_audit`. + - `sp_return_book` updates `loan.returned_on`, restores `book.copies_free`, trigger logs audit. + - `fn_late_fee` calculates overdue fee for reporting or application use. +2. **Shop** + - `add_order_item` locks product row, checks stock, inserts/updates `order_item`, decrements `product.stock`, recalculates `customer_order.total_cents`. +3. **Warehouse** + - `usp_SyncStock` aggregates `SupplierFeed` rows since a timestamp, merges into `StockLevel` via `MERGE`, records counts and errors in `SyncLog` within a single transaction. + +#### Dependencies +- **Internal** – cross‑package tables (`author`, `book`, `product`, etc.) and audit tables. +- **External** – PostgreSQL built‑ins (`now()`, `CURRENT_DATE`), MySQL row locking (`FOR UPDATE`), SQL Server system functions (`SYSUTCDATETIME()`, `ERROR_MESSAGE()`). +- **Indexes** – e.g., `idx_book_author`, `idx_loan_member`, `idx_product_sku`, `idx_stocklevel_key`. + +#### Cross‑cutting +- **Audit** – library uses a trigger‑based audit table; warehouse logs sync runs. +- **Constraints & checks** – enforce data integrity (e.g., `copies_free <= copies_total`, stock ≥ quantity). +- **Transactions** – shop and warehouse procedures wrap critical updates in atomic transactions. +- **Error handling** – shop raises errors for missing products or insufficient stock; warehouse captures `ERROR_MESSAGE()` in `SyncLog`. +- **Seeding & migration** – library includes migration scripts to introduce branch‑aware copies and seed data. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..4ab20609 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,69 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:33:52Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Defines a MySQL 8 schema for a web shop with products, orders, and order items, and a stored procedure to add items to an order while reserving stock and updating totals. + +#### Purpose +- Stores product catalog, customer orders, and line items. +- Provides `add_order_item` to add or update an item, reserve stock, and recalculate order total. + +#### Type +- Table: `product`, `customer_order`, `order_item`. +- Procedure: `add_order_item`. +- Dialect: MySQL 8. + +#### Schema +**product** +- `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT PK` +- `sku VARCHAR(40) NOT NULL UNIQUE uk_product_sku` +- `name VARCHAR(200) NOT NULL` +- `price_cents INT UNSIGNED NOT NULL` +- `stock INT NOT NULL DEFAULT 0` + +**customer_order** +- `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PK` +- `customer_id BIGINT UNSIGNED NOT NULL` +- `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW'` +- `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` +- `total_cents INT UNSIGNED NOT NULL DEFAULT 0` +- Index `idx_order_customer (customer_id, created_at)` + +**order_item** +- `order_id BIGINT UNSIGNED NOT NULL PK` +- `product_id INT UNSIGNED NOT NULL PK` +- `quantity SMALLINT UNSIGNED NOT NULL` +- `unit_price_cents INT UNSIGNED NOT NULL` +- FK `fk_item_order (order_id) REFERENCES customer_order(order_id) ON DELETE CASCADE` +- FK `fk_item_product (product_id) REFERENCES product(product_id)` + +#### Reads +- `product` (SELECT product_id, price_cents WHERE sku = p_sku AND stock >= p_qty FOR UPDATE). +- `order_item` (SELECT SUM(quantity * unit_price_cents) WHERE order_id = p_order_id). + +#### Writes +- `order_item`: INSERT one row; if duplicate, UPDATE quantity. +- `product`: UPDATE stock (one row). +- `customer_order`: UPDATE total_cents (one row). + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (FK, cascade delete). +- `order_item.product_id -> product.product_id` (FK). + +#### Routine logic +- Parameters: `p_order_id BIGINT UNSIGNED`, `p_sku VARCHAR(40)`, `p_qty SMALLINT UNSIGNED`. +- Lookup product by SKU with stock check; lock row. +- If not found or insufficient stock, raise error. +- Insert or update `order_item` quantity. +- Decrement `product.stock`. +- Recalculate `customer_order.total_cents` from all items of the order. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item`. +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..95c657e6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,46 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:34:54Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Provides a MySQL 8 schema and stored procedure for managing products, orders, and order items in a web shop, including stock reservation and order total calculation. + +#### Purpose +- Stores product catalog, customer orders, and line items. +- Offers `add_order_item` to add or update an item, reserve stock, and recalculate order total. + +#### Responsibilities +- Product catalog management. +- Order lifecycle handling (NEW, PAID, SHIPPED, CANCELLED). +- Order item creation and quantity updates. +- Stock reservation and decrement. +- Order total calculation. + +#### Key units +- **Table `product`** – product catalog with SKU, price, and stock. +- **Table `customer_order`** – order header with status, timestamps, and total. +- **Table `order_item`** – line items linking orders to products. +- **Procedure `add_order_item`** – inserts/updates items, reserves stock, updates totals. + +#### Data flow +- `add_order_item(p_order_id, p_sku, p_qty)` + 1. SELECT product by SKU with `FOR UPDATE`. + 2. Verify stock ≥ `p_qty`; error if insufficient. + 3. INSERT or UPDATE `order_item` quantity. + 4. UPDATE `product.stock` decrement. + 5. Recalculate `customer_order.total_cents` from all items. + +#### Dependencies +- Internal tables: `product`, `customer_order`, `order_item`. +- FK constraints: `order_item.order_id → customer_order.order_id` (cascade delete), `order_item.product_id → product.product_id`. +- No external functions or sequences. + +#### Cross-cutting +- Row locking with `FOR UPDATE` for stock consistency. +- FK and cascade delete enforce referential integrity. +- Error handling for missing product or insufficient stock. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..b4f571b8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,44 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:34:58Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Keeps the warehouse inventory in sync with nightly supplier feeds and records each sync run. + +#### Purpose +- Aggregate supplier feed data into the warehouse inventory. +- Persist a log of each sync operation. + +#### Responsibilities +- **Data ingestion** – read `dbo.SupplierFeed` rows since a given timestamp. +- **Inventory update** – merge aggregated quantities into `dbo.StockLevel`. +- **Audit logging** – record insert/update counts and any errors in `dbo.SyncLog`. + +#### Key units +- **dbo.StockLevel** – inventory table keyed by `WarehouseId`/`Sku`; tracks `OnHand` and `UpdatedAt`. +- **dbo.SupplierFeed** – staging table for raw supplier rows (`WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`). +- **dbo.SyncLog** – audit table for each sync run (`StartedAt`, `RowsInserted`, `RowsUpdated`, `ErrorMessage`). +- **dbo.usp_SyncStock** – T‑SQL procedure that aggregates, merges, and logs the sync. + +#### Data flow +1. Caller supplies `@Since` timestamp to `usp_SyncStock`. +2. Procedure aggregates `SupplierFeed` rows by `WarehouseId`/`Sku` since `@Since`. +3. `MERGE` updates existing `StockLevel` rows or inserts new ones, adjusting `OnHand` and `UpdatedAt`. +4. Counts of inserted and updated rows are captured. +5. A single row is inserted into `SyncLog` with the counts and any error message. +6. Transaction is committed or rolled back on error. + +#### Dependencies +- Internal tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. +- SQL Server system functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. +- Transaction control via `@@TRANCOUNT`. + +#### Cross-cutting +- Uses a single transaction to ensure atomicity of inventory update and logging. +- Error handling captures `ERROR_MESSAGE()` and logs it in `SyncLog`. +- Default constraints provide safe defaults for `OnHand` and `UpdatedAt`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..48a35b60 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run2/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,76 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:33:55Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Synchronises nightly stock levels from a supplier feed into the warehouse inventory table and records the operation outcome. + +#### Purpose +- Updates `dbo.StockLevel` with aggregated supplier feed data. +- Logs each sync run in `dbo.SyncLog`. + +#### Type +- Table: `dbo.StockLevel` +- Table: `dbo.SupplierFeed` +- Table: `dbo.SyncLog` +- Procedure: `dbo.usp_SyncStock` (T‑SQL) + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL CONSTRAINT DF_StockLevel_OnHand DEFAULT (0)` + - `UpdatedAt DATETIME2(0) NOT NULL CONSTRAINT DF_StockLevel_UpdatedAt DEFAULT (SYSUTCDATETIME())` + - Primary key: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL CONSTRAINT PK_SupplierFeed PRIMARY KEY` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL CONSTRAINT PK_SyncLog PRIMARY KEY` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + +#### Reads +- `dbo.SupplierFeed` (columns: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`) +- `dbo.StockLevel` (columns: `WarehouseId`, `Sku`, `OnHand`) + +#### Writes +- `dbo.StockLevel` + - `UPDATE` on matched rows: `OnHand`, `UpdatedAt` + - `INSERT` on non‑matched rows: `WarehouseId`, `Sku`, `OnHand` +- `dbo.SyncLog` + - `INSERT` one row per sync run with `StartedAt`, `RowsInserted`, `RowsUpdated`, optional `ErrorMessage` + +#### Relationships +- None (no foreign keys defined). + +#### Routine logic +- Parameters: `@Since DATETIME2(0)` +- Steps: + 1. Capture start time `@Started`. + 2. Aggregate `SupplierFeed` rows received since `@Since` by `WarehouseId` and `Sku`. + 3. `MERGE` aggregated data into `StockLevel`: + - `UPDATE` existing rows: add quantity to `OnHand`, set `UpdatedAt`. + - `INSERT` new rows with `OnHand = quantity`. + 4. Capture merge actions in table variable `@Changes`. + 5. Insert a log row into `SyncLog` with counts of inserts and updates. + 6. Commit transaction; on error rollback and log error. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()` +- System variables: `@@TRANCOUNT` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/meta/gpt-6-luna.json new file mode 100644 index 00000000..503bd941 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/meta/gpt-6-luna.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:43:16Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 175.9, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 75.5, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.9, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:47:31Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 83203, + "cachedPromptTokens": 83131, + "completionTokens": 19526, + "seconds": 175.2440779 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.010602, + "costUsd": 0.017709, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/meta/gpt-oss-20b.json new file mode 100644 index 00000000..18390799 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/meta/gpt-oss-20b.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:47:31Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 113.5, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 57.4, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.4, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:50:24Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 84739, + "cachedPromptTokens": 71456, + "completionTokens": 16567, + "seconds": 112.7526392 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.004696, + "costUsd": 0.002139, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..271ced74 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,60 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:43:17Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> File indexing conditions select source files by extension, size, line count, modification time, and relative-path glob. + +#### Purpose +- Evaluates `AiCondition` trees against `AiFileContext` file metadata. +- Validates condition configuration and detects whether line counts are required. + +#### Type +- `public final class AiConditionEvaluator` — class; no superclass or implemented interfaces. + +#### Input +- `AiCondition` tree with `and`, `or`, `not`, extensions, size, lines, modification-time, or path-glob fields. +- `AiFileContext` facts: file name, size in bytes, line count, last-modified epoch milliseconds, and relative path. +- ISO-8601 instant strings for modification-time conditions. + +#### Output +- `matches(...)` returns whether the file satisfies the condition. +- `validate(...)` returns no value; throws for invalid conditions. +- `usesLines(...)` returns whether a `lines` condition occurs in the tree. + +#### Core logic +- Evaluates `and` children all-match, `or` children any-match, and `not` by negating its child. +- Matches extension conditions when the file name ends with any non-null listed extension. +- Checks size and line-count ranges through `AiRangeCondition.contains(...)`. +- Compares modification time strictly after or before the parsed instant. +- Delegates path-glob matching to `AiSourceExcludeFilter` using the relative path. +- Validates that each node sets exactly one of nine branches; recursively validates combinators. +- Requires non-empty combinator groups and extension lists, bounded size/line ranges, parseable dates, and nonblank path globs. +- Recursively detects `lines` conditions so callers can avoid reading file contents when unnecessary. + +#### Public API +- `AiConditionEvaluator()` -> constructs evaluator. +- `matches(AiCondition, AiFileContext) -> boolean` — evaluate file condition. +- `validate(AiCondition) -> void` — validate condition tree. +- `usesLines(AiCondition) -> boolean` — detect line-count requirement. + +#### Dependencies +- `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext` +- `AiSourceExcludeFilter` +- `Instant`, `DateTimeParseException` +- `Collections`, `List` +- `Nullable` + +#### Exceptions / Errors +- `validate(...)` throws `IllegalArgumentException` for invalid branch counts, empty groups or extensions, unbounded ranges, invalid ISO-8601 instants, or blank path globs. +- Invalid instants wrap `DateTimeParseException` in `IllegalArgumentException`. +- `matches(...)` throws `IllegalStateException` when no branch is set; assumes prior validation. +- Null child lists are tolerated during matching and line-condition detection; validation rejects null or empty group children. + +#### Concurrency +- No mutable instance state; methods use local variables. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..bfb1ddf8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,45 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:43:24Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Groups child AI conditions for Maven-configured `and`/`or` combinators. + +#### Purpose +- Holds the child `AiCondition` items used as an `and`/`or` combinator body. +- Uses a `conditions` field so Maven binds items as `…`. + +#### Type +- `public class AiConditionGroup` — class; annotated `@ToString`. +- Nullable `List conditions`. + +#### Input +- `setConditions` accepts a nullable `Collection`. + +#### Output +- `getConditions` returns the nullable child-condition list. +- `setConditions` stores a defensive `ArrayList` copy, or `null`. + +#### Core logic +- `AiConditionGroup()` performs no initialization. +- `setConditions` copies non-null input into a new list; preserves null as null. + +#### Public API +- `AiConditionGroup()` -> `AiConditionGroup` — creates an empty group. +- `getConditions()` -> `@Nullable List` — returns child conditions. +- `setConditions(Collection)` -> `void` — defensively copies conditions. + +#### Dependencies +- `AiCondition` +- `ArrayList`, `Collection`, `List` +- Lombok `ToString` +- JSpecify `Nullable` + +#### Exceptions / Errors +- No explicit exceptions. +- Null input to `setConditions` is stored as null. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..228fb7b5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,57 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:43:27Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Produces exact whole-source counts for configured regex-based facts, formatted for inclusion with AI-generated summaries. + +#### Purpose +- `AiFactExtractor` builds a deterministic facts block from configured `AiFactCounter` labels and regex patterns. +- Validates fact-counter configuration and rejects invalid patterns before use. + +#### Type +- `AiFactExtractor` — final class; utility class with a private constructor. +- `@Nullable` marks nullable counter-list parameters. + +#### Input +- `factsBlock(counters, source)` receives nullable `List` and full source text. +- `validate(counters)` receives a nullable list of `AiFactCounter` values. + +#### Output +- `factsBlock` returns an empty string if no usable counters exist; otherwise returns formatted `label: count` entries followed by a blank line. +- Counts non-overlapping regex matches across the full source; emits no I/O or mutable state. + +#### Core logic +- `factsBlock` skips null counters and counters with null labels or patterns. +- Counts matches with `Matcher.find()` for each usable counter; joins entries with `; ` and prefixes `**Facts (exact, whole file):** `. +- `validate` skips null lists and null counter elements; rejects missing labels, missing patterns, and regex syntax errors. +- Compiles patterns during validation and again when counting matches. + +#### Public API +- `FACTS_HEADER` — header identifying exact whole-file counts. +- `LABEL_COUNT_SEPARATOR` — separator between label and count. +- `ENTRY_SEPARATOR` — separator between entries. +- `FACTS_SUFFIX` — blank-line suffix after the facts block. +- `factsBlock(List, String) -> String` — builds formatted facts block. +- `validate(List) -> void` — validates counter configuration. + +#### Dependencies +- `AiFactCounter` +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for a missing label, missing pattern, or invalid regex; invalid-regex errors retain the `PatternSyntaxException` cause. +- `factsBlock` does not handle a null `source`; regex matching may throw `NullPointerException`. +- Null counters and counters with null labels or patterns are skipped by `factsBlock`. + +#### Concurrency +- Stateless and pure; no shared mutable state or synchronization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..55354dc1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,95 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:43:33Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures model routing, prompt limits, sampling, reasoning, hardware usage, caching, and stop behavior for AI-generated source summaries. + +#### Purpose +- Carries one generation step’s settings from Maven configuration to AI providers. +- Supplies defaults and mutable JavaBean accessors; instances are managed by identity. + +#### Type +- `public class AiGenerationConfig` — class; Lombok `@ToString`; nullable fields use JSpecify `@Nullable`. + +#### Input +- No-argument constructor; callers set model path, generation parameters, provider/API settings, lists, and optional `AiCalibration`. +- List setters accept nullable `List`; several string setters normalize `null` to defaults. + +#### Output +- Returns configured values through getters; stores changes in mutable instance fields. +- DRY sequence-breaker and stop-string getters return unmodifiable views. +- Lombok generates `toString()` over instance fields. + +#### Core logic +- Initializes model, prompt, sampling, reasoning, caching, hardware, provider, and repetition settings from public defaults. +- `charsPerToken` and `maxInputChars` provide inputs for automatic prompt-size calculation; this class does not perform that calculation. +- Nullable chat-template thinking distinguishes unset from explicit `true` or `false`. +- Uses sentinel defaults such as `-1` and empty strings to leave provider or llama.cpp defaults in effect. +- Resets nullable lazy mode, cache types, device/provider/model/URL/API-key-env strings, and lists to defaults or empty values. +- Keeps API-key values out of configuration: stores only the environment-variable name. + +#### Public API +- `AiGenerationConfig()` — construct with defaults. +- `getModelPath()`/`setModelPath(String)` -> GGUF model path. +- `getContextSize()`/`setContextSize(int)` -> context window. +- `getMaxOutputTokens()`/`setMaxOutputTokens(int)` -> output token limit. +- `getTemperature()`/`setTemperature(float)` -> sampling temperature. +- `getThreads()`/`setThreads(int)` -> inference CPU threads. +- `getCharsPerToken()`/`setCharsPerToken(int)` -> input sizing ratio. +- `getMaxInputChars()`/`setMaxInputChars(int)` -> input character limit. +- `isWarnOnTrim()`/`setWarnOnTrim(boolean)` -> trim warnings. +- `getTopP()`/`setTopP(float)` -> nucleus sampling. +- `getTopK()`/`setTopK(int)` -> top-k sampling. +- `getRepeatPenalty()`/`setRepeatPenalty(float)` -> repetition penalty. +- `getMinP()`/`setMinP(float)` -> min-p sampling. +- `getTopNSigma()`/`setTopNSigma(float)` -> top-n-sigma sampling. +- `getChatTemplateEnableThinking()`/`setChatTemplateEnableThinking(Boolean)` -> tri-state thinking mode. +- `isCachePrompt()`/`setCachePrompt(boolean)` -> prompt-prefix caching. +- `isSwaFull()`/`setSwaFull(boolean)` -> full SWA KV cache. +- `getCacheReuse()`/`setCacheReuse(int)` -> KV prefix reuse threshold. +- `getGpuLayers()`/`setGpuLayers(int)` -> GPU layer offload. +- `getCpuMoeLayers()`/`setCpuMoeLayers(int)` -> CPU MoE layers. +- `getCpuFfnLayers()`/`setCpuFfnLayers(int)` -> CPU FFN layers. +- `getSeed()`/`setSeed(int)` -> generation RNG seed. +- `getKvUnifiedPerSlot()`/`setKvUnifiedPerSlot(int)` -> per-slot KV context cap. +- `getLazyMode()`/`setLazyMode(String)` -> tensor-read laziness. +- `getRepeatLastN()`/`setRepeatLastN(int)` -> repeat-penalty window. +- `getCacheTypeK()`/`setCacheTypeK(String)` -> K-cache data type. +- `getCacheTypeV()`/`setCacheTypeV(String)` -> V-cache data type. +- `isFlashAttn()`/`setFlashAttn(boolean)` -> Flash Attention setting. +- `getBatchSize()`/`setBatchSize(int)` -> logical batch size. +- `getUbatchSize()`/`setUbatchSize(int)` -> physical batch size. +- `getThreadsBatch()`/`setThreadsBatch(int)` -> prompt-processing threads. +- `getMainGpu()`/`setMainGpu(int)` -> primary GPU index. +- `getDevices()`/`setDevices(String)` -> backend device selection. +- `getProvider()`/`setProvider(String)` -> per-model AI provider. +- `getRemoteModel()`/`setRemoteModel(String)` -> remote model identifier. +- `getBaseUrl()`/`setBaseUrl(String)` -> OpenAI-compatible API base URL. +- `getApiKeyEnv()`/`setApiKeyEnv(String)` -> API-key environment-variable name. +- `getReasoningEffort()`/`setReasoningEffort(String)` -> reasoning-effort kwarg. +- `getReasoningBudgetTokens()`/`setReasoningBudgetTokens(int)` -> reasoning token cap. +- `getDryMultiplier()`/`setDryMultiplier(float)` -> DRY repetition penalty. +- `getDryBase()`/`setDryBase(float)` -> DRY penalty growth base. +- `getDryAllowedLength()`/`setDryAllowedLength(int)` -> unpenalized n-gram length. +- `getDryPenaltyLastN()`/`setDryPenaltyLastN(int)` -> DRY look-back window. +- `getDrySequenceBreakers()`/`setDrySequenceBreakers(List)` -> DRY sequence breakers. +- `getStopStrings()`/`setStopStrings(List)` -> generation stop strings. +- `getCalibration()`/`setCalibration(AiCalibration)` -> optional machine timing calibration. +- Public defaults: `DEFAULT_CONTEXT_SIZE`, `DEFAULT_MAX_OUTPUT_TOKENS`, `DEFAULT_TEMPERATURE`, `DEFAULT_THREADS`, `DEFAULT_MAX_INPUT_CHARS`, `DEFAULT_CHARS_PER_TOKEN`, `DEFAULT_SAFETY_MARGIN_CHARS`, `DEFAULT_WARN_ON_TRIM`, `DEFAULT_TOP_P`, `DEFAULT_TOP_K`, `DEFAULT_MIN_P`, `DEFAULT_TOP_N_SIGMA`, `DEFAULT_REPEAT_PENALTY`, `DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING`, `DEFAULT_CACHE_PROMPT`, `DEFAULT_REASONING_EFFORT`, `DEFAULT_REASONING_BUDGET_TOKENS`, `DEFAULT_SWA_FULL`, `DEFAULT_CACHE_REUSE`, `DEFAULT_GPU_LAYERS`, `DEFAULT_SEED`, `DEFAULT_CPU_MOE_LAYERS`, `DEFAULT_CPU_FFN_LAYERS`, `DEFAULT_KV_UNIFIED_PER_SLOT`, `DEFAULT_LAZY_MODE`, `DEFAULT_REPEAT_LAST_N`, `DEFAULT_CACHE_TYPE_K`, `DEFAULT_CACHE_TYPE_V`, `DEFAULT_FLASH_ATTN`, `DEFAULT_BATCH_SIZE`, `DEFAULT_UBATCH_SIZE`, `DEFAULT_THREADS_BATCH`, `DEFAULT_MAIN_GPU`, `DEFAULT_DEVICES`, `DEFAULT_PROVIDER`, `DEFAULT_REMOTE_MODEL`, `DEFAULT_BASE_URL`, `DEFAULT_API_KEY_ENV`, `DEFAULT_DRY_MULTIPLIER`, `DEFAULT_DRY_BASE`, `DEFAULT_DRY_ALLOWED_LENGTH`, `DEFAULT_DRY_PENALTY_LAST_N`. + +#### Dependencies +- `AiCalibration`; `ArrayList`, `Collections`, `List`; Lombok `ToString`; JSpecify `Nullable`. +- `Runtime.getRuntime().availableProcessors()` determines the default thread count, capped at four. + +#### Exceptions / Errors +- Setters generally do not validate parameter ranges; provider/binding validation may reject invalid values. +- Nullable model path, calibration, and thinking mode are preserved; selected nullable setters reset to defaults. + +#### Concurrency +- Mutable, unsynchronized JavaBean; no thread-safety guarantees. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..3dcfe4b5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,48 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:43:47Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures how source files exceeding an AI model’s context window are handled: fail, sample the head, summarize chunks, or emit deterministic metadata. + +#### Purpose +- Defines per-routing-rule behavior for oversized source files. +- Uses `fail` as the default when no strategy is configured. + +#### Type +- `public enum AiOversizeStrategy`; annotated input parameter with `@Nullable`. +- Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`. +- Public default constant: `DEFAULT = FAIL`. + +#### Input +- `fromConfig(String value)` accepts a nullable `` config token. + +#### Output +- `configValue()` returns the config token for a strategy. +- `fromConfig(...)` returns the matching strategy or `DEFAULT` for null or blank input. + +#### Core logic +- Stores each enum value’s config token: `fail`, `sample`, `mapReduce`, or `deterministic`. +- Parses config tokens case-insensitively after trimming whitespace. +- Represents oversized-file handling modes: + - `FAIL`: abort and require a larger-context model. + - `SAMPLE`: summarize the trimmed file head in one call. + - `MAP_REDUCE`: summarize line-boundary chunks, then combine summaries. + - `DETERMINISTIC`: produce model-free metadata and head/tail sample. + +#### Public API +- `configValue()` -> `String` — return config token. +- `fromConfig(String)` -> `AiOversizeStrategy` — parse config token. +- `DEFAULT` — default strategy constant. +- `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` — strategy constants. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `fromConfig(...)` throws `IllegalArgumentException` for a nonblank, unrecognized token. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..c84ef135 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,79 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:43:52Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures source-file selection, AI prompt/model routing, llama.cpp fallback settings, and metadata for generating `.ai.md` project documentation. + +#### Purpose +- Shared mutable configuration for `srcmorph` runs, bindable from Maven, future JSON/YAML, or Java callers. +- Holds source filtering, generation routing, model settings, output location, and generated-document metadata. + +#### Type +- `public class SrcMorphConfiguration` — class; annotated `@ToString`. +- No superclass or interfaces declared. + +#### Input +- `File` paths for project base, output, and model directories; `String` provider, model path, versions, and project name. +- Lists of source subtrees, excludes, extensions, prompt definitions, model definitions, field-generation rules, and fact definitions. +- File-size bounds, force and plan-only flags, and llama.cpp context, token, temperature, and thread settings. + +#### Output +- Exposes configuration values through JavaBean getters; setters replace stored values. +- Defaults: output `src/site/ai`, provider `mock`, llama context `2048`, max output tokens `128`, temperature `0.15f`, threads `AiGenerationConfig.DEFAULT_THREADS`, AI version `0.0.0`. +- Other fields default to `false`, numeric zero, empty plugin version, or `null`. + +#### Core logic +- Stores a unified configuration for source indexing and AI documentation generation; performs no generation itself. +- Uses `fieldGenerations` for per-field routing; llama.cpp settings and `llamaModelPath` are documented as fallbacks when field-generation rules are empty. +- `modelDirectory` specifies the base for relative model paths; absolute paths remain usable, and absent a model directory, relative paths use the JVM working directory. +- Source scope is controlled by base-relative subtrees, exclude globs, extensions, and file-size limits; nonpositive size bounds disable their respective limits. +- `force` requests regeneration of populated AI fields; `planOnly` stops a generate run after its routing plan. +- Maven lifecycle skip flags are deliberately not part of this configuration. + +#### Public API +- `DEFAULT_OUTPUT_DIRECTORY` -> default output path; `DEFAULT_GENERATION_PROVIDER` -> default provider; `DEFAULT_LLAMA_CONTEXT_SIZE` -> default context window. +- `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS` -> default output limit; `DEFAULT_LLAMA_TEMPERATURE` -> default sampling temperature; `DEFAULT_LLAMA_THREADS` -> default CPU threads. +- `DEFAULT_AI_VERSION` -> default summarisation version. +- `SrcMorphConfiguration()` -> initializes defaults. +- `getBaseDirectory()`/`setBaseDirectory(File)` -> project base directory. +- `getOutputDirectory()`/`setOutputDirectory(File)` -> `.ai.md` output directory. +- `isForce()`/`setForce(boolean)` -> regenerate populated fields. +- `getSubtrees()`/`setSubtrees(List)` -> source subdirectory scope. +- `getExcludes()`/`setExcludes(List)` -> excluded source-file globs. +- `getFileExtensions()`/`setFileExtensions(List)` -> indexed file extensions. +- `getMinFileSizeBytes()`/`setMinFileSizeBytes(long)` -> exclusive lower size bound. +- `getMaxFileSizeBytes()`/`setMaxFileSizeBytes(long)` -> inclusive upper size bound. +- `isPlanOnly()`/`setPlanOnly(boolean)` -> stop after routing plan. +- `getGenerationProvider()`/`setGenerationProvider(String)` -> default AI provider. +- `getPromptDefinitions()`/`setPromptDefinitions(List)` -> prompt templates. +- `getAiDefinitions()`/`setAiDefinitions(List)` -> AI model definitions. +- `getModelDirectory()`/`setModelDirectory(File)` -> relative model-path base. +- `getFieldGenerations()`/`setFieldGenerations(List)` -> field routing rules. +- `getFactDefinitions()`/`setFactDefinitions(List)` -> reusable fact groups. +- `getLlamaModelPath()`/`setLlamaModelPath(String)` -> fallback GGUF model path. +- `getLlamaContextSize()`/`setLlamaContextSize(int)` -> fallback context window. +- `getLlamaMaxOutputTokens()`/`setLlamaMaxOutputTokens(int)` -> fallback output token limit. +- `getLlamaTemperature()`/`setLlamaTemperature(float)` -> fallback sampling temperature. +- `getLlamaThreads()`/`setLlamaThreads(int)` -> fallback CPU thread count. +- `getPluginVersion()`/`setPluginVersion(String)` -> generated-header plugin version. +- `getAiVersion()`/`setAiVersion(String)` -> generated-header AI version. +- `getProjectName()`/`setProjectName(String)` -> aggregate index title. + +#### Dependencies +- `java.io.File`; `java.util.List`. +- `lombok.ToString`; `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition`. +- `AiGenerationConfig`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`. + +#### Exceptions / Errors +- No explicit exceptions, validation, or error handling. +- Nullable lists and values may be unset; getters return stored values directly. + +#### Concurrency +- Mutable JavaBean; no synchronization or thread-safety guarantees. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/package.ai.md new file mode 100644 index 00000000..5ae87d01 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/config/package.ai.md @@ -0,0 +1,47 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:46:13Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> Defines source-selection rules and AI documentation-generation settings, including model routing, oversized-file handling, and exact source facts. + +#### Purpose +- Configure which source files are eligible for indexing and how their AI-generated documentation is produced. +- Provide condition evaluation and regex-based fact extraction used to prepare source inputs. + +#### Responsibilities +- **Source filtering:** Combine condition trees over file metadata, including extensions, size, line count, modification time, and relative-path globs; validate rules and identify when line counting is needed. +- **Generation configuration:** Store source scope, output paths, prompts, model and field-routing definitions, fallback llama.cpp settings, and generated-document metadata. +- **Prompt facts and size handling:** Validate regex fact counters and format exact whole-file counts; define policies for files exceeding model context limits. + +#### Key units +- `AiConditionEvaluator` — validates and evaluates `AiCondition` trees against `AiFileContext`, and detects line-count requirements. +- `AiConditionGroup` — holds defensively copied child conditions for Maven-configured `and`/`or` groups. +- `AiFactExtractor` — validates `AiFactCounter` definitions and formats whole-source regex counts for prompts. +- `AiGenerationConfig` — stores model, sampling, reasoning, hardware, caching, provider, and stop-behavior settings for a generation step. +- `AiOversizeStrategy` — represents `FAIL`, `SAMPLE`, `MAP_REDUCE`, and `DETERMINISTIC` handling modes for oversized files. +- `SrcMorphConfiguration` — stores run-wide source selection, routing, fallback-model, output, and documentation metadata settings. + +#### Data flow +- File metadata and an `AiCondition` tree enter `AiConditionEvaluator`; validation checks rule shape and bounds before matching, while `usesLines` indicates whether source contents must be read for line counts. +- Full source text and configured `AiFactCounter` entries enter `AiFactExtractor`; usable regexes produce exact counts formatted as a facts block. +- `SrcMorphConfiguration` supplies source scope and generation-routing definitions; `AiGenerationConfig` carries settings for a generation step, while `AiOversizeStrategy` expresses the configured policy for oversized inputs. + +#### Dependencies +- Internal configuration and domain types: `AiCondition`, `AiRangeCondition`, `AiFileContext`, `AiSourceExcludeFilter`, `AiFactCounter`, `AiCalibration`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, and `AiFactDefinition`. +- Java utilities include `Instant`, collections, regex APIs, and `File`; annotations and generated behavior use JSpecify `Nullable` and Lombok `ToString`. + +#### Cross-cutting +- `AiGenerationConfig` and `SrcMorphConfiguration` are mutable JavaBeans without synchronization; evaluator and fact-extractor logic is stateless. +- Configuration validation is explicit for condition trees and fact counters; generation-setting setters generally do not validate ranges. +- Nullable configuration is used throughout; `AiOversizeStrategy.fromConfig` defaults blank or null values to `FAIL`, but rejects unknown nonblank tokens. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..6900264d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,54 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:46:29Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Selects and prepares source material for AI documentation, then generates text through configurable local or OpenAI-compatible model backends. + +#### Purpose +- Define source-selection and generation settings for AI documentation runs. +- Route generation requests to supported providers and normalize completion output. + +#### Responsibilities +- **Source selection and prompt preparation:** Evaluate file-metadata conditions, extract configured regex-based source facts, and represent policies for oversized inputs. +- **Run and model configuration:** Store source scope, output and documentation metadata, prompts, model and field-routing settings, and generation parameters. +- **Generation backends:** Select mock, llama.cpp JNI, or OpenAI-compatible providers; construct requests and return completion text with timing data where available. +- **Response and transport handling:** Parse local-model responses, clean leading Gemma 4 thinking blocks, and support OpenAI-compatible endpoint, API-key, HTTP-error, and usage handling. + +#### Key units +- `SrcMorphConfiguration` — stores run-wide source selection, routing, fallback-model, output, and documentation metadata settings. +- `AiConditionEvaluator` — validates and evaluates `AiCondition` trees against `AiFileContext`, and identifies line-count requirements. +- `AiFactExtractor` — validates fact-counter definitions and formats regex counts from source text. +- `AiGenerationConfig` — stores model, sampling, reasoning, hardware, caching, provider, and stop-behavior settings. +- `AiOversizeStrategy` — represents `FAIL`, `SAMPLE`, `MAP_REDUCE`, and `DETERMINISTIC` oversized-file policies. +- `AiGenerationProvider` — defines generation, optional timing results, and resource cleanup. +- `AiGenerationProviderFactory` — selects a mock, llama.cpp JNI, or OpenAI-compatible backend from effective provider settings. +- `LlamaCppJniConfig` — holds immutable local-inference and compatible-provider settings, constructed through a fluent builder. +- `LlamaCppJniAiGenerationProvider` — performs local llama.cpp JNI inference and exposes response text and native timing metrics. +- `AiCompletionParser` — removes an initial Gemma 4 thinking block while preserving answer text. +- `OpenAiCompatibleProviderSupport` — provides request construction and endpoint, API-key, HTTP-error, and timing utilities. + +#### Data flow +- File metadata and an `AiCondition` tree pass to `AiConditionEvaluator` for validation and matching; `usesLines` signals when source contents are needed for line counts. +- Source text and `AiFactCounter` entries pass to `AiFactExtractor`, which formats exact counts for prompt facts. +- `SrcMorphConfiguration` supplies source scope and routing definitions; generation settings configure the step and oversized-input policy. +- Provider settings flow through `AiGenerationProviderFactory`; the selected backend consumes `AiGenerationRequest` and `AiPromptSupport` to produce text and, where supported, timing data. +- The llama.cpp backend builds inference parameters, invokes chat completion, and parses and cleans response content; OpenAI-compatible support builds non-streaming chat-completion requests and converts usage and elapsed time to timings. + +#### Dependencies +- Internal configuration and domain types include `AiCondition`, `AiFileContext`, `AiFactCounter`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiPromptDefinition`, `AiGenerationRequest`, and `AiPromptSupport`. +- Generation support includes `AiGenerationTimings`, `ChatResponseParser`, `ChatResponse`, and `Usage`. +- Local inference uses llama.cpp JNI types and `LlamaCppJniProviderSupport`; OpenAI-compatible request serialization uses Jackson and API-key resolution uses a supplied environment lookup function. +- Configuration utilities include Java collections, regex APIs, `Instant`, and `File`; configuration annotations include JSpecify `Nullable` and Lombok `ToString`. + +#### Cross-cutting +- Configuration beans are generally mutable and unsynchronized; `LlamaCppJniConfig` is immutable after construction, while its builder is not thread-safe. +- Condition trees and fact counters have explicit validation; generation-setting setters generally do not validate ranges. +- Providers implement `AutoCloseable`; the default timing method delegates to generation with zero timings, while the llama.cpp provider closes its cached native model. +- llama.cpp lazy initialization and close/generation operations are unsynchronized; OpenAI-compatible support restricts API-key transmission to HTTPS or HTTP loopback. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..7b49aa9f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,44 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:44:02Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Removes leading Gemma 4 chain-of-thought text from model completions so only the answer is stored. + +#### Purpose +- `AiCompletionParser` cleans raw LLM completion text before it is persisted. +- Preserves markers appearing in answer text; strips a thinking block only when it begins the response. + +#### Type +- `public class AiCompletionParser` — class; non-final; annotated `@ToString`. + +#### Input +- `parseCompletion(String response)` accepts raw model completion text; `null` is allowed. + +#### Output +- Returns trimmed answer text, never `null`; a `null` response becomes `""`. +- No fields are mutated and no resources are written. + +#### Core logic +- Trims the response; returns it unchanged if it does not start with `THINKING_BLOCK_START_MARKER`. +- For a leading thinking block, finds the first `THINKING_BLOCK_END_MARKER` after the start marker and returns the trimmed text following it. +- Throws `IOException` if the leading block has no closing marker, with guidance to increase `maxOutputTokens` and the response length. + +#### Public API +- `AiCompletionParser()` — creates parser. +- `parseCompletion(String)` -> `String` — strips leading thinking block. +- `THINKING_BLOCK_START_MARKER` (`String`) — Gemma 4 thinking-block opener. +- `THINKING_BLOCK_END_MARKER` (`String`) — Gemma 4 thinking-block closer. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `parseCompletion` throws `IOException` when a leading thinking block lacks its closing marker. +- `null` input is handled as an empty response. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..72ccec02 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,46 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:44:06Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Generates text from source-aware AI requests, with optional model timing data for calibration. + +#### Purpose +- Defines a pluggable AI backend for generating text from `AiGenerationRequest`. +- Supports local model implementations and test mocks. + +#### Type +- `AiGenerationProvider` — interface; extends `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume a request containing a prompt key, source file, source text, and current header. + +#### Output +- Returns generated text; it may be blank but is documented as never `null`. +- Default `generateWithTimings` returns `AiGenerationTimings` with generated text and zero timing values. +- `close()` has no default side effect. + +#### Core logic +- Implementations provide `generate` using their default sampling parameters. +- Default `generateWithTimings` delegates to `generate` and reports unavailable timings as zero; providers may override it. +- Default `close` does nothing. + +#### Public API +- `generate(AiGenerationRequest)` -> `String` — generate text. +- `generateWithTimings(AiGenerationRequest)` -> `AiGenerationTimings` — generate text with timing data. +- `close()` -> `void` — close provider resources. + +#### Dependencies +- `AiGenerationRequest` +- `AiGenerationTimings` +- `AutoCloseable` +- `IOException` + +#### Exceptions / Errors +- `generate`, `generateWithTimings`, and `close` declare `IOException` for provider failures. +- Generated text is documented as non-null; it may be blank. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..9c43212f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,56 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:44:10Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Selects a mock, llama.cpp, or OpenAI-compatible AI generation provider using run-level and model-level provider settings. + +#### Purpose +- Creates the provider that generates AI responses for a configured model. +- Uses the model’s provider setting when present; otherwise uses the run’s setting, defaulting to mock. + +#### Type +- `public class AiGenerationProviderFactory` — class; annotated `@ToString`. + +#### Input +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` — run provider key, model configuration, and prompt lookup support. +- `effectiveProvider(String runProvider, String modelProvider)` — nullable run and model provider keys. +- `compatibilityHelper` — internally constructed `Java8CompatibilityHelper`. + +#### Output +- `create(...)` returns a newly instantiated `AiGenerationProvider`. +- Provider constants expose keys: `mock`, `llamacpp-jni`, and `openai-compatible`. + +#### Core logic +- `effectiveProvider` returns the trimmed model provider if non-null and nonblank; otherwise returns the run provider. +- `create` resolves the effective key and returns `MockAiGenerationProvider` when it is null or blank. +- Dispatches `mock` to `MockAiGenerationProvider`, `llamacpp-jni` to `LlamaCppJniAiGenerationProvider`, and `openai-compatible` to `OpenAiCompatibleAiGenerationProvider`. +- Passes `llamaConfig` and `promptSupport` to the llama.cpp and OpenAI-compatible providers. + +#### Public API +- `AiGenerationProviderFactory()` — constructs factory. +- `PROVIDER_MOCK` — mock provider key. +- `PROVIDER_LLAMACPP_JNI` — llama.cpp provider key. +- `PROVIDER_OPENAI_COMPATIBLE` — OpenAI-compatible provider key. +- `effectiveProvider(String, String) -> @Nullable String` — resolves model and run provider. +- `create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider` — creates configured provider. + +#### Dependencies +- `AiGenerationProvider` +- `MockAiGenerationProvider` +- `LlamaCppJniAiGenerationProvider` +- `OpenAiCompatibleAiGenerationProvider` +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `Java8CompatibilityHelper` +- Lombok `@ToString` +- JSpecify `@Nullable` + +#### Exceptions / Errors +- Throws `IllegalArgumentException` for an unrecognized nonblank provider key. +- Null or blank effective provider selects the mock provider. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..7ad39ae9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,59 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:44:15Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Runs local GGUF language models for AI-assisted code generation and reports inference throughput and prompt-cache reuse. + +#### Purpose +- Generates completion text for `AiGenerationRequest` using llama.cpp through the JNI binding. +- Loads the native model on first generation and reuses it for subsequent requests. + +#### Type +- `public final class LlamaCppJniAiGenerationProvider` — class; implements `AiGenerationProvider`, `AutoCloseable`. +- `@ToString` Lombok annotation; native model handle and provider support are excluded from the generated string. + +#### Input +- Constructor: `LlamaCppJniConfig` for model and inference options; `AiPromptSupport` for request prompt rendering. +- Generation methods consume `AiGenerationRequest`. +- Configuration supplies GGUF path, context/thread settings, GPU and CPU offload controls, KV cache options, batching, lazy loading, devices, and chat-template options. + +#### Output +- `generate(...)` returns parsed completion text. +- `generateWithTimings(...)` returns `AiGenerationTimings` with text, prompt/cache/prediction token counts, and throughput; absent timings produce zero metrics. +- `close()` closes the cached native model when loaded. + +#### Core logic +- Builds `ModelParameters` on first model access, including automatic reasoning-channel parsing and chat-template kwargs from `LlamaCppJniProviderSupport`. +- Applies optional settings only when their configured values meet the relevant guards; creates and caches `LlamaModel`. +- Builds inference parameters via support, calls `chatComplete`, and parses the full response with `ChatResponseParser`. +- `generate(...)` warns on truncated answers, logs prompt-cache reuse, and parses first response content with `AiCompletionParser`. +- `generateWithTimings(...)` exposes native prompt, cache, and predicted-token metrics and their rates. +- Exposes `close()` for native model cleanup. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport)` — validates configuration and initializes support. +- `generate(AiGenerationRequest) -> String` — generate completion text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` — generate text and metrics. +- `close() -> void` — close loaded model. + +#### Dependencies +- `AiGenerationProvider`, `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport` +- `LlamaCppJniConfig`, `LlamaCppJniProviderSupport` +- `LlamaModel`, `ModelParameters`, `FlashAttn`, `ReasoningFormat` +- `ChatResponseParser`, `ChatResponse`, `Timings` +- `AiCompletionParser`, `Java8CompatibilityHelper` +- `IOException`, `Map`, `Objects`, Lombok `ToString`, JSpecify `Nullable` + +#### Exceptions / Errors +- Constructor rejects null config or prompt support with `NullPointerException`. +- `generate(...)` declares `IOException`; chat and response parsing paths are documented as throwing unchecked exceptions. +- Native model construction, inference, parsing, or close failures are not caught here. + +#### Concurrency +- Lazy model initialization and the nullable model field are unsynchronized; concurrent first calls or close/generation are not coordinated. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..131a80f2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,135 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:44:22Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Configures GGUF model loading and text generation, including sampling, hardware offload, caching, remote-provider settings, reasoning, and stop sequences. + +#### Purpose +- Captures immutable llama.cpp JNI and OpenAI-compatible generation settings with defaults sourced from `AiGenerationConfig`. +- Provides a fluent builder requiring a model path and allowing optional overrides. + +#### Type +- `LlamaCppJniConfig` — `final` class; annotated `@ConvertToRecord`, Lombok `@ToString` and `@EqualsAndHashCode`. +- Nested `Builder` — `public static final` class. +- 41 configuration fields; all final in the config. Nullable `Boolean chatTemplateEnableThinking` distinguishes unset from true/false. + +#### Input +- `builder(String modelPath)` requires a non-null GGUF model path. +- Builder setters accept sampling values, generation limits, CPU/GPU and KV-cache controls, provider/API metadata, reasoning and DRY settings, plus DRY sequence breakers and stop strings. +- Defaults come from `AiGenerationConfig.DEFAULT_*`; both lists default to empty lists. + +#### Output +- `build()` produces an immutable `LlamaCppJniConfig` containing builder values. +- List accessors return unmodifiable views of configured DRY sequence breakers and stop strings. +- Lombok generates value-based `equals`, `hashCode`, and `toString` over all 41 fields. + +#### Core logic +- Builder initializes optional settings from `AiGenerationConfig` defaults; callers override them through fluent setters. +- Constructor copies every builder field without further normalization. +- Null string setters restore their corresponding defaults; null list setters restore empty lists. Null thinking mode remains unset. +- `apiKeyEnv` stores the environment-variable name, not the API key; empty provider/model/reasoning values have documented omission or fallback semantics. +- Builder is mutable and not thread-safe; the produced config is immutable. + +#### Public API +- `builder(String) -> Builder` — start configuration with model path. +- `modelPath() -> String` — GGUF model path. +- `contextSize() -> int` — context window. +- `maxOutputTokens() -> int` — output token limit. +- `temperature() -> float` — sampling temperature. +- `threads() -> int` — CPU thread count. +- `topP() -> float` — nucleus threshold. +- `topK() -> int` — top-k limit. +- `minP() -> float` — min-p threshold. +- `topNSigma() -> float` — top-n-sigma threshold. +- `repeatPenalty() -> float` — repetition penalty. +- `chatTemplateEnableThinking() -> @Nullable Boolean` — template thinking mode. +- `cachePrompt() -> boolean` — prompt caching flag. +- `swaFull() -> boolean` — full SWA cache flag. +- `cacheReuse() -> int` — KV prefix reuse chunk. +- `gpuLayers() -> int` — GPU offload layers. +- `seed() -> int` — generation RNG seed. +- `cpuMoeLayers() -> int` — CPU MoE layers. +- `cpuFfnLayers() -> int` — CPU FFN layers. +- `kvUnifiedPerSlot() -> int` — per-slot KV cap. +- `lazyMode() -> String` — tensor-read laziness. +- `repeatLastN() -> int` — repetition window. +- `cacheTypeK() -> String` — K-cache data type. +- `cacheTypeV() -> String` — V-cache data type. +- `flashAttn() -> boolean` — Flash Attention flag. +- `batchSize() -> int` — logical batch size. +- `ubatchSize() -> int` — physical batch size. +- `threadsBatch() -> int` — batch-processing threads. +- `mainGpu() -> int` — primary GPU index. +- `devices() -> String` — device selection. +- `provider() -> String` — AI provider selection. +- `remoteModel() -> String` — remote model identifier. +- `baseUrl() -> String` — OpenAI-compatible API base URL. +- `apiKeyEnv() -> String` — API-key environment variable name. +- `reasoningEffort() -> String` — reasoning-effort setting. +- `reasoningBudgetTokens() -> int` — reasoning token budget. +- `dryMultiplier() -> float` — DRY sampling multiplier. +- `dryBase() -> float` — DRY base. +- `dryAllowedLength() -> int` — DRY allowed length. +- `dryPenaltyLastN() -> int` — DRY penalty window. +- `drySequenceBreakers() -> List` — unmodifiable DRY breakers. +- `stopStrings() -> List` — unmodifiable stop strings. +- `Builder.contextSize(int) -> Builder` — set context window. +- `Builder.maxOutputTokens(int) -> Builder` — set output limit. +- `Builder.temperature(float) -> Builder` — set temperature. +- `Builder.threads(int) -> Builder` — set CPU threads. +- `Builder.topP(float) -> Builder` — set nucleus threshold. +- `Builder.topK(int) -> Builder` — set top-k limit. +- `Builder.minP(float) -> Builder` — set min-p threshold. +- `Builder.topNSigma(float) -> Builder` — set top-n-sigma threshold. +- `Builder.repeatPenalty(float) -> Builder` — set repetition penalty. +- `Builder.chatTemplateEnableThinking(@Nullable Boolean) -> Builder` — set template thinking mode. +- `Builder.cachePrompt(boolean) -> Builder` — set prompt caching. +- `Builder.swaFull(boolean) -> Builder` — set full SWA cache. +- `Builder.cacheReuse(int) -> Builder` — set KV prefix reuse chunk. +- `Builder.gpuLayers(int) -> Builder` — set GPU offload layers. +- `Builder.seed(int) -> Builder` — set RNG seed. +- `Builder.cpuMoeLayers(int) -> Builder` — set CPU MoE layers. +- `Builder.cpuFfnLayers(int) -> Builder` — set CPU FFN layers. +- `Builder.kvUnifiedPerSlot(int) -> Builder` — set per-slot KV cap. +- `Builder.lazyMode(String) -> Builder` — set tensor-read laziness. +- `Builder.repeatLastN(int) -> Builder` — set repetition window. +- `Builder.cacheTypeK(String) -> Builder` — set K-cache type. +- `Builder.cacheTypeV(String) -> Builder` — set V-cache type. +- `Builder.flashAttn(boolean) -> Builder` — set Flash Attention. +- `Builder.batchSize(int) -> Builder` — set logical batch size. +- `Builder.ubatchSize(int) -> Builder` — set physical batch size. +- `Builder.threadsBatch(int) -> Builder` — set batch threads. +- `Builder.mainGpu(int) -> Builder` — set primary GPU. +- `Builder.devices(String) -> Builder` — set device selection. +- `Builder.provider(String) -> Builder` — set provider. +- `Builder.remoteModel(String) -> Builder` — set remote model. +- `Builder.baseUrl(String) -> Builder` — set API base URL. +- `Builder.apiKeyEnv(String) -> Builder` — set API-key variable name. +- `Builder.reasoningEffort(String) -> Builder` — set reasoning effort. +- `Builder.reasoningBudgetTokens(int) -> Builder` — set reasoning budget. +- `Builder.dryMultiplier(float) -> Builder` — set DRY multiplier. +- `Builder.dryBase(float) -> Builder` — set DRY base. +- `Builder.dryAllowedLength(int) -> Builder` — set DRY allowed length. +- `Builder.dryPenaltyLastN(int) -> Builder` — set DRY penalty window. +- `Builder.drySequenceBreakers(List) -> Builder` — set DRY breakers. +- `Builder.stopStrings(List) -> Builder` — set stop strings. +- `Builder.build() -> LlamaCppJniConfig` — create immutable config. + +#### Dependencies +- `AiGenerationConfig`, `ConvertToRecord`, `Nullable`. +- `Collections`, `List`, `Objects`. +- Lombok `EqualsAndHashCode`, `ToString`. + +#### Exceptions / Errors +- `builder(null)` throws `NullPointerException` with message `modelPath`. +- Null string builder inputs restore defaults for lazy mode, cache types, devices, provider, remote model, base URL, API-key variable, and reasoning effort. +- Null list inputs become empty lists; nullable thinking mode is preserved. + +#### Concurrency +- `LlamaCppJniConfig` is immutable; builder is explicitly not thread-safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..036f6837 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,110 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:44:37Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> OpenAI-compatible chat generation builds portable completion requests, protects API keys on HTTP transports, and converts responses and usage into generation timings. + +#### Purpose +- Supports the non-network behavior for OpenAI-compatible AI generation: request JSON, endpoint and API-key handling, HTTP status/error helpers, and timing conversion. +- Provides reusable loopback-host and success-status checks for remote model calls. + +#### Type +- `final class OpenAiCompatibleProviderSupport` — package-private final class. +- Annotated `@ToString`; prompt support and environment lookup are excluded from generated string output. + +#### Input +- Constructor: `LlamaCppJniConfig`, `AiPromptSupport`, environment lookup `Function`. +- Request construction reads `AiGenerationRequest` prompt key, source file, and source text; configuration supplies model, URL, API-key variable name, and sampling options. +- API-key lookup reads the configured environment variable; transport checks accept an endpoint string. +- Timing conversion consumes completion text, `ChatResponse` usage, and wall-clock seconds. +- Error formatting consumes endpoint, HTTP status, and response body. + +#### Output +- Serializes chat-completions request JSON with non-streaming mode. +- Produces `/chat/completions` endpoint, nullable trimmed API key, status/error helpers, and `AiGenerationTimings`. +- Rejects cleartext API-key transmission to non-loopback HTTP hosts. + +#### Core logic +- Builds `messages` with system prompt and user source content; includes required sampling fields and conditionally includes model, `top_k`, `min_p`, seed, stop strings, and reasoning effort. +- Trims `baseUrl`, requires `http://` or `https://`, strips trailing slashes, then appends `/chat/completions`. +- Resolves `apiKeyEnv`; returns null if unconfigured, missing, or blank, otherwise returns the trimmed value. +- Allows a configured API key on HTTPS; on HTTP, parses the host and permits only exact `localhost`, IPv4 `127.x.x.x` matching the literal pattern, or `[::1]`. +- Classifies status codes 200–299 as success; formats failures with endpoint, status, and up to 500 body characters plus `...` when truncated. +- Converts response usage counts to integers; decode rate is completion tokens divided by positive wall-clock seconds, otherwise zero; prefill rate is zero. + +#### Public API +- No public or protected members; all declared methods and constructor are package-private. + +#### Dependencies +- `LlamaCppJniConfig`, `AiGenerationRequest`, `AiPromptSupport`, `Java8CompatibilityHelper` +- `ChatResponse`, `Usage`, `AiGenerationTimings` +- Jackson `ObjectMapper`, `ArrayNode`, `ObjectNode` +- `Function`, `Objects`, `List`, `URL`, `IOException`, `Pattern` +- Lombok `@ToString`; JSpecify `@Nullable` + +#### Exceptions / Errors +- Constructor rejects null config, prompt support, or environment function via `Objects.requireNonNull`. +- `requestBody()` propagates `IOException` from JSON serialization. +- `endpoint()` throws `IllegalArgumentException` for non-HTTP(S) base URLs. +- `apiKeyFor()` may throw `IOException` for invalid URL parsing or configured keys sent to non-loopback HTTP hosts. +- `errorMessage()` truncates bodies longer than 500 characters. + +#### Concurrency +- No synchronization or mutable per-call state; configuration, prompt support, environment function, and compatibility helper are instance fields. + +DISCONTINUE + +> OpenAI-compatible chat generation builds completion requests, protects API keys on HTTP transports, and converts response usage into generation timings. + +#### Purpose +- Provides non-network support for OpenAI-compatible generation: request JSON, endpoint and API-key handling, status and error helpers, and timing conversion. +- Centralizes loopback-host validation for API-key transport safety. + +#### Type +- `final class OpenAiCompatibleProviderSupport` — package-private final class. +- Annotated `@ToString`; `promptSupport` and `environment` are excluded from generated string output. + +#### Input +- Constructor receives `LlamaCppJniConfig`, `AiPromptSupport`, and an environment lookup function. +- Request creation reads `AiGenerationRequest` prompt key, source file, and source text, plus model and sampling options from `LlamaCppJniConfig`. +- API-key resolution reads the configured environment variable; transport validation receives an endpoint URL. +- Timing conversion receives completion text, `ChatResponse`, and elapsed seconds; error formatting receives endpoint, status, and body. + +#### Output +- JSON chat-completions request body and `/chat/completions` endpoint. +- Nullable trimmed API key, HTTP success classification, formatted error message, loopback-host predicate, and `AiGenerationTimings`. +- Refuses configured API keys over plain HTTP to non-loopback hosts. + +#### Core logic +- Builds system and user messages from `AiPromptSupport`; emits `stream: false` and configured sampling values. +- Includes `model` and `reasoning.effort` only when non-blank; includes `top_k` and `min_p` only when positive, `seed` when nonnegative, and `stop` when non-empty. +- Trims `baseUrl`, accepts only `http://` or `https://`, removes trailing slashes, then appends `/chat/completions`. +- Resolves `apiKeyEnv` through the supplied environment function; returns null if unset, missing, or blank, otherwise returns the trimmed key. +- For HTTP endpoints with a key, allows only exact `localhost`, matching `127.x.x.x`, or `[::1]`; HTTPS does not require this check. +- Treats statuses 200–299 as success; error messages include endpoint, status, and at most 500 body characters, with `...` for longer bodies. +- Derives token counts from `ChatResponse.Usage`; decode rate is completion tokens divided by positive elapsed seconds, or zero; prefill rate is zero. + +#### Public API +- No public or protected members; constructor and methods are package-private. + +#### Dependencies +- `LlamaCppJniConfig`, `AiGenerationRequest`, `AiPromptSupport`, `Java8CompatibilityHelper` +- `ChatResponse`, `Usage`, `AiGenerationTimings` +- Jackson `ObjectMapper`, `ArrayNode`, `ObjectNode` +- Java `Function`, `Objects`, `List`, `URL`, `IOException`, `Pattern` +- Lombok `@ToString`; JSpecify `@Nullable` + +#### Exceptions / Errors +- Constructor rejects null config, prompt support, or environment function. +- `requestBody()` may throw `IOException` during JSON serialization. +- `endpoint()` throws `IllegalArgumentException` for a non-HTTP(S) base URL. +- `apiKeyFor()` may throw `IOException` for URL parsing failures or an API key sent to a non-loopback HTTP host. + +#### Concurrency +- No synchronization; fields are final, while request and response-processing data are local to each call. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/package.ai.md new file mode 100644 index 00000000..cbace908 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/java/provider/package.ai.md @@ -0,0 +1,50 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:46:20Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Generates source-aware text completions through configurable mock, local llama.cpp, or OpenAI-compatible backends, with response cleanup and optional inference metrics. + +#### Purpose +- Define and construct AI generation backends for requests containing a prompt key and source context. +- Configure model and transport behavior, normalize completion text, and expose timing data where available. + +#### Responsibilities +- **Provider contract and selection:** `AiGenerationProvider` defines generation, optional timing results, and resource cleanup; `AiGenerationProviderFactory` resolves model-level versus run-level provider settings and dispatches to mock, llama.cpp JNI, or OpenAI-compatible implementations. +- **Local model inference:** `LlamaCppJniAiGenerationProvider` lazily loads and reuses a native GGUF model, performs chat inference, parses responses, and reports token and throughput metrics. +- **Provider configuration:** `LlamaCppJniConfig` captures immutable model, sampling, hardware, cache, reasoning, provider, and stop-sequence settings. +- **Completion and remote-request support:** `AiCompletionParser` strips a leading Gemma 4 thinking block; `OpenAiCompatibleProviderSupport` builds chat-completion requests and handles endpoint, API-key, HTTP-status, error-message, and usage-to-timing utilities. + +#### Key units +- `AiGenerationProvider` — backend interface for generating text, optionally with timings, and closing resources. +- `AiGenerationProviderFactory` — chooses `mock`, `llamacpp-jni`, or `openai-compatible` using effective provider settings. +- `LlamaCppJniAiGenerationProvider` — runs local llama.cpp JNI inference and exposes response text and native timing metrics. +- `LlamaCppJniConfig` — immutable configuration value with a fluent builder for local inference and compatible-provider options. +- `AiCompletionParser` — removes an initial Gemma 4 thinking block while preserving answer text. +- `OpenAiCompatibleProviderSupport` — package-private helpers for request JSON, endpoint and API-key handling, HTTP checks, error formatting, and timing conversion. + +#### Data flow +- Provider settings and `LlamaCppJniConfig` flow through `AiGenerationProviderFactory` to a selected backend; missing or blank effective settings select the mock provider. +- A backend consumes `AiGenerationRequest` and `AiPromptSupport`; the llama.cpp provider builds inference parameters, invokes chat completion, parses the response, and applies `AiCompletionParser` to its first response content. +- OpenAI-compatible support builds a non-streaming chat-completions request from system and user prompts and configuration; response usage and elapsed time can be converted to `AiGenerationTimings`. + +#### Dependencies +- Internal request and prompt types: `AiGenerationRequest`, `AiPromptSupport`; configuration defaults: `AiGenerationConfig`. +- Generation support types: `AiGenerationTimings`, `ChatResponseParser`, `ChatResponse`, and `Usage`. +- Local inference: llama.cpp JNI types including `LlamaModel`, `ModelParameters`, `FlashAttn`, and `ReasoningFormat`, plus `LlamaCppJniProviderSupport`. +- OpenAI-compatible request serialization uses Jackson; API-key resolution uses a supplied environment lookup function. + +#### Cross-cutting +- Providers implement `AutoCloseable`; the interface’s default timing method delegates to generation and reports zero timings, while the llama.cpp provider closes its cached native model. +- `LlamaCppJniConfig` is immutable after construction; its builder is mutable and not thread-safe. The llama.cpp provider’s lazy model initialization and close/generation operations are unsynchronized. +- OpenAI-compatible support allows API keys over HTTPS or HTTP loopback only; it rejects cleartext key transmission to non-loopback hosts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..1f3f97e3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/kernels/histogram.cl.ai.md @@ -0,0 +1,45 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:45:39Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Counts the frequency of each byte value in an image or byte stream using parallel work-group histograms and a reduction pass. + +#### Purpose +- Computes a 256-bin byte histogram in two OpenCL passes. +- Produces per-work-group partial counts, then combines them into final bin totals. + +#### Type +- OpenCL C 1.2 kernel source; defines two `__kernel` entry points. + +#### Input +- `histogram_partial`: byte buffer `input`, element count `length`, output buffer `partial`, and work-group local-memory buffer `local_bins`. +- `histogram_reduce`: partial histogram buffer `partial` and number of work-groups `group_count`. + +#### Output +- `histogram_partial` writes `BINS` counters per work-group to `partial`. +- `histogram_reduce` writes the final `BINS` counts to `histogram`. + +#### Core logic +- `histogram_partial` initializes local bins cooperatively, synchronizes the work-group, and counts input bytes using strided global-ID traversal and local atomic increments. +- After a second local-memory barrier, work-items cooperatively write the local counts to the work-group’s partial-histogram region. +- `histogram_reduce` assigns one work-item to each bin, sums that bin across all work-groups, and stores the total; IDs outside the bin range return immediately. + +#### Public API +- `histogram_partial(input, length, partial, local_bins) -> void` — count bytes per work-group. +- `histogram_reduce(partial, group_count, histogram) -> void` — combine partial counts per bin. + +#### Constants and configuration +- `BINS=256` — number of byte-value bins. + +#### Dependencies +- OpenCL built-ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `barrier`, `atomic_inc`. +- OpenCL memory fence flag: `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- No explicit error handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/kernels/package.ai.md new file mode 100644 index 00000000..5819878b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/kernels/package.ai.md @@ -0,0 +1,36 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:46:36Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes byte-value frequency distributions for image or byte-stream data using parallel histogramming. + +#### Purpose +- Produces a 256-bin histogram of input bytes. +- Uses per-work-group partial histograms and a reduction pass to calculate final counts. + +#### Responsibilities +- Parallel counting: each work-group counts byte values into local bins and writes its partial counts. +- Histogram reduction: combines each bin’s partial counts across work-groups. + +#### Key units +- `histogram_partial` — builds one 256-bin partial histogram per work-group. +- `histogram_reduce` — sums partial counts for each bin into the final histogram. +- `BINS` — configures the histogram to 256 byte-value bins. + +#### Data flow +- `input` bytes and `length` feed `histogram_partial`; work-groups count values into `local_bins` and write results to `partial`. +- `histogram_reduce` reads `partial` and `group_count`, then writes the combined counts to `histogram`. + +#### Dependencies +- OpenCL built-ins for work-item and work-group indexing, barriers, and local atomic increments. +- `CLK_LOCAL_MEM_FENCE` for local-memory synchronization. + +#### Cross-cutting +- Uses OpenCL C 1.2 work-group parallelism, local-memory bins, atomic increments, and barriers. +- Defines no explicit error handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..e5a9a188 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,46 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:46:49Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides low-level byte-stream processing alongside operational backup rotation and regional sales reporting utilities. + +#### Purpose +- Computes byte-frequency histograms and buffers producer-to-consumer streams. +- Supports operational workflows for rotating directory backups and summarizing monthly regional sales. + +#### Responsibilities +- **Byte histogramming (`kernels/`):** Count input bytes into 256 bins using work-group partial histograms and a reduction pass. +- **FIFO buffering (`ringbuf/`):** Manage a bounded circular byte buffer, including lifecycle, occupancy queries, and partial reads and writes. +- **Operational scripts (`scripts/`):** Create retained timestamped compressed backups and report currency-filtered monthly sales by region. + +#### Key units +- `histogram_partial` / `histogram_reduce` — build per-work-group byte counts and combine them into the final 256-bin histogram. +- `ringbuf_t` / `ringbuf_status_t` — represent ring-buffer state and initialization outcomes. +- `ringbuf_init`, `ringbuf_free`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space` — manage storage and report or transfer buffered bytes. +- `rotate_backups.sh` — create timestamped tar.gz archives and enforce retention. +- `Order`, `parse_orders`, `revenue_by_month_and_region`, `main` — parse currency-matched CSV orders, aggregate monthly regional revenue, and print qualifying totals. + +#### Data flow +- **Histogram:** Input bytes → per-work-group local bins → partial histograms → reduction into final bin counts. +- **Ring buffer:** Initialize allocated storage → writes enqueue into available slots → reads dequeue stored bytes; indices determine occupancy. +- **Backups:** Source directory → temporary `.partial` archive → timestamped archive → retention cleanup. +- **Sales reporting:** CSV files → currency-filtered `Order` records → month/region totals → minimum-revenue filter → tab-separated output. + +#### Dependencies +- `kernels/` uses OpenCL C 1.2 work-item/work-group operations, local atomics, and barriers. +- `ringbuf/` pairs `ringbuf.c` with `ringbuf.h` and uses standard allocation and byte-copy routines. +- `rotate_backups.sh` uses Bash and system commands including `tar`, `date`, `mv`, and `rm`. +- `sales_report.py` uses Python standard-library CSV, argument parsing, dates, decimals, and collections. + +#### Cross-cutting +- Histogram computation uses work-group parallelism, local-memory bins, and synchronization barriers. +- `ringbuf/` targets single-producer, single-consumer use; power-of-two capacity enables mask-based wraparound, with one slot reserved to distinguish full from empty. +- Backup creation cleans up partial archives on exit; sales CSV validation reports malformed headers or row values through `ValueError`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/ringbuf/package.ai.md new file mode 100644 index 00000000..8b2a31d6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/ringbuf/package.ai.md @@ -0,0 +1,40 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:46:40Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Buffers producer-to-consumer byte streams in FIFO order using bounded circular storage. + +#### Purpose +- Provide a fixed-capacity byte ring buffer with initialization, cleanup, occupancy queries, and partial reads and writes. +- Support single-producer, single-consumer use; reserve one slot to distinguish full from empty. + +#### Responsibilities +- Buffer lifecycle and validation: allocate only for nonzero power-of-two capacities, initialize indices, and release/reset storage. +- FIFO transfer and capacity tracking: copy bytes across wraparound boundaries, limiting transfers to available space or stored data. + +#### Key units +- `ringbuf_t` — buffer state containing storage, capacity, and `head`/`tail` indices. +- `ringbuf_status_t` — initialization result codes `RINGBUF_OK`, `RINGBUF_EINVAL`, and `RINGBUF_ENOMEM`. +- `ringbuf_init`, `ringbuf_free` — initialize and release buffer storage. +- `ringbuf_write`, `ringbuf_read` — enqueue and dequeue up to the requested byte count. +- `ringbuf_used`, `ringbuf_free_space` — report stored and writable byte counts. + +#### Data flow +- `ringbuf_init` validates capacity and allocates storage; writes copy source bytes into available slots and advance `head`, while reads copy stored bytes out and advance `tail`. +- Occupancy is derived from the indices and capacity; usable storage is `capacity - 1`. + +#### Dependencies +- `ringbuf.c` implements the API declared by `ringbuf.h`. +- Uses standard allocation and copy routines from `` and ``, with `size_t` and `uint8_t` types. + +#### Cross-cutting +- Power-of-two capacity enables index wraparound through a capacity mask. +- `head` and `tail` are documented as producer-owned and consumer-owned `volatile` indices; the API is intended for single-producer, single-consumer use. +- Invalid capacity and allocation failure are reported through status codes; reads and writes may transfer fewer bytes than requested. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..2c5054d7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,62 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:45:44Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Stores and retrieves byte streams through a bounded circular buffer while preserving FIFO order. + +#### Purpose +- Implements initialization, cleanup, occupancy queries, and byte reads/writes for `ringbuf_t`. +- Uses a power-of-two buffer with one slot reserved to distinguish full from empty. + +#### Type +- C implementation file; exports the `ringbuf_*` functions declared in `ringbuf.h`. + +#### Input +- `ringbuf_init`: `ringbuf_t *rb`, requested `size_t capacity`. +- `ringbuf_write`: buffer, source byte pointer `src`, requested length `len`. +- `ringbuf_read`: buffer, destination byte pointer `dst`, requested length `len`. +- Occupancy queries and cleanup take a `ringbuf_t` pointer. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`; allocates storage and initializes indices on success. +- `ringbuf_write` and `ringbuf_read` return the number of bytes transferred, which may be less than requested. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. +- `ringbuf_free` releases storage and resets buffer fields. + +#### Core logic +- `ringbuf_init` rejects zero or non-power-of-two capacities; allocates `capacity` bytes and sets `head` and `tail` to zero. +- Computes used bytes as `(head - tail) & (capacity - 1)`; free space is `capacity - 1 - used`. +- `ringbuf_write` limits transfer to free space; copies across the array boundary in at most two chunks, then advances `head` with a capacity mask. +- `ringbuf_read` limits transfer to used bytes; copies across the boundary in at most two chunks, then advances `tail` with a capacity mask. +- `ringbuf_free` frees the data allocation and resets `data`, `capacity`, `head`, and `tail`. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — allocate and initialize buffer +- `ringbuf_free(ringbuf_t *rb) -> void` — release and reset buffer +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report stored bytes +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report writable bytes +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — enqueue bytes +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — dequeue bytes +- Internal helpers: `is_power_of_two`, `min_size` + +#### Constants and configuration +- `RINGBUF_EINVAL` — returned for invalid capacity. +- `RINGBUF_ENOMEM` — returned when allocation fails. +- `RINGBUF_OK` — returned on successful initialization. +- No configuration or environment variables are read. + +#### Dependencies +- `"ringbuf.h"` — buffer types, status type, and status codes. +- ``: `malloc`, `free`. +- ``: `memcpy`. +- `uint8_t`, `size_t`. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` for zero or non-power-of-two capacity. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if `malloc` fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..0d3ff0b9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,63 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:45:52Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides fixed-capacity byte buffering between a single producer and a single consumer. + +#### Purpose +- Declares an API for initializing, writing to, reading from, querying, and freeing a byte ring buffer. +- Uses one reserved slot, so usable capacity is `capacity - 1`. + +#### Type +- C header `ringbuf.h`, with C++ linkage compatibility. +- `ringbuf_t`: struct containing a data pointer, capacity, and volatile producer-owned `head` and consumer-owned `tail` indices. +- `ringbuf_status_t`: enum of initialization status codes. +- Buffer capacity must be a power of two. + +#### Input +- `ringbuf_init`: buffer pointer and requested capacity. +- `ringbuf_write`: buffer, source byte pointer, and requested length. +- `ringbuf_read`: buffer, destination byte pointer, and requested length. +- `ringbuf_used` / `ringbuf_free_space`: buffer pointer. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`. +- `ringbuf_write` and `ringbuf_read` return the number of bytes copied, up to the requested length. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. +- `ringbuf_free` releases buffer resources. + +#### Core logic +- Declares a fixed-capacity byte ring buffer intended for single-producer, single-consumer use. +- Tracks the next write and read positions with `head` and `tail`. +- Reserves one slot to distinguish full from empty; usable storage is one byte less than capacity. +- Declares partial-copy semantics for reads and writes. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — initialize buffer. +- `ringbuf_free(ringbuf_t *rb) -> void` — release buffer resources. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — copy bytes into buffer. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — copy bytes out of buffer. +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report bytes currently used. +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report available byte space. + +#### Constants and configuration +- `RINGBUF_H`: include guard. +- Capacity constraint: nonzero power of two; usable capacity is `capacity - 1`. +- `RINGBUF_OK = 0`: success. +- `RINGBUF_EINVAL = -1`: capacity is zero or not a power of two. +- `RINGBUF_ENOMEM = -2`: allocation failed. + +#### Dependencies +- ``: `size_t`. +- ``: `uint8_t`. +- C++ linkage declarations via `extern "C"`. + +#### Exceptions / Errors +- `ringbuf_init` reports invalid capacity with `RINGBUF_EINVAL`. +- `ringbuf_init` reports allocation failure with `RINGBUF_ENOMEM`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/scripts/package.ai.md new file mode 100644 index 00000000..f3f898ce --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/scripts/package.ai.md @@ -0,0 +1,39 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:46:44Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides operational utilities for rotating compressed directory backups and reporting monthly regional sales revenue from order CSVs. + +#### Purpose +- Create timestamped backups with configurable retention. +- Aggregate matching-currency orders into monthly revenue totals by region, with an optional minimum-revenue filter. + +#### Responsibilities +- **Backup rotation:** Archive a source directory as a gzip-compressed tar file, publish it via a temporary `.partial` path, and remove older matching archives beyond the retention count. +- **Sales reporting:** Parse order CSVs, skip rows in other currencies, aggregate amounts by month and region, and print qualifying totals. + +#### Key units +- `rotate_backups.sh` — validates inputs, creates the dated archive, and enforces backup retention. +- `Order` — frozen dataclass holding an order’s date, region, and amount. +- `parse_orders(path, currency)` — validates CSV headers and yields parsed orders matching the selected currency. +- `revenue_by_month_and_region(orders)` — returns sorted monthly revenue totals grouped by region. +- `main(argv=None)` — processes sales-report arguments and prints tab-separated results. + +#### Data flow +- **Backups:** Source directory → temporary tar.gz archive → final timestamped archive → newest-first retention cleanup. +- **Sales report:** One or more CSV files → currency-filtered `Order` records → month/region aggregation → minimum-revenue filter → standard output. + +#### Dependencies +- `rotate_backups.sh` uses Bash and system commands including `tar`, `date`, `mv`, and `rm`; reads and writes the source and backup directories. +- `sales_report.py` uses Python standard-library CSV, argument parsing, dates, decimals, and collections; reads CSV files and writes results to standard output. + +#### Cross-cutting +- Both scripts are command-line utilities with explicit inputs and output behavior. +- Backup creation uses an `EXIT` trap to remove partial archives; sales CSV validation reports malformed headers or row values through `ValueError`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..7f5e30f7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,61 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:45:58Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates dated compressed archives of a source directory and removes older archives beyond the retention count. + +#### Purpose +- Back up one directory to a backup directory, retaining only the newest configured number of archives. +- Run directly as `rotate_backups.sh`; not a sourced library. + +#### Type +- Bash (`#!/usr/bin/env bash`); strict mode: `set -euo pipefail`. + +#### Input +- `$1` → `SOURCE_DIR`: directory to archive. +- `$2` → `BACKUP_DIR`: destination directory. +- `$3` → `KEEP`: optional retention count; defaults to `7`. +- No options or environment variables read. +- Reads the contents of `SOURCE_DIR` and matching archives in `BACKUP_DIR`. + +#### Output +- Creates `BACKUP_DIR` if needed and writes a gzip-compressed tar archive named `_.tar.gz`. +- Removes older matching archives beyond the newest `KEEP`. +- Prints the created archive and its human-readable size; prints each removed archive. +- Exits `2` for an invalid retention count or missing source directory; exits `0` on success. Other command failures trigger `set -e`. + +#### Core logic +- Requires `SOURCE_DIR` and `BACKUP_DIR`; assigns `KEEP` from the optional third argument or defaults it to `7`. +- Validates `KEEP` as a positive integer and verifies `SOURCE_DIR` exists as a directory. +- Creates `BACKUP_DIR`, derives the source basename, and builds a UTC-timestamped archive path plus a `.partial` temporary path. +- Registers an `EXIT` trap to remove the temporary archive. +- Creates the tar.gz archive from the source directory’s parent, then renames the completed temporary archive to its final path. +- Prints the archive path and size. +- Lists matching archives newest-first and removes all entries after the first `KEEP`. + +#### Constants and configuration +- `SOURCE_DIR="${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR="${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP="${3:-7}"` +- `name="$(basename "$SOURCE_DIR")"` +- `archive="$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp="$archive.partial"` +- `archives` — populated by `mapfile` from the matching archive listing. +- `old` — each archive selected for removal by the retention loop. + +#### Dependencies +- External commands: `basename`, `date`, `mkdir`, `tar`, `dirname`, `mv`, `du`, `cut`, `ls`, `rm`. +- Bash builtins: `mapfile`, `echo`, `exit`, `trap`. +- Uses the `BACKUP_DIR` directory and archive names matching `${name}_*.tar.gz`. + +#### Errors and exit codes +- Missing required positional arguments fail through parameter expansion with the usage message. +- Exits `2` when `KEEP` is not a positive integer or `SOURCE_DIR` is not a directory. +- `EXIT` trap runs `rm -f "$tmp"` to clean up the partial archive. +- `set -euo pipefail` makes unset variables and command failures fatal; no retry or timeout logic. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..25986488 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/other/scripts/sales_report.py.ai.md @@ -0,0 +1,50 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:46:07Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Aggregates CSV order amounts into monthly revenue totals by region for a selected currency, with an optional minimum-revenue filter. + +#### Purpose +- Read one or more order CSV exports and report qualifying monthly revenue by region. +- Skip orders in currencies other than the selected currency. + +#### Type +- Python module; defines frozen dataclass `Order`. + +#### Input +- `parse_orders(path, currency)`: CSV file with `order_date`, `region`, `amount`, and `currency` columns. +- `main(argv=None)`: command-line arguments; accepts one or more CSV file paths, `--currency`, and `--min-revenue`. + +#### Output +- Prints tab-separated month, region, and revenue with currency to standard output. +- Prints `no orders found` to standard error and returns `1` if no matching orders; otherwise returns `0`. + +#### Core logic +- `parse_orders` validates required CSV headers, skips rows with a different currency, parses ISO dates and decimal amounts, and strips whitespace from regions. +- `revenue_by_month_and_region` sums amounts by `YYYY-MM` and region, then returns totals in sorted-key order. +- `main` combines orders from all input files, filters aggregated totals against the minimum revenue, and prints revenue to two decimal places. + +#### Public API +- `Order(order_date, region, amount) -> Order` — stores a parsed order. +- `parse_orders(path, currency) -> iterator[Order]` — yields matching-currency orders. +- `revenue_by_month_and_region(orders) -> dict` — aggregates revenue by month and region. +- `main(argv=None) -> int` — runs report command-line processing. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` +- `--currency`: default `EUR`. +- `--min-revenue`: parsed as `Decimal`; default `Decimal("0")`. + +#### Dependencies +- Standard library: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. +- Uses `csv.DictReader`, `date.fromisoformat`, `Decimal`, `defaultdict`, `argparse.ArgumentParser`, and `sys.exit`. + +#### Exceptions / Errors +- `parse_orders` raises `ValueError` for missing required columns or invalid date/amount values; row errors include the file path and line number. +- File opening and CSV parsing errors are not handled locally. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..c007c729 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/package.ai.md @@ -0,0 +1,52 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:47:19Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> Provides AI-assisted documentation generation, byte-stream and operational utilities, and database workflows for lending, order fulfillment, and warehouse inventory. + +#### Purpose +- Select source material and generate AI documentation through configurable model providers. +- Combine low-level processing and operations tools with SQL-backed library, retail, and warehouse workflows. + +#### Responsibilities +- **AI documentation (`java/`):** Evaluate source-selection conditions, extract prompt facts, configure generation runs and oversized-input policies, and route requests to mock, llama.cpp JNI, or OpenAI-compatible providers. +- **Byte processing and operations (`other/`):** Compute byte histograms with OpenCL, buffer bytes through a single-producer/single-consumer ring buffer, rotate compressed backups, and report monthly regional sales. +- **Database workflows (`sql/`):** Manage library catalog, memberships, loans, audit and reports; reserve shop inventory for order items; synchronize supplier quantities into warehouse stock. + +#### Key units +- `SrcMorphConfiguration`, `AiConditionEvaluator`, `AiFactExtractor` — configure documentation runs, match source metadata, and format regex-derived source facts. +- `AiGenerationProviderFactory`, `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport`, `AiCompletionParser` — select generation backends, obtain completion text and timings, and clean local-model responses. +- `histogram_partial`, `histogram_reduce` — compute and combine work-group byte-frequency counts. +- `ringbuf_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read` — manage bounded circular byte storage and transfers. +- `rotate_backups.sh`, `parse_orders`, `revenue_by_month_and_region` — rotate retained archives and aggregate currency-filtered sales. +- `author`, `book`, `member`, `loan`, `fn_checkout_book`, `sp_return_book`, `fn_late_fee` — represent library lending data and its checkout, return, and fee operations. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit`, `overdue_loans`, `member_loan_stats`, `popular_books` — record loan events and report lending activity. +- `branch`, `book_copy` — represent branch locations and individually tracked copies. +- `product`, `customer_order`, `order_item`, `add_order_item` — store shop products and orders, and update order lines while reserving stock. +- `dbo.usp_SyncStock(@Since)`, `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog` — merge recent supplier quantities into warehouse stock and record sync outcomes. + +#### Data flow +- Source metadata and text are evaluated and mined for prompt facts; configuration and provider settings determine how generation requests produce completion text and optional timings. +- Histogram inputs become per-work-group counts and then a reduced 256-bin result; ring-buffer writes and reads enqueue and dequeue bytes. +- Backup scripts archive a source directory before applying retention; sales tools parse CSV orders, aggregate by month and region, then filter and print totals. +- Library operations update loans and availability, trigger audit events, and support derived reports; migration creates branch-associated copies from aggregate book counts. +- Shop order-item updates validate product stock, adjust line quantities, decrement inventory, and recalculate order totals; warehouse sync aggregates recent supplier rows by warehouse and SKU, merges stock, and logs results. + +#### Dependencies +- AI generation uses internal request, prompt, model, condition, and timing types; llama.cpp JNI support; Jackson request serialization; and supplied environment lookup for API keys. +- Histogram kernels use OpenCL C 1.2; ring-buffer code uses standard allocation and byte-copy routines; scripts use Bash/system commands and Python standard-library CSV, date, decimal, and argument-parsing utilities. +- SQL workflows span PostgreSQL library data, MySQL shop data, and SQL Server warehouse data, each using database-native relationships and operations. + +#### Cross-cutting +- AI configuration is generally mutable and unsynchronized; llama.cpp model initialization and close/generation operations are unsynchronized, while providers support cleanup. +- Input validation varies by domain: AI conditions and fact counters are validated; sales parsing reports malformed data; library and shop operations reject invalid or unavailable requests. +- Inventory semantics differ across workflows: library copies are branch-associated, shop stock is held on products, and warehouse stock is keyed by warehouse and SKU. +- SQL failure handling is database-specific: library routines raise exceptions, shop item updates signal SQLSTATE `45000`, and warehouse synchronization rolls back, logs, and rethrows errors. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..7003cf2b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: D3C1C9EF +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:47:28Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The Java subsystem selects and prepares source material for AI documentation, with configurable settings and mock, local llama.cpp, or OpenAI-compatible completion backends. Byte-stream utilities include parallel byte-value histograms and a bounded FIFO ring buffer, alongside backup-rotation and sales-reporting scripts. SQL workflows cover library lending, shop orders with stock reservation, and warehouse inventory synchronization. + +#### Packages +- java/config — Defines source-selection rules and AI documentation-generation settings, including model routing, oversized-file handling, and exact source facts. +- java — Selects and prepares source material for AI documentation, then generates text through configurable local or OpenAI-compatible model backends. +- java/provider — Generates source-aware text completions through configurable mock, local llama.cpp, or OpenAI-compatible backends, with response cleanup and optional inference metrics. +- other/kernels — Computes byte-value frequency distributions for image or byte-stream data using parallel histogramming. +- other — Provides low-level byte-stream processing alongside operational backup rotation and regional sales reporting utilities. +- other/ringbuf — Buffers producer-to-consumer byte streams in FIFO order using bounded circular storage. +- other/scripts — Provides operational utilities for rotating compressed directory backups and reporting monthly regional sales revenue from order CSVs. +- . — Provides AI-assisted documentation generation, byte-stream and operational utilities, and database workflows for lending, order fulfillment, and warehouse inventory. +- sql/library — Defines a lending-library database for cataloging books and authors, managing members and loans, reporting borrowing activity, and evolving inventory to branch-level copies. +- sql — Defines database workflows for library lending, retail order fulfillment, and warehouse stock synchronization. +- sql/shop — Manages shop inventory and customer orders, including adding order items while reserving stock and updating order totals. +- sql/warehouse — Synchronizes warehouse on-hand inventory from recent supplier quantities and records the outcome of each run. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..32e2eed9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/01_schema.sql.ai.md @@ -0,0 +1,56 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:44:48Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models library authors, books, members, and loans, including copy availability, loan deadlines, and returns. + +#### Purpose +- Defines the core relational schema for a lending library. +- Enforces book, member, author, and loan data constraints. + +#### Type +- Tables; PostgreSQL. + +#### Schema +- `author` + - `author_id BIGSERIAL` — primary key. + - `full_name VARCHAR(200)` — NOT NULL. + - `birth_year SMALLINT` — CHECK `birth_year BETWEEN 1000 AND 2100`. + - `country_code CHAR(2)`. +- `book` + - `book_id BIGSERIAL` — primary key. + - `isbn VARCHAR(17)` — NOT NULL, UNIQUE. + - `title VARCHAR(300)` — NOT NULL. + - `author_id BIGINT` — NOT NULL, FK to `author.author_id`. + - `published_year SMALLINT`. + - `copies_total INTEGER` — NOT NULL, DEFAULT `1`, CHECK `copies_total >= 0`. + - `copies_free INTEGER` — NOT NULL, DEFAULT `1`, CHECK `copies_free >= 0`. + - `book_free_le_total` — CHECK `copies_free <= copies_total`. +- `member` + - `member_id BIGSERIAL` — primary key. + - `email VARCHAR(254)` — NOT NULL, UNIQUE. + - `full_name VARCHAR(200)` — NOT NULL. + - `joined_on DATE` — NOT NULL, DEFAULT `CURRENT_DATE`. + - `is_blocked BOOLEAN` — NOT NULL, DEFAULT `FALSE`. +- `loan` + - `loan_id BIGSERIAL` — primary key. + - `book_id BIGINT` — NOT NULL, FK to `book.book_id`. + - `member_id BIGINT` — NOT NULL, FK to `member.member_id`, ON DELETE CASCADE. + - `loaned_on DATE` — NOT NULL, DEFAULT `CURRENT_DATE`. + - `due_on DATE` — NOT NULL. + - `returned_on DATE`. + - `loan_due_after_loan` — CHECK `due_on > loaned_on`. +- Index `idx_book_author` — `book(author_id)`, default method. +- Index `idx_loan_member` — `loan(member_id)`, default method. +- Index `idx_loan_open` — `loan(due_on)`, default method, partial predicate `returned_on IS NULL`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (ON DELETE CASCADE) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..144e399f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/02_views.sql.ai.md @@ -0,0 +1,55 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:44:54Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Provides lending-library reports for overdue loans, member borrowing activity, and books loaned frequently in the past year. + +#### Purpose +- Report unreturned loans past their due dates, including days overdue. +- Summarize member loan activity and identify popular books. + +#### Type +- PostgreSQL views: `overdue_loans`, `member_loan_stats` +- PostgreSQL materialized view: `popular_books` +- PostgreSQL index: `idx_popular_books_id` + +#### Schema +- `overdue_loans` view: + - `loan_id` — type inherited from `loan.loan_id` + - `member_id` — type inherited from `member.member_id` + - `email` — type inherited from `member.email` + - `title` — type inherited from `book.title` + - `due_on` — type inherited from `loan.due_on` + - `days_overdue` — integer (`CURRENT_DATE - due_on`) +- `member_loan_stats` view: + - `member_id` — type inherited from `member.member_id` + - `full_name` — type inherited from `member.full_name` + - `loans_total` — bigint (`COUNT`) + - `loans_open` — bigint (`COUNT ... FILTER`) + - `last_loan_on` — type returned by `MAX(loan.loaned_on)` +- `popular_books` materialized view: + - `book_id` — type inherited from `book.book_id` + - `title` — type inherited from `book.title` + - `author_name` — type inherited from `author.full_name` + - `times_loaned` — bigint (`COUNT`) +- Index `idx_popular_books_id` on `popular_books (book_id)`; unique, default method. + +#### Reads +- `overdue_loans`: `loan.loan_id`, `loan.member_id`, `loan.book_id`, `loan.due_on`, `loan.returned_on`; `member.member_id`, `member.email`; `book.book_id`, `book.title` +- `member_loan_stats`: `member.member_id`, `member.full_name`; `loan.loan_id`, `loan.member_id`, `loan.returned_on`, `loan.loaned_on` +- `popular_books`: `loan.book_id`, `loan.loaned_on`; `book.book_id`, `book.title`, `book.author_id`; `author.author_id`, `author.full_name` + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author` +- Materialized view: `popular_books` (referenced by `idx_popular_books_id`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..881f5919 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/03_routines.sql.ai.md @@ -0,0 +1,57 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:45:01Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Manages library book checkout and return, tracks loan audit events, and calculates capped overdue fees. + +#### Purpose +- Lends available book copies to unblocked members and records loan returns. +- Audits checkouts and returns; computes late fees in cents. + +#### Type +- PostgreSQL: table `loan_audit`; functions `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn`; procedure `sp_return_book`; trigger `trg_loan_audit`. + +#### Schema +- `loan_audit` + - `audit_id BIGSERIAL` — primary key (unnamed constraint). + - `loan_id BIGINT NOT NULL`. + - `action VARCHAR(10) NOT NULL` — unnamed CHECK: `action IN ('CHECKOUT', 'RETURN')`. + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()`. + +#### Reads +- `member.member_id`, `member.is_blocked` — checkout eligibility. +- `book.book_id`, `book.copies_free` — checkout availability. +- `loan.loan_id`, `loan.returned_on`, `loan.book_id` — return processing. +- `fn_late_fee` inputs: `p_due_on`, `p_returned_on`; uses `CURRENT_DATE`. + +#### Writes +- `fn_checkout_book`: updates `book.copies_free`; inserts `loan(book_id, member_id, due_on)` (one row per successful call). +- `sp_return_book`: updates `loan.returned_on`; updates `book.copies_free`. +- `trg_loan_audit_fn`: inserts `loan_audit(loan_id, action)` for checkout or first return (one row per qualifying trigger event). + +#### Relationships +- `loan_audit.loan_id -> loan.loan_id` — audit association; no foreign key declared. + +#### Routine logic +- `fn_checkout_book(p_member_id BIGINT, p_book_id BIGINT, p_days INTEGER DEFAULT 21) RETURNS BIGINT` + - Raises an exception for blocked members or unavailable copies. + - Decrements free-copy count, inserts a loan due `p_days` from today, returns `loan_id`. +- `sp_return_book(p_loan_id BIGINT)` + - Sets `returned_on` to today for an unreturned loan and retrieves its `book_id`. + - Raises an exception if the loan is unknown or already returned; otherwise increments the book’s free-copy count. +- `fn_late_fee(p_due_on DATE, p_returned_on DATE) RETURNS INTEGER` + - Immutable SQL function; charges 50 cents per overdue day, using today when return date is null; floors at zero and caps at 2000. +- `trg_loan_audit_fn() RETURNS TRIGGER` + - Inserts `CHECKOUT` audit on loan insertion; inserts `RETURN` when `returned_on` changes from null to non-null; returns `NEW`. +- `trg_loan_audit` + - After insert or update of `loan.returned_on`, executes `trg_loan_audit_fn` once per row. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Built-ins: `now()`, `CURRENT_DATE`, `COALESCE`, `GREATEST`, `LEAST`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..b189d8c7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,58 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:45:10Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds branch-based lending locations, assigns existing book copies to the main branch, and updates member and loan records for branch and copy tracking. + +#### Purpose +- Introduces library branches and per-copy inventory with barcode and availability status. +- Migrates existing copy counts into `book_copy`, associates members with a home branch, and retires book-level copy counters. + +#### Type +- PostgreSQL migration; creates tables and an index. + +#### Schema +- `branch`: + - `branch_id SMALLSERIAL` — primary key (constraint name not specified). + - `name VARCHAR(100) NOT NULL UNIQUE` — unique constraint name not specified. + - `city VARCHAR(100) NOT NULL`. +- `book_copy`: + - `copy_id BIGSERIAL` — primary key (constraint name not specified). + - `book_id BIGINT NOT NULL` — FK to `book.book_id` (constraint name not specified). + - `branch_id SMALLINT NOT NULL` — FK to `branch.branch_id` (constraint name not specified). + - `barcode VARCHAR(32) NOT NULL UNIQUE` — unique constraint name not specified. + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE', 'ON_LOAN', 'LOST'))` — check constraint name not specified. +- `loan`: adds `copy_id BIGINT` with FK to `book_copy.copy_id` (constraint name not specified). +- `member`: renames `joined_on` to `member_since`; adds `home_branch_id SMALLINT` with FK to `branch.branch_id` (constraint name not specified). +- `book`: drops constraint `book_free_le_total`; drops columns `copies_free`, `copies_total`. +- Index `idx_book_copy_book` on `book_copy (book_id)`; method not specified. + +#### Reads +- `book.book_id`, `book.isbn`, `book.copies_total`, `book.copies_free` — source for copy generation and status assignment. +- `member.home_branch_id` — tested for NULL by the update. + +#### Writes +- `branch`: 1 row (`Main`, `Springfield`). +- `book_copy`: `INSERT ... SELECT` generates one row per book and `generate_series(1, book.copies_total)` value; total depends on existing book data. +- `loan`: adds `copy_id`. +- `member`: renames `joined_on` to `member_since`; adds `home_branch_id`; sets NULL `home_branch_id` values to `1`. +- `book`: drops `book_free_le_total`, `copies_free`, and `copies_total`. +- Creates index `idx_book_copy_book`. + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- `book` +- `loan` +- `member` +- `generate_series` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..85d3af17 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,31 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:45:19Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Seeds a lending-library database with author, book, member, and loan records for development or testing. + +#### Purpose +- Populate sample catalog, membership, and borrowing data in one transaction. + +#### Type +- PostgreSQL DML seed script + +#### Writes +- `author`: 15 rows; IDs 1–15; columns `author_id`, `full_name`, `birth_year`, `country_code`. +- `book`: 110 rows; IDs 1–110; columns `book_id`, `isbn`, `title`, `author_id`, `published_year`, `copies_total`, `copies_free`. +- `member`: 50 rows; IDs 1–50; columns `member_id`, `email`, `full_name`, `joined_on`, `is_blocked`. +- `loan`: 150 rows; IDs 1–150; columns `loan_id`, `book_id`, `member_id`, `loaned_on`, `due_on`, `returned_on`. + +#### Relationships +- Seeded `book.author_id` values correspond to `author.author_id`. +- Seeded `loan.book_id` values correspond to `book.book_id`. +- Seeded `loan.member_id` values correspond to `member.member_id`. + +#### Dependencies +- Target tables: `author`, `book`, `member`, `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/package.ai.md new file mode 100644 index 00000000..7078a873 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/library/package.ai.md @@ -0,0 +1,55 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:46:54Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> Defines a lending-library database for cataloging books and authors, managing members and loans, reporting borrowing activity, and evolving inventory to branch-level copies. + +#### Purpose +- Store and enforce library catalog, membership, loan, and inventory data. +- Support checkout, returns, overdue reporting, late-fee calculation, audit history, and sample-data setup. + +#### Responsibilities +- **Core schema — `01_schema.sql`:** Defines `author`, `book`, `member`, and `loan`, with keys, constraints, relationships, and indexes. +- **Reporting — `02_views.sql`:** Exposes overdue loans and member borrowing statistics; materializes popular-book counts. +- **Loan operations and audit — `03_routines.sql`:** Checks out available books for eligible members, processes returns, calculates capped late fees, and records checkout/return audit events. +- **Branch and copy migration — `04_migration_v2.sql`:** Adds branches and individually tracked `book_copy` inventory, assigns existing copies to the main branch, adds member home branches and loan copy references, and removes book-level copy counters. +- **Development/test data — `05_seed_data.sql`:** Inserts sample authors, books, members, and loans in a transaction. + +#### Key units +- `author`, `book`, `member`, `loan` — core catalog, membership, and lending tables. +- `overdue_loans` — view of unreturned loans past due, including `days_overdue`. +- `member_loan_stats` — per-member loan totals, open-loan counts, and most recent loan date. +- `popular_books` — materialized counts of books loaned in the past year. +- `fn_checkout_book` — validates member and book availability, creates a loan, and decrements free copies. +- `sp_return_book` — marks an open loan returned and restores a free-copy count. +- `fn_late_fee` — computes overdue charges at 50 cents per day, floored at zero and capped at 2000 cents. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — record checkout and first-return events. +- `branch`, `book_copy` — branch locations and individually identified copies with availability status. + +#### Data flow +- Seed records populate `author`, `book`, `member`, and `loan`, linked by their foreign-key relationships. +- Checkout checks member blocking and book availability, updates `book.copies_free`, inserts a `loan`, and triggers checkout auditing. +- Return updates an open loan and restores book availability; the trigger audits the first transition to returned. +- Views derive overdue, member-activity, and popular-book reports from loan, member, book, and author data. +- The v2 migration creates a main branch and generates `book_copy` rows from existing `book.copies_total`, then adds branch/copy references and removes legacy copy counters. + +#### Dependencies +- Reports depend on `loan`, `member`, `book`, and `author`; `idx_popular_books_id` indexes `popular_books`. +- Loan routines depend on `member`, `book`, and `loan`; audit routines write to `loan_audit`. +- Migration depends on the existing `book`, `loan`, and `member` tables and PostgreSQL `generate_series`. +- Schema and migration use PostgreSQL keys, checks, defaults, indexes, and foreign-key relationships. + +#### Cross-cutting +- PostgreSQL throughout; primary keys, uniqueness, foreign keys, checks, and indexes enforce data integrity and query support. +- Checkout and return failures raise exceptions for blocked members, unavailable copies, unknown loans, or already-returned loans. +- The migration changes inventory representation from aggregate book copy counts to branch-associated individual copies; the initial routines and seed data refer to the pre-migration counters and columns. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/package.ai.md new file mode 100644 index 00000000..bf283441 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/package.ai.md @@ -0,0 +1,47 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:47:12Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> Defines database workflows for library lending, retail order fulfillment, and warehouse stock synchronization. + +#### Purpose +- Store and manage catalog, membership, lending, product, order, and warehouse inventory data. +- Provide operational SQL for loans, order-item stock reservation, and supplier-driven stock updates. + +#### Responsibilities +- **Library lending and reporting:** Catalog authors and books, manage members and loans, report borrowing activity, audit loan events, and evolve inventory to branch-level copies. +- **Shop orders and inventory:** Store products, customer orders, and order lines; add or increment order items while reserving stock and recalculating totals. +- **Warehouse synchronization:** Aggregate recent supplier quantities by warehouse and SKU, merge them into stock levels, and log run outcomes. + +#### Key units +- `author`, `book`, `member`, `loan` — library catalog, membership, and lending records. +- `overdue_loans`, `member_loan_stats`, `popular_books` — library overdue, member-activity, and popular-title reports. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee` — library checkout, return, and capped late-fee operations. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — record library checkout and first-return events. +- `branch`, `book_copy` — branch locations and individually tracked library copies. +- `product`, `customer_order`, `order_item`, `add_order_item` — shop catalog, orders, line items, and stock-reserving line updates. +- `dbo.usp_SyncStock(@Since)` — transactionally merges recent supplier quantities into warehouse stock and logs the result. +- `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog` — warehouse quantity input, current stock, and synchronization outcome records. + +#### Data flow +- Library seed data populates catalog, members, and loans; checkout and return operations update loan and availability records and trigger audit events, while views derive borrowing reports. The migration converts aggregate book counts into branch-associated `book_copy` records. +- Shop `add_order_item` looks up a product by SKU, validates stock, inserts or increments an order line, decrements inventory, and recalculates the order total. +- Warehouse `usp_SyncStock` filters supplier rows by `@Since`, aggregates quantities by warehouse and SKU, merges them into `StockLevel`, and records insert/update counts or an error in `SyncLog`. + +#### Dependencies +- **Library:** PostgreSQL tables, constraints, indexes, `generate_series`, and foreign-key relationships connect catalog, member, loan, branch, and copy data. +- **Shop:** MySQL foreign keys connect `order_item` to `customer_order` and `product`; `add_order_item` reads and updates those tables. +- **Warehouse:** SQL Server T-SQL uses `SYSUTCDATETIME()` for timestamps and `ERROR_MESSAGE()` for error details; `usp_SyncStock` reads `SupplierFeed` and `StockLevel` and writes `StockLevel` and `SyncLog`. + +#### Cross-cutting +- The package spans PostgreSQL, MySQL, and SQL Server; each subpackage uses database-native constraints and operations. +- Operations validate unavailable or invalid inputs: library loan routines raise exceptions, shop item updates signal SQLSTATE `45000`, and warehouse synchronization rolls back, logs failures, and rethrows. +- Inventory is represented differently by domain: library copies are branch-associated after migration, shop stock is held on products, and warehouse stock is keyed by `(WarehouseId, Sku)`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..5dafbce7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,64 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:45:23Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models shop products, customer orders, and order lines, with a procedure that adds an item while reserving stock and recalculating the order total. + +#### Purpose +- Stores product inventory, customer order status and totals, and order line quantities and prices. +- `add_order_item` adds or increments an order line, decrements product stock, and updates the order total. + +#### Type +- MySQL 8: tables `product`, `customer_order`, `order_item`; procedure `add_order_item`. +- Enum `customer_order.status`: `NEW`, `PAID`, `SHIPPED`, `CANCELLED`. + +#### Schema +- `product` + - `product_id INT UNSIGNED` — NOT NULL, AUTO_INCREMENT, PRIMARY KEY. + - `sku VARCHAR(40)` — NOT NULL, UNIQUE via `uk_product_sku`. + - `name VARCHAR(200)` — NOT NULL. + - `price_cents INT UNSIGNED` — NOT NULL. + - `stock INT` — NOT NULL, DEFAULT `0`. + - Index: `uk_product_sku` — UNIQUE on `sku`. +- `customer_order` + - `order_id BIGINT UNSIGNED` — NOT NULL, AUTO_INCREMENT, PRIMARY KEY. + - `customer_id BIGINT UNSIGNED` — NOT NULL. + - `status ENUM('NEW', 'PAID', 'SHIPPED', 'CANCELLED')` — NOT NULL, DEFAULT `'NEW'`. + - `created_at DATETIME` — NOT NULL, DEFAULT `CURRENT_TIMESTAMP`. + - `total_cents INT UNSIGNED` — NOT NULL, DEFAULT `0`. + - Index: `idx_order_customer` — on `(customer_id, created_at)`. +- `order_item` + - `order_id BIGINT UNSIGNED` — NOT NULL, part of PRIMARY KEY `(order_id, product_id)`. + - `product_id INT UNSIGNED` — NOT NULL, part of PRIMARY KEY `(order_id, product_id)`. + - `quantity SMALLINT UNSIGNED` — NOT NULL. + - `unit_price_cents INT UNSIGNED` — NOT NULL. + - Constraint `fk_item_order` — FOREIGN KEY (`order_id`) REFERENCES `customer_order` (`order_id`) ON DELETE CASCADE. + - Constraint `fk_item_product` — FOREIGN KEY (`product_id`) REFERENCES `product` (`product_id`). + +#### Reads +- `product`: `product_id`, `price_cents`, `sku`, `stock` — SKU lookup, stock eligibility check, and row lock. +- `order_item`: `quantity`, `unit_price_cents` — summed to recalculate an order total. + +#### Writes +- `order_item`: INSERT one line per procedure call; on duplicate key, increments `quantity`. +- `product`: UPDATE `stock` by subtracting the requested quantity. +- `customer_order`: UPDATE `total_cents` from the sum of its order lines. + +#### Relationships +- `order_item.order_id -> customer_order.order_id` +- `order_item.product_id -> product.product_id` + +#### Routine logic +- `add_order_item(IN p_order_id BIGINT UNSIGNED, IN p_sku VARCHAR(40), IN p_qty SMALLINT UNSIGNED)` +- Looks up and locks the matching product if stock is sufficient; signals SQLSTATE `45000` for an unknown SKU or insufficient stock. +- Inserts an order line using the product’s current price, or increments its quantity if the order/product key already exists. +- Decrements product stock and recalculates the order’s `total_cents` as the sum of line quantities times unit prices. + +#### Dependencies +- Tables: `product`, `order_item`, `customer_order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/shop/package.ai.md new file mode 100644 index 00000000..c68badcb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/shop/package.ai.md @@ -0,0 +1,34 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:47:02Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Manages shop inventory and customer orders, including adding order items while reserving stock and updating order totals. + +#### Purpose +- Defines product inventory, customer orders, and order-line storage in MySQL. +- Provides `add_order_item` to add or increment a line, subtract stock, and recalculate the order total. + +#### Responsibilities +- **Catalog and inventory:** `product` stores SKU, name, price, and available stock. +- **Orders and lines:** `customer_order` tracks customer, status, creation time, and total; `order_item` stores quantities and unit prices per order and product. +- **Order item updates:** `add_order_item` validates SKU and stock, upserts the order line, reserves inventory, and refreshes the total. + +#### Key units +- `product` — product catalog and stock inventory, with unique SKU. +- `customer_order` — customer order status (`NEW`, `PAID`, `SHIPPED`, `CANCELLED`) and total. +- `order_item` — order-product line items keyed by `(order_id, product_id)`. +- `add_order_item` — adds or increments an order line using the product’s current price and updates stock and order total. + +#### Data flow +- `add_order_item` looks up and locks a product by SKU; signals SQLSTATE `45000` for an unknown SKU or insufficient stock. +- Inserts or increments the matching `order_item`, subtracts the requested quantity from `product.stock`, then recalculates `customer_order.total_cents` from line quantities and unit prices. + +#### Dependencies +- `order_item.order_id` references `customer_order.order_id` with `ON DELETE CASCADE`; `order_item.product_id` references `product.product_id`. +- `add_order_item` reads `product` and `order_item`, and writes `order_item`, `product`, and `customer_order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/warehouse/package.ai.md new file mode 100644 index 00000000..2d85be82 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/warehouse/package.ai.md @@ -0,0 +1,40 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:47:06Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Synchronizes warehouse on-hand inventory from recent supplier quantities and records the outcome of each run. + +#### Purpose +- Apply supplier-feed quantities received since a supplied timestamp to stock levels grouped by warehouse and SKU. +- Record successful insert/update counts or synchronization errors. + +#### Responsibilities +- Aggregate `dbo.SupplierFeed` quantities by `WarehouseId` and `Sku`, filtered by `ReceivedAt >= @Since`. +- Merge aggregates into `dbo.StockLevel`, inserting missing warehouse/SKU pairs and updating matched stock and timestamps. +- Log synchronization results in `dbo.SyncLog`; roll back and log the error if processing fails. + +#### Key units +- `dbo.usp_SyncStock(@Since DATETIME2(0))` — transactionally aggregates feed rows, merges stock, logs counts, and rethrows errors after logging. +- `dbo.StockLevel` — stores on-hand inventory keyed by `(WarehouseId, Sku)`, with defaulted `OnHand` and UTC `UpdatedAt`. +- `dbo.SupplierFeed` — stores supplier quantities and receipt timestamps for warehouse/SKU aggregation. +- `dbo.SyncLog` — stores run start time, inserted and updated row counts, and an optional error message. +- `@Changes` — table variable capturing `MERGE` actions through `OUTPUT $action` for insert/update counts. + +#### Data flow +- `@Since` filters `dbo.SupplierFeed`; quantities are summed per warehouse and SKU. +- Aggregates are matched against `dbo.StockLevel` by `(WarehouseId, Sku)`; unmatched keys are inserted, matched keys have `OnHand` and `UpdatedAt` updated. +- Captured merge actions produce success counts for `dbo.SyncLog`; on failure, the transaction is rolled back and the error is logged with zero counts before rethrowing. + +#### Dependencies +- SQL Server T-SQL; `SYSUTCDATETIME()` supplies timestamps and `ERROR_MESSAGE()` supplies failure details. +- `dbo.usp_SyncStock` reads `dbo.SupplierFeed` and `dbo.StockLevel`, and writes `dbo.StockLevel` and `dbo.SyncLog`. + +#### Cross-cutting +- Stock identity is the `(WarehouseId, Sku)` primary key; supplier rows are grouped on the same pair. +- A transaction wraps the merge and success logging; error handling rolls back an active transaction, logs the failure, and rethrows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..ae38ab91 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,67 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:45:31Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Aggregates recent supplier quantities by warehouse and SKU, updates on-hand inventory, and records each synchronization outcome. + +#### Purpose +- Maintains warehouse stock levels from supplier-feed rows received since a supplied timestamp. +- Logs inserted and updated stock counts, or the error from a failed synchronization. + +#### Type +- Tables and procedure; Microsoft SQL Server (T-SQL). +- Procedure: `dbo.usp_SyncStock`. + +#### Schema +- `dbo.StockLevel` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT (0)`; default constraint `DF_StockLevel_OnHand` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())`; default constraint `DF_StockLevel_UpdatedAt` + - Primary key constraint `PK_StockLevel` on `(WarehouseId, Sku)` +- `dbo.SupplierFeed` + - `FeedRowId BIGINT IDENTITY(1, 1) NOT NULL`; primary key constraint `PK_SupplierFeed` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` +- `dbo.SyncLog` + - `SyncLogId INT IDENTITY(1, 1) NOT NULL`; primary key constraint `PK_SyncLog` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + +#### Reads +- `dbo.SupplierFeed`: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`; filters by `ReceivedAt >= @Since`, groups by warehouse and SKU, sums `Quantity`. +- `dbo.StockLevel`: matches on `WarehouseId`, `Sku`; reads `OnHand` when updating matched rows. +- `@Changes`: reads `MergeAction` to calculate insert and update counts. + +#### Writes +- `dbo.StockLevel`: `MERGE` inserts `(WarehouseId, Sku, OnHand)` for unmatched source keys; updates `OnHand` and `UpdatedAt` for matched keys. +- `dbo.SyncLog`: success-path `INSERT ... SELECT` writes one aggregate log row; catch-path `INSERT ... VALUES` writes one error log row. Both paths cannot execute for the same invocation. +- `@Changes`: receives each `MERGE` action through `OUTPUT $action`. + +#### Relationships +- `dbo.StockLevel.WarehouseId -> source.WarehouseId` and `dbo.StockLevel.Sku -> source.Sku` (`MERGE` matching pairs; `source` aggregates `dbo.SupplierFeed`). + +#### Routine logic +- `dbo.usp_SyncStock(@Since DATETIME2(0))` + - Captures UTC start time; begins a transaction. + - Aggregates supplier quantities received since `@Since` by warehouse and SKU. + - Merges aggregates into `dbo.StockLevel`, recording actions in `@Changes`. + - On success, logs insert/update counts and commits. + - On error, rolls back if a transaction is active, logs `ERROR_MESSAGE()` with zero counts, then rethrows. + +#### Dependencies +- `dbo.SupplierFeed` +- `dbo.StockLevel` +- `dbo.SyncLog` +- `SYSUTCDATETIME()` +- `ERROR_MESSAGE()` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..edf030ad --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,51 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:47:32Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Evaluates and validates file‑selection conditions for the source‑morph indexer. + +#### Purpose +- Checks if a file satisfies an `AiCondition` tree. +- Validates condition trees for correctness. +- Detects if line counting is required. + +#### Type +`final class AiConditionEvaluator` – public class, no inheritance, no interfaces. + +#### Input +- `AiCondition` trees (branches: and, or, not, extensions, size, lines, modifiedAfter, modifiedBefore, pathGlob). +- `AiFileContext` providing file name, size, line count, last modified epoch, relative path. + +#### Output +- `boolean` from `matches`, `usesLines`. +- Exceptions (`IllegalArgumentException`, `IllegalStateException`) on invalid trees or parsing errors. + +#### Core logic +- `matches`: recursively evaluates and/or/not groups; delegates to leaf checks (`matchesExtension`, `size.contains`, `lines.contains`, timestamp comparisons, glob matching). +- `validate`: ensures exactly one branch/leaf per node; checks non‑empty extensions, bounded ranges, parsable dates, non‑blank glob; recursively validates groups. +- `usesLines`: traverses tree to find any `lines` condition; short‑circuits on first match. +- Helper methods: `branchCount`, `matchesExtension`, `globMatches`, `parseEpochMilli`. + +#### Public API +- `matches(AiCondition, AiFileContext) -> boolean` – evaluate condition tree. +- `validate(AiCondition) -> void` – throw if tree invalid. +- `usesLines(AiCondition) -> boolean` – detect line‑count requirement. + +#### Dependencies +- `java.time.Instant`, `java.time.format.DateTimeParseException` +- `java.util.Collections`, `java.util.List` +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` for misconfigured nodes, empty extensions, unbounded ranges, invalid dates, blank glob. +- `IllegalStateException` if a node sets more than one branch/leaf. + +#### Concurrency +- Stateless; all methods are thread‑safe. No shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..c5421fbc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,47 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:47:39Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> A container for child AI conditions used by / combinators in configuration. + +#### Purpose +- Holds a list of child `AiCondition` objects for logical combinators. + +#### Type +`public class AiConditionGroup` – class, public, no modifiers, annotated `@ToString`, `@SuppressWarnings`. + +#### Input +- Constructor: no parameters. +- `setConditions(Collection)`: accepts a collection of `AiCondition` (nullable). + +#### Output +- `getConditions()`: returns the internal `List` (nullable). +- Internal state: `conditions` list, defensively copied on set. + +#### Core logic +- `setConditions`: if argument non‑null, creates a new `ArrayList` from it; otherwise sets field to `null`. +- `getConditions`: simply returns the stored list. + +#### Public API +- `AiConditionGroup()` → creates empty group +- `List getConditions()` → child conditions or null +- `void setConditions(Collection)` → set child conditions + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCondition` + +#### Exceptions / Errors +- No checked exceptions thrown. +- Null handling: accepts and returns `null` for empty configuration. + +#### Concurrency +- No synchronization; instance is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..cd161803 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,50 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:47:41Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Computes deterministic, language‑agnostic fact counts from regex counters for a source file. + +#### Purpose +- Provides exact, whole‑file fact counts for AI summaries. +- Validates fact counter configurations. + +#### Type +`final class AiFactExtractor` – utility class, no instances. + +#### Input +- `factsBlock(List, String)` – list of counters, source text. +- `validate(List)` – list of counters. +- `countMatches(String, String)` – regex pattern, source text. + +#### Output +- `factsBlock` returns a formatted facts block string or empty string. +- `validate` throws `IllegalArgumentException` on invalid counters. +- `countMatches` returns integer match count. + +#### Core logic +- `factsBlock`: iterate counters, skip nulls, append `label: count` entries separated by `; `, prepend header, append suffix. +- `validate`: check non‑null label/pattern, compile pattern, throw `IllegalArgumentException` on failures. +- `countMatches`: compile pattern, use `Matcher.find()` loop to count non‑overlapping matches. + +#### Public API +- `factsBlock(List, String) -> String` – build facts block. +- `validate(List) -> void` – validate counters. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` for missing label/pattern or invalid regex. + +#### Concurrency +- Stateless; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..7dddd163 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,138 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:47:44Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> A mutable JavaBean that holds all AI‑generation parameters for a single model run, from model path and context size to sampling, GPU, cache, and provider settings. + +#### Purpose +- Stores configuration for a single AI generation step. +- Exposes getters/setters for Maven plugin and provider layers. + +#### Type +`public class AiGenerationConfig` – mutable JavaBean, Lombok `@ToString`, no other annotations. + +#### Input +- Constructor: no arguments, defaults applied. +- Setters for all fields (modelPath, contextSize, maxOutputTokens, temperature, threads, charsPerToken, maxInputChars, warnOnTrim, topP, topK, minP, topNSigma, repeatPenalty, chatTemplateEnableThinking, cachePrompt, swaFull, cacheReuse, gpuLayers, seed, cpuMoeLayers, cpuFfnLayers, kvUnifiedPerSlot, lazyMode, repeatLastN, cacheTypeK, cacheTypeV, flashAttn, batchSize, ubatchSize, threadsBatch, mainGpu, devices, provider, remoteModel, baseUrl, apiKeyEnv, reasoningEffort, reasoningBudgetTokens, dryMultiplier, dryBase, dryAllowedLength, dryPenaltyLastN, drySequenceBreakers, stopStrings, calibration). + +#### Output +- Getters return current values. +- `getDrySequenceBreakers()` and `getStopStrings()` return unmodifiable lists. +- `toString()` (Lombok) prints all fields for diagnostics. + +#### Core logic +- Default constants defined for every parameter. +- Setters validate nulls by resetting to defaults. +- `setLazyMode`, `setCacheTypeK`, `setCacheTypeV`, `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, `setApiKeyEnv` replace null with default. +- List setters replace null with empty list. +- No additional computation; values are passed through to provider. + +#### Public API +- `getModelPath() -> String?` – model file path. +- `setModelPath(String?)` – set model path. +- `getContextSize() -> int` – context window size. +- `setContextSize(int)` – set context size. +- `getMaxOutputTokens() -> int` – max output tokens. +- `setMaxOutputTokens(int)` – set max output tokens. +- `getTemperature() -> float` – sampling temperature. +- `setTemperature(float)` – set temperature. +- `getThreads() -> int` – CPU threads. +- `setThreads(int)` – set threads. +- `getCharsPerToken() -> int` – chars per token ratio. +- `setCharsPerToken(int)` – set chars per token. +- `getMaxInputChars() -> int` – max input chars. +- `setMaxInputChars(int)` – set max input chars. +- `isWarnOnTrim() -> boolean` – trim warning flag. +- `setWarnOnTrim(boolean)` – set trim warning. +- `getTopP() -> float` – nucleus sampling threshold. +- `setTopP(float)` – set top‑p. +- `getTopK() -> int` – top‑k limit. +- `setTopK(int)` – set top‑k. +- `getRepeatPenalty() -> float` – repetition penalty. +- `setRepeatPenalty(float)` – set repeat penalty. +- `getMinP() -> float` – min‑p threshold. +- `setMinP(float)` – set min‑p. +- `getTopNSigma() -> float` – top‑n‑sigma threshold. +- `setTopNSigma(float)` – set top‑n‑sigma. +- `getChatTemplateEnableThinking() -> Boolean?` – chat‑template thinking mode. +- `setChatTemplateEnableThinking(Boolean?)` – set thinking mode. +- `isCachePrompt() -> boolean` – prompt‑caching flag. +- `isSwaFull() -> boolean` – full‑SWA flag. +- `setSwaFull(boolean)` – set full‑SWA. +- `getCacheReuse() -> int` – cache‑reuse chunk size. +- `setCacheReuse(int)` – set cache‑reuse. +- `getGpuLayers() -> int` – GPU offload layers. +- `setGpuLayers(int)` – set GPU layers. +- `getSeed() -> int` – RNG seed. +- `setSeed(int)` – set seed. +- `getCpuMoeLayers() -> int` – CPU MoE layers. +- `setCpuMoeLayers(int)` – set CPU MoE layers. +- `getCpuFfnLayers() -> int` – CPU FFN layers. +- `setCpuFfnLayers(int)` – set CPU FFN layers. +- `getKvUnifiedPerSlot() -> int` – unified KV cap. +- `setKvUnifiedPerSlot(int)` – set KV cap. +- `getLazyMode() -> String` – tensor‑read laziness. +- `setLazyMode(String?)` – set lazy mode. +- `getRepeatLastN() -> int` – repeat‑penalty window. +- `setRepeatLastN(int)` – set repeat‑penalty window. +- `getCacheTypeK() -> String` – KV cache type K. +- `setCacheTypeK(String?)` – set cache type K. +- `getCacheTypeV() -> String` – KV cache type V. +- `setCacheTypeV(String?)` – set cache type V. +- `isFlashAttn() -> boolean` – Flash Attention flag. +- `setFlashAttn(boolean)` – set Flash Attention. +- `getBatchSize() -> int` – logical batch size. +- `setBatchSize(int)` – set batch size. +- `getUbatchSize() -> int` – physical batch size. +- `setUbatchSize(int)` – set physical batch size. +- `getThreadsBatch() -> int` – batch thread count. +- `setThreadsBatch(int)` – set batch threads. +- `getMainGpu() -> int` – primary GPU index. +- `setMainGpu(int)` – set main GPU. +- `getDevices() -> String` – device list. +- `setDevices(String)` – set devices. +- `getProvider() -> String` – AI provider. +- `setProvider(String?)` – set provider. +- `getRemoteModel() -> String` – remote model id. +- `setRemoteModel(String?)` – set remote model. +- `getBaseUrl() -> String` – base URL. +- `setBaseUrl(String?)` – set base URL. +- `getApiKeyEnv() -> String` – API key env var name. +- `setApiKeyEnv(String?)` – set API key env. +- `getReasoningEffort() -> String` – reasoning effort level. +- `setReasoningEffort(String)` – set reasoning effort. +- `getReasoningBudgetTokens() -> int` – reasoning budget. +- `setReasoningBudgetTokens(int)` – set reasoning budget. +- `getDryMultiplier() -> float` – DRY multiplier. +- `setDryMultiplier(float)` – set DRY multiplier. +- `getDryBase() -> float` – DRY base. +- `setDryBase(float)` – set DRY base. +- `getDryAllowedLength() -> int` – DRY allowed length. +- `setDryAllowedLength(int)` – set DRY allowed length. +- `getDryPenaltyLastN() -> int` – DRY penalty window. +- `setDryPenaltyLastN(int)` – set DRY penalty window. +- `getDrySequenceBreakers() -> List` – unmodifiable breakers list. +- `setDrySequenceBreakers(List?)` – set breakers. +- `getStopStrings() -> List` – unmodifiable stop strings. +- `setStopStrings(List?)` – set stop strings. +- `getCalibration() -> AiCalibration?` – calibration object. +- `setCalibration(AiCalibration?)` – set calibration. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCalibration` + +#### Exceptions / Errors +- No checked exceptions thrown. +- Null arguments are replaced with defaults; no `NullPointerException`. + +#### Concurrency +- No synchronization; class is not thread‑safe. Instances are intended for single‑thread use by Maven plugin. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..5f056523 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,47 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:47:55Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Defines how oversized source files are handled during routing. + +#### Purpose +- Determines action when a source file exceeds the model’s context window. + +#### Type +`public enum AiOversizeStrategy` – enum, final, implements `java.lang.Enum`. + +#### Input +- `String value` in `fromConfig(String)` (nullable, trimmed). + +#### Output +- `AiOversizeStrategy` instance from `fromConfig`. +- `String` token via `configValue()`. + +#### Core logic +- Enum constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` each with a config token. +- `DEFAULT` set to `FAIL`. +- `configValue()` returns the token. +- `fromConfig(String)`: + 1. Return `DEFAULT` if `value` is `null` or blank after trim. + 2. Iterate over `values()`; compare `configValue` case‑insensitively. + 3. Return matching strategy. + 4. Throw `IllegalArgumentException` if no match. + +#### Public API +- `configValue() -> String` – get config token. +- `fromConfig(String) -> AiOversizeStrategy` – parse config value. + +#### Dependencies +- `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `IllegalArgumentException` in `fromConfig` for unknown strategy. + +#### Concurrency +- Immutable enum; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..bf451145 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,119 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:47:58Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Holds all runtime parameters for a srcmorph run, from Maven plugin fields to future CLI or JSON/YAML configs. + +#### Purpose +- Central configuration holder for srcmorph executions. +- Mutable JavaBean for binding by Maven, Jackson, or code. + +#### Type +`public class SrcMorphConfiguration` – class, mutable, Lombok `@ToString`, suppresses null‑init warnings. + +#### Input +- Constructor: no arguments, defaults applied. +- Setter methods for: + - `File baseDirectory` + - `File outputDirectory` + - `boolean force` + - `List subtrees` + - `List excludes` + - `List fileExtensions` + - `long minFileSizeBytes` + - `long maxFileSizeBytes` + - `boolean planOnly` + - `String generationProvider` + - `List promptDefinitions` + - `List aiDefinitions` + - `File modelDirectory` + - `List fieldGenerations` + - `List factDefinitions` + - `String llamaModelPath` + - `int llamaContextSize` + - `int llamaMaxOutputTokens` + - `float llamaTemperature` + - `int llamaThreads` + - `String pluginVersion` + - `String aiVersion` + - `String projectName` + +#### Output +- Getter methods expose all fields. +- No side effects beyond field mutation. + +#### Core logic +- Provides default constants for output directory, provider, llama settings, and AI version. +- No additional computation; acts purely as a data container. + +#### Public API +- `SrcMorphConfiguration()` – create with defaults +- `File getBaseDirectory()` – base project directory +- `void setBaseDirectory(File)` – set base directory +- `File getOutputDirectory()` – output dir for .ai.md files +- `void setOutputDirectory(File)` – set output dir +- `boolean isForce()` – always regenerate AI fields? +- `void setForce(boolean)` – set force flag +- `List getSubtrees()` – source subdirectory filters +- `void setSubtrees(List)` – set subtrees +- `List getExcludes()` – glob patterns to skip +- `void setExcludes(List)` – set excludes +- `List getFileExtensions()` – file extensions to index +- `void setFileExtensions(List)` – set extensions +- `long getMinFileSizeBytes()` – lower file‑size bound +- `void setMinFileSizeBytes(long)` – set lower bound +- `long getMaxFileSizeBytes()` – upper file‑size bound +- `void setMaxFileSizeBytes(long)` – set upper bound +- `boolean isPlanOnly()` – stop after routing plan? +- `void setPlanOnly(boolean)` – set plan‑only flag +- `String getGenerationProvider()` – AI provider name +- `void setGenerationProvider(String)` – set provider +- `List getPromptDefinitions()` – prompt templates +- `void setPromptDefinitions(List)` – set prompts +- `List getAiDefinitions()` – AI model configs +- `void setAiDefinitions(List)` – set models +- `File getModelDirectory()` – directory for relative model paths +- `void setModelDirectory(File)` – set model directory +- `List getFieldGenerations()` – routing rules +- `void setFieldGenerations(List)` – set rules +- `List getFactDefinitions()` – reusable fact groups +- `void setFactDefinitions(List)` – set facts +- `String getLlamaModelPath()` – fallback GGUF model path +- `void setLlamaModelPath(String)` – set fallback model path +- `int getLlamaContextSize()` – llama.cpp context window +- `void setLlamaContextSize(int)` – set context size +- `int getLlamaMaxOutputTokens()` – llama.cpp max output tokens +- `void setLlamaMaxOutputTokens(int)` – set max tokens +- `float getLlamaTemperature()` – llama.cpp sampling temperature +- `void setLlamaTemperature(float)` – set temperature +- `int getLlamaThreads()` – llama.cpp CPU threads +- `void setLlamaThreads(int)` – set thread count +- `String getPluginVersion()` – generator plugin version +- `void setPluginVersion(String)` – set plugin version +- `String getAiVersion()` – AI summarisation logic version +- `void setAiVersion(String)` – set AI version +- `String getProjectName()` – project title for index +- `void setProjectName(String)` – set project title + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiModelDefinition` +- `net.ladenthin.srcmorph.config.AiFieldGenerationConfig` +- `net.ladenthin.srcmorph.config.AiFactDefinition` +- `net.ladenthin.srcmorph.config.AiGenerationConfig` (for DEFAULT_THREADS) + +#### Exceptions / Errors +- No checked exceptions thrown; setters accept null where annotated. + +#### Concurrency +- No synchronization; instance is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..44c5b975 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,55 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:49:25Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> A configuration‑centric framework that evaluates file‑selection rules, extracts deterministic code‑facts, and orchestrates AI‑generation settings for source‑morph indexing. + +#### Purpose +- Centralize runtime parameters for srcmorph runs. +- Validate and evaluate file‑selection conditions. +- Compute deterministic fact blocks for AI summarization. + +#### Responsibilities +- **Configuration Management** – `SrcMorphConfiguration` holds all plugin, AI, and file‑selection settings. +- **Condition Evaluation** – `AiConditionEvaluator` checks `AiCondition` trees against file metadata. +- **Fact Extraction** – `AiFactExtractor` counts regex‑based facts in source files. +- **Oversize Handling** – `AiOversizeStrategy` defines actions for files exceeding context limits. +- **AI Generation Parameters** – `AiGenerationConfig` stores model, sampling, and caching options. + +#### Key units +- `SrcMorphConfiguration` – mutable bean for Maven/Jackson binding. +- `AiConditionEvaluator` – stateless validator/evaluator for `AiCondition` trees. +- `AiConditionGroup` – container for logical combinator children. +- `AiFactExtractor` – utility for deterministic fact counting. +- `AiOversizeStrategy` – enum of oversize handling policies. +- `AiGenerationConfig` – JavaBean of AI generation settings. + +#### Data flow +1. **Configuration Load** – `SrcMorphConfiguration` is populated from Maven or JSON/YAML. +2. **File Routing** – `AiConditionEvaluator` uses `AiCondition` trees to decide if a file is included. +3. **Fact Computation** – `AiFactExtractor` processes source text to produce a facts block. +4. **AI Generation** – `AiGenerationConfig` supplies parameters to the provider layer, which may use `AiOversizeStrategy` to handle oversized inputs. + +#### Dependencies +- Java core (`java.util`, `java.io`, `java.time`, `java.util.regex`). +- Lombok (`@ToString`). +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.config` package (AiCondition, AiPromptDefinition, AiModelDefinition, AiFieldGenerationConfig, AiFactDefinition, AiCalibration). +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`. + +#### Cross‑cutting +- **Null handling** – setters replace `null` with defaults or empty collections. +- **Thread safety** – all utilities are stateless; configuration beans are not thread‑safe. +- **Validation** – `AiConditionEvaluator.validate` and `AiFactExtractor.validate` enforce configuration correctness. +- **Immutability** – `AiOversizeStrategy` enum is immutable; `AiConditionGroup` defensively copies collections. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..9767cd52 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,57 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:49:37Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A framework that orchestrates AI‑driven source‑code transformation by evaluating file‑selection rules, extracting deterministic facts, and delegating generation to pluggable AI back‑ends. + +#### Purpose +- Centralize configuration for source‑morph runs. +- Route files to AI providers based on conditions. +- Generate transformed code snippets with timing diagnostics. + +#### Responsibilities +- **Configuration Management** – load, validate, and expose runtime parameters (`SrcMorphConfiguration`). +- **Condition Evaluation** – decide file inclusion via `AiConditionEvaluator` and logical groups. +- **Fact Extraction** – count deterministic regex‑based facts (`AiFactExtractor`). +- **Oversize Handling** – policy for files exceeding context limits (`AiOversizeStrategy`). +- **AI Generation** – abstract provider selection, prompt handling, response parsing, and metrics (`AiGenerationProviderFactory`, `AiGenerationProvider` implementations). + +#### Key units +- `SrcMorphConfiguration` – mutable bean for Maven/Jackson binding. +- `AiConditionEvaluator` – stateless validator for `AiCondition` trees. +- `AiFactExtractor` – utility for deterministic fact counting. +- `AiOversizeStrategy` – enum of oversize handling policies. +- `AiGenerationProviderFactory` – resolves provider keys. +- `AiGenerationProvider` interface – contract for generation and timing. +- `LlamaCppJniAiGenerationProvider` – native llama.cpp inference. +- `OpenAiCompatibleProviderSupport` – OpenAI‑compatible HTTP client. +- `MockAiGenerationProvider` – test stub. +- `AiCompletionParser` – strips internal reasoning from LLM output. +- `LlamaCppJniConfig` – immutable config holder for llama.cpp parameters. + +#### Data flow +1. **Load configuration** → `SrcMorphConfiguration`. +2. **Evaluate file conditions** → `AiConditionEvaluator` → inclusion decision. +3. **Extract facts** → `AiFactExtractor` → facts block. +4. **Resolve provider** → `AiGenerationProviderFactory` → concrete `AiGenerationProvider`. +5. **Generate text** → provider’s `generate` (or `generateWithTimings`) → `AiCompletionParser` → final snippet. +6. **Return result** with optional `AiGenerationTimings`. + +#### Dependencies +- **Internal**: `AiPromptSupport`, `AiGenerationRequest`, `AiGenerationTimings`, `Java8CompatibilityHelper`. +- **External**: `net.ladenthin.llama` (model, parameters, JSON), `com.fasterxml.jackson` (JSON), `java.net`, `java.io`, `lombok`, `org.jspecify.annotations.Nullable`. +- **Optional**: environment variable lookup for API keys, OpenAI‑compatible HTTP client. + +#### Cross‑cutting +- **Thread safety** – stateless utilities; providers may cache a single native model. +- **Error handling** – `IOException` for I/O or parsing errors; `IllegalArgumentException` for unsupported providers. +- **Immutability** – `LlamaCppJniConfig` and `AiOversizeStrategy` are immutable; configuration beans are mutable but not thread‑safe. +- **Timing metrics** – `AiGenerationTimings` captures token counts, throughput, and timestamps. +- **Prompt caching** – `LlamaCppJniAiGenerationProvider` logs cache reuse and warns on truncation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..c16539ce --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,46 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:48:05Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Extracts the model’s final answer from a raw LLM completion by removing any leading Gemma‑4 thinking block. + +#### Purpose +- Parses LLM completion text. +- Strips internal reasoning before persisting the answer. + +#### Type +`public class AiCompletionParser` – non‑final, annotated `@ToString`. + +#### Input +- `String response` (may be `null`). + +#### Output +- `String` – cleaned answer, never `null`. +- May throw `IOException` if a thinking block is incomplete. + +#### Core logic +- If `response` is `null`, return empty string. +- Trim whitespace; if it does not start with `THINKING_BLOCK_START_MARKER`, return trimmed text. +- Otherwise, locate the first `THINKING_BLOCK_END_MARKER` after the start marker. +- If absent, throw `IOException` with guidance to increase token budget. +- Return the substring after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` → construct parser. +- `String parseCompletion(String)` → clean answer, may throw IOException. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `IOException` when a thinking block starts but no closing marker is found; message advises increasing `maxOutputTokens`. + +#### Concurrency +- Stateless; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..10e9424a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,49 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:48:07Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Provides AI text generation for source‑code transformation requests, supporting optional timing metrics. + +#### Purpose +- Supplies generated text for an `AiGenerationRequest`. +- Enables optional timing data for calibration. + +#### Type +`public interface AiGenerationProvider` – interface, extends `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest request)` – request with prompt key, source file, source text, current header. +- `generateWithTimings(AiGenerationRequest request)` – same request. + +#### Output +- `generate` returns non‑null `String` (may be blank). +- `generateWithTimings` returns `AiGenerationTimings` containing text and timing metrics. +- `close` performs no action. + +#### Core logic +- `generate` is abstract; implementations supply text. +- `generateWithTimings` default: calls `generate`, returns timings with zeros. +- `close` default: no-op. + +#### Public API +- `generate(AiGenerationRequest) -> String` – produce text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – produce text with timings. +- `close() -> void` – close resources. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.document.AiGenerationTimings` + +#### Exceptions / Errors +- `generate` throws `IOException` on provider failure. +- `generateWithTimings` throws `IOException` if underlying `generate` fails. + +#### Concurrency +- No explicit synchronization; implementations decide thread safety. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..90259d34 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,51 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:48:10Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Instantiates AI generation providers based on a provider key or model configuration. + +#### Purpose +- Selects and creates an `AiGenerationProvider` implementation. + +#### Type +`public class AiGenerationProviderFactory` – class, final, no generics, annotated `@ToString`. + +#### Input +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` – provider key, model config, prompt lookup. +- `effectiveProvider(String runProvider, String modelProvider)` – provider keys. + +#### Output +- `create` returns a concrete `AiGenerationProvider` instance. +- `effectiveProvider` returns the resolved provider key. + +#### Core logic +- Resolve provider key via `effectiveProvider`. +- If key blank or null, return `MockAiGenerationProvider`. +- Switch on key: + - `"mock"` → `MockAiGenerationProvider`. + - `"llamacpp-jni"` → `LlamaCppJniAiGenerationProvider`. + - `"openai-compatible"` → `OpenAiCompatibleAiGenerationProvider`. + - else throw `IllegalArgumentException`. + +#### Public API +- `AiGenerationProviderFactory()` – construct factory. +- `static @Nullable String effectiveProvider(String runProvider, String modelProvider)` – resolve provider key. +- `AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` – instantiate provider. + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` when provider name unsupported. + +#### Concurrency +- No explicit synchronization; instance is stateless except for a helper. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..0f6793dc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,71 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:48:13Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Provides local GGUF model inference via llama.cpp for AI text generation. + +#### Purpose +- Implements `AiGenerationProvider` using native llama.cpp. +- Lazily loads and caches a `LlamaModel` for repeated requests. + +#### Type +`final class LlamaCppJniAiGenerationProvider` implements `AiGenerationProvider`, `AutoCloseable`; Lombok `@ToString` with exclusions. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate(AiGenerationRequest request)` / `generateWithTimings(AiGenerationRequest request)` receive request objects. +- `close()` consumes internal model. + +#### Output +- `generate` returns generated text `String`. +- `generateWithTimings` returns `AiGenerationTimings` with text, token counts, and throughput. +- `close` releases native resources. + +#### Core logic +- `model()` lazily builds `LlamaModel` with `ModelParameters` derived from `config` and `support`. +- `generate`: + 1. Calls `chatResponse` to run chat completion. + 2. Warns on truncated answers. + 3. Logs prompt cache reuse. + 4. Parses completion text. +- `chatResponse`: + - Builds inference parameters via `support`. + - Calls `model().chatComplete(...)` and parses JSON into `ChatResponse`. +- `generateWithTimings`: + - Calls `chatResponse`. + - Extracts text and `Timings`; if absent, returns zeros. + - Returns `AiGenerationTimings` with prompt, cache, predicted counts and rates. +- `close` disposes native `LlamaModel` if loaded. + +#### Public API +- `generate(AiGenerationRequest) -> String` – produce text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – produce text with metrics. +- `close() -> void` – release native resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.args.FlashAttn` +- `net.ladenthin.llama.args.ReasoningFormat` +- `net.ladenthin.llama.json.ChatResponseParser` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.ChatResponse` +- `net.ladenthin.llama.value.Timings` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- Lombok `@ToString` + +#### Exceptions / Errors +- `generate` declares `throws IOException` (though underlying calls are unchecked). +- `generateWithTimings` handles missing `Timings` by returning zeroed metrics. +- `close` silently ignores if model is null. + +#### Concurrency +- Single‑threaded usage implied; no explicit synchronization. The native `LlamaModel` is cached and reused across calls. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..289fa0a6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,133 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:48:18Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Immutable configuration holder for llama.cpp JNI provider, exposing all model‑generation knobs and defaults. + +#### Purpose +- Stores llama.cpp runtime options. +- Supplies read‑only access to configuration values. + +#### Type +`final class LlamaCppJniConfig` – immutable, Lombok‑generated `equals`, `hashCode`, `toString`. Implements `ConvertToRecord`. No superclass or interfaces. + +#### Input +- `Builder` instance supplied to private constructor. +- Builder fields initialized from `AiGenerationConfig.DEFAULT_*` or caller overrides. + +#### Output +- Immutable `LlamaCppJniConfig` instance. +- Unmodifiable lists for `drySequenceBreakers` and `stopStrings`. + +#### Core logic +- Constructor copies all 37 builder fields to final fields. +- `builder(String)` creates a new `Builder` with required `modelPath`. +- Each getter returns the corresponding field. +- `drySequenceBreakers()` / `stopStrings()` wrap lists with `Collections.unmodifiableList`. + +#### Public API +- `static Builder builder(String)` → builder with defaults +- `String modelPath()` → model file path +- `int contextSize()` → context window size +- `int maxOutputTokens()` → max output tokens +- `float temperature()` → sampling temperature +- `int threads()` → CPU thread count +- `float topP()` → nucleus‑sampling threshold +- `int topK()` → top‑k limit +- `float minP()` → min‑p threshold +- `float topNSigma()` → top‑n‑sigma threshold +- `float repeatPenalty()` → repetition penalty +- `@Nullable Boolean chatTemplateEnableThinking()` → chat‑template flag +- `boolean cachePrompt()` → prompt caching enabled +- `boolean swaFull()` → full SWA cache kept +- `int cacheReuse()` → KV prefix‑reuse chunk size +- `int gpuLayers()` → GPU layers offloaded +- `int seed()` → RNG seed +- `int cpuMoeLayers()` → CPU MoE layers +- `int cpuFfnLayers()` → CPU FFN layers +- `int kvUnifiedPerSlot()` → KV unified cap +- `String lazyMode()` → tensor‑read laziness +- `int repeatLastN()` → repeat‑penalty window +- `String cacheTypeK()` → KV cache type K +- `String cacheTypeV()` → KV cache type V +- `boolean flashAttn()` → Flash Attention enabled +- `int batchSize()` → logical batch size +- `int ubatchSize()` → physical batch size +- `int threadsBatch()` → batch thread count +- `int mainGpu()` → primary GPU index +- `String devices()` → device list +- `String provider()` → AI provider name +- `String remoteModel()` → remote model ID +- `String baseUrl()` → OpenAI‑compatible base URL +- `String apiKeyEnv()` → API key environment variable +- `String reasoningEffort()` → reasoning‑effort level +- `int reasoningBudgetTokens()` → reasoning token budget +- `float dryMultiplier()` → DRY multiplier +- `float dryBase()` → DRY base +- `int dryAllowedLength()` → DRY allowed length +- `int dryPenaltyLastN()` → DRY penalty look‑back +- `List drySequenceBreakers()` → unmodifiable breakers list +- `List stopStrings()` → unmodifiable stop strings + +`Builder` public methods +- `Builder contextSize(int)` → set context size +- `Builder maxOutputTokens(int)` → set max output tokens +- `Builder temperature(float)` → set temperature +- `Builder threads(int)` → set CPU threads +- `Builder topP(float)` → set nucleus threshold +- `Builder topK(int)` → set top‑k limit +- `Builder minP(float)` → set min‑p threshold +- `Builder topNSigma(float)` → set top‑n‑sigma threshold +- `Builder repeatPenalty(float)` → set repetition penalty +- `Builder chatTemplateEnableThinking(@Nullable Boolean)` → set chat‑template flag +- `Builder cachePrompt(boolean)` → set prompt caching +- `Builder swaFull(boolean)` → set full SWA cache +- `Builder cacheReuse(int)` → set KV prefix‑reuse size +- `Builder gpuLayers(int)` → set GPU layers +- `Builder seed(int)` → set RNG seed +- `Builder cpuMoeLayers(int)` → set CPU MoE layers +- `Builder cpuFfnLayers(int)` → set CPU FFN layers +- `Builder kvUnifiedPerSlot(int)` → set KV unified cap +- `Builder lazyMode(String)` → set tensor‑read laziness +- `Builder repeatLastN(int)` → set repeat‑penalty window +- `Builder cacheTypeK(String)` → set KV cache type K +- `Builder cacheTypeV(String)` → set KV cache type V +- `Builder flashAttn(boolean)` → set Flash Attention +- `Builder batchSize(int)` → set logical batch size +- `Builder ubatchSize(int)` → set physical batch size +- `Builder threadsBatch(int)` → set batch thread count +- `Builder mainGpu(int)` → set primary GPU index +- `Builder devices(String)` → set device list +- `Builder provider(String)` → set AI provider +- `Builder remoteModel(String)` → set remote model ID +- `Builder baseUrl(String)` → set base URL +- `Builder apiKeyEnv(String)` → set API key env name +- `Builder reasoningEffort(String)` → set reasoning effort +- `Builder reasoningBudgetTokens(int)` → set reasoning budget +- `Builder dryMultiplier(float)` → set DRY multiplier +- `Builder dryBase(float)` → set DRY base +- `Builder dryAllowedLength(int)` → set DRY allowed length +- `Builder dryPenaltyLastN(int)` → set DRY penalty window +- `Builder drySequenceBreakers(List)` → set DRY breakers +- `Builder stopStrings(List)` → set stop strings +- `LlamaCppJniConfig build()` → create immutable config + +#### Dependencies +- `net.ladenthin.srcmorph.config.AiGenerationConfig` for default constants. +- `net.ladenthin.srcmorph.support.ConvertToRecord` annotation. +- `org.jspecify.annotations.Nullable`. +- `java.util.*` for collections and `Objects`. +- Lombok annotations `@EqualsAndHashCode`, `@ToString`. + +#### Exceptions / Errors +- `Objects.requireNonNull` throws `NullPointerException` if `modelPath` is null in `Builder` constructor. + +#### Concurrency +- Immutable after construction; thread‑safe. +- Builder is not thread‑safe; intended single‑thread usage. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..e8634cfa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,78 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:48:28Z +- G: +- A: 0.0.0 +- X: file +- P: 36159BF2 +--- +> Builds the JSON request, endpoint, and key handling for an OpenAI‑compatible chat‑completion provider, and interprets responses and errors. + +#### Purpose +- Constructs request payloads for chat‑completion calls. +- Validates and builds endpoint URLs. +- Retrieves and secures API keys. +- Parses success status, error messages, and timing metrics. + +#### Type +`final class OpenAiCompatibleProviderSupport` – class, final, no inheritance, implements no interfaces. + +#### Input +- `LlamaCppJniConfig config` – model settings (remoteModel, baseUrl, apiKeyEnv, sampling knobs). +- `AiPromptSupport promptSupport` – prompt templates. +- `Function environment` – environment variable lookup. +- `AiGenerationRequest request` – file description for request body. +- `String endpoint` – URL for key validation. +- `String host` – host part of a URL for loopback check. +- `int status` – HTTP status code. +- `String body` – error response body. +- `String text, ChatResponse response, double seconds` – for timing calculation. + +#### Output +- JSON string for request body. +- Endpoint URL string. +- Optional trimmed API key string. +- Boolean flags for loopback host and success status. +- Error message string. +- `AiGenerationTimings` object with token counts and decode rate. + +#### Core logic +- `requestBody`: builds JSON with system/user messages, sampling knobs, optional fields (model, top_k, min_p, seed, stop, reasoning.effort), and disables streaming. +- `endpoint`: trims baseUrl, ensures http/https scheme, removes trailing slashes, appends `/chat/completions`. +- `apiKey`: reads env var, trims, returns null if unset or blank. +- `apiKeyFor`: validates that a plain http endpoint is only used with loopback hosts; otherwise throws `IOException`. +- `isLoopbackHost`: checks host against `localhost`, IPv4 127.x.x.x, or `[::1]`. +- `isSuccess`: true for 200–299 status codes. +- `errorMessage`: truncates body to 500 chars, appends ellipsis, formats message with endpoint and status. +- `timings`: computes completion token count, decode rate, and constructs `AiGenerationTimings`. + +#### Public API +- `String requestBody(AiGenerationRequest) -> JSON body` – build request payload. +- `String endpoint() -> URL` – construct chat‑completion endpoint. +- `String apiKey() -> key` – retrieve optional API key. +- `String apiKeyFor(String) -> key` – secure key for endpoint. +- `static boolean isLoopbackHost(String) -> flag` – loopback host check. +- `static boolean isSuccess(int) -> flag` – success status check. +- `static String errorMessage(String,int,String) -> message` – error description. +- `static AiGenerationTimings timings(String,ChatResponse,double) -> timings` – compute call metrics. + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper`, `ArrayNode`, `ObjectNode` +- `java.io.IOException`, `java.net.URL` +- `java.util.List`, `java.util.Objects`, `java.util.function.Function`, `java.util.regex.Pattern` +- `lombok.ToString` +- `net.ladenthin.llama.value.ChatResponse`, `Usage` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` if `baseUrl` lacks http/https scheme. +- `IOException` if API key sent over plain http to non‑loopback host or URL parsing fails. +- `IOException` from JSON serialization in `requestBody`. + +#### Concurrency +- All fields are immutable after construction; no synchronization needed. The class is thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..6114922b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,57 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:49:30Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Provides a pluggable AI text‑generation layer for source‑code transformation, supporting local llama.cpp inference, OpenAI‑compatible APIs, and mock providers, with configurable prompts, timing metrics, and robust response parsing. + +#### Purpose +- Supply generated code snippets for transformation requests. +- Offer timing diagnostics for performance tuning. +- Abstract over multiple AI back‑ends. + +#### Responsibilities +- **Provider selection** – `AiGenerationProviderFactory` resolves a provider key to a concrete implementation. +- **Generation logic** – `AiGenerationProvider` implementations (`LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`, `MockAiGenerationProvider`) produce text and optional metrics. +- **Configuration** – `LlamaCppJniConfig` holds all llama.cpp runtime knobs. +- **Prompt handling** – `AiPromptSupport` (not shown) supplies prompt templates. +- **Response parsing** – `AiCompletionParser` extracts the final answer from raw completions. +- **OpenAI compatibility** – `OpenAiCompatibleProviderSupport` builds request payloads, validates endpoints, secures API keys, and interprets responses. + +#### Key units +- `AiGenerationProviderFactory` – resolves provider names. +- `AiGenerationProvider` interface – contract for generation and timing. +- `LlamaCppJniAiGenerationProvider` – native llama.cpp inference, lazy model loading, token‑count metrics. +- `OpenAiCompatibleProviderSupport` – JSON request builder, endpoint validation, key handling, error formatting, timing calculation. +- `AiCompletionParser` – strips internal reasoning blocks from LLM output. +- `LlamaCppJniConfig` – immutable config holder for llama.cpp parameters. + +#### Data flow +1. **Request creation** – caller builds an `AiGenerationRequest` (prompt key, source file, text, header). +2. **Provider resolution** – `AiGenerationProviderFactory.effectiveProvider` selects a key; `create` returns the matching provider. +3. **Generation** – provider’s `generate` (or `generateWithTimings`) receives the request. + - For llama.cpp: builds inference parameters via `AiPromptSupport`, runs `LlamaModel.chatComplete`, parses JSON, logs cache usage, and parses completion with `AiCompletionParser`. + - For OpenAI‑compatible: `OpenAiCompatibleProviderSupport` builds the request body, validates the endpoint, retrieves the API key, sends the HTTP call, parses the `ChatResponse`, and computes timings. +4. **Output** – provider returns the generated text (and optionally `AiGenerationTimings`). + +#### Dependencies +- **Internal**: `AiPromptSupport`, `AiGenerationRequest`, `AiGenerationTimings`, `Java8CompatibilityHelper`. +- **External**: `net.ladenthin.llama` (model, parameters, JSON parsing), `com.fasterxml.jackson` (JSON), `java.net`, `java.io`, `lombok`. +- **Optional**: environment variable lookup for API keys, OpenAI‑compatible HTTP client (not shown). + +#### Cross-cutting +- **Thread safety**: `AiCompletionParser` is stateless; providers are generally stateless but may cache a native model (single‑threaded). Factory is stateless. +- **Error handling**: `IOException` for missing closing markers, provider failures, or HTTP errors; `IllegalArgumentException` for unsupported provider names. +- **Configuration immutability**: `LlamaCppJniConfig` is immutable; builder pattern used for construction. +- **Timing metrics**: `AiGenerationTimings` captures text, token counts, and throughput; default zeros when unavailable. +- **Prompt caching**: `LlamaCppJniAiGenerationProvider` logs cache reuse and warns on truncation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..510ff8c0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,49 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:49:01Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Computes a 256‑bin byte histogram of an input byte stream in two OpenCL kernel passes. + +#### Purpose +- Builds a 256‑bin histogram of byte values. +- Operates in two passes: per‑group partial accumulation and global reduction. + +#### Type +- OpenCL C 1.2 kernels (`__kernel` functions). + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms to `partial`. +- `histogram_reduce`: writes final histogram to `histogram`. + +#### Core logic +- **histogram_partial** + 1. Zero local bin array in parallel. + 2. Each work‑item atomically increments local bin for its assigned input bytes. + 3. After synchronization, each work‑item writes its local bin counts to the global `partial` buffer. +- **histogram_reduce** + 1. Each work‑item corresponds to one histogram bin. + 2. Sums the counts for that bin across all partial histograms. + 3. Stores the sum in the global `histogram`. + +#### Public API +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – final histogram reduction. + +#### Constants and configuration +- `#define BINS 256` + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- None explicitly handled; out‑of‑range bin indices are guarded by `if (bin >= BINS)` in `histogram_reduce`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..3f7841a2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,38 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:49:41Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes a 256‑bin byte histogram of an input byte stream using two OpenCL kernel passes. + +#### Purpose +- Build a 256‑bin histogram of byte values from a global byte buffer. +- Split work into per‑group partial accumulation and a global reduction. + +#### Responsibilities +- **Partial accumulation**: each work‑group builds a local histogram of its assigned bytes and writes it to a global partial buffer. +- **Global reduction**: each work‑item aggregates a single histogram bin across all partial histograms to produce the final result. + +#### Key units +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group kernel that fills `partial` with local histograms. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – kernel that sums across `partial` to produce the final 256‑bin histogram. +- Constant `#define BINS 256` – number of histogram bins. + +#### Data flow +1. **Input**: global byte buffer `input` and its `length`. +2. **Partial pass**: each work‑group processes a slice of `input`, atomically updates `local_bins`, then writes its local histogram to `partial`. +3. **Reduction pass**: each work‑item sums the same bin across all entries in `partial` and writes the total to `histogram`. + +#### Dependencies +- OpenCL runtime functions: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. +- Requires a global buffer `partial` sized `group_count * BINS` and a global buffer `histogram` sized `BINS`. + +#### Cross-cutting +- Uses atomic increments for thread‑safe bin updates. +- Synchronization via `barrier(CLK_LOCAL_MEM_FENCE)` to ensure local bins are fully populated before writing to global memory. +- Guard against out‑of‑range indices in the reduction kernel with `if (bin >= BINS)`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..4bb6910f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,57 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:49:51Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides GPU‑accelerated byte‑histogram computation, a lock‑free ring buffer for streaming data, and small shell/Python utilities for backup and sales reporting. + +#### Purpose +- Deliver high‑performance byte‑histogram kernels for OpenCL. +- Offer a lightweight, power‑of‑two ring buffer for single‑producer/single‑consumer byte streams. +- Supply command‑line tools for directory backups and CSV‑based sales aggregation. + +#### Responsibilities +- **GPU kernels**: split work into per‑group partial histograms and a global reduction. +- **Ring buffer**: allocate, manage head/tail indices, read/write with wrap‑around, report space. +- **Scripts**: rotate backups with retention policy; parse CSV orders, filter by currency, aggregate revenue by month/region. + +#### Key units +- **OpenCL** + - `histogram_partial` – per‑group local histogram builder. + - `histogram_reduce` – global reduction of partial histograms. + - `#define BINS 256` – constant for histogram size. +- **Ring buffer** + - `ringbuf_t` – buffer descriptor. + - `ringbuf_status_t` – status enum. + - `ringbuf_init`, `ringbuf_free`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space`. +- **Scripts** + - `rotate_backups.sh` – tar‑compress, timestamp, prune old archives. + - `sales_report.py` – `parse_orders`, `revenue_by_month_and_region`, `main`. + +#### Data flow +1. **Histogram** + - Input byte buffer → `histogram_partial` writes per‑group partials → `histogram_reduce` aggregates into final 256‑bin histogram. +2. **Ring buffer** + - Producer writes via `ringbuf_write`; consumer reads via `ringbuf_read`; status queried with `ringbuf_used`/`ringbuf_free_space`. +3. **Scripts** + - `rotate_backups.sh`: source → tar → archive → retention. + - `sales_report.py`: CSV files → parse → filter → aggregate → tab‑delimited output. + +#### Dependencies +- OpenCL runtime APIs (`get_local_id`, `atomic_inc`, `barrier`, etc.). +- Standard C headers (`stddef.h`, `stdint.h`, `stdlib.h`, `string.h`). +- Bash utilities (`tar`, `date`, `du`, `ls`, `rm`, `mv`). +- Python stdlib (`argparse`, `csv`, `collections`, `dataclasses`, `datetime`, `decimal`). + +#### Cross-cutting +- Atomic increments and barriers ensure thread safety in kernels. +- Power‑of‑two capacity enforcement and wrap‑around logic in ring buffer. +- Consistent error handling: status enums in C, exit codes in Bash, exceptions in Python. +- Input validation and informative console output across all components. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..9e6f0134 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,47 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:49:44Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides a lock‑free, power‑of‑two sized circular buffer for byte streams, enabling efficient single‑producer/single‑consumer data transfer. + +#### Purpose +- Offer a fixed‑size ring buffer API for byte streams. +- Support initialization, cleanup, read/write, and space queries. + +#### Responsibilities +- **Buffer management** – allocate, free, and maintain head/tail indices. +- **Data transfer** – read/write with wrap‑around handling. +- **Space accounting** – report used and free bytes. + +#### Key units +- `ringbuf_t` – struct holding buffer pointer, capacity, head, tail. +- `ringbuf_status_t` – enum (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – allocate and set up buffer. +- `ringbuf_free(ringbuf_t *rb)` – deallocate internal memory. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – copy up to `len` bytes into buffer. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – copy up to `len` bytes out of buffer. +- `ringbuf_used(const ringbuf_t *rb)` – compute bytes currently stored. +- `ringbuf_free_space(const ringbuf_t *rb)` – compute remaining capacity. + +#### Data flow +1. **Initialization** – caller supplies power‑of‑two `capacity`; `ringbuf_init` allocates memory and zeroes indices. +2. **Writing** – producer calls `ringbuf_write`; data is copied into buffer, head advanced modulo capacity. +3. **Reading** – consumer calls `ringbuf_read`; data is copied out, tail advanced modulo capacity. +4. **Querying** – `ringbuf_used` and `ringbuf_free_space` use `(head - tail) & (capacity - 1)` to report status. +5. **Cleanup** – `ringbuf_free` releases allocated memory. + +#### Dependencies +- Standard C headers: ``, ``, ``, ``. +- Internal: `ringbuf.h` defines types and API; `ringbuf.c` implements logic. + +#### Cross-cutting +- **Power‑of‑two enforcement** – `is_power_of_two` validates capacity; errors returned as `RINGBUF_EINVAL`. +- **Wrap‑around logic** – both read and write handle up to two contiguous memory copies to accommodate buffer wrap. +- **Error handling** – `ringbuf_init` reports `RINGBUF_ENOMEM` on allocation failure; other functions return byte counts only. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..bc539913 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,59 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:49:05Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Implements a power‑of‑two sized circular buffer with read/write and memory management. + +#### Purpose +- Provides a fixed‑size ring buffer for byte streams. +- Supports initialization, deallocation, reading, writing, and space queries. + +#### Type +- C source file implementing functions for `ringbuf_t` (defined in `ringbuf.h`). + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_free` deallocates internal buffer. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates memory, sets head/tail to 0. +- `ringbuf_free` frees memory and resets fields. +- `ringbuf_used` computes used bytes via modulo arithmetic. +- `ringbuf_free_space` calculates remaining capacity. +- `ringbuf_write` writes up to two contiguous chunks (wrap‑around) and updates head. +- `ringbuf_read` reads up to two contiguous chunks (wrap‑around) and updates tail. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free buffer. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – available space. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write data. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read data. + +#### Constants and configuration +- None defined in this file. + +#### Dependencies +- `` – `malloc`, `free`. +- `` – `memcpy`. +- `"ringbuf.h"` – type and status definitions. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity not power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..cb9016dc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,63 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:49:09Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides a fixed‑size byte ring buffer for single‑producer/single‑consumer use. + +#### Purpose +- Implements a lock‑free byte ring buffer. +- Supports initialization, cleanup, read/write, and space queries. + +#### Type +- Header file (`ringbuf.h`) in C (C99). +- Defines `ringbuf_t` struct, `ringbuf_status_t` enum, and related functions. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes (must be power of two, >0). +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. +- `ringbuf_used(const ringbuf_t *rb)` – reads current used bytes. +- `ringbuf_free_space(const ringbuf_t *rb)` – reads available space. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- `ringbuf_write` returns number of bytes actually written. +- `ringbuf_read` returns number of bytes actually read. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. +- `ringbuf_free` deallocates internal buffer. + +#### Core logic +- `ringbuf_init`: validates capacity, allocates `capacity` bytes, sets head/tail to 0. +- `ringbuf_write`: copies up to `len` bytes from `src` into buffer, wrapping at `capacity`; updates `head`. +- `ringbuf_read`: copies up to `len` bytes from buffer into `dst`, wrapping at `capacity`; updates `tail`. +- `ringbuf_used`: computes `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space`: computes `(capacity - 1) - ringbuf_used`. +- `ringbuf_free`: frees allocated `data`. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free resources. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – free capacity. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- `` – `size_t`. +- `` – `uint8_t`. +- Standard C library `malloc`, `free` (implied by `ringbuf_init`/`ringbuf_free`). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..4e9f3aa9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,44 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:49:47Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> A small utility package that backs up directories and generates monthly sales reports from CSV exports. + +#### Purpose +- Create timestamped, compressed backups and prune old ones. +- Aggregate order revenue by month and region from CSV files. + +#### Responsibilities +- **Backup management**: `rotate_backups.sh` handles directory snapshotting, naming, and retention. +- **Sales reporting**: `sales_report.py` parses CSV orders, filters by currency, aggregates revenue, and outputs a tab‑delimited report. + +#### Key units +- **`rotate_backups.sh`** – Bash script that validates arguments, creates a `.tar.gz` archive with a UTC timestamp, and deletes older archives beyond a keep count. +- **`sales_report.py`** – Python module exposing `parse_orders`, `revenue_by_month_and_region`, and `main`; processes CSV files, aggregates revenue, and prints results. + +#### Data flow +1. **Backup**: + - Input: source directory, backup directory, optional keep count. + - Process: validate, tar‑compress, move to final name, list and prune older archives. + - Output: new archive file, console messages. + +2. **Sales report**: + - Input: list of CSV paths, currency filter, min‑revenue threshold. + - Process: parse each CSV, filter by currency, accumulate totals per `(month, region)` using `defaultdict(Decimal)`. + - Output: tab‑separated lines `monthregionrevenue currency`. + +#### Dependencies +- **`rotate_backups.sh`**: external commands `tar`, `date`, `du`, `ls`, `rm`, `mv`. +- **`sales_report.py`**: standard library modules `argparse`, `csv`, `sys`, `collections`, `dataclasses`, `datetime`, `decimal`. + +#### Cross-cutting +- Both units enforce strict input validation and provide clear exit codes (`0` success, `1` or `2` error). +- Error handling uses exceptions (`ValueError`, `decimal.InvalidOperation`) in Python and shell `exit 2` for argument issues. +- Both scripts output informative console messages and clean up temporary artifacts (`trap` in Bash, no temp files in Python). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..cbf3f9a5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,62 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:49:18Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates a dated, compressed backup of a directory and prunes older archives, keeping only the newest N. + +#### Purpose +- Generates a timestamped `.tar.gz` backup of `SOURCE_DIR` into `BACKUP_DIR`. +- Deletes older backups beyond the specified `KEEP` count. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- `$1` → `SOURCE_DIR` (required). +- `$2` → `BACKUP_DIR` (required). +- `$3` → `KEEP` (optional, defaults to `7`). +- Validates `KEEP` as a positive integer. +- Checks `SOURCE_DIR` exists; creates `BACKUP_DIR` if missing. + +#### Output +- Writes a new archive file `BACKUP_DIR/_YYYYMMDDTHHMMSSZ.tar.gz`. +- Prints creation message with size. +- Removes older archives beyond `KEEP`; prints each removal. +- Exit status `0` on success, `2` on invalid arguments or missing directory. + +#### Core logic +- Validate inputs and `KEEP`. +- Ensure `BACKUP_DIR` exists. +- Build `archive` path with UTC timestamp. +- Create temporary archive `tmp`; trap to delete on exit. +- `tar -C "$(dirname "$SOURCE_DIR")" -czf "$tmp" "$name"`. +- Move `tmp` to final `archive`. +- List existing archives sorted newest first. +- Loop over archives beyond `KEEP` and delete them. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR`=`"${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR`=`"${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP`=`"${3:-7}"` +- `name`=`"$(basename "$SOURCE_DIR")"` +- `archive`=`"$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp`=`"$archive.partial"` + +#### Dependencies +- External commands: `tar`, `date`, `du`, `ls`, `rm`, `mv`. +- Uses `ls -1t` for sorting by modification time. + +#### Errors and exit codes +- `exit 2` if `KEEP` not a positive integer or `SOURCE_DIR` missing. +- `trap` ensures temporary file `tmp` is removed on exit. +- No explicit retries or timeouts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..4501617c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,59 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:49:21Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Generates a monthly sales report from CSV order exports, aggregating revenue by month and region. + +#### Purpose +- Aggregates order amounts per month and region. +- Filters by currency and minimum revenue threshold. + +#### Type +- Python script (module) with `main` entry point. + +#### Input +- `csv_files`: list of CSV file paths. +- `--currency`: target currency code (default `EUR`). +- `--min-revenue`: minimum revenue to display (default `0`). +- CSV rows must contain columns: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints lines: `monthregionrevenue currency` for each bucket meeting `min-revenue`. +- Exits with code `0` on success, `1` if no orders found. + +#### Core logic +- `parse_orders(path, currency)`: + - Opens CSV, validates required columns. + - Skips rows with non‑matching currency. + - Yields `Order(order_date, region, amount)`; errors raise `ValueError`. +- `revenue_by_month_and_region(orders)`: + - Sums `amount` per `(YYYY-MM, region)` key using `defaultdict(Decimal)`. + - Returns sorted dictionary of totals. +- `main(argv)`: + - Parses arguments. + - Collects all orders from provided files. + - If none, prints error and exits with `1`. + - Iterates over totals, prints those ≥ `min-revenue`. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` + Parses CSV, yields orders in specified currency. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` + Aggregates revenue per month and region. +- `main(argv=None) -> int` + CLI entry point; processes files, prints report. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` for missing columns or invalid data rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..5641fa42 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,67 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:50:14Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A framework that orchestrates AI‑driven source‑code transformation, GPU‑accelerated data processing, and relational data management for library, shop, and warehouse domains. + +#### Purpose +- Centralize AI‑based code transformation workflows. +- Provide high‑performance GPU kernels and a lock‑free ring buffer for streaming data. +- Persist and enforce business rules across library, shop, and warehouse domains with audit and reporting. + +#### Responsibilities +- **AI Source Morph** – configuration, condition evaluation, fact extraction, oversize handling, provider selection, prompt generation, response parsing, and timing. +- **GPU & Streaming Utilities** – OpenCL byte‑histogram kernels, power‑of‑two ring buffer, and command‑line backup/report scripts. +- **Relational Data Management** – schemas, stored procedures, triggers, and views for library loans, e‑commerce orders, and warehouse inventory. + +#### Key units +- **Java (AI)** + - `SrcMorphConfiguration` – runtime parameters. + - `AiConditionEvaluator` – file‑selection logic. + - `AiFactExtractor` – deterministic fact counting. + - `AiOversizeStrategy` – context‑limit policy. + - `AiGenerationProviderFactory` / `AiGenerationProvider` – provider abstraction. + - `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport`, `MockAiGenerationProvider` – concrete providers. + - `AiCompletionParser` – output sanitization. + - `LlamaCppJniConfig` – llama.cpp settings. +- **C / OpenCL (GPU)** + - `histogram_partial`, `histogram_reduce` – 256‑bin histogram kernels. + - `ringbuf_t`, `ringbuf_status_t` – ring buffer API (`ringbuf_init`, `ringbuf_write`, `ringbuf_read`, etc.). +- **Shell / Python (Scripts)** + - `rotate_backups.sh` – backup rotation. + - `sales_report.py` – CSV parsing and revenue aggregation. +- **SQL (Library / Shop / Warehouse)** + - Library tables (`author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`), views (`overdue_loans`, `member_loan_stats`, `popular_books`), functions (`fn_checkout_book`, `fn_late_fee`), procedure (`sp_return_book`), trigger (`trg_loan_audit`). + - Shop tables (`product`, `customer_order`, `order_item`), procedure (`add_order_item`). + - Warehouse tables (`dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`), procedure (`dbo.usp_SyncStock`). + +#### Data flow +1. **AI Morph** – load `SrcMorphConfiguration` → evaluate files with `AiConditionEvaluator` → extract facts via `AiFactExtractor` → resolve provider with `AiGenerationProviderFactory` → generate code, parse with `AiCompletionParser`, return snippet with `AiGenerationTimings`. +2. **GPU Histogram** – input byte buffer → `histogram_partial` → `histogram_reduce` → 256‑bin result. +3. **Ring Buffer** – producer writes (`ringbuf_write`), consumer reads (`ringbuf_read`), status via `ringbuf_used`/`ringbuf_free_space`. +4. **Scripts** – `rotate_backups.sh` archives directories; `sales_report.py` reads CSVs, filters, aggregates, outputs tabular report. +5. **SQL Workflows** – + - Library: `fn_checkout_book` creates loan + audit; `sp_return_book` updates loan + audit; `fn_late_fee` calculates fees; views provide reporting. + - Shop: `add_order_item` validates stock, updates order, decrements inventory, recalculates total. + - Warehouse: `dbo.usp_SyncStock` merges `SupplierFeed` into `StockLevel`, logs in `SyncLog`. + +#### Dependencies +- **Java** – Jackson, Lombok, OpenAI HTTP client, llama.cpp JNI, Java8CompatibilityHelper, environment variables for API keys. +- **C / OpenCL** – OpenCL runtime (`get_local_id`, `atomic_inc`, `barrier`), standard C headers. +- **Shell / Python** – Bash utilities (`tar`, `date`, `du`, `rm`), Python stdlib (`argparse`, `csv`, `datetime`, `decimal`). +- **SQL** – PostgreSQL/MySQL/SQL Server built‑ins, foreign keys, indexes, audit tables. + +#### Cross‑cutting +- Stateless utilities and immutable configs ensure thread safety; providers may cache native models. +- Consistent error handling: `IOException`/`IllegalArgumentException` in Java, status enums in C, exit codes in Bash, exceptions in Python. +- Timing metrics (`AiGenerationTimings`) capture token counts and throughput. +- Atomic operations and barriers guarantee safety in GPU kernels; ring buffer enforces power‑of‑two capacity with wrap‑around logic. +- Referential integrity, row locking, and audit logging provide data consistency across all domains. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..74098f48 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 9338636F +- D: 2026-11-04T07:43:16Z +- T: 2026-11-04T07:50:23Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard project is a unified framework that orchestrates AI‑driven source‑code transformation, GPU‑accelerated data processing, and relational data management across library, shop, and warehouse domains. Its core engine evaluates file‑selection rules, extracts deterministic code‑facts, and delegates generation to pluggable AI back‑ends such as llama.cpp or OpenAI‑compatible APIs, while a configuration‑centric layer fine‑tunes AI‑generation settings. GPU kernels compute 256‑bin byte histograms and a lock‑free ring buffer streams data to the AI pipeline, with utilities for backup and sales reporting. Relational schemas in PostgreSQL and MySQL enforce business rules, audit logs, and reporting for cataloging, e‑commerce orders, and inventory synchronization. + +#### Packages +- java/config — A configuration‑centric framework that evaluates file‑selection rules, extracts deterministic code‑facts, and orchestrates AI‑generation settings for source‑morph indexing. +- java — A framework that orchestrates AI‑driven source‑code transformation by evaluating file‑selection rules, extracting deterministic facts, and delegating generation to pluggable AI back‑ends. +- java/provider — Provides a pluggable AI text‑generation layer for source‑code transformation, supporting local llama.cpp inference, OpenAI‑compatible APIs, and mock providers, with configurable prompts, timing metrics, and robust response parsing. +- other/kernels — Computes a 256‑bin byte histogram of an input byte stream using two OpenCL kernel passes. +- other — Provides GPU‑accelerated byte‑histogram computation, a lock‑free ring buffer for streaming data, and small shell/Python utilities for backup and sales reporting. +- other/ringbuf — Provides a lock‑free, power‑of‑two sized circular buffer for byte streams, enabling efficient single‑producer/single‑consumer data transfer. +- other/scripts — A small utility package that backs up directories and generates monthly sales reports from CSV exports. +- . — A framework that orchestrates AI‑driven source‑code transformation, GPU‑accelerated data processing, and relational data management for library, shop, and warehouse domains. +- sql/library — A PostgreSQL library management system that stores catalog, member, and loan data, enforces borrowing rules, tracks copy availability, and provides reporting views and audit trails. +- sql — A collection of relational schemas and stored procedures that manage library cataloging, e‑commerce orders, and warehouse inventory, each with business‑rule enforcement, audit logging, and reporting capabilities. +- sql/shop — A MySQL schema for a web shop that stores products, customer orders, and order items, with a stored procedure to add items to an order while reserving stock and updating totals. +- sql/warehouse — Keeps the warehouse inventory in sync with nightly supplier feeds and records each sync run. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..85266a09 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,72 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:48:34Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Defines the core tables and indexes for a library lending system, tracking authors, books, members, and loans. + +#### Purpose +- Store library catalog and member data. +- Record book loans and enforce borrowing rules. + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` + +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author (author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` + +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` + +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `member_id BIGINT NOT NULL REFERENCES member (member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` + +- **Indexes** + - `idx_book_author ON book (author_id)` + - `idx_loan_member ON loan (member_id)` + - `idx_loan_open ON loan (due_on) WHERE returned_on IS NULL` + +#### Reads +- `author` (via foreign key in `book`) +- `book` (via foreign key in `loan`) +- `member` (via foreign key in `loan`) + +#### Writes +- Inserts/updates/deletes on `author`, `book`, `member`, `loan` as per application logic. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- `author`, `book`, `member`, `loan` tables referenced by foreign keys and indexes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..64ee4170 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,62 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:48:38Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> A set of reporting views and a materialized view for a library system, summarizing overdue loans, member loan statistics, and popular books. + +#### Purpose +- Provide read‑only reports on loan status and book popularity. +- Enable quick access to overdue loan details and member activity summaries. + +#### Type +- PostgreSQL views: `overdue_loans`, `member_loan_stats`. +- PostgreSQL materialized view: `popular_books`. +- PostgreSQL index: `idx_popular_books_id`. + +#### Schema +- **overdue_loans** + - `loan_id` integer + - `member_id` integer + - `email` text + - `title` text + - `due_on` date + - `days_overdue` integer + - Index: `idx_popular_books_id` (not applicable to this view). + +- **member_loan_stats** + - `member_id` integer + - `full_name` text + - `loans_total` bigint + - `loans_open` bigint + - `last_loan_on` timestamp + +- **popular_books** + - `book_id` integer + - `title` text + - `author_name` text + - `times_loaned` bigint + - Unique index: `idx_popular_books_id` on `book_id`. + +#### Reads +- `overdue_loans`: reads from `loan`, `member`, `book`. +- `member_loan_stats`: reads from `member`, `loan`. +- `popular_books`: reads from `loan`, `book`, `author`. + +#### Writes +- None (all objects are read‑only). + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. +- Functions: `CURRENT_DATE`, `CURRENT_DATE - INTERVAL '365 days'`. +- Index: `idx_popular_books_id` on `popular_books`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..6509c243 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,69 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:48:41Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Records and manages book loan transactions, including checkout, return, late fee calculation, and audit trail. + +#### Purpose +- Implements checkout and return logic for library loans. +- Calculates late fees. +- Audits loan actions via trigger. + +#### Type +- Table: `loan_audit` (PostgreSQL). +- Function: `fn_checkout_book` (plpgsql), `fn_late_fee` (sql), `trg_loan_audit_fn` (plpgsql trigger function). +- Procedure: `sp_return_book` (plpgsql). +- Trigger: `trg_loan_audit` (AFTER INSERT OR UPDATE OF returned_on ON `loan`). + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member` (`member_id`, `is_blocked`) – check blocked status. +- `book` (`book_id`, `copies_free`) – verify and decrement free copies. +- `loan` (`loan_id`, `returned_on`) – update return status. +- `loan` (`loan_id`, `book_id`) – retrieve book id for return. +- `loan` (`due_on`, `returned_on`) – late fee calculation. + +#### Writes +- `book` – decrement `copies_free` on checkout; increment on return. +- `loan` – insert new loan record; update `returned_on` on return. +- `loan_audit` – insert audit rows on checkout and return. + +#### Relationships +- `loan_audit.loan_id -> loan.loan_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Abort if member blocked. + - Decrement `book.copies_free`; error if none. + - Insert into `loan` with `due_on = CURRENT_DATE + p_days`; return new `loan_id`. +- **sp_return_book(p_loan_id)** + - Update `loan.returned_on` to `CURRENT_DATE`; capture `book_id`. + - If no row updated, raise exception. + - Increment `book.copies_free`. +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Multiply by 50, cap at 2000. +- **trg_loan_audit_fn()** + - On INSERT: log `CHECKOUT`. + - On UPDATE where `returned_on` changes from NULL to non‑NULL: log `RETURN`. +- **trg_loan_audit** + - Fires after INSERT or UPDATE OF `returned_on` on `loan`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Functions: `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `trg_loan_audit_fn`. +- Trigger: `trg_loan_audit`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..53637b58 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,71 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:48:44Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds library branches, creates a book_copy table linking books to branches, and updates member and loan tables to reference branches and copies. + +#### Purpose +- Introduce branch dimension for library locations. +- Replace per-book copy counters with explicit book_copy records. +- Link loans to specific copies and members to home branches. + +#### Type +- Table: `branch` +- Table: `book_copy` +- Table alterations: `loan`, `member`, `book` +- Index: `idx_book_copy_book` + +#### Schema +- **branch** + - `branch_id SMALLSERIAL PRIMARY KEY` + - `name VARCHAR(100) NOT NULL UNIQUE` + - `city VARCHAR(100) NOT NULL` +- **book_copy** + - `copy_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `branch_id SMALLINT NOT NULL REFERENCES branch (branch_id)` + - `barcode VARCHAR(32) NOT NULL UNIQUE` + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE', 'ON_LOAN', 'LOST'))` +- **loan** + - `copy_id BIGINT REFERENCES book_copy (copy_id)` (new column) +- **member** + - `joined_on` renamed to `member_since` + - `home_branch_id SMALLINT REFERENCES branch (branch_id)` (new column, default 1) +- **book** + - `copies_free` and `copies_total` columns dropped + - Constraint `book_free_le_total` dropped +- **Index** + - `idx_book_copy_book` on `book_copy (book_id)` + +#### Reads +- `book` table: `book_id`, `isbn`, `copies_free`, `copies_total` +- `member` table: `home_branch_id` (before update) + +#### Writes +- `branch`: 1 row inserted (`Main`, `Springfield`) +- `book_copy`: 1 × `b.copies_total` rows inserted per book (family: one INSERT, total rows = sum of `copies_total` across all books) +- `loan`: new column `copy_id` added (no data written) +- `member`: column `home_branch_id` added; 1 row updated per member where null (family: one UPDATE, total rows = count of members with null `home_branch_id`) +- `book`: columns and constraint dropped (no data written) + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- `book` table (existing) +- `loan` table (existing) +- `member` table (existing) +- `book_copy` table (new) +- `branch` table (new) + +#### Routine logic +- None (DDL only). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..610a7bea --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,62 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:48:48Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Seed initial data for a lending library: authors, books, members, and loan records. + +#### Purpose +- Populate the `author`, `book`, `member`, and `loan` tables with sample data for development and benchmarking. + +#### Type +- PostgreSQL data‑insertion script (DDL/DML). No tables, views, or functions are created. + +#### Schema +- **author** + - `author_id` integer PK + - `full_name` text NOT NULL + - `birth_year` integer + - `country_code` char(2) NOT NULL +- **book** + - `book_id` integer PK + - `isbn` text NOT NULL + - `title` text NOT NULL + - `author_id` integer NOT NULL FK → `author.author_id` + - `published_year` integer + - `copies_total` integer NOT NULL + - `copies_free` integer NOT NULL +- **member** + - `member_id` integer PK + - `email` text NOT NULL + - `full_name` text NOT NULL + - `joined_on` date NOT NULL + - `is_blocked` boolean NOT NULL +- **loan** + - `loan_id` integer PK + - `book_id` integer NOT NULL FK → `book.book_id` + - `member_id` integer NOT NULL FK → `member.member_id` + - `loaned_on` date NOT NULL + - `due_on` date NOT NULL + - `returned_on` date + +#### Reads +- None. + +#### Writes +- `author`: 15 rows +- `book`: 150 rows +- `member`: 50 rows +- `loan`: 150 rows + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- None beyond the referenced tables. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..389195af --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,65 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:49:56Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL library management system that stores catalog, member, and loan data, enforces borrowing rules, tracks copy availability, and provides reporting views and audit trails. + +#### Purpose +- Persist library catalog, member, and loan information. +- Enforce borrowing constraints and track copy status. +- Offer read‑only reporting and audit of loan actions. + +#### Responsibilities +- **Data Modeling** – tables for authors, books, members, loans, branches, and book copies. +- **Business Logic** – checkout, return, late fee calculation, and copy availability updates. +- **Reporting** – overdue loans, member loan statistics, and popular books views. +- **Audit Trail** – trigger‑based logging of checkout and return events. +- **Schema Evolution** – migration adding branches and explicit book copies. + +#### Key units +- **Tables**: `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`. +- **Views**: `overdue_loans`, `member_loan_stats`, `popular_books`. +- **Functions**: `fn_checkout_book`, `fn_late_fee`. +- **Procedure**: `sp_return_book`. +- **Trigger**: `trg_loan_audit` with function `trg_loan_audit_fn`. + +#### Data flow +1. **Checkout** (`fn_checkout_book`) + - Validate member not blocked. + - Decrement `book_copy.status` to `ON_LOAN`. + - Insert `loan` record with `due_on`. + - Log `CHECKOUT` in `loan_audit`. + +2. **Return** (`sp_return_book`) + - Update `loan.returned_on`. + - Increment `book_copy.status` to `AVAILABLE`. + - Log `RETURN` in `loan_audit`. + +3. **Late fee** (`fn_late_fee`) + - Compute days overdue from `due_on` and `returned_on`. + - Multiply by 50, cap at 2000. + +4. **Reporting** + - Views join `loan`, `member`, `book`, `author`, `book_copy` to produce overdue lists, member stats, and popularity counts. + +#### Dependencies +- **Internal**: `author`, `book`, `member`, `loan`, `book_copy`, `branch`, `loan_audit`. +- **External**: PostgreSQL built‑ins (`CURRENT_DATE`, `now()`, interval arithmetic). +- **DDL**: Migration adds `branch` and `book_copy`, removes per‑book copy counters. + +#### Cross-cutting +- **Foreign keys** enforce referential integrity across all tables. +- **Indexes**: `idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_book_copy_book`, `idx_popular_books_id`. +- **Constraints**: `book_free_le_total`, status checks on `book_copy`, `loan_due_after_loan`. +- **Audit**: `loan_audit` records every checkout/return with timestamp. +- **Seed data** populates initial authors, books, members, and loans for development. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..fcef2878 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,51 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:50:10Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A collection of relational schemas and stored procedures that manage library cataloging, e‑commerce orders, and warehouse inventory, each with business‑rule enforcement, audit logging, and reporting capabilities. + +#### Purpose +- Persist and enforce business rules for library loans, shop orders, and warehouse stock. +- Provide audit trails and reporting views for each domain. + +#### Responsibilities +- **Library** – catalog, member, loan lifecycle, late fee calculation, audit, and reporting. +- **Shop** – product catalog, order processing, stock reservation, and total calculation. +- **Warehouse** – nightly supplier feed ingestion, inventory merge, and sync audit logging. + +#### Key units +- **Library** + - Tables: `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`. + - Views: `overdue_loans`, `member_loan_stats`, `popular_books`. + - Functions: `fn_checkout_book`, `fn_late_fee`. + - Procedure: `sp_return_book`. + - Trigger: `trg_loan_audit` → `trg_loan_audit_fn`. +- **Shop** + - Tables: `product`, `customer_order`, `order_item`. + - Procedure: `add_order_item`. +- **Warehouse** + - Tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. + - Procedure: `dbo.usp_SyncStock`. + +#### Data flow +- **Library**: checkout → `fn_checkout_book` → loan record + audit; return → `sp_return_book` → loan update + audit; late fee → `fn_late_fee`; reporting via views. +- **Shop**: `add_order_item` receives order ID, SKU, qty → locks product, validates stock, updates/creates order item, decrements stock, recalculates order total. +- **Warehouse**: `usp_SyncStock(@Since)` aggregates new feed rows → MERGE into `StockLevel` (insert/update) → counts logged in `SyncLog`. + +#### Dependencies +- **Internal**: cross‑table foreign keys (e.g., `order_item` → `customer_order`, `book_copy` → `book`), indexes (`idx_book_author`, `idx_order_customer`), and audit tables. +- **External**: PostgreSQL built‑ins for library, MySQL row locking for shop, SQL Server system functions (`SYSUTCDATETIME`, `ERROR_MESSAGE`) for warehouse. + +#### Cross-cutting +- Referential integrity enforced via foreign keys and cascade deletes. +- Concurrency control: row locking (`FOR UPDATE`) in shop, single‑transaction merge in warehouse. +- Audit logging: `loan_audit` and `SyncLog` capture every state change. +- Indexing and constraints maintain performance and data validity across all schemas. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..5860ae55 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,68 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:48:52Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> A MySQL schema for a web shop that stores products, customer orders, and order items, with a stored procedure to add items to an order while reserving stock and updating totals. + +#### Purpose +- Define tables for products, orders, and order items. +- Provide a procedure to add an order line, reserve stock, and recalculate the order total. + +#### Type +- **Tables**: `product`, `customer_order`, `order_item`. +- **Procedure**: `add_order_item`. +- Dialect: MySQL 8. + +#### Schema + +**product** +- `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT` – PK +- `sku VARCHAR(40) NOT NULL` – UNIQUE `uk_product_sku` +- `name VARCHAR(200) NOT NULL` +- `price_cents INT UNSIGNED NOT NULL` +- `stock INT NOT NULL DEFAULT 0` + +**customer_order** +- `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT` – PK +- `customer_id BIGINT UNSIGNED NOT NULL` +- `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW'` +- `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` +- `total_cents INT UNSIGNED NOT NULL DEFAULT 0` +- INDEX `idx_order_customer` (`customer_id`, `created_at`) + +**order_item** +- `order_id BIGINT UNSIGNED NOT NULL` – PK part, FK `fk_item_order` → `customer_order(order_id)` ON DELETE CASCADE +- `product_id INT UNSIGNED NOT NULL` – PK part, FK `fk_item_product` → `product(product_id)` +- `quantity SMALLINT UNSIGNED NOT NULL` +- `unit_price_cents INT UNSIGNED NOT NULL` + +#### Reads +- `product` (SELECT `product_id`, `price_cents` WHERE `sku` = `p_sku` AND `stock` ≥ `p_qty` FOR UPDATE) +- `order_item` (SELECT SUM(`quantity` * `unit_price_cents`) WHERE `order_id` = `p_order_id`) + +#### Writes +- `order_item`: INSERT one row (or UPDATE existing) – 1 row affected. +- `product`: UPDATE `stock` – 1 row affected. +- `customer_order`: UPDATE `total_cents` – 1 row affected. + +#### Relationships +- `order_item.order_id` → `customer_order.order_id` (FK `fk_item_order`, ON DELETE CASCADE) +- `order_item.product_id` → `product.product_id` (FK `fk_item_product`) + +#### Routine logic +- Parameters: `p_order_id BIGINT UNSIGNED`, `p_sku VARCHAR(40)`, `p_qty SMALLINT UNSIGNED`. +- Lookup product by SKU with stock check; lock row (`FOR UPDATE`). +- If not found or insufficient stock, raise error. +- Insert or update `order_item` (duplicate key adds quantity). +- Decrement `product.stock` by `p_qty`. +- Recalculate `customer_order.total_cents` from all items of the order. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item`. +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..d132bd2e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,43 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:50:02Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> A MySQL schema for a web shop that stores products, customer orders, and order items, with a stored procedure to add items to an order while reserving stock and updating totals. + +#### Purpose +- Define core tables for products, orders, and order items. +- Provide a stored procedure to add an order line, reserve stock, and recalculate the order total. + +#### Responsibilities +- **Data modeling** – tables `product`, `customer_order`, `order_item`. +- **Business logic** – procedure `add_order_item` that enforces stock reservation and order total consistency. + +#### Key units +- **`product`** – holds SKU, name, price, and stock. +- **`customer_order`** – tracks order status, timestamps, and total amount. +- **`order_item`** – links orders to products with quantity and unit price. +- **`add_order_item`** – stored procedure that validates stock, updates or inserts an order item, decrements product stock, and updates the order total. + +#### Data flow +1. Caller supplies `p_order_id`, `p_sku`, `p_qty`. +2. Procedure looks up `product` by SKU, locking the row (`FOR UPDATE`). +3. If stock insufficient, error is raised. +4. Order item is inserted or its quantity updated. +5. `product.stock` is decremented by `p_qty`. +6. `customer_order.total_cents` is recalculated from all items of the order. + +#### Dependencies +- Internal: tables `product`, `customer_order`, `order_item`. +- No external functions or sequences. + +#### Cross-cutting +- **Referential integrity** – foreign keys with cascade delete from `order_item` to `customer_order`. +- **Concurrency control** – row locking (`FOR UPDATE`) to prevent race conditions on stock. +- **Error handling** – procedure raises an error when product not found or stock is insufficient. +- **Indexing** – `idx_order_customer` on `customer_order` for efficient customer‑order queries. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..a7f113d3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,45 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:50:05Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Keeps the warehouse inventory in sync with nightly supplier feeds and records each sync run. + +#### Purpose +- Merge supplier feed data into current stock levels. +- Log each sync run with counts of inserted and updated rows or errors. + +#### Responsibilities +- **Data ingestion** – read new supplier feed rows since a given timestamp. +- **Inventory update** – merge aggregated feed quantities into the `StockLevel` table. +- **Audit logging** – record the outcome of each sync run in `SyncLog`. + +#### Key units +- **`dbo.StockLevel`** – warehouse inventory table (PK: `WarehouseId, Sku`). +- **`dbo.SupplierFeed`** – staging table for nightly supplier rows (PK: `FeedRowId`). +- **`dbo.SyncLog`** – audit table for sync runs (PK: `SyncLogId`). +- **`dbo.usp_SyncStock`** – T‑SQL procedure that orchestrates the merge and logging. + +#### Data flow +1. `usp_SyncStock(@Since)` starts a transaction. +2. Aggregates `SupplierFeed` rows received after `@Since` by `WarehouseId, Sku`. +3. `MERGE` into `StockLevel`: + - `WHEN MATCHED`: add `Quantity` to `OnHand`, update `UpdatedAt`. + - `WHEN NOT MATCHED BY TARGET`: insert new record with `OnHand = Quantity`. +4. Counts of `INSERT` and `UPDATE` actions are captured. +5. A row is inserted into `SyncLog` with those counts or an error message. +6. Transaction is committed; on error, rollback and log the error. + +#### Dependencies +- Internal tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. + +#### Cross-cutting +- Uses a single transaction to ensure atomicity of the merge and log insert. +- Error handling captures and logs exceptions via `SyncLog`. +- No foreign key constraints; relationships are implicit through merge logic. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..bbd51138 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-java/run3/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,78 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:48:56Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Synchronises nightly stock levels from a supplier feed into the warehouse inventory and records the operation outcome. + +#### Purpose +- Merge supplier feed data into current stock levels. +- Log each sync run with counts of inserted and updated rows or errors. + +#### Type +- Table: `dbo.StockLevel` +- Table: `dbo.SupplierFeed` +- Table: `dbo.SyncLog` +- Procedure: `dbo.usp_SyncStock` (T‑SQL) + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT (0)` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())` + - PK: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + - PK: `PK_SupplierFeed (FeedRowId)` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + - PK: `PK_SyncLog (SyncLogId)` + +#### Reads +- `dbo.SupplierFeed` (WarehouseId, Sku, Quantity, ReceivedAt) +- `dbo.StockLevel` (WarehouseId, Sku, OnHand) + +#### Writes +- `dbo.StockLevel` + - `INSERT`: rows where no existing record (count per merge action). + - `UPDATE`: rows where existing record updated (count per merge action). +- `dbo.SyncLog` + - `INSERT`: one row per sync run, with counts of inserts/updates or error message. + +#### Relationships +- None defined via foreign keys. + +#### Routine logic +- Parameters: `@Since DATETIME2(0)` +- Steps: + 1. Start transaction. + 2. Aggregate `SupplierFeed` rows received since `@Since` by `WarehouseId, Sku`. + 3. `MERGE` into `StockLevel`: + - `WHEN MATCHED`: add `Quantity` to `OnHand`, update `UpdatedAt`. + - `WHEN NOT MATCHED BY TARGET`: insert new record with `OnHand = Quantity`. + - Capture `$action` into table variable `@Changes`. + 4. Insert a log row into `SyncLog` with counts of `INSERT` and `UPDATE` actions. + 5. Commit transaction. + 6. On error: rollback, insert log row with `ErrorMessage`, rethrow. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/meta/gpt-6-luna.json new file mode 100644 index 00000000..c6d9c351 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/meta/gpt-6-luna.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:19:50Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 181.7, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 84.5, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.4, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:24:20Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 86143, + "cachedPromptTokens": 48265, + "completionTokens": 18956, + "seconds": 181.1051141 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.013748, + "costUsd": 0.021587, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/meta/gpt-oss-20b.json new file mode 100644 index 00000000..3fe09919 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:24:20Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 157.1, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 52.5, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.6, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:27:52Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 87648, + "cachedPromptTokens": 4256, + "completionTokens": 17433, + "seconds": 156.3667924 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.004896, + "costUsd": 0.003608, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..e498a967 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,57 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:19:50Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> File conditions determine which source files qualify by extension, size, line count, modification time, and relative-path glob. + +#### Purpose +- Evaluates `AiCondition` trees against file metadata in `AiFileContext`. +- Validates condition structure and reports whether a tree requires line counts. + +#### Type +- `public final class AiConditionEvaluator` — class; no supertypes; no annotations. + +#### Input +- `AiConditionEvaluator()` — no parameters. +- `matches(AiCondition condition, AiFileContext context)` — condition tree and file facts, including name, size, line count, modification time, and relative path. +- `validate(AiCondition condition)` and `usesLines(AiCondition condition)` — condition tree. + +#### Output +- `matches(...)` returns whether the file satisfies the condition. +- `validate(...)` returns `void`; rejects invalid condition trees. +- `usesLines(...)` returns whether any tree node tests line count. +- No persistent state or resource writes. + +#### Core logic +- `matches` evaluates the first configured branch: `and` requires all children; `or` requires any child; `not` negates its child. +- Leaf checks match filename suffixes in `extensions`, byte size and line count through `AiRangeCondition.contains`, strict modification-time comparisons against parsed ISO-8601 instants, or `pathGlob`. +- `pathGlob` delegates to `AiSourceExcludeFilter` with a singleton glob and calls `isExcluded(relativePath)`. +- `validate` requires exactly one of nine branch/leaf fields; recursively validates combinator children. +- `and`/`or` groups must have at least one child. Extension lists must be non-empty; size and line ranges must have a bound; path globs must not be blank. +- `usesLines` recursively checks `and`, `or`, and `not` trees for a line-count condition. + +#### Public API +- `AiConditionEvaluator()` -> `AiConditionEvaluator` — create evaluator. +- `matches(AiCondition, AiFileContext)` -> `boolean` — test file against condition. +- `validate(AiCondition)` -> `void` — validate condition tree. +- `usesLines(AiCondition)` -> `boolean` — detect line-count conditions. + +#### Dependencies +- `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext` +- `AiSourceExcludeFilter` +- `Instant`, `DateTimeParseException`, `Collections`, `List`, `Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for invalid branch count, empty groups/extensions, unbounded ranges, blank globs, or invalid ISO-8601 instants. +- Invalid instants wrap `DateTimeParseException` in `IllegalArgumentException`. +- `matches` throws `IllegalStateException` when no branch is set; assumes prior validation. +- Nullable group child lists are treated as empty by matching and `usesLines`; null extension entries are skipped. + +#### Concurrency +- Stateless evaluator; no synchronization or mutable instance fields. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..d5a9a9ce --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,44 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:19:57Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Groups child AI conditions so Maven configuration can bind `` and `` combinator bodies as `…`. + +#### Purpose +- `AiConditionGroup` holds the child `AiCondition` values for an `and`/`or` combinator. +- Uses a `conditions` field so Maven derives the child element name as `condition`. + +#### Type +- `public class AiConditionGroup` — class; annotated `@ToString`; no declared supertypes. + +#### Input +- `setConditions(Collection conditions)` accepts a nullable collection of child conditions. + +#### Output +- `getConditions()` returns the nullable child-condition list. +- `setConditions(...)` stores a defensive `ArrayList` copy, or `null`. + +#### Core logic +- Stores child conditions in nullable `List conditions`. +- Setter copies the supplied collection to avoid retaining the caller’s collection; `null` clears the field. +- No-argument constructor performs no initialization. + +#### Public API +- `AiConditionGroup()` — creates an empty group. +- `getConditions() -> @Nullable List` — returns child conditions. +- `setConditions(@Nullable Collection) -> void` — copies or clears child conditions. + +#### Dependencies +- `AiCondition` +- `ArrayList`, `Collection`, `List` +- Lombok `ToString` +- JSpecify `Nullable` + +#### Exceptions / Errors +- No explicit exception handling or precondition checks. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..8734d45c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,58 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:20:02Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Produces exact whole-source counts for configured regex-based facts and formats them for inclusion in AI summaries. + +#### Purpose +- `AiFactExtractor` counts configured facts such as rows, tables, fields, or functions across complete source text. +- Formats counts as a facts block, or validates counter configuration before use. + +#### Type +- `public final class AiFactExtractor` — class; utility class with a private constructor. + +#### Input +- `factsBlock(@Nullable List counters, String source)` consumes counters and the full source text. +- `validate(@Nullable List counters)` consumes configured counters. + +#### Output +- `factsBlock` returns a formatted `String` ending in a blank line, or `""` when counters are absent or no valid entries remain. +- `validate` produces no value; throws `IllegalArgumentException` for missing labels or patterns and invalid regexes. +- Public constants define the facts header and formatting separators. + +#### Core logic +- `factsBlock` returns `""` for null or empty lists; skips null counters and counters with null labels or patterns. +- For each remaining counter, compiles its regex, counts non-overlapping matches across the source, and appends `label: count`. +- Joins entries with `; ` and wraps them with the exact-facts header and trailing blank line. +- `validate` permits a null list and skips null entries; rejects counters with null labels or patterns, and wraps `PatternSyntaxException` in `IllegalArgumentException`. +- `countMatches` repeatedly calls `Matcher.find()` and increments once per match. + +#### Public API +- `FACTS_HEADER: String` — facts-line header. +- `LABEL_COUNT_SEPARATOR: String` — label and count separator. +- `ENTRY_SEPARATOR: String` — separator between entries. +- `FACTS_SUFFIX: String` — trailing blank line. +- `factsBlock(@Nullable List, String) -> String` — format whole-source fact counts. +- `validate(@Nullable List) -> void` — check counter configuration. + +#### Dependencies +- `AiFactCounter` +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for a missing label, missing pattern, or invalid regex; invalid-regex errors retain the `PatternSyntaxException` cause. +- `factsBlock` skips null counters and null labels or patterns. +- `source` is not declared nullable; no explicit null handling is present. + +#### Concurrency +- Pure computation with no I/O or mutable shared state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..c8f2c18e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,103 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:20:08Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Carries model, sampling, prompt-trimming, provider, and runtime settings for an AI generation step between Maven configuration and AI providers. + +#### Purpose +- `AiGenerationConfig` stores mutable per-model generation settings, initialized from defaults and populated through JavaBean setters. +- Covers prompt limits, sampling and repetition controls, llama.cpp runtime options, remote-provider routing, stop strings, and optional machine calibration. + +#### Type +- `public class AiGenerationConfig` — class; no explicit superclass or interfaces; `@ToString`, `@SuppressWarnings`. +- No `equals` or `hashCode` generation; instances are mutable and identity-managed. + +#### Input +- No-argument constructor; no constructor parameters. +- Setters accept model path, context/output limits, sampling parameters, threading, prompt caching, GPU/device and KV-cache settings, provider and remote API configuration, reasoning and DRY controls, stop strings, calibration, and other generation options. +- `modelPath`, `chatTemplateEnableThinking`, and `calibration` are nullable. +- `setLazyMode`, `setCacheTypeK`, `setCacheTypeV`, `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, and `setApiKeyEnv` normalize null to their defaults; list setters normalize null to empty lists. + +#### Output +- Stores configured values in mutable instance fields; getters expose configuration values. +- List getters return unmodifiable views of the stored DRY sequence breakers and stop strings. +- `toString()` is generated by Lombok over instance fields. +- No I/O or generation is performed by this configuration object. + +#### Core logic +- Initializes configuration fields from constants, including a context size of 32768, output limit of 128, temperature `0.15f`, and thread count capped at four or available processors. +- Provides JavaBean accessors for inference limits, sampling, prompt trimming, provider routing, model runtime, and retry-independent generation options. +- Preserves sentinel values such as `-1` for “leave upstream default” and `null` for an unset chat-template thinking mode. +- `charsPerToken` defaults to 4; its documentation specifies zero disables automatic input-limit calculation in favor of `maxInputChars`. +- List setters retain the supplied list reference (or create an empty list for null); list getters wrap the current list as unmodifiable. + +#### Public API +- `AiGenerationConfig()` — initializes defaults. +- `getModelPath()` / `setModelPath(String)` -> GGUF model path. +- `getContextSize()` / `setContextSize(int)` -> context token limit. +- `getMaxOutputTokens()` / `setMaxOutputTokens(int)` -> output token limit. +- `getTemperature()` / `setTemperature(float)` -> sampling temperature. +- `getThreads()` / `setThreads(int)` -> inference thread count. +- `getCharsPerToken()` / `setCharsPerToken(int)` -> input sizing ratio. +- `getMaxInputChars()` / `setMaxInputChars(int)` -> prompt source character limit. +- `isWarnOnTrim()` / `setWarnOnTrim(boolean)` -> trim warning toggle. +- `getTopP()` / `setTopP(float)` -> nucleus threshold. +- `getTopK()` / `setTopK(int)` -> top-k limit. +- `getRepeatPenalty()` / `setRepeatPenalty(float)` -> repetition penalty. +- `getMinP()` / `setMinP(float)` -> min-p threshold. +- `getTopNSigma()` / `setTopNSigma(float)` -> top-n-sigma threshold. +- `getChatTemplateEnableThinking()` / `setChatTemplateEnableThinking(Boolean)` -> nullable thinking mode. +- `isCachePrompt()` / `setCachePrompt(boolean)` -> prompt-prefix caching. +- `isSwaFull()` / `setSwaFull(boolean)` -> full-size SWA KV cache. +- `getCacheReuse()` / `setCacheReuse(int)` -> KV prefix-reuse chunk size. +- `getGpuLayers()` / `setGpuLayers(int)` -> GPU layer offload. +- `getCpuMoeLayers()` / `setCpuMoeLayers(int)` -> CPU MoE layers. +- `getSeed()` / `setSeed(int)` -> generation RNG seed. +- `getCpuFfnLayers()` / `setCpuFfnLayers(int)` -> CPU FFN layers. +- `getKvUnifiedPerSlot()` / `setKvUnifiedPerSlot(int)` -> per-slot KV context cap. +- `getLazyMode()` / `setLazyMode(String)` -> tensor-read laziness. +- `getRepeatLastN()` / `setRepeatLastN(int)` -> repetition-penalty window. +- `getCacheTypeK()` / `setCacheTypeK(String)` -> K-cache data type. +- `getCacheTypeV()` / `setCacheTypeV(String)` -> V-cache data type. +- `isFlashAttn()` / `setFlashAttn(boolean)` -> Flash Attention toggle. +- `getBatchSize()` / `setBatchSize(int)` -> logical batch size. +- `getUbatchSize()` / `setUbatchSize(int)` -> physical batch size. +- `getThreadsBatch()` / `setThreadsBatch(int)` -> prompt-processing threads. +- `getMainGpu()` / `setMainGpu(int)` -> primary GPU index. +- `getDevices()` / `setDevices(String)` -> backend device selection. +- `getProvider()` / `setProvider(String)` -> per-model AI provider. +- `getRemoteModel()` / `setRemoteModel(String)` -> remote model identifier. +- `getBaseUrl()` / `setBaseUrl(String)` -> OpenAI-compatible API base URL. +- `getApiKeyEnv()` / `setApiKeyEnv(String)` -> API-key environment variable name. +- `getReasoningEffort()` / `setReasoningEffort(String)` -> reasoning-effort setting. +- `getReasoningBudgetTokens()` / `setReasoningBudgetTokens(int)` -> reasoning token budget. +- `getDryMultiplier()` / `setDryMultiplier(float)` -> DRY repetition multiplier. +- `getDryBase()` / `setDryBase(float)` -> DRY penalty growth base. +- `getDryAllowedLength()` / `setDryAllowedLength(int)` -> unpenalized n-gram length. +- `getDryPenaltyLastN()` / `setDryPenaltyLastN(int)` -> DRY look-back window. +- `getDrySequenceBreakers()` / `setDrySequenceBreakers(List)` -> DRY sequence breakers. +- `getStopStrings()` / `setStopStrings(List)` -> generation stop strings. +- `getCalibration()` / `setCalibration(AiCalibration)` -> optional machine calibration. +- Public constants: `DEFAULT_CONTEXT_SIZE`, `DEFAULT_MAX_OUTPUT_TOKENS`, `DEFAULT_TEMPERATURE`, `DEFAULT_THREADS`, `DEFAULT_MAX_INPUT_CHARS`, `DEFAULT_CHARS_PER_TOKEN`, `DEFAULT_SAFETY_MARGIN_CHARS`, `DEFAULT_WARN_ON_TRIM`, `DEFAULT_TOP_P`, `DEFAULT_TOP_K`, `DEFAULT_MIN_P`, `DEFAULT_TOP_N_SIGMA`, `DEFAULT_REPEAT_PENALTY`, `DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING`, `DEFAULT_CACHE_PROMPT`, `DEFAULT_REASONING_EFFORT`, `DEFAULT_REASONING_BUDGET_TOKENS`, `DEFAULT_SWA_FULL`, `DEFAULT_CACHE_REUSE`, `DEFAULT_GPU_LAYERS`, `DEFAULT_SEED`, `DEFAULT_CPU_MOE_LAYERS`, `DEFAULT_CPU_FFN_LAYERS`, `DEFAULT_KV_UNIFIED_PER_SLOT`, `DEFAULT_LAZY_MODE`, `DEFAULT_REPEAT_LAST_N`, `DEFAULT_CACHE_TYPE_K`, `DEFAULT_CACHE_TYPE_V`, `DEFAULT_FLASH_ATTN`, `DEFAULT_BATCH_SIZE`, `DEFAULT_UBATCH_SIZE`, `DEFAULT_THREADS_BATCH`, `DEFAULT_MAIN_GPU`, `DEFAULT_DEVICES`, `DEFAULT_PROVIDER`, `DEFAULT_REMOTE_MODEL`, `DEFAULT_BASE_URL`, `DEFAULT_API_KEY_ENV`, `DEFAULT_DRY_MULTIPLIER`, `DEFAULT_DRY_BASE`, `DEFAULT_DRY_ALLOWED_LENGTH`, `DEFAULT_DRY_PENALTY_LAST_N`. + +#### Dependencies +- `AiCalibration` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `Runtime.getRuntime().availableProcessors()` + +#### Exceptions / Errors +- No explicit exceptions or validation checks. +- Nullable model path, thinking mode, and calibration; several string setters replace null with defaults. +- List setters replace null with empty lists; getters prevent mutation through the returned view, but do not copy the underlying list. + +#### Concurrency +- Mutable, unsynchronized configuration; no thread-safety guarantees. +- List getters provide unmodifiable views, not immutable snapshots. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..9333c628 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,45 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:20:23Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Configures how source files exceeding an AI model’s context window are handled: abort, sample, map-reduce, or deterministic output. + +#### Purpose +- Defines oversize handling strategies for AI source-file routing rules. +- Parses the `` configuration token and supplies the default strategy. + +#### Type +- `AiOversizeStrategy` — enum; no supertypes declared; no type parameters. + +#### Input +- `fromConfig(@Nullable String value)` consumes a configured strategy token; accepts `null`, blank, and case-insensitive tokens. +- Enum constructor receives each strategy’s config token. + +#### Output +- `configValue()` returns the strategy’s config token. +- `fromConfig(...)` returns a matching strategy or `DEFAULT`. + +#### Core logic +- Defines `FAIL` (`fail`), `SAMPLE` (`sample`), `MAP_REDUCE` (`mapReduce`), and `DETERMINISTIC` (`deterministic`). +- Sets `DEFAULT` to `FAIL`. +- `fromConfig` returns `DEFAULT` for `null` or blank input; otherwise trims input and matches tokens case-insensitively. +- Throws `IllegalArgumentException` when a non-blank token matches no strategy. + +#### Public API +- `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` — oversize handling strategies. +- `DEFAULT: AiOversizeStrategy` — default strategy (`FAIL`). +- `configValue() -> String` — return configuration token. +- `fromConfig(String) -> AiOversizeStrategy` — parse configuration token. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `fromConfig` throws `IllegalArgumentException` for an unknown non-blank strategy token. +- `fromConfig` treats `null` and blank input as `DEFAULT`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..e41002a1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,75 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:20:27Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Centralizes source indexing and AI-generation settings, including file selection, prompt/model routing, llama.cpp fallbacks, and generated index metadata. + +#### Purpose +- Provides the mutable configuration shared by `srcmorph` execution and binding surfaces such as Maven, future JSON/YAML, and plain Java callers. +- Excludes Maven lifecycle skip flags; an engine built from this configuration executes when requested. + +#### Type +- `public class SrcMorphConfiguration` — class; annotated `@ToString`; mutable JavaBean with no declared superclass or interfaces. +- Public constants: `DEFAULT_OUTPUT_DIRECTORY` (`String`), `DEFAULT_GENERATION_PROVIDER` (`String`), `DEFAULT_LLAMA_CONTEXT_SIZE` (`int`), `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS` (`int`), `DEFAULT_LLAMA_TEMPERATURE` (`float`), `DEFAULT_LLAMA_THREADS` (`int`), `DEFAULT_AI_VERSION` (`String`). + +#### Input +- No-argument constructor; defaults output directory to `src/site/ai`, provider to `mock`, llama.cpp context size to `2048`, maximum output tokens to `128`, temperature to `0.15f`, thread count to `AiGenerationConfig.DEFAULT_THREADS`, and AI version to `0.0.0`. +- Setters accept base/output directories; force and plan-only flags; source subtrees, exclude globs, extensions, and file-size bounds; provider; prompt, model, field-generation, and fact definitions; model paths and llama.cpp parameters; plugin/AI versions; project name. +- Nullable configuration includes lists, model directory, llama model path, and project name; several other fields have no initializer and are expected to be populated by a binding or caller. + +#### Output +- Mutable configuration state consumed by source discovery, file filtering, AI routing/generation, and output metadata. +- Supplies output directory for `.ai.md` files, model path resolution base, and generator/project version and title metadata. +- Getters return configured values directly; list values are not copied. + +#### Core logic +- Stores 23 configuration properties as mutable fields, exposing JavaBean getters and setters for binding compatibility. +- Defines `minFileSizeBytes` as an exclusive lower bound (`<= 0` disables it) and `maxFileSizeBytes` as an inclusive upper bound (`<= 0` means unlimited). +- Uses `subtrees` to restrict source roots, `excludes` to skip base-relative glob paths, and `fileExtensions` to override engine-default extensions. +- Uses `fieldGenerations` as per-field routing rules; prompt definitions, AI model definitions, and reusable fact definitions supply referenced configuration. +- Provides llama.cpp fallback settings when field-generation rules are empty; model paths may resolve against `modelDirectory`, while absolute paths remain usable. +- Stores `force` for regenerating populated AI fields and `planOnly` for stopping after routing-plan output. + +#### Public API +- `SrcMorphConfiguration()` -> constructor; initializes defaults. +- `DEFAULT_OUTPUT_DIRECTORY: String`, `DEFAULT_GENERATION_PROVIDER: String`, `DEFAULT_LLAMA_CONTEXT_SIZE: int`, `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS: int`, `DEFAULT_LLAMA_TEMPERATURE: float`, `DEFAULT_LLAMA_THREADS: int`, `DEFAULT_AI_VERSION: String` -> public defaults. +- `getBaseDirectory()`/`setBaseDirectory(File)` -> project base directory. +- `getOutputDirectory()`/`setOutputDirectory(File)` -> generated file directory. +- `isForce()`/`setForce(boolean)` -> regenerate populated fields. +- `getSubtrees()`/`setSubtrees(List)` -> source-root restrictions. +- `getExcludes()`/`setExcludes(List)` -> skipped source-file globs. +- `getFileExtensions()`/`setFileExtensions(List)` -> indexed extensions. +- `getMinFileSizeBytes()`/`setMinFileSizeBytes(long)` -> exclusive size lower bound. +- `getMaxFileSizeBytes()`/`setMaxFileSizeBytes(long)` -> inclusive size upper bound. +- `isPlanOnly()`/`setPlanOnly(boolean)` -> stop after routing plan. +- `getGenerationProvider()`/`setGenerationProvider(String)` -> default AI provider. +- `getPromptDefinitions()`/`setPromptDefinitions(List)` -> prompt templates. +- `getAiDefinitions()`/`setAiDefinitions(List)` -> model definitions. +- `getModelDirectory()`/`setModelDirectory(File)` -> relative model-path base. +- `getFieldGenerations()`/`setFieldGenerations(List)` -> per-field routing rules. +- `getFactDefinitions()`/`setFactDefinitions(List)` -> reusable fact groups. +- `getLlamaModelPath()`/`setLlamaModelPath(String)` -> fallback GGUF model path. +- `getLlamaContextSize()`/`setLlamaContextSize(int)` -> fallback context window. +- `getLlamaMaxOutputTokens()`/`setLlamaMaxOutputTokens(int)` -> fallback output-token limit. +- `getLlamaTemperature()`/`setLlamaTemperature(float)` -> fallback sampling temperature. +- `getLlamaThreads()`/`setLlamaThreads(int)` -> fallback inference thread count. +- `getPluginVersion()`/`setPluginVersion(String)` -> generated-header plugin version. +- `getAiVersion()`/`setAiVersion(String)` -> generated-header AI logic version. +- `getProjectName()`/`setProjectName(String)` -> aggregate index title. + +#### Dependencies +- `java.io.File`, `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `AiGenerationConfig`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No explicit exceptions, validation, or null checks. +- Nullable fields are annotated `@Nullable`; non-null-annotated reference fields are not validated by this class. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/package.ai.md new file mode 100644 index 00000000..5570d551 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/config/package.ai.md @@ -0,0 +1,52 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:22:52Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> Defines source-file eligibility, factual extraction, generation settings, and oversize handling for producing AI-indexed source summaries. + +#### Purpose +- Centralizes configuration and utility logic for selecting source files, routing AI generation, and formatting exact source facts. +- Supplies shared JavaBean settings for indexing and generation, including provider, model, prompt, and output metadata. + +#### Responsibilities +- **File-condition evaluation:** validates and evaluates `AiCondition` trees against file metadata, including extensions, size, line count, modification time, and relative-path globs. +- **Fact counting:** validates regex-based `AiFactCounter` definitions and formats whole-source match counts into a facts block. +- **Generation configuration:** stores per-model inference, prompt-sizing, provider-routing, runtime, sampling, stop-string, and calibration settings with defaults. +- **Index configuration:** `SrcMorphConfiguration` holds source roots, exclusions, extensions, size bounds, field-generation rules, prompt/model/fact definitions, llama.cpp fallbacks, and output metadata. +- **Oversize policy and binding:** `AiOversizeStrategy` parses oversize handling tokens; `AiConditionGroup` supports Maven binding of `and`/`or` condition children. + +#### Key units +- `AiConditionEvaluator` — validates condition trees and matches them against `AiFileContext`. +- `AiConditionGroup` — stores child `AiCondition` values for combinator configuration. +- `AiFactExtractor` — counts regex matches in complete source text and emits the formatted facts block. +- `AiGenerationConfig` — mutable per-model generation settings with defaults and JavaBean accessors. +- `AiOversizeStrategy` — defines `FAIL`, `SAMPLE`, `MAP_REDUCE`, and `DETERMINISTIC` policies and parses their config tokens. +- `SrcMorphConfiguration` — shared configuration for source discovery, AI routing, generation fallbacks, and generated index metadata. + +#### Data flow +- `AiConditionEvaluator` receives an `AiCondition` and `AiFileContext`, validates the condition structure, and returns whether the file qualifies. +- `AiFactExtractor` receives configured counters and full source text, then returns exact counts in a facts block. +- `SrcMorphConfiguration` supplies source-selection and routing settings, prompts, model definitions, generation rules, and output metadata to indexing and generation consumers. +- `AiGenerationConfig` carries model-specific settings toward AI providers; `AiOversizeStrategy` supplies the configured policy for files exceeding context limits. + +#### Dependencies +- Condition evaluation uses `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, and `AiSourceExcludeFilter`. +- Fact extraction uses `AiFactCounter` and Java regex utilities. +- Configuration references `AiCalibration`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, and `AiFactDefinition`. +- Java standard libraries provide collections, file and time handling, and regex support; Lombok `ToString` and JSpecify `Nullable` appear in configuration types. + +#### Cross-cutting +- `AiConditionEvaluator` and `AiFactExtractor` are stateless utilities; configuration objects are mutable JavaBeans without thread-safety guarantees. +- Nullable collections and references are common; `AiConditionGroup` copies assigned child collections, while configuration list getters generally expose stored values or unmodifiable views. +- Validation is explicit in condition and fact utilities; invalid condition structure, regexes, or unknown nonblank oversize tokens produce `IllegalArgumentException`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..544b617e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,50 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:23:09Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Selects source files and prepares their facts and settings for AI indexing, then generates summaries through mock, local llama.cpp, or OpenAI-compatible backends. + +#### Purpose +- Coordinates configuration for source eligibility, fact extraction, model generation, and oversize handling. +- Provides shared provider selection and generation support for source-document requests. + +#### Responsibilities +- **Indexing configuration:** `SrcMorphConfiguration` and related settings define source selection, exclusions, prompts, models, generation rules, fallbacks, and output metadata. +- **Eligibility and facts:** `AiConditionEvaluator` checks file metadata against configured conditions; `AiFactExtractor` counts regex matches in complete source text. +- **Provider selection and generation:** `AiGenerationProviderFactory` resolves provider settings; `AiGenerationProvider` defines the common generation and lifecycle contract. +- **Generation backends and support:** Local llama.cpp inference and OpenAI-compatible request support handle backend-specific configuration, inference or HTTP requests, and timing data. +- **Oversize and completion handling:** `AiOversizeStrategy` defines policies for files exceeding context limits; `AiCompletionParser` strips a leading thinking block or rejects an unterminated one. + +#### Key units +- `SrcMorphConfiguration` — shared source-indexing, routing, generation, and output settings. +- `AiConditionEvaluator` / `AiConditionGroup` — validate and evaluate file-condition trees and store combinator children. +- `AiFactExtractor` — formats exact regex-match counts from source text. +- `AiGenerationConfig` — mutable per-model generation settings; `AiOversizeStrategy` — supported policies and config-token parsing. +- `AiGenerationProviderFactory` / `AiGenerationProvider` — select a backend and expose generation, timing, and close operations. +- `LlamaCppJniAiGenerationProvider` / `LlamaCppJniConfig` — run local inference and configure model/runtime settings. +- `OpenAiCompatibleProviderSupport` — builds chat-completion requests and handles endpoint, credentials, HTTP results, and timing. +- `AiCompletionParser` — cleans completion text by removing a leading Gemma-4 thinking block. + +#### Data flow +- `SrcMorphConfiguration` supplies discovery, condition, prompt, model, routing, and output settings to indexing and generation consumers. +- `AiConditionEvaluator` matches an `AiCondition` against `AiFileContext`; `AiFactExtractor` processes configured counters against full source text. +- `AiGenerationProviderFactory` resolves the effective provider key and creates a backend; providers receive `AiGenerationRequest` and return completion text, optionally with timing metrics. +- Local generation uses `AiPromptSupport` and llama.cpp inference; OpenAI-compatible support builds chat-completion JSON and handles the HTTP response. Completion parsing cleans returned text before use. + +#### Dependencies +- Shared project types include `AiCondition`, `AiFileContext`, `AiFactCounter`, `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, and `AiGenerationConfig`. +- Configuration references `AiModelDefinition`, `AiPromptDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, and `AiCalibration`. +- Local inference uses llama.cpp JNI types; remote request support uses Jackson; fact extraction uses Java regex utilities. + +#### Cross-cutting +- Configuration objects are generally mutable JavaBeans; `LlamaCppJniConfig` is immutable and built with a fluent builder. +- Condition and fact utilities validate inputs; invalid structures, regexes, or unknown nonblank oversize tokens produce `IllegalArgumentException`. +- Local model loading is lazy and cached but unsynchronized; concurrent initialization may race, and inference and close are not synchronized. +- Providers without timing support report zero metrics; OpenAI-compatible support withholds API keys from non-loopback HTTP endpoints. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..49a30cb1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,47 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:20:40Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Removes leading Gemma-4 chain-of-thought text from model completions before the answer is stored, while preserving markers that appear in the answer itself. + +#### Purpose +- `AiCompletionParser` cleans raw model completion text for storage by stripping a leading thinking block. +- Rejects a started thinking block if its closing marker is missing. + +#### Type +- `public class AiCompletionParser` — class; non-final; annotated `@ToString`; no supertypes declared. + +#### Input +- `AiCompletionParser()` — no parameters. +- `parseCompletion(final String response)` — raw completion text; accepts `null`. +- Reads public static marker constants `THINKING_BLOCK_START_MARKER` and `THINKING_BLOCK_END_MARKER`. + +#### Output +- `parseCompletion` returns trimmed answer text, never `null`. +- Returns `""` for `null` input; does not mutate fields or write resources. + +#### Core logic +- Return `""` for a `null` response; otherwise trim it. +- If trimmed text does not start with `THINKING_BLOCK_START_MARKER`, return it unchanged apart from trimming. +- For a leading marker, find the first `THINKING_BLOCK_END_MARKER` after it and return the trimmed text following that marker. +- If the end marker is absent, throw `IOException` with token-budget guidance and the original response length. + +#### Public API +- `AiCompletionParser()` — creates parser. +- `THINKING_BLOCK_START_MARKER: String` — opening thinking token. +- `THINKING_BLOCK_END_MARKER: String` — closing thinking token. +- `parseCompletion(String) -> String` — strips a leading thinking block. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `parseCompletion` throws `IOException` if a leading thinking block has no closing marker. +- `null` input is handled as an empty response. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..90cd8c12 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,47 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:20:45Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Generates text from AI generation requests and optionally reports model timing for calibration. + +#### Purpose +- Defines the pluggable AI backend contract for producing text from `AiGenerationRequest`. +- Supports providers with optional generation timing and a no-op close operation. + +#### Type +- `public interface AiGenerationProvider` — interface; extends `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume a request containing a prompt key, source file, source text, and current header. + +#### Output +- `generate(...)` returns generated `String` text. +- `generateWithTimings(...)` returns `AiGenerationTimings`; its default implementation uses zero rates and timing values. +- Default `close()` performs no action. + +#### Core logic +- `generate(...)` is the provider implementation contract; implementations supply generated text. +- Default `generateWithTimings(...)` delegates to `generate(request)` and wraps the text with zero timing values. +- Providers exposing timing data can override `generateWithTimings(...)`. +- Default `close()` is empty. + +#### Public API +- `generate(AiGenerationRequest)` -> `String` — generate text. +- `generateWithTimings(AiGenerationRequest)` -> `AiGenerationTimings` — generate text with timing data. +- `close()` -> `void` — close provider resources. + +#### Dependencies +- `java.io.IOException` +- `java.lang.AutoCloseable` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `AiGenerationTimings` + +#### Exceptions / Errors +- `generate(...)`, `generateWithTimings(...)`, and `close()` declare `IOException`. +- Generated text is documented as non-null; it may be blank. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..f56b0aaf --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,53 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:20:49Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Selects the AI generation provider for a run, using model-level provider overrides and defaulting to deterministic mock generation. + +#### Purpose +- `AiGenerationProviderFactory` resolves a provider key and creates the corresponding `AiGenerationProvider`. + +#### Type +- `public class AiGenerationProviderFactory` — class; annotated `@ToString`. +- No supertypes or generics declared. + +#### Input +- `effectiveProvider(runProvider, modelProvider)` — nullable run and model provider keys. +- `create(providerName, llamaConfig, promptSupport)` — run provider key, `LlamaCppJniConfig`, and `AiPromptSupport`. +- Private `compatibilityHelper` — `Java8CompatibilityHelper` used to check blank provider names. + +#### Output +- `effectiveProvider` returns the model provider when nonblank; otherwise the run provider. +- `create` returns a new mock, llama.cpp JNI, or OpenAI-compatible provider instance. +- No fields are mutated. + +#### Core logic +- `effectiveProvider` trims and prefers a nonblank model provider; otherwise returns the run provider. +- `create` uses that effective key; `null` or blank selects `MockAiGenerationProvider`. +- Dispatches `mock` to `MockAiGenerationProvider`, `llamacpp-jni` to `LlamaCppJniAiGenerationProvider`, and `openai-compatible` to `OpenAiCompatibleAiGenerationProvider`. +- Passes `llamaConfig` and `promptSupport` to the llama.cpp JNI and OpenAI-compatible providers. + +#### Public API +- `AiGenerationProviderFactory()` — constructs the factory. +- `PROVIDER_MOCK: String` — mock provider key. +- `PROVIDER_LLAMACPP_JNI: String` — llama.cpp JNI provider key. +- `PROVIDER_OPENAI_COMPATIBLE: String` — OpenAI-compatible provider key. +- `effectiveProvider(String, String) -> @Nullable String` — resolves model/run provider key. +- `create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider` — creates selected provider. + +#### Dependencies +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `AiGenerationProvider`, `MockAiGenerationProvider`, `LlamaCppJniConfig`, `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider` + +#### Exceptions / Errors +- `create` throws `IllegalArgumentException` for an unsupported nonblank provider key. +- `providerName` may be `null` according to the method documentation; `effectiveProvider` parameters and return are nullable. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..7dff469d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,66 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:20:54Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Locally generates AI completions from GGUF models through llama.cpp, with configurable hardware, cache, and throughput reporting. + +#### Purpose +- Provides AI text generation using the `net.ladenthin:llama` JNI binding and rendered request prompts. +- Loads the native model only when generation first occurs; reports model timing and prompt-cache metrics. + +#### Type +- `public final class LlamaCppJniAiGenerationProvider` — class; implements `AiGenerationProvider`, `AutoCloseable`; annotated `@ToString`. +- No generics. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`; both required non-null. +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume generation requests. +- Configuration supplies model path, context and thread counts, reasoning format behavior, GPU/CPU placement, KV cache, batching, lazy mode, Flash Attention, cache types, and device selection. +- `AiPromptSupport` builds chat-template arguments and inference parameters. + +#### Output +- `generate(...)` returns parsed completion text. +- `generateWithTimings(...)` returns `AiGenerationTimings` containing text, prompt/prediction token counts, cache-hit tokens, and throughput; missing timing data yields zero metrics. +- Lazily creates and caches a `LlamaModel`; `close()` closes it if initialized. +- Lombok-generated `toString()` omits the native model handle and provider support helper. + +#### Core logic +- Constructor validates `config` and `promptSupport`, then creates `LlamaCppJniProviderSupport`. +- `model()` initializes the native model on first use: + - Builds chat-template kwargs and `ModelParameters` with model path, context size, threads, and automatic reasoning parsing. + - Applies configured SWA, cache reuse, GPU layers, CPU MoE/FFN layers, per-slot KV limit, lazy mode, Flash Attention, KV cache types, batch sizes, batch threads, main GPU, and explicit devices, subject to each option’s guard. + - Stores the resulting `LlamaModel` for subsequent requests. +- `chatResponse()` builds inference parameters, runs `chatComplete`, and parses the full response. +- `generate()` warns about truncated answers, logs prompt-cache reuse, then parses the first content. +- `generateWithTimings()` extracts completion text and timing metrics; returns zero rates and counts if timings are absent. +- `close()` closes the model only if it was initialized. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport)` → provider initialization. +- `generate(AiGenerationRequest) -> String` — generate completion text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` — generate text and timing metrics. +- `close() -> void` — release initialized model. + +#### Dependencies +- `AiGenerationProvider`, `AiGenerationRequest`, `AiGenerationTimings` +- `LlamaCppJniConfig`, `LlamaCppJniProviderSupport`, `AiPromptSupport` +- `LlamaModel`, `ModelParameters`, `FlashAttn`, `ReasoningFormat` +- `ChatResponseParser`, `ChatResponse`, `Timings`, `AiCompletionParser` +- `Java8CompatibilityHelper` +- `IOException`, `Map`, `Objects`, Lombok `@ToString`, JSpecify `@Nullable` + +#### Exceptions / Errors +- Constructor uses `Objects.requireNonNull` for `config` and `promptSupport`. +- `generate(...)` declares `IOException`; `generateWithTimings(...)` does not. +- Invalid model parameters or native inference failures may propagate from the llama binding; no local handling is shown. +- Missing response timings are handled by returning zero-valued metrics. + +#### Concurrency +- Lazy `model` initialization and cached model access are unsynchronized; concurrent first calls may race. +- No synchronization is shown around inference or close. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..2f5829f0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,100 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:21:02Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Configures llama.cpp JNI and OpenAI-compatible text generation, including model loading, sampling, hardware, caching, reasoning, and stop controls. + +#### Purpose +- `LlamaCppJniConfig` holds immutable model and generation settings; `Builder` applies defaults and assembles configurations. +- Exposes sampling, llama.cpp runtime, remote-provider, reasoning, DRY, and stop-string options. + +#### Type +- `public final class LlamaCppJniConfig` — annotated `@ConvertToRecord`, Lombok `@ToString`, `@EqualsAndHashCode`; no supertypes declared. Contains 41 private final fields. +- `public static final class Builder` — nested builder; no supertypes declared. Holds mutable configuration values while building. +- `chatTemplateEnableThinking` is `@Nullable Boolean`; other fields comprise `String`, primitive numeric/boolean types, and `List`. + +#### Input +- `builder(String modelPath)` requires a GGUF model path; builder constructor rejects null via `Objects.requireNonNull`. +- 40 optional builder settings cover generation, hardware/runtime, provider/API, reasoning, DRY, and stop controls. Defaults come from `AiGenerationConfig.DEFAULT_*`; list defaults are empty. +- Null string settings for lazy mode, cache types, devices, provider, remote model, base URL, API-key environment-variable name, and reasoning effort restore their respective defaults. Null DRY sequence-breaker and stop-string lists become empty lists. +- Null `chatTemplateEnableThinking` represents an unset option. + +#### Output +- `build()` produces an immutable `LlamaCppJniConfig`; its constructor copies builder values. +- Accessors expose all configuration values. List accessors return unmodifiable views. +- Lombok generates `equals`, `hashCode`, and `toString` over the fields. + +#### Core logic +- `builder(modelPath)` creates a builder with the required model path and defaults for every other option. +- Fluent setters replace selected values; selected nullable inputs restore defaults or empty lists. +- `build()` transfers builder state into the configuration without further normalization. +- `drySequenceBreakers()` and `stopStrings()` wrap their stored lists with `Collections.unmodifiableList`. +- Configuration is immutable; the builder is documented as not thread-safe. + +#### Public API +- `builder(String) -> Builder` — starts configuration with defaults. +- `modelPath() -> String` — GGUF model path. +- `contextSize() -> int` — context window. +- `maxOutputTokens() -> int` — output token limit. +- `temperature() -> float` — sampling temperature. +- `threads() -> int` — CPU thread count. +- `topP() -> float` — nucleus threshold. +- `topK() -> int` — top-k limit. +- `minP() -> float` — min-p threshold. +- `topNSigma() -> float` — top-n-sigma threshold. +- `repeatPenalty() -> float` — repetition penalty. +- `chatTemplateEnableThinking() -> @Nullable Boolean` — template thinking option. +- `cachePrompt() -> boolean` — prompt caching. +- `swaFull() -> boolean` — full SWA KV cache. +- `cacheReuse() -> int` — KV prefix-reuse chunk size. +- `gpuLayers() -> int` — GPU offload layers. +- `seed() -> int` — generation RNG seed. +- `cpuMoeLayers() -> int` — CPU MoE layers. +- `cpuFfnLayers() -> int` — CPU FFN layers. +- `kvUnifiedPerSlot() -> int` — per-slot KV context cap. +- `lazyMode() -> String` — tensor-read laziness. +- `repeatLastN() -> int` — repetition window. +- `cacheTypeK() -> String` — K-cache data type. +- `cacheTypeV() -> String` — V-cache data type. +- `flashAttn() -> boolean` — Flash Attention setting. +- `batchSize() -> int` — logical batch size. +- `ubatchSize() -> int` — physical batch size. +- `threadsBatch() -> int` — batch-processing threads. +- `mainGpu() -> int` — primary GPU index. +- `devices() -> String` — device selection. +- `provider() -> String` — provider selection. +- `remoteModel() -> String` — remote model identifier. +- `baseUrl() -> String` — OpenAI-compatible API base URL. +- `apiKeyEnv() -> String` — API-key environment-variable name. +- `reasoningEffort() -> String` — reasoning-effort option. +- `reasoningBudgetTokens() -> int` — reasoning token budget. +- `dryMultiplier() -> float` — DRY multiplier. +- `dryBase() -> float` — DRY base. +- `dryAllowedLength() -> int` — DRY allowed length. +- `dryPenaltyLastN() -> int` — DRY penalty window. +- `drySequenceBreakers() -> List` — DRY sequence breakers. +- `stopStrings() -> List` — generation stop strings. +- `Builder.contextSize(int) -> Builder`, `maxOutputTokens(int) -> Builder`, `temperature(float) -> Builder`, `threads(int) -> Builder`, `topP(float) -> Builder`, `topK(int) -> Builder`, `minP(float) -> Builder`, `topNSigma(float) -> Builder`, `repeatPenalty(float) -> Builder` — set generation options. +- `Builder.chatTemplateEnableThinking(@Nullable Boolean) -> Builder` — set template thinking. +- `Builder.cachePrompt(boolean) -> Builder`, `swaFull(boolean) -> Builder`, `cacheReuse(int) -> Builder`, `gpuLayers(int) -> Builder`, `seed(int) -> Builder`, `cpuMoeLayers(int) -> Builder`, `cpuFfnLayers(int) -> Builder`, `kvUnifiedPerSlot(int) -> Builder`, `lazyMode(String) -> Builder`, `repeatLastN(int) -> Builder`, `cacheTypeK(String) -> Builder`, `cacheTypeV(String) -> Builder`, `flashAttn(boolean) -> Builder`, `batchSize(int) -> Builder`, `ubatchSize(int) -> Builder`, `threadsBatch(int) -> Builder`, `mainGpu(int) -> Builder`, `devices(String) -> Builder` — set runtime options. +- `Builder.provider(String) -> Builder`, `remoteModel(String) -> Builder`, `baseUrl(String) -> Builder`, `apiKeyEnv(String) -> Builder`, `reasoningEffort(String) -> Builder`, `reasoningBudgetTokens(int) -> Builder` — set provider and reasoning options. +- `Builder.dryMultiplier(float) -> Builder`, `dryBase(float) -> Builder`, `dryAllowedLength(int) -> Builder`, `dryPenaltyLastN(int) -> Builder`, `drySequenceBreakers(List) -> Builder`, `stopStrings(List) -> Builder` — set DRY and stop options. +- `Builder.build() -> LlamaCppJniConfig` — creates immutable configuration. + +#### Dependencies +- `AiGenerationConfig` — defaults for configuration options. +- `ConvertToRecord`, Lombok `EqualsAndHashCode`, Lombok `ToString`, JSpecify `Nullable`. +- `Collections`, `List`, `Objects`. + +#### Exceptions / Errors +- `builder(null)` throws `NullPointerException` with message `modelPath`. +- No other validation or normalization is performed during construction. + +#### Concurrency +- `LlamaCppJniConfig` is immutable; builder is explicitly not thread-safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..050c4b59 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,56 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:21:16Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Builds OpenAI-compatible chat-completion requests, protects API keys from cleartext transmission to non-local servers, and converts responses into generation timings. + +#### Purpose +- `OpenAiCompatibleProviderSupport` prepares request JSON and endpoint details for OpenAI-compatible model calls. +- It resolves and safeguards API keys, evaluates HTTP results, formats error messages, and calculates generation timings. + +#### Type +- `final class OpenAiCompatibleProviderSupport` — final class; package-private; no declared supertypes; annotated `@ToString`. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, and `Function environment`. +- `requestBody(AiGenerationRequest request)` reads prompt key, source file, and source text, plus model and sampling settings from `config`. +- `endpoint()` reads `config.baseUrl()`. +- `apiKey()` reads `config.apiKeyEnv()` and queries the environment function. +- `apiKeyFor(String endpoint)` parses the endpoint host when a key is configured and the endpoint uses HTTP. +- `isLoopbackHost(String host)`, `isSuccess(int status)`, `errorMessage(String endpoint, int status, String body)`, and `timings(String text, ChatResponse response, double seconds)` consume their named arguments. + +#### Output +- `requestBody` returns serialized JSON with system/user messages and configured sampling options. +- `endpoint` returns the normalized base URL plus `/chat/completions`. +- `apiKey` and `apiKeyFor` return a trimmed key or `null`. +- `isLoopbackHost` and `isSuccess` return boolean checks; `errorMessage` returns an exception-message string. +- `timings` returns `AiGenerationTimings`; no fields are mutated. +- Uses a static Jackson `ObjectMapper`; no network calls or resource writes. + +#### Core logic +- `requestBody` includes `model` and `reasoning.effort` only when non-blank; always adds system and user messages, token limit, temperature, top-p, repetition penalty, and `stream: false`. +- Adds `top_k` and `min_p` only when positive, `seed` only when nonnegative, and `stop` only when the configured stop-string list is non-empty. +- `endpoint` trims `baseUrl`, accepts only `http://` or `https://`, removes trailing slashes, then appends `/chat/completions`. +- `apiKey` returns `null` if the environment-variable name is blank, the variable is unset, or its value is blank; otherwise returns the trimmed value. +- `apiKeyFor` permits a configured key over HTTPS or HTTP to `localhost`, an IPv4 `127.x.x.x` literal, or `[::1]`; rejects other HTTP hosts before sending the key. +- `isSuccess` accepts status codes 200–299. `errorMessage` appends the response body, truncated to 500 characters plus `...` when longer. +- `timings` uses response usage counts; decode rate is completion tokens divided by positive wall-clock seconds, otherwise zero. Prefill rate is always zero. + +#### Dependencies +- Jackson: `ObjectMapper`, `ArrayNode`, `ObjectNode`. +- Java: `IOException`, `URL`, `List`, `Objects`, `Function`, `Pattern`. +- Lombok: `ToString`. +- JSpecify: `Nullable`. +- Project types: `LlamaCppJniConfig`, `ChatResponse`, `Usage`, `AiGenerationRequest`, `AiPromptSupport`, `Java8CompatibilityHelper`, `AiGenerationTimings`. + +#### Exceptions / Errors +- Constructor uses `Objects.requireNonNull` for `config`, `promptSupport`, and `environment`. +- `requestBody` propagates `IOException` during serialization. +- `endpoint` throws `IllegalArgumentException` for non-HTTP(S) base URLs. +- `apiKeyFor` propagates `IOException` for an unparsable URL or a configured key destined for a non-loopback HTTP host. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/package.ai.md new file mode 100644 index 00000000..9abf5fd1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/java/provider/package.ai.md @@ -0,0 +1,54 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:23:01Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Provides configurable AI text generation for source-document requests through mock, local llama.cpp, or OpenAI-compatible backends, with completion cleanup and optional timing metrics. + +#### Purpose +- Selects and configures AI generation providers, then exposes a common contract for generating text and optionally reporting timing data. +- Supports local GGUF inference and OpenAI-compatible request preparation, including prompt rendering, response handling, and completion parsing. + +#### Responsibilities +- **Provider contract and selection:** `AiGenerationProvider` defines generation, timing, and close operations; `AiGenerationProviderFactory` resolves model-level overrides and selects mock, llama.cpp JNI, or OpenAI-compatible providers. +- **Local inference:** `LlamaCppJniAiGenerationProvider` lazily loads and caches a llama.cpp model, applies runtime settings, runs inference, and reports token/cache metrics. +- **Remote request support:** `OpenAiCompatibleProviderSupport` builds chat-completion JSON, resolves endpoints and API keys, checks HTTP results, and derives timing data. +- **Configuration:** `LlamaCppJniConfig` collects immutable model, sampling, hardware, cache, reasoning, provider, DRY, and stop-string settings through a builder. +- **Completion cleanup:** `AiCompletionParser` removes a leading Gemma-4 thinking block and rejects an unterminated block. + +#### Key units +- `AiGenerationProvider` — shared `generate`, `generateWithTimings`, and `close` contract, with default zero-valued timing metrics. +- `AiGenerationProviderFactory` — chooses a provider using the effective run/model provider key; defaults blank keys to mock generation. +- `LlamaCppJniAiGenerationProvider` — performs local inference with lazy model initialization, completion parsing, and timing/cache reporting. +- `LlamaCppJniConfig` / `LlamaCppJniConfig.Builder` — immutable generation and runtime settings plus fluent configuration construction. +- `OpenAiCompatibleProviderSupport` — prepares remote chat-completion requests and handles endpoint, API-key, HTTP-status, and timing support. +- `AiCompletionParser` — strips a leading thinking block from completion text or throws `IOException` if it is not closed. + +#### Data flow +- `AiGenerationProviderFactory` resolves the provider key and creates a backend using `LlamaCppJniConfig` and `AiPromptSupport`. +- A provider receives `AiGenerationRequest`; local inference uses prompt support to build chat-template arguments and inference parameters, while OpenAI-compatible support builds JSON with system/user messages and configured sampling options. +- Generated completion text is parsed before return; timing-capable paths package text and available token/timing metrics as `AiGenerationTimings`. +- The provider contract’s default timing method delegates to generation and supplies zero-valued metrics when a backend does not override it. + +#### Dependencies +- Project types: `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, `AiGenerationConfig`, `LlamaCppJniProviderSupport`, `ChatResponseParser`, `ChatResponse`, and `Usage`. +- Local inference: `net.ladenthin:llama` JNI types including `LlamaModel`, `ModelParameters`, `FlashAttn`, and `ReasoningFormat`. +- Remote request support: Jackson JSON node and mapper types. +- Supporting utilities and annotations: `Java8CompatibilityHelper`, `IOException`, Lombok, and JSpecify `Nullable`. + +#### Cross-cutting +- `LlamaCppJniConfig` is immutable; its builder is not thread-safe, and list accessors expose unmodifiable views. +- Local model initialization and cached access are unsynchronized; concurrent first generation calls may race, and inference/close are not synchronized. +- Local inference loads the model lazily and closes it only if initialized. +- OpenAI-compatible API keys are withheld from non-loopback HTTP endpoints; HTTPS and HTTP loopback endpoints are permitted. +- Missing generation timing data yields zero metrics; the default provider timing implementation also reports zero values. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..830e239b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/kernels/histogram.cl.ai.md @@ -0,0 +1,47 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:22:11Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Counts the frequency of every byte value in an image or byte stream using a two-pass 256-bin histogram. + +#### Purpose +- Computes byte-value frequencies, producing one count for each value from 0 to 255. +- Uses per-work-group partial histograms followed by a reduction pass. + +#### Type +- OpenCL C 1.2 kernel source. + +#### Input +- `histogram_partial`: `input` byte buffer, `length`, `partial` output buffer, and caller-provided `local_bins` memory. +- `histogram_reduce`: `partial` buffer and `group_count`. + +#### Output +- `partial`: one 256-counter histogram per work-group. +- `histogram`: final 256-counter histogram. + +#### Core logic +- `histogram_partial` initializes local bins cooperatively, then synchronizes the work-group. +- Each work-item processes input indices starting at its global ID, stepping by the global size; `atomic_inc` counts each byte in local memory. +- After a second local-memory barrier, work-items write local bin counts to `partial[group_id * BINS + bin]`. +- `histogram_reduce` assigns one work-item per bin, sums that bin across all work-groups, and writes the result; IDs beyond `BINS` return immediately. + +#### Public API +- `histogram_partial(__global const uchar *input, const uint length, __global uint *partial, __local uint *local_bins) -> void` — builds per-group histograms. +- `histogram_reduce(__global const uint *partial, const uint group_count, __global uint *histogram) -> void` — combines partial histograms. + +#### Constants and configuration +- `BINS = 256`. + +#### Dependencies +- OpenCL built-ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `barrier`, `atomic_inc`. +- OpenCL flag: `CLK_LOCAL_MEM_FENCE`. +- OpenCL types and address spaces: `uchar`, `uint`, `__global`, `__local`, `__kernel`. + +#### Exceptions / Errors +- No explicit error handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/kernels/package.ai.md new file mode 100644 index 00000000..d7bf6049 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/kernels/package.ai.md @@ -0,0 +1,35 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:23:17Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes byte-value frequency distributions for image or stream data using parallel 256-bin histograms. + +#### Purpose +- Count occurrences of each byte value from 0 to 255. +- Produce per-work-group partial histograms and reduce them into one final histogram. + +#### Responsibilities +- Parallel histogram construction: distribute input-byte counting across work-groups using local-memory bins. +- Histogram reduction: sum each bin across work-groups. + +#### Key units +- `histogram_partial` — builds and writes one 256-counter partial histogram per work-group. +- `histogram_reduce` — combines partial counts into the final 256-counter `histogram`. +- `BINS` — sets the histogram size to 256. + +#### Data flow +- `input` bytes and `length` feed `histogram_partial`, which writes per-group counts to `partial`. +- `histogram_reduce` reads `partial` and `group_count`, then writes the final `histogram`. + +#### Dependencies +- OpenCL C 1.2 built-ins for work-item and group indexing, barriers, and local-memory atomic increments. + +#### Cross-cutting +- Uses local-memory initialization and synchronization before and after atomic counting. +- Provides no explicit error handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..cb651206 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,46 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:23:31Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides low-level byte-processing utilities and operational tools for buffering streams, computing byte histograms, rotating backups, and reporting regional sales. + +#### Purpose +- Groups reusable byte-processing components with scripts for backup retention and monthly sales reporting. +- Supports parallel byte-frequency analysis, bounded FIFO transfer, and CSV-based revenue aggregation. + +#### Responsibilities +- **Byte analysis (`kernels/`):** Build per-work-group 256-bin histograms and reduce them into a final byte-frequency distribution. +- **Stream buffering (`ringbuf/`):** Manage fixed-capacity circular byte storage with partial reads and writes, occupancy reporting, and lifecycle operations. +- **Operations and reporting (`scripts/`):** Create timestamped compressed backups with retention cleanup; filter order exports by currency and report qualifying monthly regional revenue. + +#### Key units +- `histogram_partial` / `histogram_reduce` — count input byte values in parallel and combine partial counts into a 256-bin histogram. +- `ringbuf_t` — holds circular-buffer storage, capacity, and producer/consumer indices; `ringbuf_init`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space`, and `ringbuf_free` provide its API. +- `rotate_backups.sh` — creates a compressed archive and removes older matching backups beyond the retention limit. +- `Order` — immutable sales record containing date, region, and decimal amount. +- `parse_orders(path, currency)` / `revenue_by_month_and_region(orders)` — filter CSV orders and aggregate totals by month and region. +- `main(argv=None)` — runs the sales-report command-line interface. + +#### Data flow +- Histogram: input bytes and length → work-group partial histograms → reduction → final 256-bin counts. +- Ring buffer: initialize storage → write available bytes and read available data across wraparound → derive used and free capacity from indices. +- Backup: source directory → temporary timestamped `.tar.gz` archive → completed backup → newest-first retention cleanup. +- Sales report: CSV files → validate required columns and filter currency → aggregate by month and region → apply minimum-revenue threshold → tab-separated output. + +#### Dependencies +- `kernels/` uses OpenCL C 1.2 work-item/group indexing, barriers, local memory, and atomic increments. +- `ringbuf/` exposes declarations in `ringbuf.h` and uses standard C allocation, copying, and size/byte types. +- `scripts/` uses Bash and system utilities for archiving and cleanup; the report uses Python standard-library CSV, argument parsing, date, decimal, and aggregation facilities. + +#### Cross-cutting +- Histogram work-groups synchronize around local-memory initialization and counting; no explicit error handling is described. +- Ring-buffer capacities must be nonzero powers of two; one slot is reserved, and the API documents single-producer/single-consumer ownership of `head` and `tail`. +- Backup creation uses strict Bash mode and an exit trap to remove incomplete archives; sales amounts use `Decimal`, with file-context errors for missing columns or invalid dates and amounts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/ringbuf/package.ai.md new file mode 100644 index 00000000..b32bdcf6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/ringbuf/package.ai.md @@ -0,0 +1,43 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:23:21Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides bounded FIFO byte buffering for passing data between a producer and a consumer. + +#### Purpose +- Defines and implements a fixed-capacity circular buffer with partial byte reads and writes. +- Uses one reserved slot to distinguish full from empty, so usable capacity is `capacity - 1`. + +#### Responsibilities +- Buffer lifecycle and status: initialize storage, validate capacity, and free/reset the ring buffer. +- FIFO byte transfer: copy available bytes into or out of the buffer, including across wraparound. +- Occupancy reporting: calculate used bytes and remaining writable space. + +#### Key units +- `ringbuf_t` — stores the byte-array pointer, capacity, next-write `head`, and next-read `tail`. +- `ringbuf_status_t` — reports initialization success or invalid capacity/allocation failure. +- `ringbuf_init` — allocates and initializes a ring buffer with a nonzero power-of-two capacity. +- `ringbuf_write` / `ringbuf_read` — copy up to available space or data and return the number of bytes transferred. +- `ringbuf_used` / `ringbuf_free_space` — report occupancy and writable capacity. +- `ringbuf_free` — releases storage and resets buffer fields. + +#### Data flow +- Initialization validates capacity, allocates storage, and sets `head` and `tail` to zero. +- Writes copy available source bytes into the buffer and advance `head`; reads copy available bytes to the destination and advance `tail`. +- Transfers wrap at the array boundary; occupancy and free space are derived from the indices and capacity. + +#### Dependencies +- `ringbuf.h` declares the API, structure, and status codes; `ringbuf.c` implements them. +- Uses `` for allocation, `` for copying, and `` / `` for size and byte types. + +#### Cross-cutting +- Power-of-two capacities enable index wraparound using a capacity mask. +- Initialization returns `RINGBUF_EINVAL` for invalid capacity and `RINGBUF_ENOMEM` on allocation failure; success is `RINGBUF_OK`. +- The header describes producer-owned `head` and consumer-owned `tail` indices and single-producer/single-consumer use. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..71321a3f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,61 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:22:18Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Stores and retrieves byte streams in a fixed-capacity circular buffer, preserving FIFO order across wraparound. + +#### Purpose +- Implements ring-buffer initialization, cleanup, occupancy queries, and bounded byte reads and writes. +- Reserves one byte to distinguish full from empty. + +#### Type +- C implementation file; exports `ringbuf_*` functions declared via `ringbuf.h`; internal helpers are `static`. + +#### Input +- `ringbuf_init`: ring-buffer pointer `rb`, requested `capacity`. +- `ringbuf_write`: buffer `rb`, source bytes `src`, requested length `len`. +- `ringbuf_read`: buffer `rb`, destination `dst`, requested length `len`. +- Occupancy queries and `ringbuf_free`: ring-buffer pointer `rb`. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`; reads, writes, and occupancy queries return `size_t`. +- Writes bytes into or reads bytes from `rb->data`; updates `head` and `tail`. +- `ringbuf_free` releases storage and resets buffer fields. + +#### Core logic +- `ringbuf_init` accepts only nonzero power-of-two capacities, allocates `capacity` bytes, and initializes `head` and `tail` to zero. +- `ringbuf_used` computes occupancy as `(head - tail) & (capacity - 1)`; `ringbuf_free_space` reports `capacity - 1 - used`. +- `ringbuf_write` copies up to available space in at most two chunks, wrapping at the array end; advances `head` with a capacity mask. +- `ringbuf_read` copies up to used bytes in at most two chunks, wrapping at the array end; advances `tail` with a capacity mask. +- `ringbuf_free` frees storage and zeros the pointer, capacity, and indices. + +#### Public API +- `ringbuf_init(rb, capacity) -> ringbuf_status_t` — allocate and initialize buffer. +- `ringbuf_free(rb) -> void` — release and reset buffer. +- `ringbuf_used(rb) -> size_t` — report occupied bytes. +- `ringbuf_free_space(rb) -> size_t` — report writable bytes. +- `ringbuf_write(rb, src, len) -> size_t` — append available bytes. +- `ringbuf_read(rb, dst, len) -> size_t` — retrieve available bytes. +- Internal helpers: `is_power_of_two`, `min_size`. + +#### Constants and configuration +- `RINGBUF_EINVAL` — returned for invalid capacity. +- `RINGBUF_ENOMEM` — returned if allocation fails. +- `RINGBUF_OK` — returned on successful initialization. + +#### Dependencies +- `"ringbuf.h"` — ring-buffer types and status codes. +- `` — `malloc`, `free`. +- `` — `memcpy`. +- `uint8_t`, `size_t`. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` when capacity is zero or not a power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` when `malloc` fails. +- No other parameter validation is performed. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..7e935aa7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,58 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:22:26Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides fixed-capacity byte buffering between a single producer and a single consumer. + +#### Purpose +- Defines the `ringbuf_t` data structure and API for storing and retrieving bytes in a bounded ring buffer. +- Reserves one slot to distinguish full from empty; usable capacity is `capacity - 1`. + +#### Type +- C header; declares `ringbuf_t` struct and `ringbuf_status_t` enum. +- Exposes declarations with C linkage when included from C++. + +#### Input +- `ringbuf_init`: buffer pointer and requested `capacity`. +- `ringbuf_write`: buffer pointer, source byte array, and requested `len`. +- `ringbuf_read`: buffer pointer, destination byte array, and requested `len`. +- `ringbuf_used` and `ringbuf_free_space`: buffer pointer. +- Capacity must be a nonzero power of two. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`. +- `ringbuf_write` and `ringbuf_read` return the number of bytes copied. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. +- `ringbuf_free` releases buffer resources; implementation details are not present. + +#### Core logic +- `ringbuf_t` stores a byte-array pointer, capacity, producer-owned next-write index (`head`), and consumer-owned next-read index (`tail`). +- Declares partial writes and reads: each copies up to the requested length and reports the actual byte count. +- Uses a power-of-two capacity requirement and leaves one slot unused. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — initialize buffer. +- `ringbuf_free(ringbuf_t *rb) -> void` — release buffer. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — copy bytes into buffer. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — copy bytes out. +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report used bytes. +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report available bytes. + +#### Constants and configuration +- `RINGBUF_H`: include guard. +- `RINGBUF_OK = 0`: success status. +- `RINGBUF_EINVAL = -1`: capacity is zero or not a power of two. +- `RINGBUF_ENOMEM = -2`: allocation failed. + +#### Dependencies +- ``: `size_t`. +- ``: `uint8_t`. + +#### Exceptions / Errors +- `ringbuf_init` reports invalid capacity with `RINGBUF_EINVAL` and allocation failure with `RINGBUF_ENOMEM`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/scripts/package.ai.md new file mode 100644 index 00000000..1385f057 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/scripts/package.ai.md @@ -0,0 +1,39 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:23:26Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides operational utilities for retaining compressed directory backups and turning order exports into currency-specific monthly regional revenue reports. + +#### Purpose +- Create timestamped archives with configurable retention for a source directory. +- Aggregate CSV order data into monthly revenue totals by region, with currency and minimum-revenue filters. + +#### Responsibilities +- **Backup rotation:** `rotate_backups.sh` creates a compressed archive, reports its path and size, and removes older matching archives beyond the retention limit. +- **Sales reporting:** `sales_report.py` parses matching-currency orders, groups revenue by month and region, and prints qualifying totals. + +#### Key units +- `rotate_backups.sh` — validates paths and retention count, creates an archive through a temporary partial file, then applies retention. +- `Order` — immutable order record containing date, region, and decimal amount. +- `parse_orders(path, currency)` — validates CSV headers and yields orders matching the currency. +- `revenue_by_month_and_region(orders)` — returns sorted revenue totals keyed by `(YYYY-MM, region)`. +- `main(argv=None)` — runs the sales-report CLI and returns its status. + +#### Data flow +- Backup: source directory → timestamped `.tar.gz` partial archive → completed archive in the backup directory → newest-first retention cleanup. +- Reporting: one or more CSV files → required-column validation and currency filtering → monthly regional aggregation → minimum-revenue filtering and tab-separated output. + +#### Dependencies +- `rotate_backups.sh` uses Bash and external utilities including `tar`, `date`, `mkdir`, `mv`, `du`, `ls`, and `rm`. +- `sales_report.py` uses Python standard-library CSV, argument-parsing, date, decimal, and aggregation facilities; input columns are `order_date`, `region`, `amount`, and `currency`. + +#### Cross-cutting +- Backup script uses strict Bash mode and an `EXIT` trap to remove a partial archive on failure. +- Sales reporting uses `Decimal` for amounts; missing CSV columns and invalid dates or amounts produce errors that include file context. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..8eff0ec7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,60 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:22:33Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates timestamped compressed backups of a directory and removes older archives beyond the retention limit. + +#### Purpose +- Back up one source directory as a dated `.tar.gz` archive, retaining only the newest requested number of archives. +- Run directly as `rotate_backups.sh`; not a sourced library. + +#### Type +- Bash (`#!/usr/bin/env bash`); strict mode: `set -euo pipefail`. + +#### Input +- Positional argument 1 → `SOURCE_DIR`; required source directory. +- Positional argument 2 → `BACKUP_DIR`; required destination directory. +- Positional argument 3 → `KEEP`; optional retention count, defaults to `7`; must be a positive integer. +- Reads the contents of `SOURCE_DIR`; lists matching archives in `BACKUP_DIR`. +- Reads no environment variables. + +#### Output +- Creates `BACKUP_DIR` if needed and writes a gzip-compressed tar archive named `_.tar.gz`. +- Prints the created archive path and size; prints each removed archive path. +- Deletes matching older archives beyond the newest `KEEP`. +- Exits with status `2` for invalid `KEEP` or a missing source directory. With `set -e`, failures of other commands also terminate the script. + +#### Core logic +- Requires `SOURCE_DIR` and `BACKUP_DIR`; sets `KEEP` from argument 3 or defaults it to `7`. +- Validates `KEEP` against a positive-integer pattern; rejects invalid values with an error on stderr. +- Verifies `SOURCE_DIR` exists as a directory; creates `BACKUP_DIR`. +- Builds an archive name from the source basename and a UTC timestamp; registers an `EXIT` trap to remove the partial archive. +- Runs `tar` from the source directory’s parent, writes to a `.partial` path, then renames the completed archive into place. +- Prints the archive path and human-readable size. +- Lists matching archives newest-first and removes entries after the first `KEEP`. + +#### Constants and configuration +- `SOURCE_DIR="${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR="${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP="${3:-7}"` +- `name="$(basename "$SOURCE_DIR")"` +- `archive="$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp="$archive.partial"` +- `archives` receives the matching archive paths from `ls -1t`. +- `old` receives each archive selected for removal by the retention loop. + +#### Dependencies +- External commands: `basename`, `date`, `mkdir`, `tar`, `mv`, `du`, `cut`, `ls`, `rm`. +- Bash builtins/features: `[[ ]]`, `mapfile`, arrays, process substitution, `trap`. +- Operates on `SOURCE_DIR` and `BACKUP_DIR`; no remote hosts, services, or endpoints. + +#### Errors and exit codes +- Status `2`: missing required positional argument, invalid `KEEP`, or `SOURCE_DIR` is not a directory. +- `set -euo pipefail`: command failures, unset-variable expansions, and pipeline failures terminate execution. +- `EXIT` trap removes `tmp` if present. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..a2d6e727 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/other/scripts/sales_report.py.ai.md @@ -0,0 +1,56 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:22:44Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Aggregates order CSV exports into monthly revenue totals by region for a selected currency, with an optional minimum-revenue threshold. + +#### Purpose +- Parses orders from one or more CSV files and reports revenue grouped by month and region. +- Filters orders by currency and suppresses totals below the requested minimum. + +#### Type +- Python module; defines frozen dataclass `Order`. + +#### Input +- `parse_orders(path, currency)`: CSV file path and currency code. +- `revenue_by_month_and_region(orders)`: iterable of `Order` records. +- `main(argv=None)`: optional argument list; CLI accepts one or more `csv_files`, `--currency`, and `--min-revenue`. +- CSV columns: `order_date`, `region`, `amount`, `currency`. + +#### Output +- `parse_orders` yields matching `Order` records; rows in other currencies are skipped. +- `revenue_by_month_and_region` returns a sorted dictionary keyed by `(YYYY-MM, region)`. +- CLI prints tab-separated month, region, and two-decimal revenue with currency; prints `no orders found` to stderr and returns `1` when no matching orders exist, otherwise returns `0`. + +#### Core logic +- `Order` stores an ISO-parsed order date, stripped region, and decimal amount. +- `parse_orders` validates required CSV headers, then reads rows starting at line 2 and yields only rows matching the requested currency. +- `revenue_by_month_and_region` sums amounts by formatted month and region, then sorts the grouped entries. +- `main` combines orders from all input files, exits with an error status if none match, and prints totals meeting `--min-revenue`. +- Module entry point passes `main()` to `sys.exit`. + +#### Public API +- `Order(order_date, region, amount)` — immutable order data. +- `parse_orders(path, currency)` → iterator of `Order` — reads matching-currency CSV rows. +- `revenue_by_month_and_region(orders)` → `dict` — aggregates monthly regional revenue. +- `main(argv=None)` → `int` — runs the report CLI. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")`. +- `--currency`: default `EUR`. +- `--min-revenue`: `Decimal` default `Decimal("0")`. + +#### Dependencies +- Standard library: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. +- Calls `open`, `csv.DictReader`, `date.fromisoformat`, `Decimal`, `enumerate`, `strftime`, `ArgumentParser.add_argument`, `parse_args`, `print`, and `sys.exit`. + +#### Exceptions / Errors +- `parse_orders` raises `ValueError` when required columns are missing, including the file path and missing column names. +- Invalid dates or decimal amounts raise a chained `ValueError` containing the file path and CSV line number. +- File-opening and CSV-reading errors are not handled locally. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..32758972 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/package.ai.md @@ -0,0 +1,49 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:24:06Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> Supports AI-assisted source indexing alongside byte-processing utilities, operational reporting, and transactional workflows for library lending, shop orders, and warehouse inventory. + +#### Purpose +- Combines source-selection and AI summarization support with reusable byte tools, backup and sales-report scripts, and database operations for lending, purchasing, and stock management. +- Covers distinct domains across Java, OpenCL/C, Bash/Python, PostgreSQL, MySQL, and SQL Server components. + +#### Responsibilities +- **AI indexing and generation (`java/`):** Configure source eligibility, facts, prompts, models, output behavior, and oversize handling; generate summaries through local llama.cpp or OpenAI-compatible providers. +- **Byte processing and operations (`other/`):** Compute parallel byte histograms, buffer byte streams in a circular FIFO, rotate compressed backups, and aggregate monthly regional sales from CSV exports. +- **Transactional business data (`sql/`):** Maintain library catalog and loan workflows with auditing and reports; reserve shop inventory during order updates; synchronize warehouse stock from supplier receipts. + +#### Key units +- `SrcMorphConfiguration`, `AiConditionEvaluator`, `AiFactExtractor` — configure source indexing, evaluate file conditions, and extract regex-based facts. +- `AiGenerationProviderFactory`, `AiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport`, `AiCompletionParser` — select generation backends, produce and clean completions, and support timing. +- `histogram_partial`, `histogram_reduce`, `ringbuf_t` — count byte frequencies and provide circular-buffer storage and read/write operations. +- `rotate_backups.sh`, `parse_orders`, `revenue_by_month_and_region`, `main` — retain compressed backups and filter and report sales totals. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `overdue_loans`, `member_loan_stats`, `popular_books` — process and report library lending activity. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — record loan state transitions. +- `add_order_item` — update shop order lines, reserve product stock, and recalculate order totals. +- `dbo.usp_SyncStock(@Since)` — aggregate supplier receipts into warehouse stock levels and log synchronization outcomes. + +#### Data flow +- Source files and metadata are selected and evaluated; configured facts and generation settings feed a provider, which returns completion text for parsing. +- Byte inputs flow through parallel partial histograms and reduction; stream bytes move through `ringbuf_t` storage. CSV orders are currency-filtered, grouped by month and region, thresholded, and printed. +- Library catalog and member records feed checkout, return, auditing, and reports; shop order-item changes validate and reserve product inventory; warehouse receipts are timestamp-filtered, aggregated, merged into stock, and logged. +- Backup scripts archive a source directory before pruning older matching archives to the retention limit. + +#### Dependencies +- AI indexing uses shared project types such as `AiCondition`, `AiFileContext`, `AiGenerationRequest`, `AiGenerationConfig`, and `AiPromptSupport`; backend support uses llama.cpp JNI and Jackson. +- Byte components use OpenCL C 1.2 and standard C allocation and memory-copy facilities; scripts use Bash/system utilities and Python standard-library CSV, date, decimal, and aggregation facilities. +- Database routines operate on library catalog/loan tables, shop `customer_order`, `order_item`, and `product`, and warehouse `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. +- SQL components target PostgreSQL (library), MySQL 8 (shop), and SQL Server (warehouse). + +#### Cross-cutting +- AI settings are generally mutable JavaBeans; validation errors include invalid condition structures, regexes, and oversize tokens. Local model initialization is lazy and cached but unsynchronized. +- Ring buffers require nonzero power-of-two capacity and document single-producer/single-consumer ownership; histogram work-groups synchronize local-memory operations. +- Inventory changes are coupled to business operations; database constraints and auditing protect relationships and state transitions, with transactional rollback and error logging in warehouse synchronization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..c33a5220 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: C890557E +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:24:17Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project combines Java-based AI source indexing—covering source selection, factual extraction, settings, and mock, local llama.cpp, or OpenAI-compatible generation—with byte-processing utilities for stream buffering and parallel byte histograms. Operational tools handle compressed backups and regional sales reports, while SQL subsystems support library lending and audits, shop orders and inventory, and timestamp-filtered warehouse stock synchronization. + +#### Packages +- java/config — Defines source-file eligibility, factual extraction, generation settings, and oversize handling for producing AI-indexed source summaries. +- java — Selects source files and prepares their facts and settings for AI indexing, then generates summaries through mock, local llama.cpp, or OpenAI-compatible backends. +- java/provider — Provides configurable AI text generation for source-document requests through mock, local llama.cpp, or OpenAI-compatible backends, with completion cleanup and optional timing metrics. +- other/kernels — Computes byte-value frequency distributions for image or stream data using parallel 256-bin histograms. +- other — Provides low-level byte-processing utilities and operational tools for buffering streams, computing byte histograms, rotating backups, and reporting regional sales. +- other/ringbuf — Provides bounded FIFO byte buffering for passing data between a producer and a consumer. +- other/scripts — Provides operational utilities for retaining compressed directory backups and turning order exports into currency-specific monthly regional revenue reports. +- . — Supports AI-assisted source indexing alongside byte-processing utilities, operational reporting, and transactional workflows for library lending, shop orders, and warehouse inventory. +- sql/library — Supports library cataloging, branch inventory, member borrowing, loan reporting, returns, late-fee calculation, and audit tracking. +- sql — Provides database structures and transactional operations for library lending, shop order fulfillment, and warehouse stock synchronization. +- sql/shop — Maintains a shop catalog and inventory while recording customer order items and keeping order totals in sync. +- sql/warehouse — Applies timestamp-filtered supplier stock receipts to warehouse/SKU inventory and records synchronization results or failures. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..293abb4d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/01_schema.sql.ai.md @@ -0,0 +1,59 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:21:24Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models authors, books, library members, and book loans, including copy availability and loan due dates. + +#### Purpose +- Defines the core lending-library schema for cataloging books and authors, tracking members, and recording loans. + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- `author` + - `author_id BIGSERIAL` — primary key. + - `full_name VARCHAR(200) NOT NULL`. + - `birth_year SMALLINT` — `CHECK (birth_year BETWEEN 1000 AND 2100)`. + - `country_code CHAR(2)`. +- `book` + - `book_id BIGSERIAL` — primary key. + - `isbn VARCHAR(17) NOT NULL UNIQUE`. + - `title VARCHAR(300) NOT NULL`. + - `author_id BIGINT NOT NULL` — foreign key to `author.author_id`. + - `published_year SMALLINT`. + - `copies_total INTEGER NOT NULL DEFAULT 1` — `CHECK (copies_total >= 0)`. + - `copies_free INTEGER NOT NULL DEFAULT 1` — `CHECK (copies_free >= 0)`. + - `book_free_le_total` — `CHECK (copies_free <= copies_total)`. +- `member` + - `member_id BIGSERIAL` — primary key. + - `email VARCHAR(254) NOT NULL UNIQUE`. + - `full_name VARCHAR(200) NOT NULL`. + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE`. + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE`. +- `loan` + - `loan_id BIGSERIAL` — primary key. + - `book_id BIGINT NOT NULL` — foreign key to `book.book_id`. + - `member_id BIGINT NOT NULL` — foreign key to `member.member_id`, `ON DELETE CASCADE`. + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE`. + - `due_on DATE NOT NULL`. + - `returned_on DATE`. + - `loan_due_after_loan` — `CHECK (due_on > loaned_on)`. +- Indexes: + - `idx_book_author` on `book (author_id)`. + - `idx_loan_member` on `loan (member_id)`. + - `idx_loan_open` on `loan (due_on)`, partial predicate `returned_on IS NULL`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (`ON DELETE CASCADE`) + +#### Dependencies +- `author`, `book`, `member`, and `loan` are created in this file; foreign keys reference `author`, `book`, and `member`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..6cc92f94 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/02_views.sql.ai.md @@ -0,0 +1,42 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:21:29Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Provides lending-library reports for overdue loans, member borrowing activity, and frequently loaned books. + +#### Purpose +- Exposes overdue-loan and member-loan statistics for reporting. +- Materializes recently popular books based on loan counts. + +#### Type +- Views and materialized view; PostgreSQL. + +#### Schema +- `overdue_loans`: `loan_id`, `member_id`, `email`, `title`, `due_on`, `days_overdue` (`CURRENT_DATE - l.due_on`). +- `member_loan_stats`: `member_id`, `full_name`, `loans_total` (`COUNT(l.loan_id)`), `loans_open` (count filtered to unreturned loans), `last_loan_on` (`MAX(l.loaned_on)`). +- `popular_books` (materialized): `book_id`, `title`, `author_name` (`a.full_name`), `times_loaned` (`COUNT(*)`); includes books loaned at least 5 times in the last 365 days. +- Index `idx_popular_books_id` on `popular_books (book_id)`, UNIQUE. + +#### Reads +- `overdue_loans`: `loan.loan_id`, `loan.member_id`, `loan.book_id`, `loan.due_on`, `loan.returned_on`; `member.member_id`, `member.email`; `book.book_id`, `book.title`. +- `member_loan_stats`: `member.member_id`, `member.full_name`; `loan.loan_id`, `loan.member_id`, `loan.returned_on`, `loan.loaned_on`. +- `popular_books`: `loan.loaned_on`, `loan.book_id`; `book.book_id`, `book.title`, `book.author_id`; `author.author_id`, `author.full_name`. + +#### Writes +- Creates `overdue_loans` and `member_loan_stats` views. +- Creates and populates materialized view `popular_books`. +- Creates unique index `idx_popular_books_id` on `popular_books`. + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..537b1d41 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/03_routines.sql.ai.md @@ -0,0 +1,58 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:21:35Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Manages library book checkouts and returns, updates copy availability, calculates overdue fees, and records loan audit events. + +#### Purpose +- Provides checkout and return operations for member loans and book-copy inventory. +- Calculates capped late fees and audits checkout/return changes. + +#### Type +- PostgreSQL: table `loan_audit`; functions `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn`; procedure `sp_return_book`; trigger `trg_loan_audit`. + +#### Schema +- `loan_audit` + - `audit_id BIGSERIAL` — primary key (unnamed constraint). + - `loan_id BIGINT NOT NULL`. + - `action VARCHAR(10) NOT NULL` — CHECK `action IN ('CHECKOUT', 'RETURN')` (unnamed constraint). + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()`. +- Indexes: none declared. + +#### Reads +- `member.member_id`, `member.is_blocked` — checkout blocked-member existence check. +- `book.book_id`, `book.copies_free` — checkout availability predicate. +- `loan.loan_id`, `loan.returned_on`, `loan.book_id` — return eligibility/update and book lookup. +- `fn_late_fee`: parameters `p_due_on`, `p_returned_on`; uses `CURRENT_DATE`. + +#### Writes +- `book.copies_free` — checkout decrements available copies; return increments available copies. +- `loan`: checkout inserts `book_id`, `member_id`, `due_on` (1 row per call); return updates `returned_on`. +- `loan_audit`: trigger inserts one row per checkout event (`CHECKOUT`) or first transition from unreturned to returned (`RETURN`). + +#### Relationships +- `loan_audit.loan_id -> loan.loan_id` — audit association; no foreign-key constraint declared. + +#### Routine logic +- `fn_checkout_book(p_member_id BIGINT, p_book_id BIGINT, p_days INTEGER DEFAULT 21) RETURNS BIGINT` + - Rejects blocked members; decrements one free copy or raises an exception. + - Inserts a loan due `p_days` from `CURRENT_DATE`; returns the new `loan_id`. +- `sp_return_book(p_loan_id BIGINT)` + - Sets `loan.returned_on` to `CURRENT_DATE` only if not already returned; raises an exception if unknown or already returned. + - Restores one free copy to the associated book. +- `fn_late_fee(p_due_on DATE, p_returned_on DATE) RETURNS INTEGER` + - Returns 50 cents per overdue day, with no charge before the due date; uses current date when return date is null and caps the fee at 2000. +- `trg_loan_audit_fn() RETURNS TRIGGER` + - On loan insert, records `CHECKOUT`; when `returned_on` changes from null to non-null, records `RETURN`; returns `NEW`. +- `trg_loan_audit` + - Row-level `AFTER INSERT OR UPDATE OF returned_on` trigger on `loan`, executing `trg_loan_audit_fn`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Built-ins: `now()`, `CURRENT_DATE`, `LEAST`, `GREATEST`, `COALESCE`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..3bd4b36b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,56 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:21:43Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds branch-based inventory to a lending library, assigns existing book copies to the main branch, and associates members and loans with branch-specific copies. + +#### Purpose +- Introduces branches and per-copy inventory, migrating existing book copy counts into individual copy records. +- Renames the member join-date column and removes the retired book-level copy counters. + +#### Type +- PostgreSQL migration script; creates tables and an index, alters tables, and migrates data. + +#### Schema +- `branch` + - `branch_id SMALLSERIAL` — primary key (unnamed constraint). + - `name VARCHAR(100)` — NOT NULL, UNIQUE (unnamed constraint). + - `city VARCHAR(100)` — NOT NULL. +- `book_copy` + - `copy_id BIGSERIAL` — primary key (unnamed constraint). + - `book_id BIGINT` — NOT NULL; FK to `book.book_id` (unnamed constraint). + - `branch_id SMALLINT` — NOT NULL; FK to `branch.branch_id` (unnamed constraint). + - `barcode VARCHAR(32)` — NOT NULL, UNIQUE (unnamed constraint). + - `status VARCHAR(12)` — NOT NULL, DEFAULT `'AVAILABLE'`; CHECK `status IN ('AVAILABLE', 'ON_LOAN', 'LOST')` (unnamed constraint). +- Alters `loan`: adds `copy_id BIGINT`, FK to `book_copy.copy_id` (unnamed constraint). +- Alters `member`: renames `joined_on` to `member_since`; adds `home_branch_id SMALLINT`, FK to `branch.branch_id` (unnamed constraint). +- Alters `book`: drops constraint `book_free_le_total`; drops columns `copies_free` and `copies_total`. +- Index: `idx_book_copy_book` on `book_copy (book_id)`; default method and operator class. + +#### Reads +- `book`: `book_id`, `isbn`, `copies_total`, `copies_free` (copy-migration SELECT). +- `member.home_branch_id` (migration UPDATE condition). + +#### Writes +- `branch`: 1 seed row, `('Main', 'Springfield')`. +- `book_copy`: one `INSERT ... SELECT`; one row per generated series value from 1 through each book’s `copies_total`; barcode uses `isbn` and series number; status is `AVAILABLE` through `copies_free`, otherwise `ON_LOAN`. Exact total depends on source `book` data. +- `loan`: adds `copy_id` column. +- `member`: renames `joined_on`; adds `home_branch_id`; updates rows where it is NULL to `1`. +- `book`: drops `book_free_le_total`, `copies_free`, and `copies_total`. +- Creates index `idx_book_copy_book`. + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- Tables: `book`, `loan`, `member`. +- Function: `generate_series`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..b47cc483 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,37 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:21:51Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Seeds a lending-library database with authors, book inventory, members, and loan history. + +#### Purpose +- Populate the library catalog, member registry, and borrowing records with sample data. +- Run all seed inserts within one transaction. + +#### Type +- PostgreSQL DML script; transaction uses `BEGIN` and `COMMIT`. + +#### Writes +- `author`: 15 rows in 15 single-row INSERTs; `author_id` 1–15. +- `book`: 110 rows in 110 single-row INSERTs; `book_id` 1–110. +- `member`: 50 rows in 50 single-row INSERTs; `member_id` 1–50. +- `loan`: 150 rows in 150 single-row INSERTs; `loan_id` 1–150; rows include both `returned_on` dates and `NULL`. +- Inserted columns: + - `author`: `author_id`, `full_name`, `birth_year`, `country_code` + - `book`: `book_id`, `isbn`, `title`, `author_id`, `published_year`, `copies_total`, `copies_free` + - `member`: `member_id`, `email`, `full_name`, `joined_on`, `is_blocked` + - `loan`: `loan_id`, `book_id`, `member_id`, `loaned_on`, `due_on`, `returned_on` + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- Target tables: `author`, `book`, `member`, `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/package.ai.md new file mode 100644 index 00000000..48bbbc28 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/library/package.ai.md @@ -0,0 +1,55 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:23:39Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> Supports library cataloging, branch inventory, member borrowing, loan reporting, returns, late-fee calculation, and audit tracking. + +#### Purpose +- Defines and evolves a PostgreSQL lending-library database for books, authors, members, loans, and branch-specific copies. +- Provides operational routines, reporting views, and sample catalog and loan data. + +#### Responsibilities +- **Core schema and migration:** Creates `author`, `book`, `member`, and `loan`; adds `branch` and `book_copy` inventory, assigns legacy copies to the Main branch, and updates member and loan relationships. +- **Loan operations and audit:** Checks out available books, processes returns, calculates capped late fees, and records checkout and return events. +- **Reporting:** Exposes overdue loans and member borrowing statistics; materializes frequently loaned books from recent loan history. +- **Sample data:** Seeds authors, books, members, and loan history in a transaction. + +#### Key units +- `author`, `book`, `member`, `loan` — core catalog, membership, and borrowing records. +- `branch`, `book_copy` — branch locations and individually identified copies with availability status. +- `overdue_loans` — reports unreturned loans past their due dates. +- `member_loan_stats` — aggregates member loan totals, open loans, and most recent loan date. +- `popular_books` — materialized report of books loaned at least five times in the last 365 days. +- `fn_checkout_book` — validates membership and availability, records a loan, and returns its ID. +- `sp_return_book` — marks an eligible loan returned and restores a copy. +- `fn_late_fee` — calculates overdue charges at 50 cents per day, capped at 2000. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — store and capture checkout and return events. +- `04_migration_v2.sql` — migrates book-level copy counts into branch-specific `book_copy` records and removes the old counters. + +#### Data flow +- Book, author, member, and loan records form the base for reporting views and `popular_books`. +- Checkout validates member and book state, inserts a loan, and decrements the available-copy count; the loan trigger records a `CHECKOUT` audit event. +- Return updates an open loan and restores a copy; the trigger records a `RETURN` event on the first transition to returned. +- Migration generates one `book_copy` per legacy total copy, assigning `AVAILABLE` or `ON_LOAN` based on the prior free-copy count, and links members and loans to branches and copies. +- Seed inserts populate the core tables with sample catalog, member, and loan records. + +#### Dependencies +- Views and routines read or update `author`, `book`, `member`, and `loan`. +- The migration adds relationships from `book_copy` to `book` and `branch`, from `loan` to `book_copy`, and from `member` to `branch`. +- PostgreSQL built-ins include `CURRENT_DATE`, `now()`, `COALESCE`, `LEAST`, `GREATEST`, and `generate_series`. + +#### Cross-cutting +- Referential integrity connects books to authors and loans to books and members; deleting a member cascades to their loans. +- Constraints enforce valid copy counts, loan due dates, member and book identifiers, and allowed `book_copy.status` and audit action values. +- `idx_loan_open` supports open-loan due-date access; `idx_book_author`, `idx_loan_member`, and `idx_book_copy_book` index common relationships; `popular_books` has a unique index on `book_id`. +- The migration renames `member.joined_on` to `member_since` and retires `book.copies_total` and `book.copies_free` in favor of individual copy records. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/package.ai.md new file mode 100644 index 00000000..a3b866fd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/package.ai.md @@ -0,0 +1,46 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:23:57Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> Provides database structures and transactional operations for library lending, shop order fulfillment, and warehouse stock synchronization. + +#### Purpose +- Defines domain-specific schemas, routines, and reports for library catalog and loans, shop products and orders, and warehouse inventory. +- Handles key workflows including checkout and returns, stock-reserving order updates, and supplier-feed synchronization. + +#### Responsibilities +- **Library lending:** Manage authors, books, members, branches, book copies, loans, auditing, late fees, and borrowing reports. +- **Shop purchasing:** Store product inventory, customer orders, and order lines; add items while reserving stock and recalculating order totals. +- **Warehouse synchronization:** Aggregate timestamp-filtered supplier receipts into stock levels and log synchronization outcomes. + +#### Key units +- `author`, `book`, `member`, `loan`, `branch`, `book_copy` — library catalog, membership, branch inventory, and borrowing records. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee` — validate and process lending operations and calculate capped late charges. +- `overdue_loans`, `member_loan_stats`, `popular_books` — report overdue borrowing, member activity, and frequently loaned titles. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — record checkout and return events. +- `product`, `customer_order`, `order_item`, `add_order_item` — shop catalog, order data, and stock-aware order-line updates. +- `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog`, `dbo.usp_SyncStock(@Since)` — warehouse receipt input, on-hand inventory, synchronization logging, and the sync procedure. + +#### Data flow +- **Library:** Catalog, member, and loan records feed reports; checkout creates a loan and reduces available inventory, while return closes an open loan and restores a copy. Triggers audit loan state transitions. +- **Shop:** `add_order_item` locks and validates a product by SKU, inserts or increments its order line, decrements stock, and recalculates `customer_order.total_cents`. +- **Warehouse:** `usp_SyncStock` filters `SupplierFeed` by receipt time, aggregates quantities by warehouse and SKU, merges totals into `StockLevel`, and logs counts or failure details. + +#### Dependencies +- Library routines and reports operate on the library catalog, member, loan, branch, and copy tables; migration converts legacy book copy counts into branch-specific copy records. +- Shop `order_item` references `customer_order` and `product`; `add_order_item` reads and updates all three. +- Warehouse `usp_SyncStock` reads `dbo.SupplierFeed`, writes `dbo.StockLevel`, and records results in `dbo.SyncLog`. +- Uses distinct SQL platforms: PostgreSQL for library operations, MySQL 8 for shop orders, and SQL Server for warehouse synchronization. + +#### Cross-cutting +- Referential integrity and constraints protect library relationships, copy and audit statuses, shop order lines, and unique product SKUs. +- Inventory changes are coupled to business operations: lending updates copy availability, shop orders reserve product stock, and warehouse sync applies aggregated receipts. +- Error handling includes shop validation errors, warehouse transactional rollback and error logging, and library loan-event auditing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..128203e5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,68 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:21:54Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models shop products, customer orders, and order lines, with a procedure that adds items, reserves inventory, and refreshes order totals. + +#### Purpose +- Stores product catalog and stock, customer orders, and per-order product quantities and prices. +- `add_order_item` adds or increments an order line, decrements stock, and recalculates the order total. + +#### Type +- MySQL 8; tables: `product`, `customer_order`, `order_item`; procedure: `add_order_item`. + +#### Schema +- `product` + - `product_id INT UNSIGNED` — primary key `PRIMARY`, `NOT NULL`, `AUTO_INCREMENT`. + - `sku VARCHAR(40)` — `NOT NULL`, unique key `uk_product_sku`. + - `name VARCHAR(200)` — `NOT NULL`. + - `price_cents INT UNSIGNED` — `NOT NULL`. + - `stock INT` — `NOT NULL`, `DEFAULT 0`. +- `customer_order` + - `order_id BIGINT UNSIGNED` — primary key `PRIMARY`, `NOT NULL`, `AUTO_INCREMENT`. + - `customer_id BIGINT UNSIGNED` — `NOT NULL`. + - `status ENUM('NEW', 'PAID', 'SHIPPED', 'CANCELLED')` — `NOT NULL`, `DEFAULT 'NEW'`. + - `created_at DATETIME` — `NOT NULL`, `DEFAULT CURRENT_TIMESTAMP`. + - `total_cents INT UNSIGNED` — `NOT NULL`, `DEFAULT 0`. +- `order_item` + - `order_id BIGINT UNSIGNED` — primary-key component `PRIMARY`, `NOT NULL`; foreign key `fk_item_order`. + - `product_id INT UNSIGNED` — primary-key component `PRIMARY`, `NOT NULL`; foreign key `fk_item_product`. + - `quantity SMALLINT UNSIGNED` — `NOT NULL`. + - `unit_price_cents INT UNSIGNED` — `NOT NULL`. +- Indexes: + - `PRIMARY` on `product (product_id)`. + - `uk_product_sku` on `product (sku)` — unique. + - `PRIMARY` on `customer_order (order_id)`. + - `idx_order_customer` on `customer_order (customer_id, created_at)`. + - `PRIMARY` on `order_item (order_id, product_id)`. + - `fk_item_order` on `order_item (order_id)` — foreign-key index. + - `fk_item_product` on `order_item (product_id)` — foreign-key index. + +#### Reads +- `product`: `product_id`, `price_cents`, `sku`, `stock` — SKU lookup and stock eligibility check. +- `order_item`: `order_id`, `quantity`, `unit_price_cents` — sums line totals for an order. + +#### Writes +- `order_item`: inserts one line per procedure call; on duplicate `(order_id, product_id)`, increments `quantity`. +- `product`: updates `stock` by subtracting `p_qty` for the selected `product_id`. +- `customer_order`: updates `total_cents` for `order_id` using the sum of its order-item line totals. + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (`fk_item_order`, `ON DELETE CASCADE`). +- `order_item.product_id -> product.product_id` (`fk_item_product`). + +#### Routine logic +- `add_order_item(IN p_order_id BIGINT UNSIGNED, IN p_sku VARCHAR(40), IN p_qty SMALLINT UNSIGNED)` +- Selects and locks the matching product by SKU when stock is sufficient. +- Signals SQLSTATE `45000` with `unknown SKU or not enough stock` if no product is selected. +- Inserts an order line or increments its quantity on duplicate key; decrements product stock; recalculates the order total. +- No result set; effects are persisted in `order_item`, `product`, and `customer_order`. + +#### Dependencies +- Tables: `product`, `order_item`, `customer_order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/shop/package.ai.md new file mode 100644 index 00000000..497b7866 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/shop/package.ai.md @@ -0,0 +1,41 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:23:47Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Maintains a shop catalog and inventory while recording customer order items and keeping order totals in sync. + +#### Purpose +- Defines product, customer-order, and order-line storage for shop purchases. +- Provides `add_order_item` to add or increment an order line, reserve stock, and recalculate the order total. + +#### Responsibilities +- Catalog and inventory: store product SKUs, prices, and stock; enforce unique SKUs. +- Order records: track customer, status, creation time, and total. +- Order lines: store quantities and unit prices, linked to orders and products. +- Item addition: validate SKU and available stock, update the line and inventory, and refresh the order total. + +#### Key units +- `product` — product catalog and available stock. +- `customer_order` — customer order metadata and calculated total. +- `order_item` — per-order product quantities and unit prices, keyed by order and product. +- `add_order_item` — adds or increments a line, decrements stock, and recalculates the order total. + +#### Data flow +- `add_order_item` looks up and locks a product by SKU when stock is sufficient; otherwise signals SQLSTATE `45000` with `unknown SKU or not enough stock`. +- It inserts an `order_item` row or increments its quantity on duplicate `(order_id, product_id)`, then subtracts the requested quantity from product stock. +- It sums the order’s line totals and writes the result to `customer_order.total_cents`; it returns no result set. + +#### Dependencies +- `order_item.order_id` references `customer_order.order_id` with `ON DELETE CASCADE`. +- `order_item.product_id` references `product.product_id`. +- `add_order_item` reads and writes `product`, `order_item`, and `customer_order`. + +#### Cross-cutting +- Uses MySQL 8 tables, foreign keys, primary keys, and indexes; `product.sku` has a unique constraint. +- Product selection uses a lock during SKU and stock validation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/warehouse/package.ai.md new file mode 100644 index 00000000..383aa997 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/warehouse/package.ai.md @@ -0,0 +1,38 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:23:52Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Applies timestamp-filtered supplier stock receipts to warehouse/SKU inventory and records synchronization results or failures. + +#### Purpose +- Synchronize aggregated supplier-feed quantities into on-hand stock levels. +- Record inserted and updated row counts, or the error message, for each synchronization attempt. + +#### Responsibilities +- **Stock aggregation and application:** Group `dbo.SupplierFeed` quantities by warehouse and SKU, then insert or update corresponding `dbo.StockLevel` rows. +- **Outcome logging:** Write synchronization start time and row counts to `dbo.SyncLog`; record errors on failure. + +#### Key units +- `dbo.usp_SyncStock(@Since)`: Transactionally applies feed quantities received since `@Since` and logs the outcome. +- `dbo.SupplierFeed`: Source rows containing warehouse, SKU, quantity, and receipt timestamp. +- `dbo.StockLevel`: On-hand inventory keyed by `WarehouseId` and `Sku`. +- `dbo.SyncLog`: Synchronization timestamps, inserted/updated counts, and optional error message. + +#### Data flow +- Filter `dbo.SupplierFeed` by `ReceivedAt >= @Since`, then sum quantities per `WarehouseId` and `Sku`. +- `MERGE` aggregated totals into `dbo.StockLevel`: update matching rows or insert new ones. +- Capture merge actions to calculate insert/update counts and write a success row to `dbo.SyncLog`. + +#### Dependencies +- `dbo.usp_SyncStock` reads `dbo.SupplierFeed` and matches/writes `dbo.StockLevel`; it writes outcomes to `dbo.SyncLog`. +- Uses SQL Server `SYSUTCDATETIME()` for the start time and `ERROR_MESSAGE()` for failure details. + +#### Cross-cutting +- Uses a transaction; on error, rolls back any active transaction, logs the error with zero counts, and rethrows. +- `StockLevel` uses a composite primary key on `WarehouseId` and `Sku`; no foreign keys are declared. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..99030474 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,59 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:22:03Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Aggregates supplier stock receipts by warehouse and SKU, updates on-hand inventory, and records synchronization outcomes. + +#### Purpose +- `dbo.usp_SyncStock` applies supplier-feed quantities received since a supplied timestamp to warehouse stock levels. +- Logs inserted and updated stock counts, or the error message if synchronization fails. + +#### Type +- SQL Server (T-SQL): tables `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`; procedure `dbo.usp_SyncStock`. + +#### Schema +- `dbo.StockLevel` + - `WarehouseId INT` NOT NULL; `Sku NVARCHAR(40)` NOT NULL; composite primary key `PK_StockLevel` (`WarehouseId`, `Sku`). + - `OnHand INT` NOT NULL DEFAULT `(0)`; default constraint `DF_StockLevel_OnHand`. + - `UpdatedAt DATETIME2(0)` NOT NULL DEFAULT `(SYSUTCDATETIME())`; default constraint `DF_StockLevel_UpdatedAt`. +- `dbo.SupplierFeed` + - `FeedRowId BIGINT` IDENTITY(1,1) NOT NULL; primary key constraint `PK_SupplierFeed`. + - `WarehouseId INT` NOT NULL; `Sku NVARCHAR(40)` NOT NULL; `Quantity INT` NOT NULL; `ReceivedAt DATETIME2(0)` NOT NULL. +- `dbo.SyncLog` + - `SyncLogId INT` IDENTITY(1,1) NOT NULL; primary key constraint `PK_SyncLog`. + - `StartedAt DATETIME2(0)` NOT NULL; `RowsInserted INT` NOT NULL; `RowsUpdated INT` NOT NULL; `ErrorMessage NVARCHAR(4000)` NULL. +- No separately declared indexes. + +#### Reads +- `dbo.SupplierFeed`: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`; filters on `ReceivedAt >= @Since`, groups by `WarehouseId`, `Sku`, and sums `Quantity`. +- `dbo.StockLevel`: `WarehouseId`, `Sku` for matching; `OnHand` for updates. +- `@Changes`: `MergeAction` for calculating logged insert and update counts. + +#### Writes +- `dbo.StockLevel`: `MERGE` updates `OnHand`, `UpdatedAt` for matches; inserts `WarehouseId`, `Sku`, `OnHand` for non-matches. +- `dbo.SyncLog`: success insert writes `StartedAt`, `RowsInserted`, `RowsUpdated`; error insert writes those columns plus `ErrorMessage`. + +#### Relationships +- `dbo.StockLevel.WarehouseId -> source.WarehouseId` (MERGE match). +- `dbo.StockLevel.Sku -> source.Sku` (MERGE match). +- Source values are aggregated from `dbo.SupplierFeed` by `WarehouseId`, `Sku`; no declared foreign keys. + +#### Routine logic +- `dbo.usp_SyncStock(@Since DATETIME2(0))`. +- Captures UTC start time; begins a transaction and aggregates feed quantities received since `@Since`. +- Merges totals into `dbo.StockLevel`, capturing `$action` values in `@Changes`. +- Inserts a `dbo.SyncLog` row with counts of inserted and updated stock rows, then commits. +- On error, rolls back any active transaction, logs `ERROR_MESSAGE()` with zero counts, and rethrows. + +#### Dependencies +- `dbo.SupplierFeed` +- `dbo.StockLevel` +- `dbo.SyncLog` +- `SYSUTCDATETIME()` +- `ERROR_MESSAGE()` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..816784eb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,64 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:24:21Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Evaluates and validates file‑selection conditions for source‑code indexing. + +#### Purpose +- Checks if a file satisfies a tree of `AiCondition` nodes. +- Validates condition trees for correct structure and bounds. +- Determines if line counting is required. + +#### Type +- `final class AiConditionEvaluator` – public, no generics, no annotations. + +#### Input +- `matches(AiCondition, AiFileContext)` – condition tree, file facts. +- `validate(AiCondition)` – condition tree. +- `usesLines(AiCondition)` – condition tree. +- Internal helpers: `branchCount(AiCondition)`, `matchesExtension(List, String)`, `globMatches(String, String)`, `parseEpochMilli(String)`. + +#### Output +- `matches` returns `boolean` indicating file match. +- `validate` throws `IllegalArgumentException` on misconfiguration. +- `usesLines` returns `boolean` indicating need for line count. +- Helper methods return booleans or parsed epoch milliseconds. + +#### Core logic +- `matches`: recursively evaluates `and`, `or`, `not`, extensions, size, lines, modifiedAfter, modifiedBefore, pathGlob; throws if node has no branch. +- `validate`: ensures exactly one branch per node, checks non‑empty extensions, bounded size/lines, parses dates, non‑blank glob. +- `usesLines`: traverses tree to detect any `lines` node. +- `validateGroup`: ensures group has at least one child and validates each child. +- `branchCount`: counts non‑null branch/leaf fields. +- `matchesExtension`: checks file name ends with any listed extension. +- `globMatches`: uses `AiSourceExcludeFilter` to test path glob. +- `parseEpochMilli`: parses ISO‑8601 instant to epoch milliseconds, throws on failure. + +#### Public API +- `matches(AiCondition, AiFileContext) -> boolean` – evaluate condition tree. +- `validate(AiCondition) -> void` – validate tree structure. +- `usesLines(AiCondition) -> boolean` – detect line‑count requirement. + +#### Dependencies +- `java.time.Instant`, `java.time.format.DateTimeParseException` +- `java.util.Collections`, `java.util.List` +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalStateException` if a node has no branch. +- `IllegalArgumentException` for: + - multiple or no branches (`ERROR_ONE_BRANCH`). + - empty ``. + - unbounded `` or ``. + - invalid ISO‑8601 dates. + - blank ``. + +#### Concurrency +- Stateless; no shared mutable state. Thread‑safe by design. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..6c640bdd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,51 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:24:30Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> A container for child AI conditions used by / combinators in the AI configuration. + +#### Purpose +- Holds a list of `AiCondition` objects for logical combinators. +- Provides defensive copying when setting the list. + +#### Type +- `public class AiConditionGroup` + - Modifiers: public, final (implicit), no superclass. + - Field: `private @Nullable List conditions`. + - Constructor: `public AiConditionGroup()` (no-op). + - Methods: + - `public @Nullable List getConditions()` – returns the list or null. + - `public void setConditions(final @Nullable Collection conditions)` – copies into a new `ArrayList` or sets null. + +#### Input +- `setConditions` accepts a `Collection` (nullable). + +#### Output +- `getConditions` returns the internal `List` or null. +- `setConditions` mutates the internal `conditions` field. + +#### Core logic +- `setConditions`: if argument is non‑null, create a new `ArrayList` from it; otherwise set field to null. +- `getConditions`: simply return the field. + +#### Public API +- `getConditions() -> List` – retrieve child conditions. +- `setConditions(Collection) -> void` – set child conditions. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCondition` + +#### Exceptions / Errors +- No exceptions thrown; defensive copying handles nulls. + +#### Concurrency +- No synchronization; class is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..27ccbd2e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,50 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:24:33Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Computes deterministic, language‑agnostic fact counts from source text using regex counters. + +#### Purpose +- Generates a facts block summarizing exact counts of language constructs. +- Validates fact counter configurations. + +#### Type +- `final class AiFactExtractor` (public, final, no supertype). + - Fields: `FACTS_HEADER`, `LABEL_COUNT_SEPARATOR`, `ENTRY_SEPARATOR`, `FACTS_SUFFIX` (public static final String). + - Private constructor. + - Methods: `factsBlock(List, String) -> String`, `validate(List) -> void`, `countMatches(String, String) -> int` (private). + +#### Input +- `factsBlock`: list of `AiFactCounter` (may be null/empty), source `String`. +- `validate`: list of `AiFactCounter` (may be null/empty). +- `countMatches`: regex `String`, source `String`. + +#### Output +- `factsBlock`: formatted facts string or empty string. +- `validate`: throws `IllegalArgumentException` on invalid counters. +- `countMatches`: integer match count. + +#### Core logic +- `factsBlock`: iterate counters, skip null or missing label/pattern, append `label: count` separated by `ENTRY_SEPARATOR`. Prepend `FACTS_HEADER`, append `FACTS_SUFFIX`. Return empty if no valid counters. +- `validate`: for each counter, ensure non‑null label/pattern; compile pattern to detect syntax errors; throw `IllegalArgumentException` with message. +- `countMatches`: compile pattern, use `Matcher.find()` loop to count non‑overlapping matches. + +#### Public API +- `factsBlock(List, String) -> String` – build facts block from counters and source. +- `validate(List) -> void` – validate counter list. + +#### Dependencies +- `java.util.List`, `java.util.regex.Matcher`, `java.util.regex.Pattern`, `java.util.regex.PatternSyntaxException`, `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `IllegalArgumentException` from `validate` for missing label/pattern or invalid regex. +- `PatternSyntaxException` caught and wrapped in `IllegalArgumentException`. + +#### Concurrency +- Stateless, thread‑safe; no shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..f8f0c4b1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,151 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:24:38Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> A mutable JavaBean that holds all AI‑generation parameters for a single model run, including model path, sampling settings, prompt‑caching flags, GPU/offload options, and provider details. + +#### Purpose +- Stores configuration for a single AI generation step. +- Exposes getters/setters for Maven plugin and provider layers. +- Provides default constants for all parameters. + +#### Type +- `public class AiGenerationConfig` + - Modifiers: `public` + - Annotations: `@SuppressWarnings({"NullAway.Init","initialization.fields.uninitialized"})`, `@ToString` + - Fields: 73 private fields (including 2 `List` and one `AiCalibration`), all mutable. + - Constructor: public no‑arg constructor (no-op). + - No supertype or interfaces. + +#### Input +- Constructor: none. +- Setters accept: + - `String` (modelPath, provider, remoteModel, baseUrl, apiKeyEnv, reasoningEffort, devices, lazyMode, cacheTypeK, cacheTypeV, etc.) + - `int` (contextSize, maxOutputTokens, threads, charsPerToken, maxInputChars, topK, gpuLayers, seed, cpuMoeLayers, cpuFfnLayers, kvUnifiedPerSlot, repeatLastN, batchSize, ubatchSize, threadsBatch, mainGpu, reasoningBudgetTokens, dryAllowedLength, dryPenaltyLastN) + - `float` (temperature, topP, minP, topNSigma, repeatPenalty, dryMultiplier, dryBase) + - `boolean` (warnOnTrim, cachePrompt, swaFull, flashAttn, cacheReuse, etc.) + - `List` (drySequenceBreakers, stopStrings) + - `AiCalibration` (calibration) + +#### Output +- Getters return current field values. +- `getDrySequenceBreakers()` and `getStopStrings()` return unmodifiable lists. +- No side effects beyond mutating internal state. + +#### Core logic +- All setters simply assign the provided value to the corresponding field. +- `setLazyMode`, `setCacheTypeK`, `setCacheTypeV`, `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, `setApiKeyEnv` replace `null` with default constants. +- `setDrySequenceBreakers` and `setStopStrings` replace `null` with empty `ArrayList`. +- No additional computation or validation beyond these assignments. + +#### Public API +- `AiGenerationConfig()` -> void +- `String getModelPath()` -> model path +- `void setModelPath(String)` -> set model path +- `int getContextSize()` -> context size +- `void setContextSize(int)` -> set context size +- `int getMaxOutputTokens()` -> max output tokens +- `void setMaxOutputTokens(int)` -> set max output tokens +- `float getTemperature()` -> temperature +- `void setTemperature(float)` -> set temperature +- `int getThreads()` -> CPU threads +- `void setThreads(int)` -> set CPU threads +- `int getCharsPerToken()` -> chars per token +- `void setCharsPerToken(int)` -> set chars per token +- `int getMaxInputChars()` -> max input chars +- `void setMaxInputChars(int)` -> set max input chars +- `boolean isWarnOnTrim()` -> trim warning flag +- `void setWarnOnTrim(boolean)` -> set trim warning flag +- `float getTopP()` -> nucleus threshold +- `void setTopP(float)` -> set nucleus threshold +- `int getTopK()` -> top‑k limit +- `void setTopK(int)` -> set top‑k limit +- `float getRepeatPenalty()` -> repetition penalty +- `void setRepeatPenalty(float)` -> set repetition penalty +- `float getMinP()` -> min‑p threshold +- `void setMinP(float)` -> set min‑p threshold +- `float getTopNSigma()` -> top‑n‑sigma threshold +- `void setTopNSigma(float)` -> set top‑n‑sigma threshold +- `Boolean getChatTemplateEnableThinking()` -> chat‑template thinking mode +- `void setChatTemplateEnableThinking(Boolean)` -> set chat‑template thinking mode +- `boolean isCachePrompt()` -> prompt‑caching flag +- `boolean isSwaFull()` -> full‑SWA flag +- `void setSwaFull(boolean)` -> set full‑SWA flag +- `int getCacheReuse()` -> cache‑reuse chunk size +- `void setCacheReuse(int)` -> set cache‑reuse chunk size +- `int getGpuLayers()` -> GPU offload layers +- `void setGpuLayers(int)` -> set GPU offload layers +- `int getSeed()` -> RNG seed +- `void setSeed(int)` -> set RNG seed +- `int getCpuMoeLayers()` -> CPU MoE layers +- `void setCpuMoeLayers(int)` -> set CPU MoE layers +- `int getCpuFfnLayers()` -> CPU FFN layers +- `void setCpuFfnLayers(int)` -> set CPU FFN layers +- `int getKvUnifiedPerSlot()` -> KV unified per‑slot cap +- `void setKvUnifiedPerSlot(int)` -> set KV unified per‑slot cap +- `String getLazyMode()` -> tensor‑read laziness +- `void setLazyMode(String)` -> set tensor‑read laziness +- `int getRepeatLastN()` -> repeat‑penalty window +- `void setRepeatLastN(int)` -> set repeat‑penalty window +- `String getCacheTypeK()` -> KV cache type K +- `void setCacheTypeK(String)` -> set KV cache type K +- `String getCacheTypeV()` -> KV cache type V +- `void setCacheTypeV(String)` -> set KV cache type V +- `boolean isFlashAttn()` -> Flash Attention flag +- `void setFlashAttn(boolean)` -> set Flash Attention flag +- `int getBatchSize()` -> logical batch size +- `void setBatchSize(int)` -> set logical batch size +- `int getUbatchSize()` -> physical batch size +- `void setUbatchSize(int)` -> set physical batch size +- `int getThreadsBatch()` -> batch thread count +- `void setThreadsBatch(int)` -> set batch thread count +- `int getMainGpu()` -> primary GPU index +- `void setMainGpu(int)` -> set primary GPU index +- `String getDevices()` -> device list +- `void setDevices(String)` -> set device list +- `String getProvider()` -> AI provider +- `void setProvider(String)` -> set AI provider +- `String getRemoteModel()` -> remote model ID +- `void setRemoteModel(String)` -> set remote model ID +- `String getBaseUrl()` -> base URL +- `void setBaseUrl(String)` -> set base URL +- `String getApiKeyEnv()` -> API key env var name +- `void setApiKeyEnv(String)` -> set API key env var name +- `String getReasoningEffort()` -> reasoning effort level +- `void setReasoningEffort(String)` -> set reasoning effort level +- `int getReasoningBudgetTokens()` -> reasoning budget tokens +- `void setReasoningBudgetTokens(int)` -> set reasoning budget tokens +- `float getDryMultiplier()` -> DRY multiplier +- `void setDryMultiplier(float)` -> set DRY multiplier +- `float getDryBase()` -> DRY base +- `void setDryBase(float)` -> set DRY base +- `int getDryAllowedLength()` -> DRY allowed length +- `void setDryAllowedLength(int)` -> set DRY allowed length +- `int getDryPenaltyLastN()` -> DRY penalty last‑n +- `void setDryPenaltyLastN(int)` -> set DRY penalty last‑n +- `List getDrySequenceBreakers()` -> unmodifiable DRY sequence breakers +- `void setDrySequenceBreakers(List)` -> set DRY sequence breakers +- `List getStopStrings()` -> unmodifiable stop strings +- `void setStopStrings(List)` -> set stop strings +- `AiCalibration getCalibration()` -> calibration +- `void setCalibration(AiCalibration)` -> set calibration + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCalibration` (used as a field type) + +#### Exceptions / Errors +- No explicit exceptions thrown. +- Null handling: setters replace `null` with defaults; getters may return `null` for nullable fields. + +#### Concurrency +- No synchronization; the class is not thread‑safe. +- Intended for single‑threaded configuration building. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..7c418e62 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,56 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:24:50Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Defines how to handle source files that exceed the context window of the routed model. + +#### Purpose +- Enumerates oversize handling strategies for source‑file routing. +- Provides default strategy and parsing from configuration. + +#### Type +- `public enum AiOversizeStrategy` + - Modifiers: `public` + - Supertypes: `java.lang.Enum` + - Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` + - Field: `public static final AiOversizeStrategy DEFAULT = FAIL` + - Field: `private final String configValue` + - Constructor: `AiOversizeStrategy(String configValue)` + - Methods: + - `public String configValue()` – returns token + - `public static AiOversizeStrategy fromConfig(@Nullable String value)` – parses token + +#### Input +- Constructor parameter: `String configValue` per enum constant. +- `fromConfig` parameter: `@Nullable String value` (config token). + +#### Output +- `configValue()` returns the token string. +- `fromConfig` returns matching `AiOversizeStrategy` or throws `IllegalArgumentException` for unknown tokens. + +#### Core logic +- `fromConfig`: + 1. If `value` is `null` → return `DEFAULT`. + 2. Trim `value`; if empty → return `DEFAULT`. + 3. Iterate over `values()`; compare `configValue` case‑insensitively. + 4. Return matching strategy. + 5. If none match → throw `IllegalArgumentException` with message listing expected tokens. + +#### Public API +- `configValue() -> String` – get config token +- `fromConfig(@Nullable String) -> AiOversizeStrategy` – parse config token + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `fromConfig` when token is non‑blank and unrecognized. + +#### Concurrency +- Immutable enum; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..ca071ba3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,116 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:24:59Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Holds all mutable configuration needed for a srcmorph run, from Maven parameters to future JSON/YAML or programmatic use. + +#### Purpose +- Stores runtime parameters for AI‑based source generation. +- Serves as a single shared config object for Maven plugin, CLI, or code. + +#### Type +- `public class SrcMorphConfiguration` + - Modifiers: public, mutable JavaBean. + - Supertypes: none. + - Annotations: `@SuppressWarnings({"NullAway.Init","initialization.fields.uninitialized"})`, `@ToString`. + - Fields (23): + - `File baseDirectory;` + - `File outputDirectory = new File(DEFAULT_OUTPUT_DIRECTORY);` + - `boolean force;` + - `@Nullable List subtrees;` + - `@Nullable List excludes;` + - `@Nullable List fileExtensions;` + - `long minFileSizeBytes;` + - `long maxFileSizeBytes;` + - `boolean planOnly;` + - `String generationProvider = DEFAULT_GENERATION_PROVIDER;` + - `@Nullable List promptDefinitions;` + - `@Nullable List aiDefinitions;` + - `@Nullable File modelDirectory;` + - `@Nullable List fieldGenerations;` + - `@Nullable List factDefinitions;` + - `@Nullable String llamaModelPath;` + - `int llamaContextSize = DEFAULT_LLAMA_CONTEXT_SIZE;` + - `int llamaMaxOutputTokens = DEFAULT_LLAMA_MAX_OUTPUT_TOKENS;` + - `float llamaTemperature = DEFAULT_LLAMA_TEMPERATURE;` + - `int llamaThreads = DEFAULT_LLAMA_THREADS;` + - `String pluginVersion = "";` + - `String aiVersion = DEFAULT_AI_VERSION;` + - `@Nullable String projectName;` + - Constants (11): + - `DEFAULT_OUTPUT_DIRECTORY`, `DEFAULT_GENERATION_PROVIDER`, `DEFAULT_LLAMA_CONTEXT_SIZE`, `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS`, `DEFAULT_LLAMA_TEMPERATURE`, `DEFAULT_LLAMA_THREADS`, `DEFAULT_AI_VERSION`. + +#### Input +- Constructor: no parameters, defaults applied. +- Setter methods accept values for each field (File, boolean, List, long, int, float, String, @Nullable variants). + +#### Output +- Getter methods expose current field values. +- No state mutation beyond setters. +- No external resources written. + +#### Core logic +- Pure data holder; no algorithmic behavior. + +#### Public API +- `getBaseDirectory() -> File` – project base directory. +- `setBaseDirectory(File)` – set base directory. +- `getOutputDirectory() -> File` – output dir for .ai.md. +- `setOutputDirectory(File)` – set output dir. +- `isForce() -> boolean` – always regenerate AI fields. +- `setForce(boolean)` – set force flag. +- `getSubtrees() -> List` – source subdirectory paths. +- `setSubtrees(List)` – set subtrees. +- `getExcludes() -> List` – glob patterns to skip. +- `setExcludes(List)` – set excludes. +- `getFileExtensions() -> List` – file extensions to index. +- `setFileExtensions(List)` – set extensions. +- `getMinFileSizeBytes() -> long` – lower file‑size bound. +- `setMinFileSizeBytes(long)` – set lower bound. +- `getMaxFileSizeBytes() -> long` – upper file‑size bound. +- `setMaxFileSizeBytes(long)` – set upper bound. +- `isPlanOnly() -> boolean` – stop after routing plan. +- `setPlanOnly(boolean)` – set plan‑only flag. +- `getGenerationProvider() -> String` – AI provider name. +- `setGenerationProvider(String)` – set provider. +- `getPromptDefinitions() -> List` – prompt templates. +- `setPromptDefinitions(List)` – set prompts. +- `getAiDefinitions() -> List` – AI model definitions. +- `setAiDefinitions(List)` – set models. +- `getModelDirectory() -> File` – directory for relative model paths. +- `setModelDirectory(File)` – set model directory. +- `getFieldGenerations() -> List` – per‑field routing rules. +- `setFieldGenerations(List)` – set routing rules. +- `getFactDefinitions() -> List` – reusable fact groups. +- `setFactDefinitions(List)` – set fact groups. +- `getLlamaModelPath() -> String` – GGUF model path fallback. +- `setLlamaModelPath(String)` – set GGUF path. +- `getLlamaContextSize() -> int` – llama.cpp context window. +- `setLlamaContextSize(int)` – set context size. +- `getLlamaMaxOutputTokens() -> int` – max output tokens. +- `setLlamaMaxOutputTokens(int)` – set max tokens. +- `getLlamaTemperature() -> float` – sampling temperature. +- `setLlamaTemperature(float)` – set temperature. +- `getLlamaThreads() -> int` – CPU threads for llama.cpp. +- `setLlamaThreads(int)` – set thread count. +- `getPluginVersion() -> String` – plugin version in .ai.md header. +- `setPluginVersion(String)` – set plugin version. +- `getAiVersion() -> String` – AI logic version in .ai.md header. +- `setAiVersion(String)` – set AI version. +- `getProjectName() -> String` – project title for index. +- `setProjectName(String)` – set project title. + +#### Dependencies +- `java.io.File`, `java.util.List`, `lombok.ToString`, `net.ladenthin.srcmorph.prompt.AiPromptDefinition`, `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- No explicit exceptions thrown; setters accept null for nullable fields. + +#### Concurrency +- No synchronization; intended for single‑threaded configuration building. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..ddfbf8c3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,54 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:26:58Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> A Java library that configures, validates, and orchestrates AI‑driven source‑code indexing and generation for Maven projects. + +#### Purpose +- Central configuration holder for AI‑based source‑code processing. +- Validates file‑selection rules and fact‑counter definitions. +- Provides enums and utilities for oversize handling and prompt generation. + +#### Responsibilities +- **Configuration Management** – `SrcMorphConfiguration` aggregates all runtime parameters (directories, model paths, prompt definitions, field routing, fact groups, Llama settings). +- **Condition Evaluation** – `AiConditionEvaluator` checks whether a source file satisfies complex logical trees of `AiCondition` nodes (extensions, size, lines, timestamps, glob paths). +- **Fact Extraction** – `AiFactExtractor` builds deterministic fact blocks from source text using regex counters. +- **Oversize Strategy** – `AiOversizeStrategy` enumerates how to handle files larger than the model context window. +- **Condition Grouping** – `AiConditionGroup` stores child conditions for logical combinators. + +#### Key units +- `SrcMorphConfiguration` – mutable JavaBean with 23 fields for Maven/CLI use. +- `AiConditionEvaluator` – stateless validator/evaluator for `AiCondition` trees. +- `AiFactExtractor` – static utility for generating fact strings. +- `AiOversizeStrategy` – enum with `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`. +- `AiConditionGroup` – container for child `AiCondition` objects. + +#### Data flow +1. **Setup** – `SrcMorphConfiguration` is populated via Maven plugin or CLI. +2. **Routing** – `AiConditionEvaluator` receives a file’s `AiFileContext` and a condition tree; it recursively evaluates the tree to decide inclusion. +3. **Fact Generation** – For included files, `AiFactExtractor.factsBlock` produces a facts block from configured `AiFactCounter` objects. +4. **Oversize Handling** – If a file exceeds the model context, `AiOversizeStrategy.fromConfig` selects the strategy to apply. + +#### Dependencies +- Java core (`java.io.File`, `java.util.*`, `java.time.*`, `java.util.regex.*`). +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter` for glob matching. +- `net.ladenthin.srcmorph.config.AiCondition`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`. +- Lombok (`@ToString`), JSPECIFY (`@Nullable`). + +#### Cross-cutting +- Defensive copying in `AiConditionGroup.setConditions`. +- Stateless, thread‑safe utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Consistent null handling: setters replace `null` with defaults or empty collections. +- Validation throws `IllegalArgumentException` for misconfigured conditions or fact counters. +- Immutable enum `AiOversizeStrategy` with a `fromConfig` parser that defaults to `FAIL`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..a7401542 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,58 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:27:10Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A unified framework for configuring, validating, and executing AI‑driven source‑code indexing and generation across Maven projects. + +#### Purpose +- Central AI‑based source‑code processing engine. +- Validates file‑selection, fact extraction, and oversize handling. +- Provides pluggable AI generation back‑ends (local llama.cpp, OpenAI‑compatible, mock). + +#### Responsibilities +- **Configuration & Validation** – `SrcMorphConfiguration`, `AiConditionEvaluator`, `AiFactExtractor`, `AiOversizeStrategy`. +- **AI Generation Layer** – `AiGenerationProvider` interface, concrete providers, factory, request/response plumbing. +- **Parsing & Post‑processing** – `AiCompletionParser`, `OpenAiCompatibleProviderSupport`. +- **Model & Timing Management** – `LlamaCppJniAiGenerationProvider`, `LlamaCppJniConfig`, `AiGenerationTimings`. + +#### Key units +- `SrcMorphConfiguration` – mutable bean holding directories, model paths, prompt defs, fact groups, Llama settings. +- `AiConditionEvaluator` – stateless tree evaluator for `AiCondition` objects. +- `AiFactExtractor` – static fact‑block generator using regex counters. +- `AiOversizeStrategy` – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`). +- `AiGenerationProvider` – interface for generating text with optional timings. +- `AiGenerationProviderFactory` – resolves provider keys, builds `LlamaCppJniConfig`. +- `LlamaCppJniConfig` – immutable 37‑knob config for llama.cpp. +- `LlamaCppJniAiGenerationProvider` – lazy llama.cpp model loader, chat completion, JSON parsing. +- `OpenAiCompatibleProviderSupport` – request builder, endpoint/API‑key validation, timing extraction. +- `AiCompletionParser` – removes Gemma‑4 thinking blocks from raw completions. + +#### Data flow +1. **Setup** – Maven plugin/CLI populates `SrcMorphConfiguration`. +2. **File Routing** – `AiConditionEvaluator` checks each file against condition trees; included files proceed. +3. **Fact Generation** – `AiFactExtractor.factsBlock` creates deterministic fact strings per file. +4. **Oversize Handling** – `AiOversizeStrategy.fromConfig` selects strategy for files exceeding model context. +5. **AI Request** – `AiGenerationRequest` (prompt key, source text, header) is passed to `AiGenerationProviderFactory.effectiveProvider`. +6. **Generation** – Provider’s `generate`/`generateWithTimings` executes: + - *llama.cpp*: build inference params → native `chatComplete` → JSON parse → `AiCompletionParser` → plain text. + - *OpenAI‑compatible*: build request body → endpoint/API‑key validation → HTTP call → response parse → timing metrics. +7. **Output** – Plain text answer (or `AiGenerationTimings`) returned to caller. + +#### Dependencies +- **Internal** – `AiPromptSupport`, `Java8CompatibilityHelper`, `MockAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`. +- **External** – `net.ladenthin.llama` (model, parameters, JSON), `com.fasterxml.jackson` (JSON), `java.net.URL`, `java.io.IOException`, `org.jspecify.annotations.Nullable`. +- **Configuration** – `AiGenerationConfig.DEFAULT_*` constants, `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`. + +#### Cross‑cutting +- Immutable configs (`LlamaCppJniConfig`), thread‑safe stateless utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Defensive copying and null handling in configuration setters. +- Consistent error handling: `IllegalArgumentException` for misconfigurations, `IOException` for I/O or endpoint issues. +- Timing metrics (`AiGenerationTimings`) capture prompt/cache token counts and throughput; defaulted to zero when unavailable. +- Lazy model loading in `LlamaCppJniAiGenerationProvider`; subsequent calls reuse cached instance. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..97022c8b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,58 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:25:21Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Strips a Gemma‑4 model’s internal “thinking” block from a raw LLM completion so only the final answer is stored. + +#### Purpose +- Removes leading Gemma‑4 thinking block from model output. +- Validates presence of closing marker; throws `IOException` if missing. +- Returns trimmed answer text. + +#### Type +- `public class AiCompletionParser` + - Modifiers: public + - Annotations: `@ToString` + - Supertypes: none + - Fields: + - `public static final String THINKING_BLOCK_START_MARKER` + - `public static final String THINKING_BLOCK_END_MARKER` + - Methods: + - `public AiCompletionParser()` – no‑op constructor + - `public String parseCompletion(final String response) throws IOException` – core parsing logic + +#### Input +- `response: String` (may be `null`) – raw LLM completion text. + +#### Output +- `String` – cleaned answer text, never `null`. +- Throws `IOException` if a start marker is present but no end marker is found. + +#### Core logic +- If `response` is `null`, return empty string. +- Trim whitespace from `response`. +- If trimmed text does **not** start with `THINKING_BLOCK_START_MARKER`, return trimmed text. +- Extract substring after the start marker. +- Find first occurrence of `THINKING_BLOCK_END_MARKER` in that substring. +- If not found, throw `IOException` with message indicating token budget exhaustion. +- Return substring after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` – constructs parser. +- `String parseCompletion(final String response) throws IOException` – parses completion, removes leading thinking block. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` when a start marker is present but the end marker is missing, indicating token budget exhaustion. + +#### Concurrency +- No thread‑safety concerns; class is stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..6bb37715 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,51 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:25:24Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Provides a pluggable AI backend for generating text from an AiGenerationRequest. + +#### Purpose +- Supplies AI-generated text for source‑code transformation requests. +- Offers optional timing metrics for calibration. + +#### Type +- `public interface AiGenerationProvider` (extends `AutoCloseable`) + - Annotations: none + - Methods: + - `String generate(AiGenerationRequest request) throws IOException` + - `default AiGenerationTimings generateWithTimings(final AiGenerationRequest request) throws IOException` + - `default void close() throws IOException` + +#### Input +- `AiGenerationRequest request` (prompt key, source file, source text, current header) + +#### Output +- `String` from `generate`; never `null`, may be blank. +- `AiGenerationTimings` from `generateWithTimings`; contains generated text and timing metrics. +- `void` from `close()` (no side effects). + +#### Core logic +- `generate`: implementation‑specific text generation. +- `generateWithTimings`: default implementation calls `generate`, returns `AiGenerationTimings` with zeroed timing fields. +- `close`: default no‑op; may be overridden to release resources. + +#### Public API +- `generate(AiGenerationRequest) -> String` – produce AI text for request. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – produce text with timing data. +- `close() -> void` – release provider resources. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` + +#### Exceptions / Errors +- `IOException` thrown by `generate` and `generateWithTimings` if provider fails. + +#### Concurrency +- No explicit synchronization; provider implementations may handle thread safety. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..fa882a0d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,78 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:25:28Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Creates an AI generation provider instance based on a provider key or model configuration. + +#### Purpose +- Instantiates an `AiGenerationProvider` implementation. +- Resolves the effective provider key from run or model configuration. + +#### Type +- `public class AiGenerationProviderFactory` + - Modifiers: public, final (implied by lack of `abstract`/`open`). + - Annotations: `@ToString`. + - Supertypes: none. + - Fields: + - `private final Java8CompatibilityHelper compatibilityHelper` – helper for blank checks. + - Methods: + - `public AiGenerationProviderFactory()` – no‑op constructor. + - `public static @Nullable String effectiveProvider(String runProvider, String modelProvider)` – resolves provider key. + - `public AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` – factory method. + - Constants: + - `public static final String PROVIDER_MOCK = "mock"` + - `public static final String PROVIDER_LLAMACPP_JNI = "llamacpp-jni"` + - `public static final String PROVIDER_OPENAI_COMPATIBLE = "openai-compatible"` + +#### Input +- `create` parameters: + - `providerName` – run‑level provider key. + - `llamaConfig` – model configuration (`LlamaCppJniConfig`). + - `promptSupport` – `AiPromptSupport` instance. +- `effectiveProvider` parameters: + - `runProvider` – run’s provider key. + - `modelProvider` – model’s provider key. + +#### Output +- `create` returns an `AiGenerationProvider` instance: + - `MockAiGenerationProvider` if provider key is blank or `"mock"`. + - `LlamaCppJniAiGenerationProvider` if `"llamacpp-jni"`. + - `OpenAiCompatibleAiGenerationProvider` if `"openai-compatible"`. +- Throws `IllegalArgumentException` for unknown provider keys. + +#### Core logic +- `effectiveProvider` trims `modelProvider`; if empty, returns `runProvider`. +- `create` obtains `effective` provider key via `effectiveProvider`. +- If `effective` is null or blank, instantiate `MockAiGenerationProvider`. +- Switch on `effective`: + - `"mock"` → `MockAiGenerationProvider`. + - `"llamacpp-jni"` → `LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)`. + - `"openai-compatible"` → `OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)`. + - default → throw `IllegalArgumentException`. + +#### Public API +- `AiGenerationProviderFactory()` – constructs factory. +- `static @Nullable String effectiveProvider(String runProvider, String modelProvider)` – resolves provider key. +- `AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` – creates provider instance. + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.provider.MockAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.OpenAiCompatibleAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniConfig` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown in `create` when provider key is unrecognised. + +#### Concurrency +- No explicit synchronization; factory is stateless except for a single helper instance. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..1a4fe7fc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,89 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:25:34Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Provides local AI text generation by loading a GGUF model via llama.cpp and exposing a prompt‑based completion API. + +#### Purpose +- Loads and caches a llama.cpp GGUF model lazily. +- Generates chat completions and parses full OpenAI‑compatible JSON responses. +- Supplies timing metrics and handles prompt‑cache reuse diagnostics. + +#### Type +- `final class LlamaCppJniAiGenerationProvider` – implements `AiGenerationProvider`, `AutoCloseable`; extends `Object`. + - Modifiers: `final`. + - Annotations: `@ToString`. + - Supertypes: `AiGenerationProvider`, `AutoCloseable`. +- Fields: + - `private final LlamaCppJniConfig config` – configuration holder. + - `@ToString.Exclude private @Nullable LlamaModel model` – native handle, lazily initialized. + - `private final AiPromptSupport promptSupport` – prompt rendering helper. + - `@ToString.Exclude private final LlamaCppJniProviderSupport support` – internal support logic. + - `private final AiCompletionParser completionParser` – parses text completions. + - `private final ChatResponseParser chatResponseParser` – parses full JSON responses. + - `private final Java8CompatibilityHelper compatibilityHelper` – helper for string checks. + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` accept `AiGenerationRequest` containing prompt data. +- `chatResponse(AiGenerationRequest request)` builds inference parameters via `support.buildInferenceParameters(request)`. + +#### Output +- `generate` returns `String` completion text. +- `generateWithTimings` returns `AiGenerationTimings` containing text, prompt token counts, cache usage, and throughput. +- `close` releases native `LlamaModel` resources. + +#### Core logic +- **Lazy model loading (`model()`):** + 1. If `model` is null, build `ModelParameters` from `config` and `support.buildChatTemplateKwargs()`. + 2. Apply optional settings: SWA, cache reuse, GPU layers, CPU MoE/FFN layers, KV unified slot, lazy mode, flash attention, cache quantization, batch sizes, GPU selection, device list. + 3. Instantiate `LlamaModel` with parameters and cache it. +- **Generation (`generate`):** + 1. Call `chatResponse(request)` to obtain full `ChatResponse`. + 2. Warn on truncated answers and log cache reuse via `support`. + 3. Parse first content with `completionParser`. +- **Chat response (`chatResponse`):** + 1. Invoke `model().chatComplete(...)` with inference parameters. + 2. Parse JSON into `ChatResponse` via `chatResponseParser`. +- **Timings (`generateWithTimings`):** + 1. Retrieve `ChatResponse` as above. + 2. Extract text, prompt/cache/token counts, and throughput from `Timings`. + 3. Return `AiGenerationTimings` with defaults if timings absent. +- **Resource cleanup (`close`):** Calls `current.close()` on the native model if present. + +#### Public API +- `generate(AiGenerationRequest request) -> String` – produce completion text. +- `generateWithTimings(AiGenerationRequest request) -> AiGenerationTimings` – produce completion text with metrics. +- `close() -> void` – release native resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.args.FlashAttn` +- `net.ladenthin.llama.args.ReasoningFormat` +- `net.ladenthin.llama.json.ChatResponseParser` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.ChatResponse` +- `net.ladenthin.llama.value.Timings` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `java.io.IOException` +- `java.util.Map` +- `java.util.Objects` +- Lombok `@ToString` + +#### Exceptions / Errors +- Constructor throws `NullPointerException` if `config` or `promptSupport` is null. +- `generate` declares `throws IOException` (though underlying calls are unchecked). +- `generateWithTimings` handles missing `Timings` by returning zeroed metrics. +- `close` silently ignores null model. + +#### Concurrency +- No explicit synchronization; `model()` is not thread‑safe – concurrent first calls may load multiple models. Subsequent calls reuse the cached instance. No other shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..19c01dd1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,97 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:25:41Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Builds an immutable configuration for llama.cpp JNI provider, exposing all runtime knobs and defaults for model generation. + +#### Purpose +- Holds 37 configuration knobs for llama.cpp JNI provider. +- Provides a fluent builder that applies `AiGenerationConfig.DEFAULT_*` values. + +#### Type +- `final class LlamaCppJniConfig` (class, final) + - Extends `Object`. + - Annotated with `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. +- `public static final class Builder` (class, static, final) + - No supertype beyond `Object`. + - Annotated with no special annotations. + +#### Input +- `Builder` constructor: `String modelPath` (non‑null). +- Builder setters: 36 optional parameters (int, float, boolean, `@Nullable Boolean`, `String`, `List`). +- `build()` consumes the populated `Builder`. + +#### Output +- `LlamaCppJniConfig` immutable instance with 37 fields. +- Getter methods return primitive values, `String`, `List` (unmodifiable), or `@Nullable Boolean`. +- `stopStrings()` and `drySequenceBreakers()` return unmodifiable lists. + +#### Core logic +- `LlamaCppJniConfig(Builder)` copies all builder fields into final fields. +- Builder initializes each field to `AiGenerationConfig.DEFAULT_*` or empty list. +- Each setter assigns the provided value and returns `this`. +- `build()` creates a new `LlamaCppJniConfig` from the builder. + +#### Public API +- `static Builder builder(String modelPath)` → builder with defaults. +- `String modelPath()` → model file path. +- `int contextSize()` → context window size. +- `int maxOutputTokens()` → max output tokens. +- `float temperature()` → sampling temperature. +- `int threads()` → CPU threads. +- `float topP()` → nucleus‑sampling threshold. +- `int topK()` → top‑k limit. +- `float minP()` → min‑p threshold. +- `float topNSigma()` → top‑n‑sigma threshold. +- `float repeatPenalty()` → repetition penalty. +- `@Nullable Boolean chatTemplateEnableThinking()` → chat‑template thinking flag. +- `boolean cachePrompt()` → prompt caching enabled. +- `boolean swaFull()` → full‑size SWA cache kept. +- `int cacheReuse()` → KV prefix‑reuse chunk size. +- `int gpuLayers()` → GPU layers offloaded. +- `int seed()` → RNG seed. +- `int cpuMoeLayers()` → CPU MoE layers. +- `int cpuFfnLayers()` → CPU FFN layers. +- `int kvUnifiedPerSlot()` → per‑slot KV cap. +- `String lazyMode()` → tensor‑read laziness. +- `int repeatLastN()` → repeat‑penalty window. +- `String cacheTypeK()` → KV‑cache type K. +- `String cacheTypeV()` → KV‑cache type V. +- `boolean flashAttn()` → Flash Attention enabled. +- `int batchSize()` → logical batch size. +- `int ubatchSize()` → physical batch size. +- `int threadsBatch()` → batch/prompt‑processing threads. +- `int mainGpu()` → primary GPU index. +- `String devices()` → device selection. +- `String provider()` → AI provider. +- `String remoteModel()` → remote model ID. +- `String baseUrl()` → OpenAI‑compatible base URL. +- `String apiKeyEnv()` → API key environment variable name. +- `String reasoningEffort()` → reasoning‑effort value. +- `int reasoningBudgetTokens()` → reasoning budget tokens. +- `float dryMultiplier()` → DRY multiplier. +- `float dryBase()` → DRY base. +- `int dryAllowedLength()` → DRY allowed length. +- `int dryPenaltyLastN()` → DRY penalty look‑back. +- `List drySequenceBreakers()` → unmodifiable DRY sequence breakers. +- `List stopStrings()` → unmodifiable stop strings. + +#### Dependencies +- `net.ladenthin.srcmorph.config.AiGenerationConfig` (default constants). +- `net.ladenthin.srcmorph.support.ConvertToRecord`. +- `org.jspecify.annotations.Nullable`. +- `java.util.Collections`, `java.util.List`, `java.util.Objects`. +- Lombok annotations: `@EqualsAndHashCode`, `@ToString`. + +#### Exceptions / Errors +- `Objects.requireNonNull(modelPath, "modelPath")` throws `NullPointerException` if `modelPath` is null. + +#### Concurrency +- Builder is not thread‑safe; intended for single‑thread use. +- `LlamaCppJniConfig` is immutable and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..6d8a6ff5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,106 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:25:53Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Builds the JSON request, endpoint, API key handling, and error/timing logic for an OpenAI‑compatible chat‑completion provider. + +#### Purpose +- Constructs chat‑completion request bodies with sampling knobs. +- Validates and builds the endpoint URL. +- Retrieves and secures the API key. +- Provides utilities for success checks, error messages, and timing calculations. + +#### Type +- `final class OpenAiCompatibleProviderSupport` (class, final) + - Extends `Object` + - Annotations: `@ToString` + - Fields: + - `static final String CHAT_COMPLETIONS_PATH` (String) + - `static final int ERROR_BODY_EXCERPT` (int) + - `private static final int HTTP_OK_FIRST` (int) + - `private static final int HTTP_OK_END` (int) + - `static final String HTTP_SCHEME` (String) + - `static final String HTTPS_SCHEME` (String) + - `private static final String LOOPBACK_HOST_NAME` (String) + - `private static final Pattern IPV4_LOOPBACK` (Pattern) + - `private static final String IPV6_LOOPBACK` (String) + - `private static final String ELLIPSIS` (String) + - `private static final ObjectMapper MAPPER` (ObjectMapper) + - `private final LlamaCppJniConfig config` (LlamaCppJniConfig) + - `@ToString.Exclude private final AiPromptSupport promptSupport` (AiPromptSupport) + - `@ToString.Exclude private final Function environment` (Function) + - `private final Java8CompatibilityHelper compatibilityHelper` (Java8CompatibilityHelper) + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, `Function environment`. +- `requestBody(AiGenerationRequest request)` consumes `AiGenerationRequest` fields: `promptKey()`, `sourceFile()`, `sourceText()`. +- `endpoint()` consumes `config.baseUrl()`. +- `apiKey()` consumes `config.apiKeyEnv()`, `environment.apply(...)`. +- `apiKeyFor(String endpoint)` consumes `endpoint` and `apiKey()`. +- `isLoopbackHost(String host)` consumes `host`. +- `isSuccess(int status)` consumes `status`. +- `errorMessage(String endpoint, int status, String body)` consumes `endpoint`, `status`, `body`. +- `timings(String text, ChatResponse response, double seconds)` consumes `text`, `ChatResponse.getUsage()`, `seconds`. + +#### Output +- `requestBody` returns JSON string. +- `endpoint` returns URL string. +- `apiKey` returns trimmed key or `null`. +- `apiKeyFor` returns key or `null`; throws `IOException` on insecure HTTP to non‑loopback. +- `isLoopbackHost` returns boolean. +- `isSuccess` returns boolean. +- `errorMessage` returns formatted message string. +- `timings` returns `AiGenerationTimings` instance with decoded rate. + +#### Core logic +- Build JSON body with optional fields based on config values. +- Trim and validate base URL scheme; remove trailing slashes; append chat‑completions path. +- Resolve API key from environment; trim; return `null` if absent or blank. +- For plain HTTP endpoints, ensure host is loopback; otherwise throw `IOException`. +- Determine loopback hosts via exact match, IPv4 regex, or IPv6 literal. +- Check HTTP status in 200–299 range. +- Construct error message with body excerpt up to 500 chars. +- Compute decode rate: `completionTokens / seconds`; return `AiGenerationTimings`. + +#### Public API +- `String requestBody(AiGenerationRequest request) -> request body` +- `String endpoint() -> chat‑completions URL` +- `@Nullable String apiKey() -> API key` +- `@Nullable String apiKeyFor(String endpoint) -> API key or null` +- `static boolean isLoopbackHost(String host) -> true if loopback` +- `static boolean isSuccess(int status) -> true if 2xx` +- `static String errorMessage(String endpoint, int status, String body) -> message` +- `static AiGenerationTimings timings(String text, ChatResponse response, double seconds) -> timings` + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper` +- `com.fasterxml.jackson.databind.node.ArrayNode` +- `com.fasterxml.jackson.databind.node.ObjectNode` +- `java.io.IOException` +- `java.net.URL` +- `java.util.List` +- `java.util.Objects` +- `java.util.function.Function` +- `java.util.regex.Pattern` +- `lombok.ToString` +- `net.ladenthin.llama.value.ChatResponse` +- `net.ladenthin.llama.value.Usage` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` in `endpoint()` if base URL not HTTP(S). +- `IOException` in `apiKeyFor()` if plain HTTP to non‑loopback host or URL parsing fails. +- `IOException` in `requestBody()` if JSON serialization fails. + +#### Concurrency +- No explicit synchronization; all fields are immutable after construction. +- Thread‑safe usage assumed. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..1a1a3d5c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,53 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:27:03Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Provides a pluggable AI generation layer that supports local llama.cpp models, OpenAI‑compatible APIs, and mock providers, exposing a unified request/response interface for source‑code transformation tasks. + +#### Purpose +- Central AI generation engine for source‑code transformation. +- Abstracts provider selection, configuration, and timing. + +#### Responsibilities +- **Provider abstraction** – `AiGenerationProvider` interface and concrete implementations (`MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`). +- **Factory & configuration** – `AiGenerationProviderFactory` resolves provider keys and builds `LlamaCppJniConfig` via a fluent builder. +- **Parsing & post‑processing** – `AiCompletionParser` strips Gemma‑4 thinking blocks; `OpenAiCompatibleProviderSupport` builds request bodies, validates endpoints, and extracts timing metrics. +- **Model handling** – `LlamaCppJniAiGenerationProvider` lazily loads and caches a `LlamaModel`, performs chat completions, and parses JSON responses. + +#### Key units +- **`AiGenerationProvider`** – interface for generating text and optional timings. +- **`AiGenerationProviderFactory`** – creates providers based on run/model keys. +- **`LlamaCppJniConfig`** – immutable config holder with 37 knobs for llama.cpp. +- **`LlamaCppJniAiGenerationProvider`** – local llama.cpp provider with lazy model loading, chat completion, and timing extraction. +- **`OpenAiCompatibleProviderSupport`** – helper for building OpenAI‑compatible requests, endpoint validation, API key handling, and error/timing utilities. +- **`AiCompletionParser`** – removes Gemma‑4 thinking blocks from raw completions. + +#### Data flow +1. **Request creation** – `AiGenerationRequest` (prompt key, source file/text, header) is passed to a provider. +2. **Provider selection** – `AiGenerationProviderFactory.effectiveProvider` resolves the key; `create` returns the appropriate provider. +3. **Generation** – Provider’s `generate` (or `generateWithTimings`) is invoked: + - For **llama.cpp**: `LlamaCppJniAiGenerationProvider` builds inference parameters, calls native `chatComplete`, parses JSON via `ChatResponseParser`, and extracts text via `AiCompletionParser`. + - For **OpenAI‑compatible**: `OpenAiCompatibleProviderSupport` builds the request body, validates the endpoint, retrieves the API key, sends the request, parses the response, and computes timings. +4. **Output** – A plain text answer (or `AiGenerationTimings` with metrics) is returned to the caller. + +#### Dependencies +- **Internal** – `AiPromptSupport`, `Java8CompatibilityHelper`, `MockAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`. +- **External** – `net.ladenthin.llama` (model, parameters, JSON parsing), `com.fasterxml.jackson` (JSON), `java.net.URL`, `java.io.IOException`, `org.jspecify.annotations.Nullable`. +- **Configuration** – `AiGenerationConfig.DEFAULT_*` constants used by `LlamaCppJniConfig.Builder`. + +#### Cross‑cutting +- **Immutability** – `LlamaCppJniConfig` is immutable; builders are single‑threaded. +- **Error handling** – `IOException` for missing markers, endpoint validation, and API key issues; `IllegalArgumentException` for unknown provider keys. +- **Timing** – `AiGenerationTimings` captures prompt/cache token counts and throughput; defaulted to zero when unavailable. +- **Thread safety** – Providers are stateless except for the optional native model cache; `LlamaCppJniAiGenerationProvider.model()` is not thread‑safe on first call but subsequent calls reuse the cached instance. All helper classes are immutable and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..75196605 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,49 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:34Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Computes a 256‑bin histogram of a byte stream in two OpenCL kernel passes. + +#### Purpose +- Builds a byte histogram for image or arbitrary byte data. +- Uses two‑pass reduction: per‑group partial histograms then global reduction. + +#### Type +- OpenCL C 1.2 kernels (`__kernel` functions) in a single source file. + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms to `partial` buffer. +- `histogram_reduce`: writes final 256‑bin histogram to `histogram` buffer. + +#### Core logic +- **histogram_partial** + 1. Zero local histogram bins in parallel. + 2. Iterate over input bytes in strided global work‑items, atomically increment local bin counts. + 3. Copy local histogram to global `partial` buffer per group. +- **histogram_reduce** + 1. Each work‑item handles one bin (if `bin < BINS`). + 2. Sum corresponding bin counts across all partial histograms. + 3. Store the sum in the final `histogram` buffer. + +#### Public API +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – global reduction. + +#### Constants and configuration +- `#define BINS 256` + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- None explicitly handled; out‑of‑bounds checks only for bin index in `histogram_reduce`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..e2a2f0ca --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,39 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:27:14Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Provides an OpenCL implementation for computing a 256‑bin histogram of arbitrary byte data using a two‑pass reduction strategy. + +#### Purpose +- Compute byte histograms for image or generic byte streams. +- Split work into per‑group partial histograms and a global reduction. + +#### Responsibilities +- **Partial histogram kernel**: build per‑work‑group local histograms and write them to a global buffer. +- **Global reduction kernel**: aggregate all partial histograms into a final 256‑bin result. + +#### Key units +- `histogram_partial` – `__kernel` that fills a per‑group local histogram and copies it to a global `partial` buffer. +- `histogram_reduce` – `__kernel` that sums across all partial histograms to produce the final `histogram` buffer. +- `BINS` constant (256) defines histogram size. + +#### Data flow +1. Host enqueues `histogram_partial` with input byte buffer, length, and a global `partial` buffer. +2. Each work‑group processes a strided segment of the input, atomically updates local bins, then writes its local histogram to `partial`. +3. Host enqueues `histogram_reduce` with the `partial` buffer, number of groups, and a global `histogram` buffer. +4. Each work‑item sums a single bin across all partial histograms and writes the result to `histogram`. + +#### Dependencies +- OpenCL runtime functions: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. +- Requires a global buffer sized `group_count * BINS` for partial results. + +#### Cross-cutting +- Uses atomic increments for thread‑safe bin updates. +- Local memory (`__local uint *local_bins`) is zeroed per work‑group before accumulation. +- Simple bounds check in `histogram_reduce` to guard against out‑of‑range bin indices. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..1738d866 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,46 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:27:24Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> A lightweight toolkit for processing byte streams: it builds OpenCL‑based histograms, offers a lock‑free ring buffer for I/O, and supplies shell/Python helpers for backup rotation and sales reporting. + +#### Purpose +- Deliver efficient byte‑level data processing primitives. +- Provide auxiliary scripts for system maintenance and reporting. + +#### Responsibilities +- **OpenCL kernels**: compute 256‑bin histograms via two‑pass reduction. +- **Ring buffer**: single‑producer/single‑consumer byte queue with power‑of‑two sizing. +- **Scripts**: automate backup rotation and generate monthly sales summaries from CSV. + +#### Key units +- `histogram_partial` / `histogram_reduce` kernels – build and reduce per‑group histograms. +- `ringbuf_t`, `ringbuf_status_t`, `ringbuf_init/free/write/read/used/free_space` – ring buffer API. +- `rotate_backups.sh` – backup rotation logic. +- `sales_report.py` – CSV parsing, revenue aggregation, CLI entry point. + +#### Data flow +1. **Histogram**: host → `histogram_partial` (input bytes → partial buffer) → `histogram_reduce` (partial → final histogram). +2. **Ring buffer**: producer writes via `ringbuf_write`; consumer reads via `ringbuf_read`; space queried by `ringbuf_used` / `ringbuf_free_space`. +3. **Scripts**: `rotate_backups.sh` archives a source directory, prunes old archives; `sales_report.py` reads CSV, parses orders, aggregates revenue by month/region, outputs TSV. + +#### Dependencies +- OpenCL runtime APIs for kernel execution. +- C standard library (`stddef.h`, `stdint.h`, `stdlib.h`, `string.h`) for ring buffer. +- Shell utilities (`tar`, `date`, `du`, `ls`, `rm`, `mv`, `basename`, `dirname`, `cut`) for backup script. +- Python standard library (`argparse`, `csv`, `collections`, `dataclasses`, `datetime`, `decimal`) for sales report. + +#### Cross-cutting +- Power‑of‑two sizing and modulo arithmetic in ring buffer. +- Lock‑free design: no mutexes, single‑producer/single‑consumer guarantees. +- Atomic increments in OpenCL kernels for thread‑safe histogram updates. +- Consistent error handling: status enums in C, exit codes in shell, exceptions in Python. +- Logging via stdout for transparency and debugging. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..780cab09 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,48 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:27:17Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides a lock‑free, power‑of‑two circular buffer for byte streams, enabling efficient single‑producer/single‑consumer data transfer. + +#### Purpose +- Offer a fixed‑size ring buffer API for byte‑level I/O. +- Support initialization, deallocation, reading, writing, and space queries. + +#### Responsibilities +- **Buffer Management** – allocate, free, and maintain head/tail indices. +- **Data Transfer** – read/write operations with wrap‑around handling. +- **Space Accounting** – compute used bytes and free space. + +#### Key units +- `ringbuf_t` – struct holding buffer pointer, capacity, head, tail. +- `ringbuf_status_t` – enum (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – create buffer. +- `ringbuf_free(ringbuf_t *rb)` – release resources. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – enqueue bytes. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – dequeue bytes. +- `ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `ringbuf_free_space(const ringbuf_t *rb)` – bytes available for writing. + +#### Data flow +1. **Initialization** → `ringbuf_init` allocates memory, sets indices to 0. +2. **Writing** → `ringbuf_write` copies up to `len` bytes into the buffer, updates `head`, handles wrap‑around. +3. **Reading** → `ringbuf_read` copies up to `len` bytes from the buffer to destination, updates `tail`, handles wrap‑around. +4. **Space queries** → `ringbuf_used` and `ringbuf_free_space` compute counts via modulo arithmetic. +5. **Cleanup** → `ringbuf_free` releases allocated memory. + +#### Dependencies +- Standard C headers: ``, ``, ``, ``. +- Internal: `ringbuf.h` defines types and API; `ringbuf.c` implements logic. + +#### Cross-cutting +- Power‑of‑two capacity enforcement (`is_power_of_two`). +- Lock‑free single‑producer/single‑consumer design (no mutexes). +- Error handling via `ringbuf_status_t` return codes. +- Memory management: dynamic allocation with `malloc`/`free`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..9fdbbc6f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,59 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:39Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Implements a power‑of‑two sized circular buffer with read/write and memory management. + +#### Purpose +- Provides a fixed‑size ring buffer for byte streams. +- Supports initialization, deallocation, reading, writing, and space queries. + +#### Type +- C source file (`ringbuf.c`). + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_free` releases allocated memory. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates memory, sets head/tail to 0. +- `ringbuf_free` frees memory, resets fields. +- `ringbuf_used` computes used bytes via modulo arithmetic. +- `ringbuf_free_space` computes available space. +- `ringbuf_write` writes up to two contiguous chunks, updates head. +- `ringbuf_read` reads up to two contiguous chunks, updates tail. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free buffer. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – bytes available for writing. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write data. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read data. + +#### Constants and configuration +- None defined in this file. + +#### Dependencies +- `stdlib.h` – `malloc`, `free`. +- `string.h` – `memcpy`. +- `ringbuf.h` – type and status definitions. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity not power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..7f6ea71d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,59 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:43Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides a fixed‑size byte ring buffer for single‑producer/single‑consumer use. + +#### Purpose +- Implements a lock‑free ring buffer with power‑of‑two capacity. +- Supports write, read, and space queries. + +#### Type +- Header (`ringbuf.h`) in C (C99). +- Exposes `ringbuf_t` struct, `ringbuf_status_t` enum, and API functions. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. + +#### Core logic +- `ringbuf_init` validates capacity (non‑zero, power of two), allocates `data` array, sets `head` and `tail` to 0. +- `ringbuf_write` copies up to `len` bytes from `src` into buffer, wrapping at `capacity`, updates `head`. +- `ringbuf_read` copies up to `len` bytes from buffer into `dst`, wrapping at `capacity`, updates `tail`. +- `ringbuf_used` computes `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space` computes `(capacity - 1) - ringbuf_used`. +- `ringbuf_free` frees allocated `data`. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – release resources. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – available space. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- ``, ``. +- Uses `malloc`, `free` (implicitly via `ringbuf_free`). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..d4dc16e7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,40 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:27:21Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Automates backup rotation and generates monthly sales summaries from CSV order exports. + +#### Purpose +- Maintain a rolling set of compressed backups for a specified directory. +- Produce revenue reports grouped by month and region from order CSV files. + +#### Responsibilities +- **Backup Rotation**: Create timestamped `.tar.gz` archives, prune older ones, and log actions. +- **Sales Reporting**: Parse CSV orders, filter by currency, aggregate revenue, and output tab‑separated summaries. + +#### Key units +- `rotate_backups.sh` – Bash script that builds and manages backup archives. +- `sales_report.py` – Python script exposing `parse_orders`, `revenue_by_month_and_region`, and `main` for CLI usage. + +#### Data flow +1. **Backup**: + `SOURCE_DIR → tar → temp archive → final archive → BACKUP_DIR` + Existing archives are listed, sorted, and the oldest beyond `KEEP` are removed. +2. **Sales Report**: + `CSV file → parse_orders → Order dataclass → revenue_by_month_and_region → sorted totals → stdout`. + +#### Dependencies +- **Shell**: `tar`, `date`, `du`, `ls`, `rm`, `mv`, `basename`, `dirname`, `cut`. +- **Python**: `argparse`, `csv`, `collections.defaultdict`, `dataclasses`, `datetime`, `decimal`. + +#### Cross-cutting +- Both tools enforce strict input validation and provide clear exit codes (`0` success, `1/2` error). +- Logging is performed via standard output, with removal actions echoed for transparency. +- Error handling uses simple exit status checks and exception propagation for malformed data. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..90580254 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,59 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:50Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates a dated, compressed backup of a directory and prunes older archives, keeping only the newest N. + +#### Purpose +- Generate a timestamped `.tar.gz` backup of a specified source directory. +- Retain only the most recent `KEEP` backups; delete older ones. +- Intended to be run directly from the command line. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`) +- Strict mode: `set -euo pipefail` + +#### Input +- `$1` → `SOURCE_DIR` (required) +- `$2` → `BACKUP_DIR` (required) +- `$3` → `KEEP` (optional, defaults to `7`) +- No external options or environment variables. + +#### Output +- Creates file `"$BACKUP_DIR/${name}_YYYYMMDDTHHMMSSZ.tar.gz"`. +- Prints creation and removal messages to stdout. +- Exit status `0` on success, `2` on invalid arguments or missing directory. + +#### Core logic +- Validate `KEEP` is a positive integer. +- Ensure `SOURCE_DIR` exists; create `BACKUP_DIR` if missing. +- Build archive name with UTC timestamp. +- Create temporary archive `"$tmp"`, then rename to final name. +- List existing archives sorted newest first. +- Delete all but the first `KEEP` entries, echoing each removal. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR`=`"${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR`=`"${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP`=`"${3:-7}"` +- `name`=`"$(basename "$SOURCE_DIR")"` +- `archive`=`"$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp`=`"$archive.partial"` + +#### Dependencies +- External commands: `tar`, `date`, `du`, `ls`, `rm`, `mv` +- Utilities: `basename`, `dirname`, `cut` + +#### Errors and exit codes +- `exit 2` if `KEEP` not a positive integer. +- `exit 2` if `SOURCE_DIR` does not exist. +- `trap` removes temporary file on exit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..79df480b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,59 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:54Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Generates a monthly sales report from CSV order exports, aggregating revenue by month and region in a specified currency. + +#### Purpose +- Produce revenue totals per month and region from order CSV files. +- Filter by currency and minimum revenue threshold. + +#### Type +- Python script (`.py`). + +#### Input +- Positional arguments: one or more CSV file paths (`csv_files`). +- Optional arguments: + - `--currency`: target currency code (default `EUR`). + - `--min-revenue`: minimum revenue to display (default `0`). +- CSV columns required: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints tab‑separated lines: `monthregionrevenuecurrency`. +- Exits with status `0` on success, `1` if no orders found. + +#### Core logic +- `parse_orders(path, currency)`: + - Open CSV, validate required columns. + - Skip rows with non‑matching currency. + - Convert `order_date` to `date`, `amount` to `Decimal`. + - Yield `Order` dataclass instances. +- `revenue_by_month_and_region(orders)`: + - Accumulate totals in `defaultdict(Decimal)` keyed by `(YYYY-MM, region)`. + - Return sorted dictionary of totals. +- `main(argv)`: + - Parse CLI arguments. + - Collect all orders from provided files. + - If none, print error and exit `1`. + - Iterate sorted totals; print rows meeting `min_revenue`. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` – read and filter orders. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` – aggregate totals. +- `main(argv=None) -> int` – command‑line entry point. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")`. + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` if CSV missing required columns or contains invalid data. +- `ValueError` propagated from `parse_orders` for malformed rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..a7b9b14e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,57 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:27:46Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A unified AI‑driven source‑code processing engine that validates, extracts facts, and generates code or documentation using pluggable back‑ends (llama.cpp, OpenAI‑compatible, or mock). + +#### Purpose +- Central framework for configuring, validating, and executing AI‑based source‑code indexing and generation across Maven projects. + +#### Responsibilities +- **Configuration & Validation** – `SrcMorphConfiguration`, `AiConditionEvaluator`, `AiFactExtractor`, `AiOversizeStrategy`. +- **AI Generation Layer** – `AiGenerationProvider` interface, concrete providers, factory, request/response plumbing. +- **Parsing & Post‑processing** – `AiCompletionParser`, `OpenAiCompatibleProviderSupport`. +- **Model & Timing Management** – `LlamaCppJniAiGenerationProvider`, `LlamaCppJniConfig`, `AiGenerationTimings`. + +#### Key units +- `SrcMorphConfiguration` – mutable bean for directories, model paths, prompt defs, fact groups, Llama settings. +- `AiConditionEvaluator` – stateless tree evaluator for `AiCondition` objects. +- `AiFactExtractor` – static fact‑block generator using regex counters. +- `AiOversizeStrategy` – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`). +- `AiGenerationProvider` – interface for generating text with optional timings. +- `AiGenerationProviderFactory` – resolves provider keys, builds `LlamaCppJniConfig`. +- `LlamaCppJniConfig` – immutable 37‑knob config for llama.cpp. +- `LlamaCppJniAiGenerationProvider` – lazy llama.cpp model loader, chat completion, JSON parsing. +- `OpenAiCompatibleProviderSupport` – request builder, endpoint/API‑key validation, timing extraction. +- `AiCompletionParser` – removes Gemma‑4 thinking blocks from raw completions. + +#### Data flow +1. **Setup** – Maven plugin/CLI populates `SrcMorphConfiguration`. +2. **File Routing** – `AiConditionEvaluator` checks each file against condition trees; included files proceed. +3. **Fact Generation** – `AiFactExtractor.factsBlock` creates deterministic fact strings per file. +4. **Oversize Handling** – `AiOversizeStrategy.fromConfig` selects strategy for files exceeding model context. +5. **AI Request** – `AiGenerationRequest` (prompt key, source text, header) is passed to `AiGenerationProviderFactory.effectiveProvider`. +6. **Generation** – Provider’s `generate`/`generateWithTimings` executes: + - *llama.cpp*: build inference params → native `chatComplete` → JSON parse → `AiCompletionParser` → plain text. + - *OpenAI‑compatible*: build request body → endpoint/API‑key validation → HTTP call → response parse → timing metrics. +7. **Output** – Plain text answer (or `AiGenerationTimings`) returned to caller. + +#### Dependencies +- **Internal** – `AiPromptSupport`, `Java8CompatibilityHelper`, `MockAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`. +- **External** – `net.ladenthin.llama` (model, parameters, JSON), `com.fasterxml.jackson` (JSON), `java.net.URL`, `java.io.IOException`, `org.jspecify.annotations.Nullable`. +- **Configuration** – `AiGenerationConfig.DEFAULT_*` constants, `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`. + +#### Cross‑cutting +- Immutable configs (`LlamaCppJniConfig`), thread‑safe stateless utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Defensive copying and null handling in configuration setters. +- Consistent error handling: `IllegalArgumentException` for misconfigurations, `IOException` for I/O or endpoint issues. +- Timing metrics (`AiGenerationTimings`) capture prompt/cache token counts and throughput; defaulted to zero when unavailable. +- Lazy model loading in `LlamaCppJniAiGenerationProvider`; subsequent calls reuse cached instance. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..5c548c24 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 842C8971 +- D: 2026-11-04T07:19:50Z +- T: 2026-11-04T07:27:50Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard project centers on an AI‑driven source‑code processing engine that validates, extracts facts, and generates code or documentation, orchestrated through a unified Java framework that supports Maven projects. The engine’s pluggable provider layer offers local llama.cpp, OpenAI‑compatible, and mock back‑ends, while the Java config package handles validation and orchestration of indexing and generation workflows. Complementary utilities in the “other” namespace provide efficient byte‑stream handling with OpenCL histograms, lock‑free ring buffers, and automation scripts for backup rotation and sales reporting. A separate SQL component supplies PostgreSQL and MySQL schemas for library, shop, and warehouse domains, exposing stored procedures for checkout, ordering, and inventory synchronization. + +#### Packages +- java/config — A Java library that configures, validates, and orchestrates AI‑driven source‑code indexing and generation for Maven projects. +- java — A unified framework for configuring, validating, and executing AI‑driven source‑code indexing and generation across Maven projects. +- java/provider — Provides a pluggable AI generation layer that supports local llama.cpp models, OpenAI‑compatible APIs, and mock providers, exposing a unified request/response interface for source‑code transformation tasks. +- other/kernels — Provides an OpenCL implementation for computing a 256‑bin histogram of arbitrary byte data using a two‑pass reduction strategy. +- other — A lightweight toolkit for processing byte streams: it builds OpenCL‑based histograms, offers a lock‑free ring buffer for I/O, and supplies shell/Python helpers for backup rotation and sales reporting. +- other/ringbuf — Provides a lock‑free, power‑of‑two circular buffer for byte streams, enabling efficient single‑producer/single‑consumer data transfer. +- other/scripts — Automates backup rotation and generates monthly sales summaries from CSV order exports. +- . — A unified AI‑driven source‑code processing engine that validates, extracts facts, and generates code or documentation using pluggable back‑ends (llama.cpp, OpenAI‑compatible, or mock). +- sql/library — A PostgreSQL library system that stores catalog, members, and loan data, and provides checkout, return, and reporting functionality. +- sql — A collection of three relational database schemas that model a library, an online shop, and a warehouse, each exposing stored procedures, functions, and audit mechanisms for common business operations such as lending, ordering, and inventory syncing. +- sql/shop — A MySQL schema for a web shop that defines products, orders, and order items, and provides a stored procedure to add items to an order while reserving stock and updating totals. +- sql/warehouse — Keeps the warehouse inventory in sync with nightly supplier feeds, logging each run and handling errors. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..af3c7d77 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,72 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:02Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Defines core tables for a lending library: authors, books, members, and loans, with constraints and indexes for integrity and performance. + +#### Purpose +- Store library catalog and member data. +- Track book loans and availability. + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` + +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author (author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` + +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` + +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `member_id BIGINT NOT NULL REFERENCES member (member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` + +- **Indexes** + - `idx_book_author ON book (author_id)` + - `idx_loan_member ON loan (member_id)` + - `idx_loan_open ON loan (due_on) WHERE returned_on IS NULL` + +#### Reads +- `author` (via `book.author_id` FK) +- `book` (via `loan.book_id` FK) +- `member` (via `loan.member_id` FK) + +#### Writes +- Inserts/updates/deletes on `author`, `book`, `member`, `loan` tables as per application operations. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- `author`, `book`, `member`, `loan` tables referenced by foreign keys and indexes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..66780d59 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,61 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:06Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Provides reporting views for a lending library, summarizing overdue loans, member loan statistics, and popular books. + +#### Purpose +- Generate read‑only reports on loan status and book popularity. +- Support library staff in tracking overdue items and member activity. + +#### Type +- PostgreSQL +- Views: `overdue_loans`, `member_loan_stats` +- Materialized view: `popular_books` +- Index: `idx_popular_books_id` + +#### Schema +- **overdue_loans** + - `loan_id` integer + - `member_id` integer + - `email` text + - `title` text + - `due_on` date + - `days_overdue` integer +- **member_loan_stats** + - `member_id` integer + - `full_name` text + - `loans_total` bigint + - `loans_open` bigint + - `last_loan_on` timestamp +- **popular_books** + - `book_id` integer + - `title` text + - `author_name` text + - `times_loaned` bigint + - **Index**: `idx_popular_books_id` on `popular_books(book_id)` (unique) + +#### Reads +- `loan` (all columns referenced) +- `member` (`member_id`, `email`, `full_name`) +- `book` (`book_id`, `title`, `author_id`) +- `author` (`author_id`, `full_name`) + +#### Writes +- None (all objects are read‑only). + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author` +- Functions: `CURRENT_DATE`, `CURRENT_DATE - INTERVAL '365 days'` +- Index: `idx_popular_books_id` (created on `popular_books`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..11fbc1eb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,66 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:10Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Handles book lending, returns, late fee calculation, and audit logging for a library system. + +#### Purpose +- Implements checkout, return, and late fee logic. +- Records audit trail of loan actions. + +#### Type +- Table: `loan_audit` +- Function: `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn` +- Procedure: `sp_return_book` +- Trigger: `trg_loan_audit` +- Dialect: PostgreSQL, PL/pgSQL + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member` (`member_id`, `is_blocked`) – check blocked status. +- `book` (`book_id`, `copies_free`) – verify free copy. +- `loan` (`loan_id`, `returned_on`, `book_id`) – update return status. +- `loan` (`due_on`, `returned_on`) – late fee calculation. + +#### Writes +- `book` – decrement `copies_free` on checkout; increment on return. +- `loan` – insert new loan record; update `returned_on` on return. +- `loan_audit` – insert audit rows on checkout and return. + +#### Relationships +- `loan_audit.loan_id -> loan.loan_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Verify member not blocked. + - Decrease `book.copies_free`; error if none. + - Insert into `loan` with `due_on = CURRENT_DATE + p_days`; return new `loan_id`. +- **sp_return_book(p_loan_id)** + - Update `loan.returned_on` to `CURRENT_DATE`; capture `book_id`. + - If no row updated, raise exception. + - Increment `book.copies_free`. +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Multiply by 50, cap at 2000. +- **trg_loan_audit_fn()** + - On `INSERT`: log `CHECKOUT`. + - On `UPDATE` where `returned_on` changes from NULL to non‑NULL: log `RETURN`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit` +- Functions: `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn` +- Trigger: `trg_loan_audit` on `loan` table. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..5d72e59d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,68 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:14Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds branch locations, creates a book_copy table linking books to branches, and updates loan and member tables to reference copies and branches. + +#### Purpose +- Introduces branch entity and book_copy table for multi‑branch inventory. +- Migrates existing book copy data into book_copy. +- Updates loan and member tables to reference copies and home branches. + +#### Type +- Table: `branch` +- Table: `book_copy` +- Table: `loan` (altered) +- Table: `member` (altered) +- Index: `idx_book_copy_book` + +#### Schema +- **branch** + - `branch_id SMALLSERIAL PRIMARY KEY` + - `name VARCHAR(100) NOT NULL UNIQUE` + - `city VARCHAR(100) NOT NULL` +- **book_copy** + - `copy_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `branch_id SMALLINT NOT NULL REFERENCES branch (branch_id)` + - `barcode VARCHAR(32) NOT NULL UNIQUE` + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE','ON_LOAN','LOST'))` +- **loan** + - added column `copy_id BIGINT REFERENCES book_copy (copy_id)` +- **member** + - renamed column `joined_on` → `member_since` + - added column `home_branch_id SMALLINT REFERENCES branch (branch_id)` +- **idx_book_copy_book** + - on `book_copy (book_id)` + +#### Reads +- `book` (SELECT book_id, copies_total, copies_free, isbn) +- `member` (UPDATE member SET home_branch_id = 1 WHERE home_branch_id IS NULL) + +#### Writes +- `branch`: 1 row inserted (`Main`, `Springfield`) +- `book_copy`: 1 INSERT statement generating `copies_total` rows per book (family: `copies_total` rows per book) +- `loan`: 1 column added (no data written) +- `member`: 1 column added, 1 UPDATE setting `home_branch_id` to 1 where NULL +- `book`: columns `copies_free`, `copies_total` dropped; constraint `book_free_le_total` dropped + +#### Relationships +- `book_copy.book_id` → `book.book_id` +- `book_copy.branch_id` → `branch.branch_id` +- `loan.copy_id` → `book_copy.copy_id` +- `member.home_branch_id` → `branch.branch_id` + +#### Dependencies +- `book` table (existing) +- `loan` table (existing) +- `member` table (existing) +- `book_copy` table (new) +- `branch` table (new) + +--- diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..a02899a3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,26 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:18Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Seeds the lending library database with authors, books, members, and loan records. + +#### Purpose +- Populate core tables with initial data for testing and benchmarking. + +#### Type +- PostgreSQL data insertion script (DDL not present). + +#### Writes +- `author`: 15 rows +- `book`: 150 rows +- `member`: 50 rows +- `loan`: 150 rows + +#### Dependencies +- None (only inserts into existing tables). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..41615aba --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,50 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:27:29Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL library system that stores catalog, members, and loan data, and provides checkout, return, and reporting functionality. + +#### Purpose +- Persist library catalog, member, and loan information. +- Enable book lending, returns, and late‑fee calculation. +- Offer read‑only reports on overdue items, member activity, and popular titles. + +#### Responsibilities +- **Data modeling** – core tables (`author`, `book`, `member`, `loan`) and later branch‑aware tables (`branch`, `book_copy`). +- **Business logic** – checkout, return, and late‑fee routines (`fn_checkout_book`, `sp_return_book`, `fn_late_fee`). +- **Audit trail** – `loan_audit` table and trigger `trg_loan_audit`. +- **Reporting** – views (`overdue_loans`, `member_loan_stats`) and materialized view (`popular_books`). +- **Seeding** – initial data population for testing. + +#### Key units +- **Tables**: `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`. +- **Views**: `overdue_loans`, `member_loan_stats`, `popular_books`. +- **Functions**: `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn`. +- **Procedure**: `sp_return_book`. +- **Trigger**: `trg_loan_audit` on `loan`. + +#### Data flow +1. **Checkout** – `fn_checkout_book` validates member and book availability, decrements `book.copies_free`, inserts a `loan` record, and logs `CHECKOUT` in `loan_audit`. +2. **Return** – `sp_return_book` updates `loan.returned_on`, increments `book.copies_free`, and logs `RETURN` via trigger. +3. **Late fee** – `fn_late_fee` calculates overdue days and caps the fee. +4. **Reporting** – Views aggregate `loan`, `member`, `book`, and `author` data to expose overdue counts, member statistics, and most‑loaned books. + +#### Dependencies +- **Internal** – foreign keys between `loan`, `book`, `member`, `author`, `book_copy`, and `branch`. +- **External** – PostgreSQL built‑in functions (`CURRENT_DATE`, `now()`) and standard SQL types. +- **Migration** – `04_migration_v2.sql` adds branch and copy tables, altering `loan` and `member` to reference them. + +#### Cross‑cutting +- Consistent use of `BIGSERIAL` primary keys and `CHECK` constraints for data integrity. +- Centralized audit via `loan_audit` and trigger `trg_loan_audit`. +- Indexes (`idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_book_copy_book`, `idx_popular_books_id`) support query performance across all views and routines. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..c241f664 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,62 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:27:40Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A collection of three relational database schemas that model a library, an online shop, and a warehouse, each exposing stored procedures, functions, and audit mechanisms for common business operations such as lending, ordering, and inventory syncing. + +#### Purpose +- Persist and manage domain data for library lending, e‑commerce orders, and warehouse stock. +- Provide transactional business logic (checkout, return, order item addition, nightly stock sync). +- Offer read‑only reporting and audit trails for compliance and analytics. + +#### Responsibilities +- **Library** – catalog, member, loan lifecycle, audit, and reporting. +- **Shop** – product catalog, order processing, stock reservation, and total calculation. +- **Warehouse** – nightly supplier feed ingestion, stock level maintenance, and sync logging. + +#### Key units +- **Library** + - Tables: `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`. + - Views: `overdue_loans`, `member_loan_stats`, `popular_books`. + - Functions/Procedures: `fn_checkout_book`, `fn_late_fee`, `sp_return_book`, `trg_loan_audit_fn`. + - Trigger: `trg_loan_audit` on `loan`. + +- **Shop** + - Tables: `product`, `customer_order`, `order_item`. + - Procedure: `add_order_item(p_order_id, p_sku, p_qty)`. + +- **Warehouse** + - Tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. + - Procedure: `dbo.usp_SyncStock(@Since)`. + +#### Data flow +1. **Library** + - `fn_checkout_book` validates, creates a `loan`, updates `book.copies_free`, logs `CHECKOUT`. + - `sp_return_book` marks `loan.returned_on`, restores `book.copies_free`, logs `RETURN`. + - `fn_late_fee` computes overdue charges. + - Views aggregate loan/member/book data for reports. + +2. **Shop** + - `add_order_item` locks the target `product`, checks stock, inserts/updates `order_item`, decrements `product.stock`, recalculates `customer_order.total_cents`. + +3. **Warehouse** + - `usp_SyncStock` aggregates new `SupplierFeed` rows, merges into `StockLevel` (update or insert), captures row counts, and records a single entry in `SyncLog` with success or error details. + +#### Dependencies +- **Internal** – foreign keys among core tables (`loan` ↔ `book`/`member`, `order_item` ↔ `product`/`customer_order`, `StockLevel` ↔ `SupplierFeed`). +- **External** – PostgreSQL built‑ins (`CURRENT_DATE`, `now()`), MySQL 8 features (`ENUM`, `FOR UPDATE`, `ON DUPLICATE KEY UPDATE`), SQL Server system functions (`SYSUTCDATETIME()`, `ERROR_MESSAGE()`), and standard SQL types. + +#### Cross-cutting +- Consistent use of primary keys (`BIGSERIAL`/`IDENTITY`) and `CHECK` constraints for data integrity. +- Centralized audit via `loan_audit` and `SyncLog`. +- Transactional integrity: all business logic runs within a single transaction, with rollback on error. +- Concurrency control: row‑level locking (`FOR UPDATE`) in the shop, `MERGE` with `OUTPUT` in the warehouse. +- Indexing strategy: dedicated indexes on foreign keys and frequently queried columns (`idx_book_author`, `idx_loan_member`, `idx_popular_books_id`, etc.) to support reporting and routine operations. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..f8a1e5ed --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,74 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:21Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> A MySQL schema for a web shop that stores products, customer orders, and order items, with a stored procedure to add items to an order while reserving stock and updating totals. + +#### Purpose +- Define tables for products, orders, and order items. +- Provide a procedure to add an item to an order, reserve stock, and recalculate the order total. + +#### Type +- **Tables**: `product`, `customer_order`, `order_item`. +- **Procedure**: `add_order_item`. +- Dialect: MySQL 8. + +#### Schema +- **product** + - `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT PK` + - `sku VARCHAR(40) NOT NULL UNIQUE uk_product_sku` + - `name VARCHAR(200) NOT NULL` + - `price_cents INT UNSIGNED NOT NULL` + - `stock INT NOT NULL DEFAULT 0` + - Index: `PRIMARY KEY (product_id)`. + +- **customer_order** + - `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PK` + - `customer_id BIGINT UNSIGNED NOT NULL` + - `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW'` + - `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` + - `total_cents INT UNSIGNED NOT NULL DEFAULT 0` + - Index: `PRIMARY KEY (order_id)`. + - Index: `idx_order_customer (customer_id, created_at)`. + +- **order_item** + - `order_id BIGINT UNSIGNED NOT NULL` + - `product_id INT UNSIGNED NOT NULL` + - `quantity SMALLINT UNSIGNED NOT NULL` + - `unit_price_cents INT UNSIGNED NOT NULL` + - Primary key: `PRIMARY KEY (order_id, product_id)`. + - Foreign keys: + - `fk_item_order (order_id) REFERENCES customer_order(order_id) ON DELETE CASCADE`. + - `fk_item_product (product_id) REFERENCES product(product_id)`. + +#### Reads +- `product` (SELECT product_id, price_cents WHERE sku = p_sku AND stock >= p_qty FOR UPDATE). +- `order_item` (SELECT SUM(quantity * unit_price_cents) WHERE order_id = p_order_id). + +#### Writes +- `order_item`: one INSERT (or UPDATE on duplicate) per call. +- `product`: one UPDATE to decrement stock. +- `customer_order`: one UPDATE to recalculate total_cents. + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (FK `fk_item_order`). +- `order_item.product_id -> product.product_id` (FK `fk_item_product`). + +#### Routine logic +- Parameters: `p_order_id BIGINT UNSIGNED`, `p_sku VARCHAR(40)`, `p_qty SMALLINT UNSIGNED`. +- Steps: + 1. Lock product row with matching SKU and sufficient stock. + 2. If not found, raise error. + 3. Insert or update `order_item` with quantity and unit price. + 4. Decrement `product.stock` by `p_qty`. + 5. Recalculate `customer_order.total_cents` from all items of the order. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item`. +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..ce4596c4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,49 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:27:33Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> A MySQL schema for a web shop that defines products, orders, and order items, and provides a stored procedure to add items to an order while reserving stock and updating totals. + +#### Purpose +- Persist shop data: products, customer orders, and order items. +- Offer a single procedure to add an item to an order, adjust inventory, and recalculate the order total. + +#### Responsibilities +- **Data definition** – tables for `product`, `customer_order`, `order_item`. +- **Business logic** – stored procedure `add_order_item` that: + - Locks the product row. + - Validates stock. + - Inserts/updates the order item. + - Decrements product stock. + - Recomputes the order total. + +#### Key units +- **Tables** + - `product`: SKU, name, price, stock. + - `customer_order`: status, total, timestamps. + - `order_item`: line items linking orders to products. +- **Procedure** + - `add_order_item(p_order_id, p_sku, p_qty)`: transactional item addition. + +#### Data flow +1. Caller supplies `p_order_id`, `p_sku`, `p_qty`. +2. Procedure locks the matching `product` row (`FOR UPDATE`). +3. If stock insufficient → error. +4. Insert or update `order_item` with quantity and unit price. +5. Decrement `product.stock` by `p_qty`. +6. Recalculate `customer_order.total_cents` from all items of that order. + +#### Dependencies +- Internal: `product`, `customer_order`, `order_item` tables. +- No external functions or sequences; relies on MySQL 8 features (ENUM, `FOR UPDATE`, `ON DUPLICATE KEY UPDATE`). + +#### Cross-cutting +- **Concurrency**: uses row‑level locking (`FOR UPDATE`) to prevent race conditions on stock. +- **Integrity**: foreign keys enforce referential integrity between orders, items, and products. +- **Error handling**: raises an error if the product SKU is not found or stock is insufficient. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..a90b7782 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,46 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:27:36Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Keeps the warehouse inventory in sync with nightly supplier feeds, logging each run and handling errors. + +#### Purpose +- Aggregate supplier feed quantities into the warehouse `StockLevel`. +- Record each sync operation in `SyncLog`. + +#### Responsibilities +- **Data ingestion**: read `SupplierFeed` rows since a given timestamp. +- **Inventory update**: merge aggregated quantities into `StockLevel`. +- **Audit & error handling**: log inserts/updates and any failures in `SyncLog`. + +#### Key units +- **dbo.StockLevel** – table of current on‑hand quantities per warehouse and SKU. +- **dbo.SupplierFeed** – staging table for raw supplier feed rows. +- **dbo.SyncLog** – audit trail of each sync run (counts, timestamps, errors). +- **dbo.usp_SyncStock** – stored procedure orchestrating the nightly sync. + +#### Data flow +1. `dbo.usp_SyncStock(@Since)` starts a transaction. +2. Aggregates `SupplierFeed` rows received after `@Since` by `WarehouseId`/`Sku`. +3. `MERGE` into `StockLevel`: + - `WHEN MATCHED`: `OnHand += Quantity`, update `UpdatedAt`. + - `WHEN NOT MATCHED`: insert new row with `OnHand = Quantity`. +4. Capture merge actions into a table variable. +5. Insert a single row into `SyncLog` with counts of inserted/updated rows or an error message. +6. Commit or rollback on error. + +#### Dependencies +- Internal tables: `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog`. +- SQL Server system functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. +- SQL Server features: `MERGE`, `OUTPUT`, `IDENTITY`. + +#### Cross-cutting +- Transactional integrity: all updates and logging occur within a single transaction. +- Error handling: rollback on exception, log error message, rethrow. +- T‑SQL patterns: use of `MERGE` with `OUTPUT` to capture row counts, aggregation via `GROUP BY`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..dd8d6201 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run1/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,76 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:26:27Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Synchronises nightly stock levels from a supplier feed into the warehouse inventory, recording changes and errors. + +#### Purpose +- Updates `StockLevel` with aggregated supplier feed quantities. +- Logs each sync run in `SyncLog`. + +#### Type +- **Table**: `dbo.StockLevel` (SQL Server, T‑SQL) +- **Table**: `dbo.SupplierFeed` (SQL Server, T‑SQL) +- **Table**: `dbo.SyncLog` (SQL Server, T‑SQL) +- **Procedure**: `dbo.usp_SyncStock` (SQL Server, T‑SQL) + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT (0)` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())` + - **PK**: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + - **PK**: `PK_SupplierFeed (FeedRowId)` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + - **PK**: `PK_SyncLog (SyncLogId)` + +#### Reads +- `dbo.SupplierFeed` (columns: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`) +- `dbo.StockLevel` (columns: `WarehouseId`, `Sku`, `OnHand`) + +#### Writes +- `dbo.StockLevel`: `INSERT` (new rows) and `UPDATE` (existing rows) via `MERGE`. +- `dbo.SyncLog`: `INSERT` (one row per sync run), with counts of inserted/updated rows or error message. + +#### Relationships +- `dbo.StockLevel (WarehouseId, Sku)` ↔ `dbo.SupplierFeed (WarehouseId, Sku)` (used in `MERGE` join). + +#### Routine logic (`dbo.usp_SyncStock`) +- Parameters: `@Since DATETIME2(0)` +- Steps: + 1. Start transaction. + 2. Aggregate `SupplierFeed` rows received since `@Since` by `WarehouseId` and `Sku`. + 3. `MERGE` into `StockLevel`: + - `WHEN MATCHED`: increment `OnHand` by aggregated `Quantity`, update `UpdatedAt`. + - `WHEN NOT MATCHED BY TARGET`: insert new row with `OnHand = Quantity`. + 4. Capture merge actions (`INSERT`/`UPDATE`) into table variable `@Changes`. + 5. Insert a log row into `SyncLog` with counts of inserted and updated rows. + 6. Commit transaction. + 7. On error: rollback, insert error log row, rethrow. + +#### Dependencies +- `dbo.SupplierFeed` +- `dbo.StockLevel` +- `dbo.SyncLog` +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`, `@@TRANCOUNT` +- System objects: `IDENTITY`, `MERGE`, `OUTPUT`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/meta/gpt-6-luna.json new file mode 100644 index 00000000..a6a1b088 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/meta/gpt-6-luna.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:35:21Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 179.8, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 84.1, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.4, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:39:48Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 86143, + "cachedPromptTokens": 86071, + "completionTokens": 18900, + "seconds": 179.2295825 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.010318, + "costUsd": 0.017383, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/meta/gpt-oss-20b.json new file mode 100644 index 00000000..79f51a9e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:39:49Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 103.7, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 97.8, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 4.8, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:43:15Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 87674, + "cachedPromptTokens": 58160, + "completionTokens": 17757, + "seconds": 103.1213308 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.004939, + "costUsd": 0.003234, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..f0bcca31 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,57 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:35:22Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Evaluates file-selection conditions using extension, size, line-count, modification-time, and path-glob rules, while validating condition trees and identifying when line counts are required. + +#### Purpose +- Match `AiFileContext` file facts against `AiCondition` trees. +- Validate condition configuration and detect whether any condition requires line counts. + +#### Type +- `public final class AiConditionEvaluator` — class; no supertypes or annotations. + +#### Input +- `AiConditionEvaluator()` — no arguments. +- `matches(AiCondition condition, AiFileContext context)` — condition tree and file facts. +- `validate(AiCondition condition)` and `usesLines(AiCondition condition)` — condition tree. +- Reads condition branches and group children; file name, size, line count, modification time, and relative path from `AiFileContext`. + +#### Output +- `matches` returns whether the file matches the condition. +- `validate` returns no value; rejects invalid condition trees. +- `usesLines` returns whether a `lines` condition occurs in the tree. +- No persistent state or resource writes. + +#### Core logic +- `matches` evaluates `and` children with all-match semantics, `or` children with any-match semantics, and `not` by negating its child. +- Leaf matching checks extension suffixes, size and line-count ranges, strict modification-time bounds, or a path glob through `AiSourceExcludeFilter`. +- `validate` requires exactly one branch or leaf per node; recursively validates combinator children. +- Rejects empty `and`/`or` groups and extension lists, unbounded size/line ranges, blank path globs, and invalid ISO-8601 timestamps. +- `usesLines` recursively searches combinator children and `not` descendants for a line-count condition. + +#### Public API +- `AiConditionEvaluator()` -> `AiConditionEvaluator` — create evaluator. +- `matches(AiCondition, AiFileContext)` -> `boolean` — test file against condition. +- `validate(AiCondition)` -> `void` — validate condition tree. +- `usesLines(AiCondition)` -> `boolean` — detect line-count conditions. + +#### Dependencies +- `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext` +- `AiSourceExcludeFilter` +- `Instant`, `DateTimeParseException`, `Collections`, `List` +- `@Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for invalid branch counts, empty groups or extensions, unbounded ranges, blank globs, and invalid timestamps. +- Invalid timestamp parsing wraps `DateTimeParseException` in `IllegalArgumentException`. +- `matches` throws `IllegalStateException` if no condition branch matches the expected branch selection. + +#### Concurrency +- Stateless evaluator; no synchronization or mutable instance state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..80177f7f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,44 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:35:29Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Groups child AI conditions so Maven configuration can bind `` and `` combinator contents as `…`. + +#### Purpose +- Holds the child `AiCondition` entries for an AI-condition combinator. +- Copies configured collections into a list; preserves `null` when no conditions are configured. + +#### Type +- `public class AiConditionGroup` — class; annotated `@ToString`; no supertypes declared. +- `conditions` is a nullable `List`. + +#### Input +- `setConditions(Collection)` accepts a nullable collection of child conditions. + +#### Output +- `getConditions()` returns the nullable child-condition list. +- `setConditions(...)` stores a defensive `ArrayList` copy, or `null`. + +#### Core logic +- `AiConditionGroup()` performs no initialization. +- `setConditions(...)` copies non-null input into a new `ArrayList`; null input clears the field. + +#### Public API +- `AiConditionGroup()` — constructs an empty group. +- `getConditions() -> @Nullable List` — returns child conditions. +- `setConditions(@Nullable Collection) -> void` — replaces child conditions. +- `toString() -> String` — Lombok-generated representation from `@ToString`. + +#### Dependencies +- `AiCondition` +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..4e21bc4b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,56 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:35:33Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Produces exact whole-source counts for configured regex-based facts and formats them for inclusion with an AI summary. + +#### Purpose +- `AiFactExtractor` counts configured source-code facts independently of AI summarization. +- Formats nonempty counts as a facts line followed by a blank line. + +#### Type +- `public final class AiFactExtractor` — final utility class; no supertypes declared. + +#### Input +- `factsBlock(List counters, String source)` — nullable counter list and complete source text. +- `validate(List counters)` — nullable list of `AiFactCounter` configuration entries. +- `countMatches(String pattern, String source)` — regex and text to search. + +#### Output +- `factsBlock` returns `""` if counters are null, empty, or yield no valid entries; otherwise returns the header, `label: count` entries, and trailing blank line. +- `validate` returns no value; rejects counters with missing labels or patterns and invalid regexes. +- No I/O or mutable instance state. + +#### Core logic +- `factsBlock` skips null counters and counters with null labels or patterns. +- For each remaining counter, compiles its pattern and counts non-overlapping matches across the full source using repeated `Matcher.find()`. +- Joins entries with `"; "` and formats them using the fixed header, `": "` label/count separator, and `"\n\n"` suffix. +- `validate` skips null lists and null counters; requires non-null labels and patterns, then compiles each pattern to check syntax. + +#### Public API +- `FACTS_HEADER: String` — exact whole-file facts prefix. +- `LABEL_COUNT_SEPARATOR: String` — label/count separator. +- `ENTRY_SEPARATOR: String` — consecutive-entry separator. +- `FACTS_SUFFIX: String` — facts/body separator. +- `factsBlock(List, String) -> String` — build formatted facts block. +- `validate(List) -> void` — validate counter configuration. + +#### Dependencies +- `AiFactCounter` +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for a non-null counter missing its label or pattern, or for an invalid regex; invalid-regex errors retain the `PatternSyntaxException` as cause. +- `factsBlock` skips null counters and counters with null labels or patterns. +- `countMatches` compiles each pattern; it does not catch regex compilation errors. +- `counters` is nullable in both public methods; `source` is not annotated nullable. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..4b5de4b4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,103 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:35:40Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Configures model routing, prompt limits, sampling, hardware, caching, and reasoning options for AI-generated source summaries. + +#### Purpose +- Carries per-model generation settings between Maven configuration and AI provider implementations. +- Supplies defaults and mutable JavaBean accessors for inference, prompt trimming, provider routing, and calibration. + +#### Type +- `public class AiGenerationConfig` — class; no declared supertypes; annotated `@ToString`, `@SuppressWarnings`. +- Public constants define defaults for context/output limits, sampling, threads, prompt trimming, caching, hardware, provider/API settings, reasoning, and DRY sampling. +- Uses nullable model path, chat-template thinking mode, and calibration; list settings hold DRY sequence breakers and stop strings. + +#### Input +- No-argument constructor; settings supplied through setters. +- Configuration values include GGUF model path, inference and sampling parameters, prompt limits, cache/GPU/device settings, provider and remote API options, reasoning and DRY options, stop strings, sequence breakers, and optional `AiCalibration`. +- `DEFAULT_THREADS` reads `Runtime.getRuntime().availableProcessors()`. + +#### Output +- Accessors expose configured values; setters mutate instance fields. +- List getters return unmodifiable views; list setters replace the backing list or reset it to empty when passed `null`. +- `toString()` is generated by Lombok over instance fields. + +#### Core logic +- Initializes configuration fields from public defaults, including a nullable, unset chat-template thinking mode and per-machine calibration. +- Provides direct getter/setter access for generation and provider configuration; does not perform inference or validate numeric ranges. +- Normalizes `null` to defaults in setters for lazy mode, cache types, devices, provider, remote model, base URL, and API-key environment name. +- Leaves model path, thinking mode, and calibration nullable; reasoning effort is assigned directly. +- Uses `-1`, empty strings, and zero values as documented “leave default,” disabled, or unset sentinels. +- Defines prompt-cache and SWA defaults for prefix reuse; exposes model routing between run-level providers and per-model provider overrides. + +#### Public API +- `AiGenerationConfig()` -> constructor. +- `DEFAULT_CONTEXT_SIZE`, `DEFAULT_MAX_OUTPUT_TOKENS`, `DEFAULT_TEMPERATURE`, `DEFAULT_THREADS`, `DEFAULT_MAX_INPUT_CHARS`, `DEFAULT_CHARS_PER_TOKEN`, `DEFAULT_SAFETY_MARGIN_CHARS`, `DEFAULT_WARN_ON_TRIM`, `DEFAULT_TOP_P`, `DEFAULT_TOP_K`, `DEFAULT_MIN_P`, `DEFAULT_TOP_N_SIGMA`, `DEFAULT_REPEAT_PENALTY`, `DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING`, `DEFAULT_CACHE_PROMPT`, `DEFAULT_REASONING_EFFORT`, `DEFAULT_REASONING_BUDGET_TOKENS`, `DEFAULT_SWA_FULL`, `DEFAULT_CACHE_REUSE`, `DEFAULT_GPU_LAYERS`, `DEFAULT_SEED`, `DEFAULT_CPU_MOE_LAYERS`, `DEFAULT_CPU_FFN_LAYERS`, `DEFAULT_KV_UNIFIED_PER_SLOT`, `DEFAULT_LAZY_MODE`, `DEFAULT_REPEAT_LAST_N`, `DEFAULT_CACHE_TYPE_K`, `DEFAULT_CACHE_TYPE_V`, `DEFAULT_FLASH_ATTN`, `DEFAULT_BATCH_SIZE`, `DEFAULT_UBATCH_SIZE`, `DEFAULT_THREADS_BATCH`, `DEFAULT_MAIN_GPU`, `DEFAULT_DEVICES`, `DEFAULT_PROVIDER`, `DEFAULT_REMOTE_MODEL`, `DEFAULT_BASE_URL`, `DEFAULT_API_KEY_ENV`, `DEFAULT_DRY_MULTIPLIER`, `DEFAULT_DRY_BASE`, `DEFAULT_DRY_ALLOWED_LENGTH`, `DEFAULT_DRY_PENALTY_LAST_N` — public static defaults. +- `getModelPath()` -> `@Nullable String` / `setModelPath(@Nullable String)` -> model file path. +- `getContextSize()` -> `int` / `setContextSize(int)` -> context window. +- `getMaxOutputTokens()` -> `int` / `setMaxOutputTokens(int)` -> output token limit. +- `getTemperature()` -> `float` / `setTemperature(float)` -> sampling temperature. +- `getThreads()` -> `int` / `setThreads(int)` -> inference CPU threads. +- `getCharsPerToken()` -> `int` / `setCharsPerToken(int)` -> prompt size estimate. +- `getMaxInputChars()` -> `int` / `setMaxInputChars(int)` -> input character limit. +- `isWarnOnTrim()` -> `boolean` / `setWarnOnTrim(boolean)` -> trim warning setting. +- `getTopP()` -> `float` / `setTopP(float)` -> nucleus sampling threshold. +- `getTopK()` -> `int` / `setTopK(int)` -> top-k sampling limit. +- `getRepeatPenalty()` -> `float` / `setRepeatPenalty(float)` -> repetition penalty. +- `getMinP()` -> `float` / `setMinP(float)` -> min-p threshold. +- `getTopNSigma()` -> `float` / `setTopNSigma(float)` -> top-n-sigma threshold. +- `getChatTemplateEnableThinking()` -> `@Nullable Boolean` / `setChatTemplateEnableThinking(@Nullable Boolean)` -> thinking kwarg. +- `isCachePrompt()` -> `boolean` / `setCachePrompt(boolean)` -> prompt-prefix caching. +- `isSwaFull()` -> `boolean` / `setSwaFull(boolean)` -> full SWA KV cache. +- `getCacheReuse()` -> `int` / `setCacheReuse(int)` -> prefix reuse chunk size. +- `getGpuLayers()` -> `int` / `setGpuLayers(int)` -> GPU layer offload. +- `getCpuMoeLayers()` -> `int` / `setCpuMoeLayers(int)` -> CPU MoE layers. +- `getSeed()` -> `int` / `setSeed(int)` -> generation RNG seed. +- `getCpuFfnLayers()` -> `int` / `setCpuFfnLayers(int)` -> CPU FFN layers. +- `getKvUnifiedPerSlot()` -> `int` / `setKvUnifiedPerSlot(int)` -> per-slot KV cap. +- `getLazyMode()` -> `String` / `setLazyMode(@Nullable String)` -> tensor-read mode. +- `getRepeatLastN()` -> `int` / `setRepeatLastN(int)` -> repeat penalty window. +- `getCacheTypeK()` -> `String` / `setCacheTypeK(@Nullable String)` -> K-cache data type. +- `getCacheTypeV()` -> `String` / `setCacheTypeV(@Nullable String)` -> V-cache data type. +- `isFlashAttn()` -> `boolean` / `setFlashAttn(boolean)` -> Flash Attention setting. +- `getBatchSize()` -> `int` / `setBatchSize(int)` -> logical batch size. +- `getUbatchSize()` -> `int` / `setUbatchSize(int)` -> physical batch size. +- `getThreadsBatch()` -> `int` / `setThreadsBatch(int)` -> prompt-processing threads. +- `getMainGpu()` -> `int` / `setMainGpu(int)` -> primary GPU index. +- `getDevices()` -> `String` / `setDevices(String)` -> backend device selection. +- `getProvider()` -> `String` / `setProvider(String)` -> per-model provider. +- `getRemoteModel()` -> `String` / `setRemoteModel(String)` -> remote model identifier. +- `getBaseUrl()` -> `String` / `setBaseUrl(String)` -> OpenAI-compatible API base URL. +- `getApiKeyEnv()` -> `String` / `setApiKeyEnv(String)` -> API-key environment variable name. +- `getReasoningEffort()` -> `String` / `setReasoningEffort(String)` -> reasoning-effort kwarg. +- `getReasoningBudgetTokens()` -> `int` / `setReasoningBudgetTokens(int)` -> reasoning token cap. +- `getDryMultiplier()` -> `float` / `setDryMultiplier(float)` -> DRY repetition multiplier. +- `getDryBase()` -> `float` / `setDryBase(float)` -> DRY penalty base. +- `getDryAllowedLength()` -> `int` / `setDryAllowedLength(int)` -> unpenalized n-gram length. +- `getDryPenaltyLastN()` -> `int` / `setDryPenaltyLastN(int)` -> DRY look-back window. +- `getDrySequenceBreakers()` -> `List` / `setDrySequenceBreakers(@Nullable List)` -> DRY reset tokens. +- `getStopStrings()` -> `List` / `setStopStrings(@Nullable List)` -> generation stop strings. +- `getCalibration()` -> `@Nullable AiCalibration` / `setCalibration(@Nullable AiCalibration)` -> timing calibration. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `AiCalibration` +- `Runtime` + +#### Exceptions / Errors +- No explicit exceptions or validation checks. +- Nullable model path, chat-template thinking mode, and calibration. +- `setLazyMode`, `setCacheTypeK`, `setCacheTypeV`, `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, and `setApiKeyEnv` normalize `null` to their defaults; list setters normalize `null` to empty lists. + +#### Concurrency +- Mutable, unsynchronized JavaBean; not thread-safe. +- List getters expose unmodifiable views of mutable backing lists. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..e430f946 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,48 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:35:54Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Routing rules choose whether oversized source files abort processing, use a head sample, use chunked summaries, or receive a deterministic model-free summary. + +#### Purpose +- Defines oversized-file handling strategies and parses routing-rule `` values. +- Uses `FAIL` when no strategy is configured. + +#### Type +- `public enum AiOversizeStrategy` — enum; no supertypes declared; `@Nullable` annotates the parser input. + +#### Input +- Enum constructor receives a `String configValue` for each strategy. +- `fromConfig(@Nullable String value)` consumes the configured strategy token. + +#### Output +- `configValue()` returns the strategy’s configuration token. +- `fromConfig(...)` returns the matching strategy; `null` or blank input returns `DEFAULT`. +- `DEFAULT` is the public constant `FAIL`. + +#### Core logic +- Associates `FAIL`, `SAMPLE`, `MAP_REDUCE`, and `DETERMINISTIC` with `fail`, `sample`, `mapReduce`, and `deterministic`. +- Trims input; blank or `null` selects `DEFAULT`. +- Matches tokens case-insensitively against enum values. +- Throws `IllegalArgumentException` for an unknown non-blank token. + +#### Public API +- `FAIL` — abort oversized-file processing. +- `SAMPLE` — summarize the trimmed file head in one call. +- `MAP_REDUCE` — summarize line-boundary chunks, then combine summaries. +- `DETERMINISTIC` — emit metadata and head/tail sample without a model. +- `DEFAULT: AiOversizeStrategy` — default strategy (`FAIL`). +- `configValue() -> String` — return config token. +- `fromConfig(String) -> AiOversizeStrategy` — parse config token. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `fromConfig(...)` throws `IllegalArgumentException` when a non-blank value matches no strategy. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..a56062d8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,86 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:35:59Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Configures source-file discovery, AI generation routing, llama.cpp fallbacks, and metadata for producing `.ai.md` files. + +#### Purpose +- `SrcMorphConfiguration` holds mutable run settings shared across Maven, future CLI/config-file binding, and plain Java callers. +- Keeps per-goal Maven lifecycle skip flags outside the engine configuration. + +#### Type +- `public class SrcMorphConfiguration` — class; mutable JavaBean; annotated `@ToString` and `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`. +- No declared supertypes or generics. + +#### Input +- Constructor accepts no arguments; initializes configured defaults. +- Setters accept base/output directories, source filters and file-size bounds, planning/force flags, provider and prompt/model/fact/routing definitions, llama.cpp fallback settings, version metadata, and project name. +- Nullable fields: `subtrees`, `excludes`, `fileExtensions`, `promptDefinitions`, `aiDefinitions`, `modelDirectory`, `fieldGenerations`, `factDefinitions`, `llamaModelPath`, and `projectName`. +- No resources are read by this class. + +#### Output +- Getters expose the configured values; setters mutate the bean’s fields. +- Configuration values describe source selection, model-path resolution, AI generation, and metadata for generated `.ai.md` files. +- Lombok `@ToString` generates a `toString()` representation. + +#### Core logic +- Initializes defaults: output directory `src/site/ai`, provider `mock`, llama.cpp context size `2048`, maximum output tokens `128`, temperature `0.15f`, threads `AiGenerationConfig.DEFAULT_THREADS`, and AI version `0.0.0`. +- Leaves other values at Java defaults unless set; supports null to represent unspecified optional collections, paths, and project name. +- Stores source roots/subtrees, excludes, extensions, and size limits for processing configuration. +- Stores prompt, model, field-generation routing, and reusable fact definitions. +- Provides llama.cpp settings as fallbacks when field-generation rules are empty; model paths may be resolved against `modelDirectory`. +- Stores plugin and AI versions and an optional aggregate-project title. + +#### Public API +- `DEFAULT_OUTPUT_DIRECTORY: String` — default output path. +- `DEFAULT_GENERATION_PROVIDER: String` — default provider. +- `DEFAULT_LLAMA_CONTEXT_SIZE: int` — default context window. +- `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS: int` — default output token limit. +- `DEFAULT_LLAMA_TEMPERATURE: float` — default sampling temperature. +- `DEFAULT_LLAMA_THREADS: int` — default inference thread count. +- `DEFAULT_AI_VERSION: String` — default AI logic version. +- `SrcMorphConfiguration()` — construct configuration with defaults. +- `getBaseDirectory()`/`setBaseDirectory(File)` -> project base directory. +- `getOutputDirectory()`/`setOutputDirectory(File)` -> generated-file directory. +- `isForce()`/`setForce(boolean)` -> regenerate existing values. +- `getSubtrees()`/`setSubtrees(List)` -> source subtree filter. +- `getExcludes()`/`setExcludes(List)` -> excluded source globs. +- `getFileExtensions()`/`setFileExtensions(List)` -> indexed extensions. +- `getMinFileSizeBytes()`/`setMinFileSizeBytes(long)` -> exclusive lower size bound. +- `getMaxFileSizeBytes()`/`setMaxFileSizeBytes(long)` -> inclusive upper size bound. +- `isPlanOnly()`/`setPlanOnly(boolean)` -> stop after routing plan. +- `getGenerationProvider()`/`setGenerationProvider(String)` -> default AI provider. +- `getPromptDefinitions()`/`setPromptDefinitions(List)` -> prompt templates. +- `getAiDefinitions()`/`setAiDefinitions(List)` -> model definitions. +- `getModelDirectory()`/`setModelDirectory(File)` -> relative model-path base. +- `getFieldGenerations()`/`setFieldGenerations(List)` -> per-field routing rules. +- `getFactDefinitions()`/`setFactDefinitions(List)` -> reusable fact groups. +- `getLlamaModelPath()`/`setLlamaModelPath(String)` -> fallback GGUF model path. +- `getLlamaContextSize()`/`setLlamaContextSize(int)` -> fallback context size. +- `getLlamaMaxOutputTokens()`/`setLlamaMaxOutputTokens(int)` -> fallback output token limit. +- `getLlamaTemperature()`/`setLlamaTemperature(float)` -> fallback sampling temperature. +- `getLlamaThreads()`/`setLlamaThreads(int)` -> fallback CPU thread count. +- `getPluginVersion()`/`setPluginVersion(String)` -> generated-header plugin version. +- `getAiVersion()`/`setAiVersion(String)` -> generated-header AI version. +- `getProjectName()`/`setProjectName(String)` -> aggregate index title. +- `toString()` -> Lombok-generated field representation. + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `net.ladenthin.srcmorph.config.AiModelDefinition` +- `net.ladenthin.srcmorph.config.AiFieldGenerationConfig` +- `net.ladenthin.srcmorph.config.AiFactDefinition` +- `net.ladenthin.srcmorph.config.AiGenerationConfig` +- `org.jspecify.annotations.Nullable` + +#### Concurrency +- Mutable bean with no synchronization or thread-safety guarantees. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/package.ai.md new file mode 100644 index 00000000..3812cb4c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/config/package.ai.md @@ -0,0 +1,50 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:38:22Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> Defines source-selection rules and AI generation settings, including file facts, model/provider options, and oversized-file handling for generated source summaries. + +#### Purpose +- Centralizes configuration and supporting logic for selecting source files and preparing AI-generated `.ai.md` summaries. +- Provides reusable condition evaluation, regex-based fact extraction, and oversized-file strategy parsing. + +#### Responsibilities +- **Source and generation configuration:** `SrcMorphConfiguration` stores discovery filters, routing definitions, llama.cpp fallback settings, and output metadata; `AiGenerationConfig` holds per-model inference, sampling, provider, prompt-limit, cache, hardware, and reasoning options. +- **File-condition rules:** `AiConditionGroup` represents combinator children; `AiConditionEvaluator` validates condition trees, matches file facts, and detects line-count requirements. +- **Summary facts and oversized inputs:** `AiFactExtractor` counts configured regex matches across source text and formats nonempty results; `AiOversizeStrategy` parses the configured oversized-file policy. + +#### Key units +- `SrcMorphConfiguration` — mutable run-level bean for source discovery, output, routing, fallback, and generated-header settings. +- `AiGenerationConfig` — mutable per-model settings with defaults for inference and provider options. +- `AiConditionEvaluator` — stateless evaluator and validator for `AiCondition` trees against `AiFileContext`. +- `AiConditionGroup` — nullable, defensively copied list of child `AiCondition` entries. +- `AiFactExtractor` — utility for validating `AiFactCounter` patterns and formatting whole-source match counts. +- `AiOversizeStrategy` — enum for `FAIL`, `SAMPLE`, `MAP_REDUCE`, and `DETERMINISTIC`, with configuration-token parsing. + +#### Data flow +- `AiConditionEvaluator` receives an `AiCondition` tree and `AiFileContext`, validates or evaluates the tree, and returns validity, a match result, or whether line counts are needed. +- `AiFactExtractor` receives counter definitions and complete source text, then returns a formatted facts block; empty or unusable counters produce an empty string. +- `AiOversizeStrategy.fromConfig` maps a configured token to a strategy, defaulting blank or null values to `FAIL`. +- `SrcMorphConfiguration` and `AiGenerationConfig` expose settings through JavaBean accessors; these classes do not themselves perform generation. + +#### Dependencies +- Condition evaluation uses `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, and `AiSourceExcludeFilter`. +- Fact extraction uses `AiFactCounter`; run configuration references `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, and `AiGenerationConfig`. +- Configuration beans use Java collections, `File`, Lombok `@ToString`, and JSpecify `@Nullable`. + +#### Cross-cutting +- Configuration classes are mutable JavaBeans without synchronization; `AiGenerationConfig` is explicitly not thread-safe. +- `AiGenerationConfig` normalizes several nullable settings to defaults and returns unmodifiable list views; `AiConditionGroup` copies non-null input collections. +- `AiConditionEvaluator` validates branch structure and rejects invalid ranges, empty groups, blank globs, and invalid timestamps; `AiFactExtractor.validate` rejects missing labels or patterns and invalid regexes. +- Defaults are explicit for generation settings and oversized-file handling; `SrcMorphConfiguration` includes fallback llama.cpp settings. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..fa29ce99 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,51 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:38:39Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Configures source-summary generation and routes AI completion requests to local, remote, or mock providers. + +#### Purpose +- Defines source-selection, generation, and oversized-file settings used to prepare `.ai.md` summaries. +- Provides configurable AI text-generation backends and shared completion handling. + +#### Responsibilities +- **Source and generation configuration:** `SrcMorphConfiguration` and `AiGenerationConfig` hold discovery, routing, model, inference, provider, and output settings. +- **File rules and facts:** `AiConditionEvaluator` evaluates source-selection conditions; `AiFactExtractor` validates and formats regex-based source facts. +- **Oversized-file policy:** `AiOversizeStrategy` parses configured handling modes: `FAIL`, `SAMPLE`, `MAP_REDUCE`, or `DETERMINISTIC`. +- **Provider dispatch and inference:** `AiGenerationProviderFactory` selects mock, llama.cpp JNI, or OpenAI-compatible generation; provider implementations handle local or remote completion requests. +- **Completion and metrics:** `AiCompletionParser` cleans completion text, while `AiGenerationTimings` represents available timing and token-count data. + +#### Key units +- `SrcMorphConfiguration` — mutable run-level source-discovery, output, routing, and fallback settings. +- `AiGenerationConfig` — mutable per-model inference and provider options with defaults. +- `AiConditionEvaluator` / `AiConditionGroup` — validate and evaluate file-condition trees and their grouped children. +- `AiFactExtractor` / `AiOversizeStrategy` — extract configured source facts and resolve oversized-file policy. +- `AiGenerationProvider` — provider contract for generation, timing, and cleanup. +- `AiGenerationProviderFactory` — resolves provider settings and constructs the selected backend. +- `LlamaCppJniAiGenerationProvider` / `LlamaCppJniConfig` — run local native inference using built model settings. +- `OpenAiCompatibleProviderSupport` — builds remote chat-completion requests and handles endpoint, key, HTTP-error, and timing support. +- `AiCompletionParser` — removes a leading Gemma-4 thinking block and trims the answer. + +#### Data flow +- Source contexts and condition trees are validated and evaluated; configured counters and source text can be converted into a formatted facts block. +- Run- and model-level settings feed provider selection; the chosen provider consumes an `AiGenerationRequest` and produces completion text with optional timing data. +- Local generation uses llama.cpp support and a cached model; remote generation builds a chat-completion request from prompt messages. +- Completion text is cleaned before returning; oversized-file configuration tokens map to a strategy, with blank or null values defaulting to `FAIL`. + +#### Dependencies +- Configuration and selection: `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, `AiSourceExcludeFilter`, `AiFactCounter`, and prompt/model/field-generation definitions. +- Provider contracts and support: `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, `LlamaCppJniProviderSupport`, mock and OpenAI-compatible providers, and `Java8CompatibilityHelper`. +- External libraries: llama.cpp JNI types, Jackson JSON nodes and `ObjectMapper`, and response `ChatResponse` / `Usage` data. + +#### Cross-cutting +- Configuration beans are mutable and unsynchronized; `LlamaCppJniConfig` is immutable after construction, with a mutable, non-thread-safe builder. +- Provider generation declares `IOException`; the provider interface supplies default zero-valued timings and a no-op `close()`. +- Local model initialization is lazy and unsynchronized, so concurrent first calls may race. +- OpenAI-compatible support restricts API-key use to HTTPS or loopback HTTP endpoints. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..65cca8d5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,45 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:36:09Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Removes leading Gemma-4 chain-of-thought text from model completions before the answer is stored. + +#### Purpose +- `AiCompletionParser` cleans raw LLM completion text, excluding a leading thinking block from the persisted answer. + +#### Type +- `public class AiCompletionParser` — class; non-final; annotated `@ToString`; no declared supertypes. + +#### Input +- `AiCompletionParser()` takes no parameters. +- `parseCompletion(String response)` consumes raw completion text; accepts `null`. + +#### Output +- `parseCompletion` returns trimmed answer text; returns `""` for `null`. +- Throws `IOException` if a leading thinking block has no closing marker. + +#### Core logic +- `parseCompletion` returns `""` for `null`, otherwise trims the response. +- If trimmed text does not start with `THINKING_BLOCK_START_MARKER`, returns it unchanged apart from trimming; markers within the text remain. +- For a leading thinking block, finds the first `THINKING_BLOCK_END_MARKER` after the start marker and returns the trimmed text after it. +- If no closing marker is found, throws an actionable `IOException` recommending a higher `maxOutputTokens` limit. + +#### Public API +- `AiCompletionParser()` -> constructor; creates parser. +- `THINKING_BLOCK_START_MARKER: String` — opening Gemma-4 thinking token. +- `THINKING_BLOCK_END_MARKER: String` — closing Gemma-4 thinking token. +- `parseCompletion(String response)` -> `String`; strips a leading thinking block. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `IOException` when a leading thinking block lacks its closing marker; message includes both markers and response length. +- `null` input is handled as an empty response. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..4e8ebc38 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,47 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:36:14Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Generates requested text through a pluggable AI backend and can report model timing for calibration. + +#### Purpose +- Defines the provider contract for generating text from an `AiGenerationRequest`. +- Supports generation timing and resource cleanup through default methods. + +#### Type +- `public interface AiGenerationProvider` — interface; extends `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume a request containing a prompt key, source file, source text, and current header. + +#### Output +- `generate(...)` returns generated text. +- `generateWithTimings(...)` returns `AiGenerationTimings`; its default implementation reports zero timing rates and counts. +- Default `close()` performs no action. + +#### Core logic +- `generate` is the provider implementation contract; implementations supply generated text. +- `generateWithTimings` delegates to `generate` and wraps the text with zero-valued timing fields unless overridden. +- `close` defaults to a no-op. + +#### Public API +- `generate(AiGenerationRequest)` -> `String` — generate text using default sampling. +- `generateWithTimings(AiGenerationRequest)` -> `AiGenerationTimings` — generate text with timing data. +- `close()` -> `void` — release provider resources. + +#### Dependencies +- `java.io.IOException` +- `java.lang.AutoCloseable` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `AiGenerationTimings` + +#### Exceptions / Errors +- `generate` and `generateWithTimings` declare `IOException` for provider failures. +- `generate` contract specifies a non-null result; it may be blank. +- `close` declares `IOException`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..7d526b65 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,58 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:36:18Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Selects the configured AI generation backend for a model run, defaulting to deterministic mock generation when no provider is specified. + +#### Purpose +- Resolves a run-level or model-level provider key and creates the matching `AiGenerationProvider`. +- Supports mock, llama.cpp JNI, and OpenAI-compatible providers. + +#### Type +- `public class AiGenerationProviderFactory` — class; annotated `@ToString`. + +#### Input +- `create(...)` receives the run provider name, `LlamaCppJniConfig`, and `AiPromptSupport`. +- `effectiveProvider(...)` receives nullable run and model provider keys. +- Holds a private `Java8CompatibilityHelper` instance. + +#### Output +- `create(...)` returns a newly created `AiGenerationProvider`. +- `effectiveProvider(...)` returns the trimmed model provider when nonblank; otherwise the run provider. +- Provider keys: `PROVIDER_MOCK = "mock"`, `PROVIDER_LLAMACPP_JNI = "llamacpp-jni"`, `PROVIDER_OPENAI_COMPATIBLE = "openai-compatible"`. + +#### Core logic +- `effectiveProvider` prefers a non-null, nonblank model provider, trimming it; otherwise uses the run provider. +- `create` defaults to `MockAiGenerationProvider` when the effective provider is null or blank. +- Dispatches recognized keys to `MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, or `OpenAiCompatibleAiGenerationProvider`; passes configuration and prompt support to the latter two. +- Rejects unrecognized provider keys. + +#### Public API +- `AiGenerationProviderFactory()` -> constructor +- `PROVIDER_MOCK: String` -> mock provider key +- `PROVIDER_LLAMACPP_JNI: String` -> llama.cpp JNI provider key +- `PROVIDER_OPENAI_COMPATIBLE: String` -> OpenAI-compatible provider key +- `effectiveProvider(String, String) -> @Nullable String` — resolve model or run provider +- `create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider` — instantiate selected provider +- `toString() -> String` — Lombok-generated representation + +#### Dependencies +- `AiGenerationProvider` +- `MockAiGenerationProvider` +- `LlamaCppJniAiGenerationProvider` +- `OpenAiCompatibleAiGenerationProvider` +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `Java8CompatibilityHelper` +- Lombok `@ToString` +- JSpecify `@Nullable` + +#### Exceptions / Errors +- `create` throws `IllegalArgumentException` for an unsupported provider key, with message `Unsupported AI provider: `. +- Null or blank effective provider selects the mock provider. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..4661d9fc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,62 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:36:24Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Generates AI completions from locally loaded GGUF models and reports llama.cpp token, throughput, and prompt-cache metrics. + +#### Purpose +- `LlamaCppJniAiGenerationProvider` runs chat inference through the llama.cpp JNI binding for `AiGenerationRequest` inputs. +- Lazily loads and reuses a configured model; parses completions and generation timings. + +#### Type +- `public final class LlamaCppJniAiGenerationProvider` — class implementing `AiGenerationProvider`, `AutoCloseable`. +- `@ToString` — Lombok-generated diagnostic string; excludes the native model handle and `support`. + +#### Input +- Constructor accepts `LlamaCppJniConfig config` and `AiPromptSupport promptSupport`; both are checked for null. +- `generate` and `generateWithTimings` accept an `AiGenerationRequest`. +- Model initialization reads configuration for model path, context size, threads, reasoning format, chat-template kwargs, SWA, cache reuse, GPU/CPU layer placement, KV settings, lazy mode, Flash Attention, cache types, batch sizing, and device selection. +- `LlamaCppJniProviderSupport` builds chat-template kwargs and per-request inference parameters. + +#### Output +- `generate` returns parsed completion text. +- `generateWithTimings` returns `AiGenerationTimings` with text, prompt/cache/predicted token counts, and throughput; absent timings produce zero metrics. +- `close` closes the loaded `LlamaModel`, if initialized. + +#### Core logic +- Constructor validates configuration and prompt support, then creates `LlamaCppJniProviderSupport`; model loading remains deferred. +- `model()` builds `ModelParameters` from configuration, applying optional settings only under their respective guards, then creates and caches one `LlamaModel`. +- Chat requests use support-generated inference parameters; `ChatResponseParser` parses the complete native response. +- `generate` logs truncation and prompt-cache reuse through `support`, then parses first-choice content with `AiCompletionParser`. +- `generateWithTimings` extracts response text and timing fields, including KV-cache prompt tokens. +- `close` releases the cached native model when present. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport)` — creates provider with lazy model loading. +- `generate(AiGenerationRequest) -> String` — generates completion text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` — returns text and model metrics. +- `close() -> void` — closes loaded model. + +#### Dependencies +- `AiGenerationProvider`, `AiGenerationRequest`, `AiGenerationTimings` +- `LlamaCppJniConfig`, `LlamaCppJniProviderSupport` +- `LlamaModel`, `ModelParameters`, `FlashAttn`, `ReasoningFormat` +- `ChatResponseParser`, `ChatResponse`, `Timings` +- `AiPromptSupport`, `AiCompletionParser`, `Java8CompatibilityHelper` +- `IOException`, `Map`, `Objects`, Lombok `ToString`, JSpecify `Nullable` + +#### Exceptions / Errors +- Constructor uses `Objects.requireNonNull` for `config` and `promptSupport`. +- `generate` declares `IOException`; `generateWithTimings` does not. +- Invalid model parameters or native inference failures may propagate from the JNI binding; no local catch is present. +- A null timing object yields zero token counts and rates. + +#### Concurrency +- The lazily initialized `model` is neither synchronized nor volatile; concurrent first calls may race to initialize it. +- The cached `LlamaModel` is shared across generation calls. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..dde37bb3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,77 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:36:31Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Configures local llama.cpp and OpenAI-compatible model generation, including sampling, hardware, caching, reasoning, and stop behavior. + +#### Purpose +- `LlamaCppJniConfig` holds immutable model-generation settings initialized from `AiGenerationConfig` defaults. +- `Builder` provides fluent configuration, with setters for model, sampling, runtime, provider, reasoning, and stopping options. + +#### Type +- `LlamaCppJniConfig` — final class; annotated `@ConvertToRecord`, Lombok `@ToString`, `@EqualsAndHashCode`; 41 final configuration fields. +- `Builder` — public static final class; nested in `LlamaCppJniConfig`; mutable fluent builder for the configuration. + +#### Input +- `builder(String modelPath)` requires the GGUF model path. +- `Builder` setter parameters configure 40 remaining values: sampling, threads, cache/KV, GPU/CPU placement, batch sizes, provider/API settings, reasoning and DRY sampling, sequence breakers, and stop strings. +- All builder settings except `modelPath` start with corresponding `AiGenerationConfig.DEFAULT_*` values; list settings start empty. +- Nullable inputs: `chatTemplateEnableThinking`, and nullable strings/lists accepted by selected setters. + +#### Output +- `build()` returns an immutable `LlamaCppJniConfig` populated from the builder. +- Accessors expose all 41 settings; list accessors return unmodifiable views. +- Lombok generates `equals`, `hashCode`, and `toString` across configuration fields. + +#### Core logic +- `builder(modelPath)` creates a builder and rejects a null path with `Objects.requireNonNull`. +- Builder setters replace their setting and return the same builder; nullable string setters restore the corresponding default, while null list setters restore empty lists. +- `build()` copies every builder value into the configuration; no further normalization or validation occurs. +- `chatTemplateEnableThinking == null` represents an unset option; provider can omit the chat-template kwarg. +- Empty strings and sentinel values (for example, `-1` or `0`) represent provider/binding defaults or disabled options as documented by accessors. + +#### Public API +- `builder(String)` -> `Builder` — start with model path. +- `modelPath()` -> `String` — GGUF model path; `contextSize()` -> `int` — context window; `maxOutputTokens()` -> `int` — output token limit. +- `temperature()` -> `float` — sampling temperature; `threads()` -> `int` — CPU threads; `topP()` -> `float` — nucleus threshold; `topK()` -> `int` — top-k limit. +- `minP()` -> `float` — min-p threshold; `topNSigma()` -> `float` — top-n-sigma threshold; `repeatPenalty()` -> `float` — repetition penalty. +- `chatTemplateEnableThinking()` -> `@Nullable Boolean` — thinking mode; `cachePrompt()` -> `boolean` — prompt caching; `swaFull()` -> `boolean` — full SWA KV cache; `cacheReuse()` -> `int` — KV prefix reuse. +- `gpuLayers()` -> `int` — GPU offload layers; `seed()` -> `int` — generation seed; `cpuMoeLayers()` -> `int` — CPU MoE layers; `cpuFfnLayers()` -> `int` — CPU FFN layers; `kvUnifiedPerSlot()` -> `int` — per-slot KV cap. +- `lazyMode()` -> `String` — tensor-read laziness; `repeatLastN()` -> `int` — repetition window; `cacheTypeK()` -> `String` — K-cache type; `cacheTypeV()` -> `String` — V-cache type; `flashAttn()` -> `boolean` — Flash Attention. +- `batchSize()` -> `int` — logical batch; `ubatchSize()` -> `int` — physical batch; `threadsBatch()` -> `int` — batch threads; `mainGpu()` -> `int` — primary GPU; `devices()` -> `String` — device selection. +- `provider()` -> `String` — AI provider; `remoteModel()` -> `String` — remote model ID; `baseUrl()` -> `String` — API base URL; `apiKeyEnv()` -> `String` — API-key environment-variable name. +- `reasoningEffort()` -> `String` — reasoning effort; `reasoningBudgetTokens()` -> `int` — reasoning token budget. +- `dryMultiplier()` -> `float` — DRY multiplier; `dryBase()` -> `float` — DRY base; `dryAllowedLength()` -> `int` — DRY allowed length; `dryPenaltyLastN()` -> `int` — DRY look-back window. +- `drySequenceBreakers()` -> `List` — DRY sequence breakers; `stopStrings()` -> `List` — stop strings. +- `Builder.contextSize(int)` -> `Builder` — set context window; `maxOutputTokens(int)` -> `Builder` — set output token limit; `temperature(float)` -> `Builder` — set temperature; `threads(int)` -> `Builder` — set CPU threads. +- `Builder.topP(float)` -> `Builder` — set nucleus threshold; `topK(int)` -> `Builder` — set top-k limit; `minP(float)` -> `Builder` — set min-p threshold; `topNSigma(float)` -> `Builder` — set top-n-sigma threshold; `repeatPenalty(float)` -> `Builder` — set repetition penalty. +- `Builder.chatTemplateEnableThinking(@Nullable Boolean)` -> `Builder` — set thinking mode; `cachePrompt(boolean)` -> `Builder` — set prompt caching; `swaFull(boolean)` -> `Builder` — set full SWA KV cache; `cacheReuse(int)` -> `Builder` — set KV prefix reuse. +- `Builder.gpuLayers(int)` -> `Builder` — set GPU offload; `seed(int)` -> `Builder` — set RNG seed; `cpuMoeLayers(int)` -> `Builder` — set CPU MoE layers; `cpuFfnLayers(int)` -> `Builder` — set CPU FFN layers; `kvUnifiedPerSlot(int)` -> `Builder` — set per-slot KV cap. +- `Builder.lazyMode(String)` -> `Builder` — set tensor-read laziness; `repeatLastN(int)` -> `Builder` — set repetition window; `cacheTypeK(String)` -> `Builder` — set K-cache type; `cacheTypeV(String)` -> `Builder` — set V-cache type; `flashAttn(boolean)` -> `Builder` — set Flash Attention. +- `Builder.batchSize(int)` -> `Builder` — set logical batch; `ubatchSize(int)` -> `Builder` — set physical batch; `threadsBatch(int)` -> `Builder` — set batch threads; `mainGpu(int)` -> `Builder` — set primary GPU; `devices(String)` -> `Builder` — set device selection. +- `Builder.provider(String)` -> `Builder` — set AI provider; `remoteModel(String)` -> `Builder` — set remote model; `baseUrl(String)` -> `Builder` — set API base URL; `apiKeyEnv(String)` -> `Builder` — set API-key environment variable. +- `Builder.reasoningEffort(String)` -> `Builder` — set reasoning effort; `reasoningBudgetTokens(int)` -> `Builder` — set reasoning budget. +- `Builder.dryMultiplier(float)` -> `Builder` — set DRY multiplier; `dryBase(float)` -> `Builder` — set DRY base; `dryAllowedLength(int)` -> `Builder` — set DRY allowed length; `dryPenaltyLastN(int)` -> `Builder` — set DRY look-back. +- `Builder.drySequenceBreakers(List)` -> `Builder` — set DRY breakers; `stopStrings(List)` -> `Builder` — set stop strings; `build()` -> `LlamaCppJniConfig` — create configuration. + +#### Dependencies +- `AiGenerationConfig` +- `ConvertToRecord` +- Lombok `EqualsAndHashCode`, `ToString` +- `Nullable` +- `Collections`, `List`, `Objects` + +#### Exceptions / Errors +- `builder(null)` throws `NullPointerException` with message `"modelPath"`. +- No range or semantic validation is performed by setters or `build()`. +- Nullable thinking mode is preserved; null selected string setters restore defaults, and null list setters produce empty lists. + +#### Concurrency +- `LlamaCppJniConfig` is immutable; list accessors expose unmodifiable views. +- `Builder` is mutable and explicitly not thread-safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..18130412 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,54 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:36:46Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Builds OpenAI-compatible chat-completion requests and protects API keys from being sent over cleartext HTTP to non-local servers. + +#### Purpose +- Supports `OpenAiCompatibleAiGenerationProvider` with request serialization, endpoint and API-key handling, HTTP status/error formatting, and call timing calculations. + +#### Type +- `final class OpenAiCompatibleProviderSupport` — final, package-private; no supertypes declared; annotated `@ToString`. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, and `Function environment`. +- `requestBody` reads the generation request’s prompt key, source file, and source text; reads model, sampling, stop-string, and reasoning settings from `config`. +- `endpoint` and `apiKeyFor` read `baseUrl`, `apiKeyEnv`, and environment values. +- `timings` consumes completion text, `ChatResponse` usage counts, and elapsed seconds. + +#### Output +- Serializes chat-completion request bodies as JSON; constructs chat-completions endpoint URLs. +- Returns a trimmed API key or `null`; refuses to return a key for non-loopback plain-HTTP endpoints. +- Produces HTTP success checks, error messages, and `AiGenerationTimings`. +- Holds final references to configuration, prompt support, environment lookup, and compatibility helper. + +#### Core logic +- `requestBody` creates system and user messages from `AiPromptSupport`; adds required sampling fields, conditionally adds non-blank model and reasoning effort, positive `top_k`/`min_p`, non-negative seed, and non-empty stop strings; sets `stream` to `false`; serializes with Jackson. +- `endpoint` trims `baseUrl`, accepts only `http://` or `https://`, removes trailing slashes, and appends `/chat/completions`. +- `apiKey` returns `null` if no environment-variable name is configured or its value is unset/blank; otherwise returns the trimmed value. +- `apiKeyFor` permits a configured key over HTTPS or plain HTTP to a loopback host; otherwise throws before sending the key. +- `isLoopbackHost` recognizes exact lowercase `localhost`, IPv4 literals matching `127.x.x.x`, and `[::1]`. +- `isSuccess` accepts HTTP statuses from 200 through 299; `errorMessage` includes endpoint, status, and at most 500 body characters, followed by `...` when truncated. +- `timings` uses response usage counts; computes decode rate as completion tokens per positive elapsed second, otherwise zero; sets prefill rate to zero. + +#### Dependencies +- Jackson: `ObjectMapper`, `ArrayNode`, `ObjectNode` +- Java: `IOException`, `URL`, `List`, `Objects`, `Function`, `Pattern` +- Lombok: `ToString` +- `ChatResponse`, `Usage` +- `AiGenerationRequest`, `AiPromptSupport` +- `Java8CompatibilityHelper`, `LlamaCppJniConfig`, `AiGenerationTimings` +- JSpecify: `Nullable` + +#### Exceptions / Errors +- Constructor rejects null `config`, `promptSupport`, or `environment` via `Objects.requireNonNull`. +- `requestBody` propagates `IOException` from JSON serialization. +- `endpoint` throws `IllegalArgumentException` for schemes other than HTTP or HTTPS. +- `apiKeyFor` propagates URL parsing `IOException`; throws `IOException` when a key would be sent over plain HTTP to a non-loopback host. +- `errorMessage` truncates error bodies longer than 500 characters. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/package.ai.md new file mode 100644 index 00000000..41e3b912 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/java/provider/package.ai.md @@ -0,0 +1,53 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:38:30Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Generates text from AI prompts through selectable local llama.cpp or OpenAI-compatible backends, with mock fallback, completion cleanup, and optional generation metrics. + +#### Purpose +- Define and configure pluggable AI text-generation providers for `AiGenerationRequest` inputs. +- Support local GGUF inference, OpenAI-compatible chat completions, and mock generation. + +#### Responsibilities +- **Provider selection and contract:** `AiGenerationProviderFactory` resolves model-level versus run-level provider settings, defaults to mock when unset, and dispatches supported provider keys; `AiGenerationProvider` defines generation, timing, and cleanup operations. +- **Local inference:** `LlamaCppJniAiGenerationProvider` lazily loads and reuses a llama.cpp `LlamaModel`, builds runtime parameters from configuration, parses completions, and reports token and throughput metrics. +- **Remote request support:** `OpenAiCompatibleProviderSupport` assembles chat-completion JSON, resolves endpoints and API keys, formats HTTP errors, and calculates timing metrics for its provider. +- **Completion cleanup:** `AiCompletionParser` removes a leading Gemma-4 thinking block and trims the remaining answer. +- **Generation configuration:** `LlamaCppJniConfig` stores immutable model, sampling, hardware, caching, provider, reasoning, and stop settings, initialized through a fluent builder. + +#### Key units +- `AiGenerationProvider` — provider interface for generation, optional timing results, and resource cleanup. +- `AiGenerationProviderFactory` — selects `mock`, `llamacpp-jni`, or `openai-compatible` implementations. +- `LlamaCppJniAiGenerationProvider` — performs native local-model inference and extracts response and timing data. +- `LlamaCppJniConfig` / `LlamaCppJniConfig.Builder` — immutable generation settings and their mutable fluent construction API. +- `OpenAiCompatibleProviderSupport` — constructs remote chat-completion requests and handles endpoint, key-safety, HTTP-result, and timing support. +- `AiCompletionParser` — strips leading Gemma-4 chain-of-thought text from completions. +- `AiGenerationTimings` — timing and token-count result used by provider APIs. + +#### Data flow +- The factory chooses a backend using run- and model-level provider keys, then constructs it with configuration and prompt support. +- A provider consumes `AiGenerationRequest`; local inference uses `LlamaCppJniProviderSupport` and a cached `LlamaModel`, while remote support builds a chat-completion request from prompt messages and configuration. +- Completion text is parsed to remove a leading thinking block; timing-capable paths return text with available token counts and rates. + +#### Dependencies +- Internal: `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, `LlamaCppJniProviderSupport`, `MockAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`, and `Java8CompatibilityHelper`. +- Local inference: llama.cpp JNI types including `LlamaModel`, `ModelParameters`, `ChatResponseParser`, and `Timings`. +- Remote request support: Jackson JSON nodes and `ObjectMapper`; response usage data from `ChatResponse` and `Usage`. +- Configuration defaults: `AiGenerationConfig`; completion parsing reports malformed thinking blocks through `IOException`. + +#### Cross-cutting +- Provider generation declares `IOException`; `AiGenerationProvider` supplies default zero-valued timing data and a no-op `close()`. +- `LlamaCppJniConfig` is immutable after building; its builder is mutable and not thread-safe, and configuration values receive no range validation. +- The local provider lazily initializes a shared `LlamaModel` without synchronization, so concurrent first calls may race. +- OpenAI-compatible support only returns API keys for HTTPS or loopback HTTP endpoints; other cleartext destinations are rejected. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..33064852 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/kernels/histogram.cl.ai.md @@ -0,0 +1,44 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:37:43Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Counts occurrences of each byte value in an image or byte stream and combines per-work-group counts into a 256-bin histogram. + +#### Purpose +- Computes a byte-value frequency histogram in two passes: work-group partial counts, then bin-wise reduction. + +#### Type +- OpenCL C 1.2 kernel source; defines two `__kernel` entry points. + +#### Input +- `histogram_partial`: `input` byte buffer, `length`, and caller-provided local-memory buffer `local_bins`. +- `histogram_reduce`: `partial` counts buffer and `group_count`. + +#### Output +- `histogram_partial` writes 256 counters per work-group to `partial`. +- `histogram_reduce` writes the final 256-bin counts to `histogram`. + +#### Core logic +- `histogram_partial` initializes local bins cooperatively, synchronizes the work-group, and has each work-item stride through input indices using global size. +- Input bytes select local bins, incremented with `atomic_inc`; after synchronization, work-items copy local counts to the group’s segment of `partial`. +- `histogram_reduce` assigns one work-item per bin, sums that bin across `group_count` partial histograms, and stores the result. + +#### Public API +- `histogram_partial(input, length, partial, local_bins) -> void` — count bytes per work-group. +- `histogram_reduce(partial, group_count, histogram) -> void` — combine partial counts per bin. + +#### Constants and configuration +- `BINS = 256` — number of byte-value bins. + +#### Dependencies +- OpenCL built-ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `barrier`, `atomic_inc`. +- OpenCL flag: `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- `histogram_reduce` returns without writing when the global ID is outside `BINS`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/kernels/package.ai.md new file mode 100644 index 00000000..50aa0c57 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/kernels/package.ai.md @@ -0,0 +1,32 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:38:48Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes the frequency distribution of byte values in image or stream data, producing a 256-bin histogram. + +#### Purpose +- Builds a histogram using work-group partial counts followed by a reduction across groups. + +#### Responsibilities +- `histogram.cl` defines OpenCL kernels to count input bytes and combine partial histograms. + +#### Key units +- `histogram_partial` — counts byte values into 256 local bins per work-group and writes group counts to `partial`. +- `histogram_reduce` — sums each bin across work-groups into the final `histogram`. +- `BINS` — sets the histogram size to 256 byte-value bins. + +#### Data flow +- `input` bytes and `length` → work-group-local counts → per-group segments in `partial` → `histogram` reduction. + +#### Dependencies +- OpenCL built-ins for work-item and group indexing, synchronization, and atomic increments; `CLK_LOCAL_MEM_FENCE`. + +#### Cross-cutting +- Uses cooperative local-memory initialization, work-group barriers, and atomic increments to form partial counts. +- `histogram_reduce` skips writes for global IDs outside the 256 bins. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..fe34b41d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,55 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:39:02Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides low-level byte-stream and image-data processing alongside standalone utilities for backup retention and regional sales reporting. + +#### Purpose +- Supplies a 256-bin byte histogram, a bounded FIFO byte ring buffer, and command-line tools for compressed backups and monthly sales reports. +- The components are independent; no shared data flow is described. + +#### Responsibilities +- **Byte processing:** OpenCL kernels count byte values and reduce work-group histograms; C ring-buffer routines manage storage, occupancy, and FIFO transfers. +- **Operational scripts:** A Bash utility creates dated compressed archives and prunes older backups. +- **Sales reporting:** A Python CLI validates and filters order CSV data, aggregates revenue by month and region, and prints qualifying totals. + +#### Key units +- `histogram_partial` — counts byte values into per-work-group 256-bin histograms. +- `histogram_reduce` — combines partial histograms into the final `histogram`. +- `BINS` — sets the histogram size to 256 byte-value bins. +- `ringbuf_t` — holds byte storage, capacity, and `head`/`tail` indices. +- `ringbuf_status_t` — represents ring-buffer initialization success or capacity/allocation errors. +- `ringbuf_init`, `ringbuf_free` — initialize and release/reset ring-buffer storage. +- `ringbuf_write`, `ringbuf_read` — transfer bytes in FIFO order, including across wraparound. +- `ringbuf_used`, `ringbuf_free_space` — report occupied and writable space. +- `rotate_backups.sh` — creates timestamped `.tar.gz` archives and retains a configured number, defaulting to seven. +- `Order` — frozen record of an order’s date, region, and decimal amount. +- `parse_orders(path, currency)` — validates CSV columns and yields orders matching the selected currency. +- `revenue_by_month_and_region(orders)` — returns monthly regional revenue totals sorted by key. +- `main(argv=None)` — runs the sales-report CLI and prints totals meeting its minimum-revenue threshold. + +#### Data flow +- **Histogram:** input bytes and length → work-group-local counts → per-group `partial` segments → final 256-bin `histogram`. +- **Ring buffer:** initialization validates capacity and allocates storage; writes fill available space, reads retrieve stored bytes, and occupancy queries expose used/free capacity. +- **Backups:** source directory → temporary compressed archive → dated archive in destination → prune older matching archives. +- **Sales:** CSV files → required-column validation and currency filtering → month/region aggregation → minimum-revenue filtering → tab-separated output. + +#### Dependencies +- OpenCL work-item/group indexing, synchronization, and atomic operations support histogram kernels. +- `ringbuf.c` implements the API declared in `ringbuf.h`; it uses `malloc`, `free`, `memcpy`, and `uint8_t`. +- `rotate_backups.sh` uses Bash and external commands including `tar`, `date`, `mkdir`, `mv`, `du`, `ls`, and `rm`. +- `sales_report.py` uses Python standard-library CSV, argument-parsing, date, decimal, record, and aggregation facilities. + +#### Cross-cutting +- Ring-buffer capacity must be a nonzero power of two; one slot is reserved to distinguish full from empty, and wraparound uses a capacity mask. The API describes single-producer/single-consumer use; synchronization is unspecified. +- Histogram construction uses local-memory initialization, work-group barriers, and atomic increments; reduction skips global IDs outside the 256 bins. +- Backup failures use strict Bash execution settings; invalid retention counts and missing source directories exit with status `2`. +- Sales parsing raises `ValueError` for missing columns or invalid dates/amounts; no matching orders writes to stderr and exits with status `1`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/ringbuf/package.ai.md new file mode 100644 index 00000000..54d2f2db --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/ringbuf/package.ai.md @@ -0,0 +1,40 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:38:51Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Stores and transfers byte streams through a bounded FIFO buffer, supporting partial reads and writes across wraparound. + +#### Purpose +- Provides a fixed-capacity byte ring buffer with initialization, cleanup, occupancy queries, and read/write operations. +- Reserves one slot to distinguish full from empty, so usable capacity is one less than configured capacity. + +#### Responsibilities +- **Buffer lifecycle and capacity:** validate power-of-two capacity, allocate storage, report status, and release/reset state. +- **Byte transfer and accounting:** copy available bytes in FIFO order, handle wraparound, and report used and writable space. + +#### Key units +- `ringbuf_t` — stores byte storage, capacity, and `head`/`tail` indices. +- `ringbuf_status_t` — reports initialization success, invalid capacity, or allocation failure. +- `ringbuf_init`, `ringbuf_free` — allocate and initialize the buffer, then release and reset it. +- `ringbuf_write`, `ringbuf_read` — transfer up to the requested number of bytes. +- `ringbuf_used`, `ringbuf_free_space` — report occupied and writable byte counts. + +#### Data flow +- `ringbuf_init` validates capacity and allocates storage; writes copy source bytes into available space, and reads copy stored bytes to the destination. +- `ringbuf_used` and `ringbuf_free_space` expose current occupancy; `ringbuf_free` releases storage. + +#### Dependencies +- `ringbuf.c` implements the API declared in `ringbuf.h`. +- Uses standard C allocation and copy routines (`malloc`, `free`, `memcpy`) and byte type `uint8_t`. + +#### Cross-cutting +- Capacity must be a nonzero power of two; index wraparound uses a capacity mask. +- The API describes a single-producer/single-consumer buffer; the provided summaries do not specify synchronization. +- Initialization reports `RINGBUF_EINVAL` for invalid capacity and `RINGBUF_ENOMEM` if allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..fe3f5c37 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,57 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:37:48Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Buffers and retrieves byte streams through a fixed-capacity ring buffer, preserving FIFO order across wraparound. + +#### Purpose +- Provides initialization, cleanup, usage queries, and bounded reads and writes for a byte ring buffer. +- Reserves one slot to distinguish full from empty. + +#### Type +- C implementation file; implements the `ringbuf.h` API. + +#### Input +- `ringbuf_init`: buffer pointer `rb`, power-of-two `capacity`. +- `ringbuf_write`: buffer `rb`, source bytes `src`, requested `len`. +- `ringbuf_read`: buffer `rb`, destination `dst`, requested `len`. +- Usage queries and `ringbuf_free`: ring-buffer pointer `rb`. + +#### Output +- Initialization returns a `ringbuf_status_t`; read and write return the number of bytes transferred. +- Maintains `rb->data`, `capacity`, `head`, and `tail`; `ringbuf_free` releases storage and resets these fields. + +#### Core logic +- `ringbuf_init` rejects zero or non-power-of-two capacities; allocates `capacity` bytes and initializes indices to zero. +- `ringbuf_used` computes occupancy as `(head - tail) & (capacity - 1)`; `ringbuf_free_space` subtracts occupancy and the reserved slot from capacity. +- `ringbuf_write` copies up to available space in at most two chunks, wrapping at the array boundary; advances `head` with a capacity mask. +- `ringbuf_read` copies up to available data in at most two chunks, wrapping at the array boundary; advances `tail` with a capacity mask. +- `ringbuf_free` releases the allocation and clears buffer state. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — allocate and initialize buffer. +- `ringbuf_free(ringbuf_t *rb) -> void` — release and reset buffer. +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report stored bytes. +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report writable bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — write available bytes. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — read available bytes. +- Internal helpers: `is_power_of_two`, `min_size`. + +#### Constants and configuration +- `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`, `RINGBUF_OK` — status values referenced from `ringbuf.h`; definitions are not present here. + +#### Dependencies +- `"ringbuf.h"` — buffer types, status type, and status values. +- ``: `malloc`, `free`. +- ``: `memcpy`. +- `uint8_t` is used for byte buffers. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` for zero or non-power-of-two capacity. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..53a5b184 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,59 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:37:55Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides fixed-capacity byte buffering between a single producer and a single consumer, with partial reads and writes. + +#### Purpose +- Declares the `ringbuf_t` API for storing and transferring bytes through a bounded ring buffer. +- Reserves one slot to distinguish full from empty, so usable capacity is `capacity - 1`. + +#### Type +- C header; C++ callers receive C linkage. +- `ringbuf_t`: struct containing the byte storage pointer, capacity, and producer-owned `head` and consumer-owned `tail` indices. +- `ringbuf_status_t`: enum of initialization status codes. + +#### Input +- `ringbuf_init`: buffer pointer and requested capacity. +- `ringbuf_write`: buffer pointer, source byte pointer, and requested length. +- `ringbuf_read`: buffer pointer, destination byte pointer, and requested length. +- `ringbuf_used` / `ringbuf_free_space`: buffer pointer. +- Capacity must be a nonzero power of two. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`; `ringbuf_write` and `ringbuf_read` return bytes actually copied. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. +- `ringbuf_init` may allocate storage; `ringbuf_free` releases buffer storage. + +#### Core logic +- Declares a fixed-capacity, single-producer/single-consumer byte ring buffer. +- Uses `head` as the next write index and `tail` as the next read index. +- Leaves one slot unused; the header does not specify the index-update or synchronization implementation. +- Read and write operations copy up to the requested length and report the actual count. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — initialize buffer. +- `ringbuf_free(ringbuf_t *rb) -> void` — release buffer. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — copy bytes into buffer. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — copy bytes out. +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report occupied bytes. +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report available bytes. + +#### Constants and configuration +- `RINGBUF_OK = 0` — success. +- `RINGBUF_EINVAL = -1` — capacity is zero or not a power of two. +- `RINGBUF_ENOMEM = -2` — allocation failed. +- Capacity requirement: power of two; usable capacity is one less than configured capacity. + +#### Dependencies +- ``: `size_t`. +- ``: `uint8_t`. + +#### Exceptions / Errors +- `ringbuf_init` reports invalid capacity with `RINGBUF_EINVAL` and allocation failure with `RINGBUF_ENOMEM`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/scripts/package.ai.md new file mode 100644 index 00000000..9790778d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/scripts/package.ai.md @@ -0,0 +1,40 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:38:57Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides command-line utilities for retaining dated compressed backups and producing monthly regional sales-revenue reports from CSV exports. + +#### Purpose +- Create and prune timestamped `.tar.gz` backups of a source directory. +- Aggregate CSV order data into monthly revenue totals by region and currency. + +#### Responsibilities +- **Backup rotation:** `rotate_backups.sh` validates its inputs, creates a compressed archive via a temporary path, then retains only the newest configured number. +- **Sales reporting:** `sales_report.py` parses orders, filters by currency, aggregates by month and region, and applies a minimum-revenue threshold to report rows. + +#### Key units +- `rotate_backups.sh` — standalone Bash script for dated backups and archive retention; defaults to keeping seven. +- `Order` — frozen record for an order’s date, region, and decimal amount. +- `parse_orders(path, currency)` — validates CSV columns and yields orders matching the selected currency. +- `revenue_by_month_and_region(orders)` — returns monthly regional totals sorted by key. +- `main(argv=None)` — parses sales-report CLI arguments, gathers orders, and prints qualifying totals. + +#### Data flow +- **Backups:** source directory → temporary compressed archive → final timestamped archive → prune older matching archives in the destination. +- **Sales report:** CSV files → required-column validation and currency filtering → monthly/region aggregation → minimum-revenue filtering → tab-separated output. + +#### Dependencies +- Backup script uses Bash and external commands including `tar`, `date`, `mkdir`, `mv`, `du`, `ls`, and `rm`. +- Sales report uses Python standard-library modules for CSV and argument parsing, dates, decimals, data records, and aggregation. + +#### Cross-cutting +- The utilities are independent command-line programs with no described shared data flow or internal collaboration. +- Backup failures use strict Bash execution settings; invalid retention counts and missing source directories exit with status `2`. +- Sales parsing reports missing columns or invalid dates and amounts as `ValueError`; no matching orders produces stderr output and status `1`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..e6db8c87 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,61 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:38:02Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates timestamped compressed backups of a source directory and prunes older archives to retain a configured number. + +#### Purpose +- Back up one directory as a dated `.tar.gz` archive and retain the newest requested number of archives for that directory. +- Run directly as `rotate_backups.sh`; not a sourced library. + +#### Type +- Bash (`#!/usr/bin/env bash`); strict mode: `set -euo pipefail`. + +#### Input +- Positional argument 1 → `SOURCE_DIR`: directory to back up; required. +- Positional argument 2 → `BACKUP_DIR`: archive destination; required. +- Positional argument 3 → `KEEP`: positive archive count; defaults to `7`. +- No option parser or environment variables read. +- Reads the contents of `SOURCE_DIR`; lists matching archives in `BACKUP_DIR`. + +#### Output +- Creates `BACKUP_DIR` if needed. +- Writes a compressed archive named `_.tar.gz` and prints its path and human-readable size. +- Deletes matching older archives beyond the newest `KEEP`, printing each removed path. +- Writes errors to stderr for invalid `KEEP` or missing `SOURCE_DIR`. + +#### Core logic +- Validate that `KEEP` contains a positive integer; otherwise exit with status `2`. +- Check that `SOURCE_DIR` exists as a directory; otherwise exit with status `2`. +- Create `BACKUP_DIR`, derive the source basename, and construct a UTC-timestamped archive path plus `.partial` temporary path. +- Install an `EXIT` trap to remove the partial archive. +- Run `tar` from the source directory’s parent to create the compressed temporary archive, then rename it to the final path. +- Print the archive path and size. +- List matching archives newest first and delete all entries after the first `KEEP`. + +#### Constants and configuration +- `SOURCE_DIR="${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR="${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP="${3:-7}"` +- `name="$(basename "$SOURCE_DIR")"` +- `archive="$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp="$archive.partial"` +- `archives` = array populated by `mapfile -t` from the archive listing. +- `old` = each archive selected for deletion by the pruning loop. + +#### Dependencies +- External commands: `basename`, `date`, `mkdir`, `tar`, `dirname`, `mv`, `echo`, `du`, `cut`, `ls`, `rm`. +- Uses Bash built-ins and syntax: `[[ ]]`, `mapfile`, process substitution, array slicing, and `trap`. +- Archive input and output paths are under `SOURCE_DIR` and `BACKUP_DIR`; no remote hosts, endpoints, or database tables. + +#### Errors and exit codes +- Exit `2` when `KEEP` is not a positive integer or `SOURCE_DIR` is not a directory. +- Required-argument expansion fails when either `SOURCE_DIR` or `BACKUP_DIR` is omitted; `set -u` and `set -e` can terminate execution on unset values or command failures. +- `EXIT` trap removes `tmp` if present. +- No explicit retry or timeout logic. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..56840d76 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/other/scripts/sales_report.py.ai.md @@ -0,0 +1,56 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:38:13Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Aggregates sales orders from CSV exports into monthly revenue totals by region and currency, with an optional minimum-revenue filter. + +#### Purpose +- Reads one or more order CSV files and reports monthly revenue grouped by region. +- Filters orders by currency and report rows by minimum revenue. + +#### Type +- Python module; defines frozen `Order` dataclass. + +#### Input +- Positional `csv_files`: one or more CSV paths; expects `order_date`, `region`, `amount`, and `currency` columns. +- `--currency`: currency to include; defaults to `EUR`. +- `--min-revenue`: minimum reported total; parsed as `Decimal`, defaults to `Decimal("0")`. +- CSV files are read as UTF-8 with newline handling. + +#### Output +- Prints tab-separated month, region, and revenue with two decimal places and the selected currency. +- Prints `no orders found` to stderr and returns status `1` when no matching orders exist. +- Returns status `0` after reporting results. + +#### Core logic +- `parse_orders` validates required CSV columns, skips rows in other currencies, and yields `Order` values with ISO-parsed dates, stripped regions, and decimal amounts. +- `revenue_by_month_and_region` sums order amounts by `YYYY-MM` and region, then returns totals sorted by key. +- `main` collects matching orders across input files, handles the empty result, and prints totals meeting the minimum-revenue threshold. +- Script entry point exits with `main()`’s status. + +#### Public API +- `Order(order_date, region, amount) -> Order` — immutable sales order record. +- `parse_orders(path, currency) -> iterator[Order]` — yield matching-currency orders. +- `revenue_by_month_and_region(orders) -> dict` — aggregate and sort monthly regional totals. +- `main(argv=None) -> int` — parse arguments and run report. +- CLI options: `--currency` (passed to `parse_orders`); `--min-revenue` (filters aggregated totals); positional `csv_files` (input paths). + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")`. +- `--currency` default: `EUR`. +- `--min-revenue` default: `Decimal("0")`. + +#### Dependencies +- Standard library: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. +- Uses `open`, `csv.DictReader`, `date.fromisoformat`, `Decimal`, `enumerate`, `print`, and `sys.exit`. + +#### Exceptions / Errors +- `parse_orders` raises `ValueError` listing missing required columns. +- Invalid date or amount raises a path-and-line-number `ValueError`, chained from `ValueError` or `InvalidOperation`. +- File opening and CSV parsing errors are not handled locally. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..16560591 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/package.ai.md @@ -0,0 +1,59 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:39:35Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> Supports AI-assisted source summarization, byte and operational utilities, and database workflows for lending, retail orders, and warehouse inventory. + +#### Purpose +- Configures source discovery and AI completion for generating `.ai.md` summaries. +- Provides byte-processing tools and standalone backup and sales-report utilities, alongside SQL workflows for library lending, retail fulfillment, and stock reconciliation. + +#### Responsibilities +- **AI summarization and generation:** Configure source selection, facts, model inference, oversized-file handling, and local, remote, or mock completion providers. +- **Byte processing:** Build 256-bin histograms with OpenCL kernels and provide a FIFO byte ring buffer in C. +- **Operational utilities:** Create and rotate compressed backups; validate sales CSV data, aggregate revenue by month and region, and report qualifying totals. +- **Database workflows:** Manage library catalog and loan lifecycles, retail order items and stock reservation, and warehouse supplier-receipt synchronization. +- **Schema and reporting:** Seed and migrate library inventory; expose loan, overdue, member-activity, and popular-book reports. + +#### Key units +- `SrcMorphConfiguration`, `AiGenerationConfig` — run-level source/output settings and per-model inference/provider options. +- `AiConditionEvaluator`, `AiFactExtractor`, `AiOversizeStrategy` — evaluate source rules, format source facts, and select oversized-file handling. +- `AiGenerationProvider`, `AiGenerationProviderFactory` — provider contract and selection for mock, llama.cpp JNI, or OpenAI-compatible generation. +- `AiCompletionParser`, `AiGenerationTimings` — clean completion text and represent timing and token-count data. +- `histogram_partial`, `histogram_reduce`, `BINS` — produce and combine per-work-group byte counts into 256-bin histograms. +- `ringbuf_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read` — manage bounded FIFO byte storage and transfers. +- `rotate_backups.sh` — create dated compressed archives and prune older backups. +- `Order`, `parse_orders`, `revenue_by_month_and_region`, `main` — parse currency-filtered sales CSVs, aggregate revenue, and run the report CLI. +- `author`, `book`, `member`, `loan`, `branch`, `book_copy` — represent library catalog, members, borrowing, and branch-level inventory. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `loan_audit` — handle library loan lifecycle, fees, and event auditing. +- `overdue_loans`, `member_loan_stats`, `popular_books` — report library loan status and activity. +- `product`, `customer_order`, `order_item`, `add_order_item` — represent retail orders and update order lines while reserving stock. +- `dbo.usp_SyncStock`, `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog` — reconcile warehouse receipts with stock balances and log synchronization outcomes. + +#### Data flow +- Source contexts and condition trees feed AI configuration and provider selection; an `AiGenerationRequest` yields completion text, which is cleaned before return. +- Histogram input bytes become per-group partial counts, then a final histogram; ring-buffer writes and reads transfer bytes in FIFO order. +- Backup utility archives a source directory to a dated compressed file, then prunes older matching archives. Sales CSVs are validated and currency-filtered, aggregated by month and region, then filtered by minimum revenue. +- Library checkout and return routines validate eligibility and availability, update loans and inventory, and record audit events; reports derive from library tables. +- Retail order-item updates check and lock product stock, insert or increment a line, decrement inventory, and recalculate order totals. +- Warehouse synchronization aggregates supplier receipts by warehouse and SKU, merges quantities into stock levels, and logs success or failure. + +#### Dependencies +- AI generation uses condition, file-context, fact-counter, prompt/model, and request types; external support includes llama.cpp JNI, Jackson, OpenAI-compatible chat responses, and `Java8CompatibilityHelper`. +- OpenCL kernels use work-item/group indexing, barriers, and atomic operations; C ring-buffer code uses standard allocation and memory-copy routines. +- Backup and sales tools depend on Bash/external archive and file commands, and Python standard-library CSV, argument-parsing, date, decimal, and aggregation facilities. +- SQL workflows use their respective library, retail, and warehouse tables; the library migration uses PostgreSQL `generate_series`. + +#### Cross-cutting +- AI configuration beans are mutable and unsynchronized; local model initialization is lazy and unsynchronized, while provider generation declares `IOException`. +- Ring-buffer capacity must be a nonzero power of two, with one slot reserved to distinguish full from empty; its API describes single-producer/single-consumer use. +- Library and retail SQL use integrity constraints, transactions, and concurrency controls; warehouse synchronization rolls back, logs failure details, and rethrows errors. +- SQL spans PostgreSQL, MySQL 8, and SQL Server; utility failures use domain-specific validation and exit behavior. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..32d78980 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: B9B0585D +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:39:46Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project combines AI-assisted source summarization—configuring source selection and generation settings, then routing completions to local, OpenAI-compatible, or mock providers—with byte-processing utilities such as image histograms and a bounded ring buffer. Standalone scripts handle compressed-backup retention and regional sales reports. Its SQL workflows cover library lending and auditing, retail order fulfillment and stock reservation, and warehouse supplier-stock reconciliation. + +#### Packages +- java/config — Defines source-selection rules and AI generation settings, including file facts, model/provider options, and oversized-file handling for generated source summaries. +- java — Configures source-summary generation and routes AI completion requests to local, remote, or mock providers. +- java/provider — Generates text from AI prompts through selectable local llama.cpp or OpenAI-compatible backends, with mock fallback, completion cleanup, and optional generation metrics. +- other/kernels — Computes the frequency distribution of byte values in image or stream data, producing a 256-bin histogram. +- other — Provides low-level byte-stream and image-data processing alongside standalone utilities for backup retention and regional sales reporting. +- other/ringbuf — Stores and transfers byte streams through a bounded FIFO buffer, supporting partial reads and writes across wraparound. +- other/scripts — Provides command-line utilities for retaining dated compressed backups and producing monthly regional sales-revenue reports from CSV exports. +- . — Supports AI-assisted source summarization, byte and operational utilities, and database workflows for lending, retail orders, and warehouse inventory. +- sql/library — Supports library lending by managing catalog inventory, member borrowing and returns, loan reporting, auditing, and schema evolution to branch-assigned copies. +- sql — Manages inventory and transactions across library lending, retail order fulfillment, and warehouse supplier-stock reconciliation. +- sql/shop — Maintains shop inventory and customer order totals by recording order lines, reserving product stock, and tracking order status. +- sql/warehouse — Reconciles recent supplier inventory receipts into warehouse stock balances and records each synchronization outcome. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..be05d667 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/01_schema.sql.ai.md @@ -0,0 +1,32 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:36:54Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models authors, books, library members, and loans, with constraints for inventory and loan dates. + +#### Purpose +- Defines the core lending-library schema for catalog records, member accounts, and book loans. +- Enforces book inventory limits, loan-date validity, and referential integrity. + +#### Type +- PostgreSQL schema DDL. + +#### Schema +- `author`: `author_id BIGSERIAL` (PK); `full_name VARCHAR(200)` NOT NULL; `birth_year SMALLINT` CHECK (`birth_year BETWEEN 1000 AND 2100`); `country_code CHAR(2)`. +- `book`: `book_id BIGSERIAL` (PK); `isbn VARCHAR(17)` NOT NULL UNIQUE; `title VARCHAR(300)` NOT NULL; `author_id BIGINT` NOT NULL FK to `author.author_id`; `published_year SMALLINT`; `copies_total INTEGER` NOT NULL DEFAULT `1`, CHECK (`copies_total >= 0`); `copies_free INTEGER` NOT NULL DEFAULT `1`, CHECK (`copies_free >= 0`); named constraint `book_free_le_total`: CHECK (`copies_free <= copies_total`). +- `member`: `member_id BIGSERIAL` (PK); `email VARCHAR(254)` NOT NULL UNIQUE; `full_name VARCHAR(200)` NOT NULL; `joined_on DATE` NOT NULL DEFAULT `CURRENT_DATE`; `is_blocked BOOLEAN` NOT NULL DEFAULT `FALSE`. +- `loan`: `loan_id BIGSERIAL` (PK); `book_id BIGINT` NOT NULL FK to `book.book_id`; `member_id BIGINT` NOT NULL FK to `member.member_id` ON DELETE CASCADE; `loaned_on DATE` NOT NULL DEFAULT `CURRENT_DATE`; `due_on DATE` NOT NULL; `returned_on DATE`; named constraint `loan_due_after_loan`: CHECK (`due_on > loaned_on`). +- Index `idx_book_author`: `book(author_id)`, default method. +- Index `idx_loan_member`: `loan(member_id)`, default method. +- Index `idx_loan_open`: `loan(due_on)`, default method, WHERE `returned_on IS NULL`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (ON DELETE CASCADE) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..30839f63 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/02_views.sql.ai.md @@ -0,0 +1,55 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:36:59Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Provides lending-library reports for overdue loans, member borrowing activity, and books frequently loaned during the past year. + +#### Purpose +- `overdue_loans`: reports unreturned loans past their due date. +- `member_loan_stats` and `popular_books`: summarize member activity and recent book popularity. + +#### Type +- PostgreSQL views: `overdue_loans`, `member_loan_stats`. +- PostgreSQL materialized view: `popular_books`. +- Index: `idx_popular_books_id`. + +#### Schema +- `overdue_loans`: + - `loan_id` — source type + - `member_id` — source type + - `email` — source type + - `title` — source type + - `due_on` — source type + - `days_overdue` — integer (`CURRENT_DATE - due_on`) +- `member_loan_stats`: + - `member_id` — source type + - `full_name` — source type + - `loans_total` — bigint (`COUNT`) + - `loans_open` — bigint (`COUNT ... FILTER`) + - `last_loan_on` — same type as `loan.loaned_on` (`MAX`) +- `popular_books`: + - `book_id` — source type + - `title` — source type + - `author_name` — same type as `author.full_name` + - `times_loaned` — bigint (`COUNT`) +- Index `idx_popular_books_id`: unique B-tree on `popular_books (book_id)`. + +#### Reads +- `loan`: `loan_id`, `member_id`, `book_id`, `due_on`, `returned_on`, `loaned_on`. +- `member`: `member_id`, `email`, `full_name`. +- `book`: `book_id`, `title`, `author_id`. +- `author`: `author_id`, `full_name`. + +#### Writes +- Defines materialized-view storage for `popular_books`, populated from its query. + +#### Relationships +- `loan.member_id -> member.member_id` (`overdue_loans`, `member_loan_stats`). +- `loan.book_id -> book.book_id` (`overdue_loans`, `popular_books`). +- `book.author_id -> author.author_id` (`popular_books`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..b7c267be --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/03_routines.sql.ai.md @@ -0,0 +1,60 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:37:06Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Implements library book checkout and return, calculates overdue fees, and records checkout/return events for loan auditing. + +#### Purpose +- Manage loan creation and return, including available-copy counts and blocked-member checks. +- Calculate capped late fees and audit loan lifecycle changes. + +#### Type +- PostgreSQL: table, PL/pgSQL and SQL functions, procedure, trigger. + +#### Schema +- `loan_audit` + - `audit_id BIGSERIAL` — primary key (unnamed constraint). + - `loan_id BIGINT NOT NULL`. + - `action VARCHAR(10) NOT NULL` — CHECK (unnamed constraint): `CHECKOUT`, `RETURN`. + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()`. +- No indexes declared. + +#### Reads +- `member.member_id`, `member.is_blocked` — checkout eligibility. +- `book.book_id`, `book.copies_free` — checkout availability. +- `loan.loan_id`, `loan.returned_on` — return eligibility. +- Function inputs `p_due_on`, `p_returned_on`; trigger inputs `TG_OP`, `NEW.loan_id`, `NEW.returned_on`, `OLD.returned_on`. + +#### Writes +- `book.copies_free` — checkout decrements when positive; return increments. +- `loan.book_id`, `loan.member_id`, `loan.due_on` — checkout inserts 1 loan row. +- `loan.returned_on` — return procedure updates an unreturned loan to `CURRENT_DATE`. +- `loan_audit.loan_id`, `loan_audit.action` — trigger inserts 1 `CHECKOUT` row per loan insert or 1 `RETURN` row when `returned_on` transitions from NULL to non-NULL. + +#### Relationships +- `loan_audit.loan_id -> loan.loan_id` — audit association; no foreign-key constraint declared. +- `loan.book_id -> book.book_id` — return procedure uses the loan’s book to restore a copy; no foreign-key constraint declared. + +#### Routine logic +- `fn_checkout_book(p_member_id BIGINT, p_book_id BIGINT, p_days INTEGER DEFAULT 21) RETURNS BIGINT` + - Raises an exception for a blocked member or when no free copy can be decremented. + - Inserts a loan due on `CURRENT_DATE + p_days`; returns its `loan_id`. +- `sp_return_book(p_loan_id BIGINT)` + - Marks an unreturned loan returned today; raises an exception if unknown or already returned. + - Increments the corresponding book’s free-copy count. +- `fn_late_fee(p_due_on DATE, p_returned_on DATE) RETURNS INTEGER` + - Immutable SQL function; computes nonnegative overdue days using `CURRENT_DATE` when return date is NULL, charges 50 cents per day, capped at 2000 cents. +- `trg_loan_audit_fn() RETURNS TRIGGER` + - Inserts `CHECKOUT` audit on loan insertion; inserts `RETURN` audit when `returned_on` changes from NULL to non-NULL; returns `NEW`. +- `trg_loan_audit` + - Row-level AFTER INSERT or UPDATE OF `loan.returned_on`; executes `trg_loan_audit_fn`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Built-in: `now()`, `CURRENT_DATE`, `COALESCE`, `GREATEST`, `LEAST`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..1143b555 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,53 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:37:15Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Migrates a lending library from book-level copy counters to individually tracked, branch-assigned copies and adds branch affiliation for members. + +#### Purpose +- Add library branches and per-copy barcode, branch, and availability tracking. +- Link loans to copies, assign members a home branch, and retire book-level copy counters. + +#### Type +- PostgreSQL migration script; creates tables and an index, alters existing tables, and inserts/updates data. + +#### Schema +- `branch` + - `branch_id SMALLSERIAL` — primary key. + - `name VARCHAR(100) NOT NULL UNIQUE`. + - `city VARCHAR(100) NOT NULL`. +- `book_copy` + - `copy_id BIGSERIAL` — primary key. + - `book_id BIGINT NOT NULL` — foreign key to `book(book_id)`. + - `branch_id SMALLINT NOT NULL` — foreign key to `branch(branch_id)`. + - `barcode VARCHAR(32) NOT NULL UNIQUE`. + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE', 'ON_LOAN', 'LOST'))`. +- `loan`: adds nullable `copy_id BIGINT`, foreign key to `book_copy(copy_id)`. +- `member`: renames `joined_on` to `member_since`; adds nullable `home_branch_id SMALLINT`, foreign key to `branch(branch_id)`. +- `book`: drops constraint `book_free_le_total`; drops columns `copies_free` and `copies_total`. +- Index `idx_book_copy_book`: on `book_copy(book_id)`. + +#### Reads +- `book.book_id`, `book.isbn`, `book.copies_total`, `book.copies_free` — used to generate copy rows and derive their status. +- `generate_series(1, b.copies_total)` — generates copy sequence values. + +#### Writes +- `branch`: 1 row inserted (`Main`, `Springfield`). +- `book_copy`: inserts one row per generated copy for each book; barcode uses `isbn` and sequence number; status is `AVAILABLE` when sequence number is at most `copies_free`, otherwise `ON_LOAN`. +- `member.home_branch_id`: sets null values to `1`. +- Schema writes: adds `loan.copy_id`, renames `member.joined_on`, adds `member.home_branch_id`, removes `book_free_le_total`, `book.copies_free`, and `book.copies_total`. + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- `book`, `loan`, `member`, `generate_series`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..899ebf43 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,30 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:37:23Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Provides deterministic sample lending-library catalog, member, and borrowing records for development and testing. + +#### Purpose +- Seeds authors and book inventory, members, and loan histories with fixed IDs and dates. +- Wraps all inserts in one transaction (`BEGIN` / `COMMIT`). + +#### Type +- PostgreSQL DML seed script. + +#### Writes +- `author`: 15 rows in 15 single-row INSERTs (IDs 1–15). +- `book`: 110 rows in 110 single-row INSERTs (IDs 1–110). +- `member`: 50 rows in 50 single-row INSERTs (IDs 1–50); `joined_on` values are date arithmetic from `DATE '2020-01-01'`; some members are blocked. +- `loan`: 150 rows in 150 single-row INSERTs (IDs 1–150); `returned_on` is `NULL` for some active loans. +- No reads or updates/deletes. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/package.ai.md new file mode 100644 index 00000000..dccf666b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/library/package.ai.md @@ -0,0 +1,55 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:39:10Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> Supports library lending by managing catalog inventory, member borrowing and returns, loan reporting, auditing, and schema evolution to branch-assigned copies. + +#### Purpose +- Define and operate a relational lending-library system covering authors, books, members, inventory, and loans. +- Supply reporting views, lifecycle routines, migration to individually tracked copies, and deterministic development/test data. + +#### Responsibilities +- **Core schema and integrity:** `author`, `book`, `member`, and `loan` tables enforce identifiers, uniqueness, foreign keys, inventory limits, and valid loan dates. +- **Reporting:** `overdue_loans` identifies unreturned past-due loans; `member_loan_stats` summarizes borrowing; `popular_books` ranks recent lending activity. +- **Loan lifecycle and audit:** Checkout and return routines validate eligibility, update inventory and loans, calculate late fees, and record lifecycle events in `loan_audit`. +- **Branch and copy migration:** Adds `branch` and per-item `book_copy` records, links loans to copies and members to home branches, and retires book-level copy counters. +- **Seed data:** Inserts fixed author, book, member, and loan records in a transaction. + +#### Key units +- `author`, `book`, `member`, `loan` — core catalog, membership, inventory, and borrowing tables. +- `overdue_loans` — view of open loans past their due dates, including days overdue. +- `member_loan_stats` — per-member loan totals, open-loan counts, and most recent loan date. +- `popular_books` — materialized view of book loan counts and author names, with unique index `idx_popular_books_id`. +- `fn_checkout_book(p_member_id, p_book_id, p_days)` — checks out an available book for an eligible member and returns the new loan ID. +- `sp_return_book(p_loan_id)` — marks an open loan returned and restores the book’s free-copy count. +- `fn_late_fee(p_due_on, p_returned_on)` — computes a nonnegative, capped overdue fee. +- `loan_audit`, `trg_loan_audit_fn()`, `trg_loan_audit` — store and capture checkout and return events. +- `branch`, `book_copy` — represent library locations and individually barcoded copies with availability status. +- `04_migration_v2.sql` — migrates copy counts to individual copies and adds member and loan branch/copy associations. + +#### Data flow +- Checkout validates member and book availability, inserts a `loan`, and decrements `book.copies_free`; the loan trigger records a `CHECKOUT` event. +- Return updates an open loan’s `returned_on`, increments the associated book’s free-copy count, and the trigger records a `RETURN` event. +- Views derive overdue loans, member statistics, and book popularity from `loan`, `member`, `book`, and `author`; `popular_books` stores its query result. +- Migration generates `book_copy` rows from existing book copy counts, assigns availability from free-copy counts, and assigns existing members a home branch. + +#### Dependencies +- Views and routines depend on `author`, `book`, `member`, and `loan`; routines also use `loan_audit`. +- Migration adds `branch` and `book_copy`, references existing `book`, `loan`, and `member` records, and uses PostgreSQL `generate_series`. +- `loan_audit.loan_id` is associated with `loan.loan_id` without a declared foreign-key constraint. + +#### Cross-cutting +- PostgreSQL DDL, views, materialized views, PL/pgSQL and SQL routines, triggers, migration, and seed DML. +- Primary keys, unique constraints, checks, foreign keys, and targeted indexes enforce integrity and support common lookups. +- Checkout and return routines raise exceptions for blocked members, unavailable inventory, and unknown or already-returned loans. +- The migration replaces aggregate book-level inventory counters with copy-level `AVAILABLE`, `ON_LOAN`, and `LOST` status. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/package.ai.md new file mode 100644 index 00000000..91158de5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/package.ai.md @@ -0,0 +1,45 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:39:27Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> Manages inventory and transactions across library lending, retail order fulfillment, and warehouse supplier-stock reconciliation. + +#### Purpose +- Define SQL-backed workflows for catalog and copy availability, customer orders and stock reservation, and warehouse stock updates. +- Provide reporting, lifecycle auditing, schema migration, and synchronization outcome logging. + +#### Responsibilities +- **Library lending:** Maintain authors, books, members, loans, branches, and individually tracked copies; enforce checkout and return rules, calculate late fees, audit loan events, and report overdue loans and borrowing activity. +- **Retail orders:** Store products, customers’ orders, and order lines; add or increment order items while reserving stock and recalculating order totals. +- **Warehouse reconciliation:** Aggregate recent supplier receipts by warehouse and SKU, merge quantities into stock balances, and log success or failure. +- **Schema and test data:** Seed library records and migrate library inventory from aggregate book counts to branch-assigned copies. + +#### Key units +- `author`, `book`, `member`, `loan`, `branch`, `book_copy` — library catalog, membership, borrowing, and branch-level inventory. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `loan_audit` — library loan lifecycle, fee calculation, and event auditing. +- `overdue_loans`, `member_loan_stats`, `popular_books` — library loan and popularity reporting. +- `product`, `customer_order`, `order_item`, `add_order_item` — retail catalog, order records, and stock-reserving item updates. +- `dbo.usp_SyncStock`, `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog` — warehouse receipt reconciliation, stock balances, and synchronization logging. + +#### Data flow +- Library checkout validates member eligibility and book availability, creates a loan, updates inventory, and records an audit event; returns close open loans, restore availability, and record return events. Reporting views derive loan and popularity information from the library tables. +- Retail `add_order_item` finds a product by SKU, checks and locks stock, inserts or increments an order line, decrements stock, and recalculates the order total. +- Warehouse `dbo.usp_SyncStock` filters supplier receipts by cutoff, aggregates quantities by warehouse and SKU, merges totals into `dbo.StockLevel`, and logs row counts; on failure it rolls back, logs the error, and rethrows it. + +#### Dependencies +- Library views and routines use `author`, `book`, `member`, and `loan`; loan auditing uses `loan_audit`. The migration uses PostgreSQL `generate_series` to create copy records. +- Retail `order_item` references `customer_order` and `product`; stock updates and totals use `product`, `order_item`, and `customer_order`. +- Warehouse synchronization uses SQL Server tables `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. + +#### Cross-cutting +- SQL implementations span PostgreSQL DDL, views, materialized views, PL/pgSQL routines, triggers, migrations, and seed data; MySQL 8 tables and stored procedures; and SQL Server stored procedures. +- Integrity and concurrency controls include keys, checks, foreign keys, indexes, transaction handling, and row locking. +- Error handling is domain-specific: library routines reject invalid or unavailable loans, retail reports unknown SKUs or insufficient stock, and warehouse synchronization rolls back, logs failure details, and rethrows errors. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..4e4c6fd0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,64 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:37:26Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models shop products, customer orders, and order lines, with a procedure that adds an item while reserving stock and recalculating the order total. + +#### Purpose +- Stores product prices and inventory, order status and totals, and per-product order quantities and prices. +- `add_order_item` adds or increments an order line, decrements stock, and refreshes the order total. + +#### Type +- MySQL 8; tables and procedure. +- `customer_order.status` enum: `NEW`, `PAID`, `SHIPPED`, `CANCELLED`. + +#### Schema +- `product` + - `product_id INT UNSIGNED` — NOT NULL, AUTO_INCREMENT, PRIMARY KEY. + - `sku VARCHAR(40)` — NOT NULL, UNIQUE KEY `uk_product_sku`. + - `name VARCHAR(200)` — NOT NULL. + - `price_cents INT UNSIGNED` — NOT NULL. + - `stock INT` — NOT NULL, DEFAULT `0`. + - Index `uk_product_sku`: UNIQUE on `sku`. +- `customer_order` + - `order_id BIGINT UNSIGNED` — NOT NULL, AUTO_INCREMENT, PRIMARY KEY. + - `customer_id BIGINT UNSIGNED` — NOT NULL. + - `status ENUM('NEW', 'PAID', 'SHIPPED', 'CANCELLED')` — NOT NULL, DEFAULT `'NEW'`. + - `created_at DATETIME` — NOT NULL, DEFAULT `CURRENT_TIMESTAMP`. + - `total_cents INT UNSIGNED` — NOT NULL, DEFAULT `0`. + - Index `idx_order_customer`: `(customer_id, created_at)`. +- `order_item` + - `order_id BIGINT UNSIGNED` — NOT NULL, part of PRIMARY KEY `(order_id, product_id)`. + - `product_id INT UNSIGNED` — NOT NULL, part of PRIMARY KEY `(order_id, product_id)`. + - `quantity SMALLINT UNSIGNED` — NOT NULL. + - `unit_price_cents INT UNSIGNED` — NOT NULL. + - Constraint `fk_item_order`: FOREIGN KEY (`order_id`) REFERENCES `customer_order` (`order_id`) ON DELETE CASCADE. + - Constraint `fk_item_product`: FOREIGN KEY (`product_id`) REFERENCES `product` (`product_id`). + +#### Reads +- `product`: `product_id`, `price_cents`, `sku`, `stock`. +- `order_item`: `quantity`, `unit_price_cents`, `order_id`. + +#### Writes +- `order_item`: INSERT `order_id`, `product_id`, `quantity`, `unit_price_cents`; on duplicate key, UPDATE `quantity`. +- `product`: UPDATE `stock`. +- `customer_order`: UPDATE `total_cents`. + +#### Relationships +- `order_item.order_id -> customer_order.order_id` +- `order_item.product_id -> product.product_id` + +#### Routine logic +- `add_order_item(IN p_order_id BIGINT UNSIGNED, IN p_sku VARCHAR(40), IN p_qty SMALLINT UNSIGNED)` +- Selects the matching product ID and price when stock is sufficient, locking the row with `FOR UPDATE`. +- Signals SQLSTATE `45000` with message `unknown SKU or not enough stock` if no product is selected. +- Inserts an order line or increments its existing quantity; decrements product stock and recalculates the order total from its lines. + +#### Dependencies +- Tables: `product`, `order_item`, `customer_order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/shop/package.ai.md new file mode 100644 index 00000000..237ee72a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/shop/package.ai.md @@ -0,0 +1,40 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:39:18Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Maintains shop inventory and customer order totals by recording order lines, reserving product stock, and tracking order status. + +#### Purpose +- Stores products, inventory, customer orders, and per-product order quantities and prices. +- Adds order items while decrementing stock and recalculating the order total. + +#### Responsibilities +- Product and inventory records: SKU, name, price, and available stock. +- Customer order records: customer, lifecycle status, creation time, and total. +- Order-line records: product, quantity, and unit price, linked to orders and products. +- Order-item insertion or quantity increment with stock reservation and total refresh. + +#### Key units +- `product` — stores product identity, unique SKU, price, and stock. +- `customer_order` — stores customer orders, status (`NEW`, `PAID`, `SHIPPED`, `CANCELLED`), and total. +- `order_item` — records each product and quantity in an order, with unit price. +- `add_order_item` — finds a SKU, checks and locks available stock, updates the order line and stock, then recalculates the order total. + +#### Data flow +- `add_order_item` receives an order ID, SKU, and quantity; it selects the matching product and price if stock is sufficient. +- It inserts an order line or increments the existing line quantity, decrements product stock, and updates `customer_order.total_cents` from the order’s lines. +- If the SKU is unknown or stock is insufficient, it signals SQLSTATE `45000`. + +#### Dependencies +- Internal tables: `product`, `order_item`, and `customer_order`. +- `order_item.order_id` references `customer_order.order_id` with cascading delete; `order_item.product_id` references `product.product_id`. + +#### Cross-cutting +- MySQL 8 schema and stored procedure; `product.sku` is unique and `order_item` uses `(order_id, product_id)` as its primary key. +- Stock selection uses `FOR UPDATE`; routine errors use SQLSTATE `45000`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/warehouse/package.ai.md new file mode 100644 index 00000000..a3f436e7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/warehouse/package.ai.md @@ -0,0 +1,38 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:39:23Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Reconciles recent supplier inventory receipts into warehouse stock balances and records each synchronization outcome. + +#### Purpose +- Aggregate supplier feed quantities by warehouse and SKU, then apply them to on-hand stock. +- Record successful row counts or failed synchronization details in an audit log. + +#### Responsibilities +- **Inventory updates:** Group recent `dbo.SupplierFeed` receipts and merge totals into `dbo.StockLevel`. +- **Outcome logging:** Record inserted and updated row counts on success, or the error message on failure, in `dbo.SyncLog`. + +#### Key units +- `dbo.usp_SyncStock(@Since)`: Synchronizes feed quantities received since the cutoff and logs the result. +- `dbo.StockLevel`: Stores on-hand quantity and update time by warehouse and SKU. +- `dbo.SupplierFeed`: Holds supplier receipt quantities and timestamps. +- `dbo.SyncLog`: Stores synchronization start time, row counts, and optional error message. + +#### Data flow +- `dbo.usp_SyncStock` filters `dbo.SupplierFeed` by `ReceivedAt >= @Since` and sums `Quantity` by `WarehouseId` and `Sku`. +- A `MERGE` adds totals to matching `dbo.StockLevel` rows or inserts rows for unmatched keys; merge actions determine outcome counts. +- The procedure writes counts to `dbo.SyncLog` and commits, or rolls back and logs the error before rethrowing it. + +#### Dependencies +- SQL Server tables: `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog`. +- Built-ins: `SYSUTCDATETIME()` for the start timestamp and `ERROR_MESSAGE()` for failure logging. + +#### Cross-cutting +- Stock changes and success logging run in a transaction. +- Errors trigger rollback of an active transaction, zero-count error logging, and rethrowing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..6af057f7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,63 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:37:34Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Aggregates recent supplier inventory receipts by warehouse and SKU, updates on-hand stock, and records the synchronization outcome. + +#### Purpose +- `dbo.usp_SyncStock` applies supplier feed quantities received since a cutoff to warehouse stock levels. +- Logs inserted and updated stock-row counts, or records an error before rethrowing it. + +#### Type +- SQL Server (T-SQL): tables `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`; procedure `dbo.usp_SyncStock`. + +#### Schema +- `dbo.StockLevel` + - `WarehouseId INT NOT NULL` — composite primary key. + - `Sku NVARCHAR(40) NOT NULL` — composite primary key. + - `OnHand INT NOT NULL DEFAULT (0)` — constraint `DF_StockLevel_OnHand`. + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())` — constraint `DF_StockLevel_UpdatedAt`. + - Primary key constraint `PK_StockLevel` (`WarehouseId`, `Sku`). +- `dbo.SupplierFeed` + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL` — primary key constraint `PK_SupplierFeed`. + - `WarehouseId INT NOT NULL`. + - `Sku NVARCHAR(40) NOT NULL`. + - `Quantity INT NOT NULL`. + - `ReceivedAt DATETIME2(0) NOT NULL`. +- `dbo.SyncLog` + - `SyncLogId INT IDENTITY(1,1) NOT NULL` — primary key constraint `PK_SyncLog`. + - `StartedAt DATETIME2(0) NOT NULL`. + - `RowsInserted INT NOT NULL`. + - `RowsUpdated INT NOT NULL`. + - `ErrorMessage NVARCHAR(4000) NULL`. + +#### Reads +- `dbo.SupplierFeed`: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`. +- `dbo.StockLevel`: `WarehouseId`, `Sku`, `OnHand` during `MERGE` matching and updates. +- `@Changes`: `MergeAction` when calculating outcome counts. + +#### Writes +- `dbo.StockLevel`: `MERGE` inserts `WarehouseId`, `Sku`, `OnHand` for unmatched keys; updates `OnHand`, `UpdatedAt` for matched keys. Row counts depend on feed data. +- `dbo.SyncLog`: inserts one aggregate outcome row on success (`StartedAt`, `RowsInserted`, `RowsUpdated`); on error, inserts one row (`StartedAt`, zero counts, `ErrorMessage`). + +#### Relationships +- `dbo.StockLevel.WarehouseId -> dbo.SupplierFeed.WarehouseId` — `MERGE` match. +- `dbo.StockLevel.Sku -> dbo.SupplierFeed.Sku` — `MERGE` match. +- No foreign key constraints declared. + +#### Routine logic +- `dbo.usp_SyncStock(@Since DATETIME2(0))`. +- Captures UTC start time; groups feed rows with `ReceivedAt >= @Since` by warehouse and SKU, summing `Quantity`. +- In a transaction, adds grouped quantities to matching `StockLevel` rows or inserts new rows; captures merge actions. +- Writes inserted and updated counts to `dbo.SyncLog`, then commits. +- On error, rolls back an active transaction, logs `ERROR_MESSAGE()` with zero counts, and rethrows. + +#### Dependencies +- Tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. +- Built-ins: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..33817698 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,74 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:39:50Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Evaluates and validates file‑selection conditions against file metadata, determining matches, required line counts, and validating configuration. + +#### Purpose +- Evaluates `AiCondition` trees against `AiFileContext`. +- Validates condition trees for correct structure and bounds. +- Reports whether line counting is needed. + +#### Type +- `final class AiConditionEvaluator` + - extends `Object` + - no interfaces + - field: `private static final String ERROR_ONE_BRANCH` + - constructor: `public AiConditionEvaluator()` (no-op) + +#### Input +- `matches(AiCondition, AiFileContext)` – condition tree, file facts. +- `validate(AiCondition)` – condition tree. +- `usesLines(AiCondition)` – condition tree. +- `anyUsesLines(List)` – optional list of child conditions. +- `validateGroup(AiConditionGroup, String)` – group and label. +- `branchCount(AiCondition)` – condition node. +- `matchesExtension(List, String)` – extensions list, file name. +- `globMatches(String, String)` – glob pattern, relative path. +- `parseEpochMilli(String)` – ISO‑8601 instant string. + +#### Output +- `matches` returns `boolean` indicating file match. +- `validate` throws `IllegalArgumentException` on misconfiguration. +- `usesLines` returns `boolean` if any `lines` condition exists. +- `anyUsesLines` returns `boolean`. +- `validateGroup` throws `IllegalArgumentException` on empty group. +- `branchCount` returns `int` count of non‑null branches/leaves. +- `matchesExtension` returns `boolean`. +- `globMatches` returns `boolean`. +- `parseEpochMilli` returns `long` epoch milliseconds. + +#### Core logic +- `matches`: recursively evaluates `and`, `or`, `not`, and leaf conditions (`extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, `pathGlob`). +- `validate`: ensures exactly one branch/leaf per node, checks non‑empty lists, bounds on ranges, parses dates, trims glob. +- `usesLines`: traverses tree to detect any `lines` condition. +- `anyUsesLines`: helper for list traversal. +- `validateGroup`: ensures group has at least one child and validates each child. +- `branchCount`: counts non‑null branch/leaf fields. +- `matchesExtension`: checks file name ends with any non‑null extension. +- `globMatches`: uses `AiSourceExcludeFilter` to test path exclusion. +- `parseEpochMilli`: parses ISO‑8601 instant to epoch milliseconds, throws on failure. + +#### Public API +- `matches(AiCondition, AiFileContext) -> boolean` – evaluate condition tree. +- `validate(AiCondition) -> void` – validate configuration. +- `usesLines(AiCondition) -> boolean` – check for line count requirement. + +#### Dependencies +- `java.time.Instant`, `java.time.format.DateTimeParseException` +- `java.util.Collections`, `java.util.List` +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalStateException` in `matches` if node has no branch/leaf. +- `IllegalArgumentException` in `validate`, `validateGroup`, `branchCount`, `parseEpochMilli` for misconfigurations or invalid dates. + +#### Concurrency +- Stateless; no shared mutable state. Thread‑safe by design. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..ff1b5a86 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,55 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:39:54Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> A container for child AI conditions used by `` / `` combinators in the AI configuration. + +#### Purpose +- Holds a list of `AiCondition` objects for combinator bodies. +- Provides defensive copying when setting conditions. + +#### Type +- `public class AiConditionGroup` + - Modifiers: public, final (implicit), @ToString, @SuppressWarnings({"NullAway.Init","initialization.fields.uninitialized"}) + - Supertype: `Object` + - Fields: + - `private @Nullable List conditions` + - Constructors: + - `public AiConditionGroup()` – no‑op + - Methods: + - `public @Nullable List getConditions()` – returns the list or `null` + - `public void setConditions(final @Nullable Collection conditions)` – defensive copy to `ArrayList` or `null` + +#### Input +- Constructor: none +- `setConditions` parameter: `Collection` (nullable) + +#### Output +- `getConditions` returns `List` or `null` +- `setConditions` mutates the private `conditions` field + +#### Core logic +- `setConditions`: if argument non‑null, create new `ArrayList<>(conditions)`; else set field to `null`. +- `getConditions`: simply return the field. + +#### Public API +- `getConditions() -> List` – retrieve child conditions +- `setConditions(Collection) -> void` – set child conditions + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCondition` + +#### Exceptions / Errors +- No explicit exceptions thrown; defensive copy handles null safely. + +#### Concurrency +- No synchronization; class is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..768657ce --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,72 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:39:56Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Computes deterministic, language‑agnostic fact counts from source text using regex counters. + +#### Purpose +- Provides a facts block for AI summaries. +- Counts non‑overlapping regex matches across entire source. + +#### Type +- `final class AiFactExtractor` (class, final) + - No supertypes. + - No annotations. + +#### Input +- `factsBlock(List counters, String source)` + - `counters`: list of counters (may be null/empty). + - `source`: full source text. +- `validate(List counters)` + - `counters`: list of counters (may be null/empty). +- `countMatches(String pattern, String source)` + - `pattern`: regex string. + - `source`: text to search. + +#### Output +- `factsBlock` returns a string: facts header + `label: count` entries separated by `; `, ending with two newlines, or empty string if no counters or all skipped. +- `validate` throws `IllegalArgumentException` on missing label/pattern or invalid regex. +- `countMatches` returns integer match count. + +#### Core logic +- `factsBlock`: + 1. Return empty if counters null/empty. + 2. Iterate counters; skip null or missing label/pattern. + 3. Append `label: count` using `countMatches`. + 4. Prepend `FACTS_HEADER`, append `FACTS_SUFFIX`. +- `validate`: + 1. Return if counters null. + 2. For each counter: check non‑null label/pattern. + 3. Compile pattern; on `PatternSyntaxException` wrap in `IllegalArgumentException`. +- `countMatches`: + 1. Compile pattern, create matcher on source. + 2. Loop `matcher.find()` counting matches. + +#### Public API +- `factsBlock(List, String) -> String` – build facts block. +- `validate(List) -> void` – validate counters. +- `FACTS_HEADER: String` – facts header. +- `LABEL_COUNT_SEPARATOR: String` – label/count separator. +- `ENTRY_SEPARATOR: String` – entry separator. +- `FACTS_SUFFIX: String` – suffix after facts block. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiFactCounter` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `validate` for missing label/pattern or invalid regex. +- `PatternSyntaxException` caught and wrapped. + +#### Concurrency +- All methods are static and stateless; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..3595e238 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,143 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:40:01Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> A mutable JavaBean that holds all AI‑generation parameters for a single model run, exposing getters/setters for configuration values used by the Maven plugin and AI provider implementations. + +#### Purpose +- Stores AI generation settings (model path, sampling, prompt trimming, cache, GPU, API, etc.). +- Provides defaults for each parameter. +- Supplies Lombok‑generated `toString` for diagnostics. + +#### Type +- `public class AiGenerationConfig` (final, mutable JavaBean, Lombok `@ToString`). +- Extends `Object`; no interfaces or annotations beyond `@SuppressWarnings` and `@ToString`. + +#### Input +- Constructor: no arguments, defaults applied. +- Setter methods for: + - `modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `charsPerToken`, `maxInputChars`, `warnOnTrim`, `topP`, `topK`, `minP`, `topNSigma`, `repeatPenalty`, `chatTemplateEnableThinking`, `cachePrompt`, `swaFull`, `cacheReuse`, `gpuLayers`, `seed`, `cpuMoeLayers`, `cpuFfnLayers`, `kvUnifiedPerSlot`, `lazyMode`, `repeatLastN`, `cacheTypeK`, `cacheTypeV`, `flashAttn`, `batchSize`, `ubatchSize`, `threadsBatch`, `mainGpu`, `devices`, `provider`, `remoteModel`, `baseUrl`, `apiKeyEnv`, `reasoningEffort`, `reasoningBudgetTokens`, `dryMultiplier`, `dryBase`, `dryAllowedLength`, `dryPenaltyLastN`, `drySequenceBreakers`, `stopStrings`, `calibration`. + +#### Output +- Getter methods return current field values. +- `getDrySequenceBreakers()` and `getStopStrings()` return unmodifiable lists. +- `setCachePrompt(boolean)` mutates `cachePrompt`. +- `setCalibration(AiCalibration)` stores calibration. + +#### Core logic +- All fields initialized to static defaults. +- Setters perform minimal validation (e.g., non‑null defaults, empty string handling). +- `setLazyMode`, `setCacheTypeK`, `setCacheTypeV` replace `null` with default constants. +- `setDevices` treats `null` as empty default. +- `setProvider`, `setRemoteModel`, `setBaseUrl`, `setApiKeyEnv` replace `null` with respective defaults. +- `setDrySequenceBreakers` and `setStopStrings` replace `null` with empty list. + +#### Public API +- `getModelPath() -> String?` – model file path +- `setModelPath(String?) -> void` – set model path +- `getContextSize() -> int` – context window size +- `setContextSize(int) -> void` +- `getMaxOutputTokens() -> int` – max output tokens +- `setMaxOutputTokens(int) -> void` +- `getTemperature() -> float` – sampling temperature +- `setTemperature(float) -> void` +- `getThreads() -> int` – CPU threads +- `setThreads(int) -> void` +- `getCharsPerToken() -> int` – chars per token +- `setCharsPerToken(int) -> void` +- `getMaxInputChars() -> int` – max input chars +- `setMaxInputChars(int) -> void` +- `isWarnOnTrim() -> boolean` – trim warning flag +- `setWarnOnTrim(boolean) -> void` +- `getTopP() -> float` – nucleus threshold +- `setTopP(float) -> void` +- `getTopK() -> int` – top‑k limit +- `setTopK(int) -> void` +- `getRepeatPenalty() -> float` – repetition penalty +- `setRepeatPenalty(float) -> void` +- `getMinP() -> float` – min‑p threshold +- `setMinP(float) -> void` +- `getTopNSigma() -> float` – top‑n‑sigma threshold +- `setTopNSigma(float) -> void` +- `getChatTemplateEnableThinking() -> Boolean?` – chat‑template thinking mode +- `setChatTemplateEnableThinking(Boolean?) -> void` +- `isCachePrompt() -> boolean` – prompt‑caching flag +- `isSwaFull() -> boolean` – full‑SWA flag +- `setSwaFull(boolean) -> void` +- `getCacheReuse() -> int` – cache‑reuse chunk size +- `setCacheReuse(int) -> void` +- `getGpuLayers() -> int` – GPU layers offload +- `setGpuLayers(int) -> void` +- `getSeed() -> int` – RNG seed +- `setSeed(int) -> void` +- `getCpuMoeLayers() -> int` – CPU MoE layers +- `setCpuMoeLayers(int) -> void` +- `getCpuFfnLayers() -> int` – CPU FFN layers +- `setCpuFfnLayers(int) -> void` +- `getKvUnifiedPerSlot() -> int` – KV unified per‑slot cap +- `setKvUnifiedPerSlot(int) -> void` +- `getLazyMode() -> String` – tensor‑read laziness +- `setLazyMode(String?) -> void` +- `getRepeatLastN() -> int` – repeat‑penalty window +- `setRepeatLastN(int) -> void` +- `getCacheTypeK() -> String` – KV cache type K +- `setCacheTypeK(String?) -> void` +- `getCacheTypeV() -> String` – KV cache type V +- `setCacheTypeV(String?) -> void` +- `isFlashAttn() -> boolean` – Flash Attention flag +- `setFlashAttn(boolean) -> void` +- `getBatchSize() -> int` – logical batch size +- `setBatchSize(int) -> void` +- `getUbatchSize() -> int` – physical batch size +- `setUbatchSize(int) -> void` +- `getThreadsBatch() -> int` – batch thread count +- `setThreadsBatch(int) -> void` +- `getMainGpu() -> int` – primary GPU index +- `setMainGpu(int) -> void` +- `getDevices() -> String` – device list +- `setDevices(String) -> void` +- `getProvider() -> String` – AI provider +- `setProvider(String) -> void` +- `getRemoteModel() -> String` – remote model id +- `setRemoteModel(String) -> void` +- `getBaseUrl() -> String` – API base URL +- `setBaseUrl(String) -> void` +- `getApiKeyEnv() -> String` – API key env var +- `setApiKeyEnv(String) -> void` +- `setCachePrompt(boolean) -> void` +- `getReasoningEffort() -> String` – reasoning effort level +- `setReasoningEffort(String) -> void` +- `getReasoningBudgetTokens() -> int` – reasoning budget +- `setReasoningBudgetTokens(int) -> void` +- `getDryMultiplier() -> float` – DRY multiplier +- `setDryMultiplier(float) -> void` +- `getDryBase() -> float` – DRY base +- `setDryBase(float) -> void` +- `getDryAllowedLength() -> int` – DRY allowed length +- `setDryAllowedLength(int) -> void` +- `getDryPenaltyLastN() -> int` – DRY penalty window +- `setDryPenaltyLastN(int) -> void` +- `getDrySequenceBreakers() -> List` – unmodifiable list +- `setDrySequenceBreakers(List?) -> void` +- `getStopStrings() -> List` – unmodifiable list +- `setStopStrings(List?) -> void` +- `getCalibration() -> AiCalibration?` – calibration +- `setCalibration(AiCalibration?) -> void` + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCalibration` + +#### Exceptions / Errors +- No explicit exceptions thrown; setters accept `null` and replace with defaults. + +#### Concurrency +- No synchronization; intended for single‑threaded configuration building. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..15c5c5c9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,60 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:40:16Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Defines how to handle source files that exceed the model’s context window during routing. + +#### Purpose +- Enumerates oversize handling strategies for source routing. +- Provides default strategy and parsing from configuration. + +#### Type +- `public enum AiOversizeStrategy` + - Modifiers: `public` + - Supertypes: `java.lang.Enum` + - Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` + - Field: `public static final AiOversizeStrategy DEFAULT = FAIL` + - Field: `private final String configValue` + - Constructor: `AiOversizeStrategy(String configValue)` + - Methods: + - `public String configValue()` + - `public static AiOversizeStrategy fromConfig(@Nullable String value)` + +#### Input +- Constructor parameter: `String configValue` (strategy token). +- `fromConfig` parameter: `@Nullable String value` (config token). + +#### Output +- `configValue()` returns the strategy’s token string. +- `fromConfig` returns an `AiOversizeStrategy` or throws `IllegalArgumentException` for unknown tokens. + +#### Core logic +- `fromConfig`: + 1. Return `DEFAULT` if `value` is `null` or blank after trimming. + 2. Iterate over `values()`; compare `configValue` case‑insensitively to trimmed input. + 3. Return matching strategy. + 4. Throw `IllegalArgumentException` if no match. + +#### Public API +- `FAIL(String)` – abort build; default. +- `SAMPLE(String)` – trim head to window, summarize once. +- `MAP_REDUCE(String)` – chunk by lines, summarize each, combine. +- `DETERMINISTIC(String)` – emit deterministic metadata. +- `DEFAULT: AiOversizeStrategy` – default strategy. +- `configValue() -> String` – get token. +- `fromConfig(@Nullable String) -> AiOversizeStrategy` – parse config. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `fromConfig` when token is unknown. + +#### Concurrency +- No mutable shared state; enum constants are thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..e1ef48b7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,98 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:40:19Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Holds all mutable configuration parameters for a srcmorph run, including file paths, AI provider settings, and generation rules. + +#### Purpose +- Stores runtime configuration for srcmorph. +- Provides defaults and mutable JavaBean accessors. + +#### Type +- `public class SrcMorphConfiguration` + - Modifiers: public, final (implicitly by lack of subclassing). + - Annotations: `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`, `@ToString`. + - Supertypes: `java.lang.Object`. + - No generics. + +#### Input +- Constructor: no parameters. +- Setter parameters: various `File`, `String`, `int`, `float`, `boolean`, `List<...>`, `@Nullable` annotations. +- No injected dependencies. + +#### Output +- Getter return types: `File`, `boolean`, `long`, `int`, `float`, `String`, `List<...>`, `@Nullable`. +- No side‑effects beyond field mutation. + +#### Core logic +- Holds default constants for output directory, AI provider, llama.cpp settings, and AI version. +- Provides getters and setters for each configuration field. +- No additional computation or validation logic. + +#### Public API +- `SrcMorphConfiguration()` → constructor, initializes defaults. +- `File getBaseDirectory()` → base directory. +- `void setBaseDirectory(File)` → set base directory. +- `File getOutputDirectory()` → output directory. +- `void setOutputDirectory(File)` → set output directory. +- `boolean isForce()` → force regeneration flag. +- `void setForce(boolean)` → set force flag. +- `List getSubtrees()` → source subtrees. +- `void setSubtrees(List)` → set subtrees. +- `List getExcludes()` → exclude globs. +- `void setExcludes(List)` → set excludes. +- `List getFileExtensions()` → file extensions. +- `void setFileExtensions(List)` → set extensions. +- `long getMinFileSizeBytes()` → min file size. +- `void setMinFileSizeBytes(long)` → set min size. +- `long getMaxFileSizeBytes()` → max file size. +- `void setMaxFileSizeBytes(long)` → set max size. +- `boolean isPlanOnly()` → plan‑only flag. +- `void setPlanOnly(boolean)` → set plan‑only flag. +- `String getGenerationProvider()` → AI provider name. +- `void setGenerationProvider(String)` → set provider. +- `List getPromptDefinitions()` → prompt templates. +- `void setPromptDefinitions(List)` → set prompts. +- `List getAiDefinitions()` → AI model definitions. +- `void setAiDefinitions(List)` → set models. +- `File getModelDirectory()` → model directory. +- `void setModelDirectory(File)` → set model directory. +- `List getFieldGenerations()` → field generation rules. +- `void setFieldGenerations(List)` → set field rules. +- `List getFactDefinitions()` → fact definitions. +- `void setFactDefinitions(List)` → set facts. +- `String getLlamaModelPath()` → llama.cpp model path. +- `void setLlamaModelPath(String)` → set llama model path. +- `int getLlamaContextSize()` → llama context size. +- `void setLlamaContextSize(int)` → set context size. +- `int getLlamaMaxOutputTokens()` → llama max output tokens. +- `void setLlamaMaxOutputTokens(int)` → set max tokens. +- `float getLlamaTemperature()` → llama temperature. +- `void setLlamaTemperature(float)` → set temperature. +- `int getLlamaThreads()` → llama thread count. +- `void setLlamaThreads(int)` → set thread count. +- `String getPluginVersion()` → plugin version. +- `void setPluginVersion(String)` → set plugin version. +- `String getAiVersion()` → AI logic version. +- `void setAiVersion(String)` → set AI version. +- `String getProjectName()` → project title. +- `void setProjectName(String)` → set project title. + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- None declared or thrown. + +#### Concurrency +- No synchronization or thread‑safety guarantees. All fields are mutable and accessed without locking. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..703a6a09 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,57 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:41:33Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> Provides AI‑driven source‑code analysis and generation, including file‑selection, fact extraction, and configurable generation pipelines for the srcmorph tool. + +#### Purpose +- Evaluate file‑selection rules for AI processing. +- Extract deterministic language‑agnostic facts from source text. +- Configure AI generation parameters and oversize handling. +- Store runtime configuration for srcmorph runs. + +#### Responsibilities +- **Condition Evaluation** – `AiConditionEvaluator` parses and validates `AiCondition` trees, determining file matches and line‑count requirements. +- **Condition Grouping** – `AiConditionGroup` holds child conditions for combinators (``, ``). +- **Fact Extraction** – `AiFactExtractor` counts regex matches to build a facts block for AI prompts. +- **Generation Configuration** – `AiGenerationConfig` exposes mutable settings for AI models, sampling, caching, and DRY logic. +- **Oversize Strategy** – `AiOversizeStrategy` defines how to route files that exceed the model’s context window. +- **Runtime Configuration** – `SrcMorphConfiguration` aggregates file paths, provider settings, prompt definitions, and model metadata for a srcmorph run. + +#### Key units +- `AiConditionEvaluator` – evaluates and validates condition trees. +- `AiConditionGroup` – container for child `AiCondition` objects. +- `AiFactExtractor` – static utility for regex‑based fact counting. +- `AiGenerationConfig` – JavaBean holding AI generation parameters. +- `AiOversizeStrategy` – enum of oversize handling strategies (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`). +- `SrcMorphConfiguration` – mutable configuration holder for srcmorph execution. + +#### Data flow +1. **Configuration**: `SrcMorphConfiguration` supplies file selection rules (`AiConditionGroup`), prompt definitions, and AI model settings to the build pipeline. +2. **File Selection**: `AiConditionEvaluator` evaluates each file’s metadata (`AiFileContext`) against the condition tree to decide inclusion and whether line counts are needed. +3. **Fact Extraction**: For selected files, `AiFactExtractor` scans the source text with defined `AiFactCounter` patterns, producing a facts block. +4. **Generation**: `AiGenerationConfig` provides parameters to the AI provider; `AiOversizeStrategy` determines routing for oversized files. +5. **Output**: Results are written to the output directory defined in `SrcMorphConfiguration`. + +#### Dependencies +- **Internal**: `AiSourceExcludeFilter`, `AiCondition`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`. +- **External**: `java.time.Instant`, `java.util.regex`, `org.jspecify.annotations.Nullable`, Lombok (`@ToString`), `net.ladenthin.srcmorph.support`. +- **Configuration**: `AiGenerationConfig` and `SrcMorphConfiguration` are populated from Maven plugin parameters or external config files. + +#### Cross-cutting +- Defensive copying in `AiConditionGroup.setConditions`. +- Stateless, thread‑safe utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Validation of configuration trees and regex patterns with clear exception messages. +- Default constants and null‑safe setters in configuration beans. +- Enum parsing with `fromConfig` in `AiOversizeStrategy` for robust configuration handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..84b969bd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,57 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:41:44Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A modular AI‑driven source‑code transformation engine that selects files, extracts facts, and generates code changes via pluggable local or cloud providers. + +#### Purpose +- Orchestrate AI‑based source‑code analysis and generation for the srcmorph tool. +- Provide configurable file selection, fact extraction, and generation pipelines. + +#### Responsibilities +- **Configuration & Selection** – `SrcMorphConfiguration`, `AiConditionEvaluator`, `AiConditionGroup`. +- **Fact Extraction** – `AiFactExtractor`, `AiFactCounter`. +- **Generation Pipeline** – `AiGenerationConfig`, `AiOversizeStrategy`, `AiGenerationProviderFactory`. +- **Provider Implementation** – `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport`, `AiCompletionParser`. + +#### Key units +- `SrcMorphConfiguration` – mutable holder for file paths, prompts, and model metadata. +- `AiConditionEvaluator` – validates and evaluates file‑selection trees. +- `AiFactExtractor` – regex‑based fact counter for AI prompts. +- `AiGenerationConfig` – JavaBean for AI model, sampling, caching, and DRY settings. +- `AiOversizeStrategy` – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`) for oversized files. +- `AiGenerationProvider` – interface (`generate`, `generateWithTimings`, `close`). +- `AiGenerationProviderFactory` – resolves provider keys to concrete implementations. +- `LlamaCppJniAiGenerationProvider` – local llama.cpp JNI provider with lazy model loading. +- `OpenAiCompatibleProviderSupport` – builds JSON payloads and normalises endpoints for OpenAI‑compatible APIs. +- `AiCompletionParser` – strips internal “thinking” blocks from LLM outputs. +- `LlamaCppJniConfig` – immutable record of 37 llama.cpp tuning knobs. + +#### Data flow +1. **Setup** – `SrcMorphConfiguration` supplies file selection rules, prompts, and AI settings. +2. **Selection** – `AiConditionEvaluator` checks each file against `AiConditionGroup`; selected files may trigger line‑count checks. +3. **Fact Extraction** – `AiFactExtractor` scans source text with `AiFactCounter` patterns, producing a facts block for prompts. +4. **Provider Selection** – `AiGenerationProviderFactory` creates the appropriate `AiGenerationProvider`. +5. **Generation** – Provider receives an `AiGenerationRequest`; for OpenAI‑compatible providers, `OpenAiCompatibleProviderSupport` builds the request body; for local llama.cpp, native chat completion is invoked. +6. **Response Handling** – `AiCompletionParser` cleans the raw output; provider returns plain text or `AiGenerationTimings`. +7. **Output** – Generated code is written to the output directory defined in `SrcMorphConfiguration`. + +#### Dependencies +- **Internal**: `AiCondition`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiSourceExcludeFilter`. +- **External**: `java.time.Instant`, `java.util.regex`, `org.jspecify.annotations.Nullable`, Lombok (`@ToString`), Jackson `ObjectMapper`, `net.ladenthin.llama` (model, args, JSON parser), `net.ladenthin.srcmorph.support`. +- **Configuration Sources**: Maven plugin parameters or external config files populate `SrcMorphConfiguration` and `AiGenerationConfig`. + +#### Cross‑cutting +- Thread‑safe, stateless utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Defensive copying in `AiConditionGroup.setConditions`. +- Immutable configuration objects (`LlamaCppJniConfig`, provider support classes). +- Robust error handling with clear exception messages for invalid configs or missing markers. +- Timing metrics via `generateWithTimings` default implementation. +- Logging of truncation, prompt‑cache reuse, and provider status (details omitted in summaries). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..18564dc0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,57 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:40:26Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Strips a Gemma‑4 style “thinking” block from an LLM completion before persisting the answer. + +#### Purpose +- Removes internal reasoning from raw LLM responses. +- Validates presence of closing marker; throws on truncated output. + +#### Type +- `public class AiCompletionParser` + - Modifiers: public + - Annotations: `@ToString` + - Supertypes: none + - Fields: + - `public static final String THINKING_BLOCK_START_MARKER` – marker for block start. + - `public static final String THINKING_BLOCK_END_MARKER` – marker for block end. + - Methods: + - `public AiCompletionParser()` – no‑op constructor. + - `public String parseCompletion(final String response) throws IOException` – core parsing logic. + +#### Input +- `response: String` – raw completion text, may be `null`. + +#### Output +- `String` – cleaned answer, never `null`. +- Throws `IOException` if a start marker is present but no end marker. + +#### Core logic +- If `response` is `null`, return empty string. +- Trim whitespace from `response`. +- If trimmed text does **not** start with `THINKING_BLOCK_START_MARKER`, return trimmed text. +- Extract substring after start marker. +- Find first occurrence of `THINKING_BLOCK_END_MARKER`. +- If absent, throw `IOException` with message indicating token budget exhaustion. +- Return substring after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` – instantiate parser. +- `String parseCompletion(final String response) throws IOException` – parse and clean completion. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `IOException` thrown when a start marker is found but the end marker is missing, indicating token budget exhaustion. + +#### Concurrency +- Stateless; no shared mutable state. Thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..cbf1009e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,52 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:40:29Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Provides a pluggable AI backend that generates text for an `AiGenerationRequest`. + +#### Purpose +- Supplies AI text generation for source morphing tasks. +- Supports optional timing metrics for calibration. + +#### Type +- `public interface AiGenerationProvider extends AutoCloseable` + - Methods: `generate(AiGenerationRequest)`, `generateWithTimings(AiGenerationRequest)`, `close()`. + - Dependencies: `java.io.IOException`, `net.ladenthin.srcmorph.document.AiGenerationRequest`, `net.ladenthin.srcmorph.provider.AiGenerationTimings`. + +#### Input +- `generate(AiGenerationRequest request)` + - `request`: prompt key, source file, source text, current header. +- `generateWithTimings(AiGenerationRequest request)` + - Same `request`. + +#### Output +- `generate`: `String` (never null, may be blank). +- `generateWithTimings`: `AiGenerationTimings` (text + timing metrics). +- `close`: no return, may throw `IOException`. + +#### Core logic +- `generate`: abstract; implementation must produce text. +- `generateWithTimings`: default; calls `generate(request)` and returns `AiGenerationTimings` with zeroed timing fields. +- `close`: default no-op; may throw `IOException`. + +#### Public API +- `generate(AiGenerationRequest request) -> String` – produce AI text. +- `generateWithTimings(AiGenerationRequest request) -> AiGenerationTimings` – produce text with timing. +- `close() -> void` – close resources. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.provider.AiGenerationTimings` + +#### Exceptions / Errors +- `generate` and `generateWithTimings` may throw `IOException` if provider fails. + +#### Concurrency +- No explicit concurrency handling; implementations may be thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..b5e6ce7e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,63 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:40:33Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Instantiates AI generation providers based on a provider key or model configuration. + +#### Purpose +- Selects an `AiGenerationProvider` implementation by name. +- Provides a default mock provider when no key is supplied. + +#### Type +- `public class AiGenerationProviderFactory` + - Modifiers: public, final (via `@ToString`), no superclass. + - Fields: `private final Java8CompatibilityHelper compatibilityHelper`. + - Constants: `public static final String PROVIDER_MOCK`, `PROVIDER_LLAMACPP_JNI`, `PROVIDER_OPENAI_COMPATIBLE`. + - Methods: `public AiGenerationProviderFactory()`, `public static @Nullable String effectiveProvider(String, String)`, `public AiGenerationProvider create(String, LlamaCppJniConfig, AiPromptSupport)`. + +#### Input +- Constructor: none. +- `effectiveProvider`: `runProvider: String?`, `modelProvider: String?`. +- `create`: `providerName: String`, `llamaConfig: LlamaCppJniConfig`, `promptSupport: AiPromptSupport`. + +#### Output +- `effectiveProvider`: `String?` (trimmed model provider or run provider). +- `create`: `AiGenerationProvider` instance (Mock, LlamaCppJni, or OpenAiCompatible). +- Side effect: none. + +#### Core logic +- `effectiveProvider` returns `modelProvider.trim()` if present; otherwise `runProvider`. +- `create` trims the effective provider key; if blank, returns `MockAiGenerationProvider`. +- Switch on effective key: + - `PROVIDER_MOCK` → `MockAiGenerationProvider`. + - `PROVIDER_LLAMACPP_JNI` → `LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)`. + - `PROVIDER_OPENAI_COMPATIBLE` → `OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)`. + - Default → `IllegalArgumentException`. + +#### Public API +- `AiGenerationProviderFactory()` → constructs factory. +- `static @Nullable String effectiveProvider(String, String)` → resolves provider key. +- `AiGenerationProvider create(String, LlamaCppJniConfig, AiPromptSupport)` → creates provider instance. + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.provider.LlamaCppJniConfig` +- `net.ladenthin.srcmorph.provider.AiGenerationProvider` +- `net.ladenthin.srcmorph.provider.MockAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.OpenAiCompatibleAiGenerationProvider` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown when provider key is unrecognised. + +#### Concurrency +- No explicit concurrency constructs; instance fields are immutable after construction. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..fae22a18 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,73 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:40:36Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Provides local AI generation by loading a GGUF model via llama.cpp and executing chat completions. + +#### Purpose +- Loads and caches a native `LlamaModel` lazily. +- Executes chat completions for `AiGenerationRequest`. +- Parses responses into plain text or detailed timings. + +#### Type +- `final class LlamaCppJniAiGenerationProvider` + *implements* `AiGenerationProvider`, `AutoCloseable` + *extends* none + *annotations* `@ToString` (excludes `model`, `support`) + *fields* + - `private final LlamaCppJniConfig config` (final) + - `@Nullable private LlamaModel model` (lazy, excluded) + - `private final AiPromptSupport promptSupport` (final) + - `private final LlamaCppJniProviderSupport support` (final, excluded) + - `private final AiCompletionParser completionParser` (final) + - `private final ChatResponseParser chatResponseParser` (final) + - `private final Java8CompatibilityHelper compatibilityHelper` (final) + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate(AiGenerationRequest request)` / `generateWithTimings(AiGenerationRequest request)` receive `AiGenerationRequest`. +- `chatResponse(AiGenerationRequest request)` builds inference parameters via `support.buildInferenceParameters(request)`. + +#### Output +- `generate` returns `String` (first content of chat response). +- `generateWithTimings` returns `AiGenerationTimings` (text, prompt tokens, cache tokens, prompt rate, predicted tokens, predicted rate). +- `close` releases native `LlamaModel` resources. + +#### Core logic +- `model()` lazily constructs `LlamaModel` with `ModelParameters` built from `config` and `support.buildChatTemplateKwargs()`. +- `generate`: + 1. Calls `chatResponse(request)` to get `ChatResponse`. + 2. Warns on truncated answer via `support.warnOnTruncatedAnswer`. + 3. Logs prompt cache reuse via `support.logPromptCacheReuse`. + 4. Parses completion text with `completionParser`. +- `chatResponse`: + 1. Calls `model().chatComplete(support.buildInferenceParameters(request))`. + 2. Parses full JSON with `chatResponseParser`. +- `generateWithTimings`: + 1. Calls `chatResponse(request)`. + 2. Extracts text and `Timings`. + 3. Builds `AiGenerationTimings` with metrics or defaults if missing. +- `close` disposes native model if loaded. + +#### Public API +- `generate(AiGenerationRequest request) -> String` – produce completion text. +- `generateWithTimings(AiGenerationRequest request) -> AiGenerationTimings` – produce completion text with metrics. +- `close() -> void` – release native resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.args.*`, `net.ladenthin.llama.json.ChatResponseParser`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.*`, `net.ladenthin.srcmorph.document.AiGenerationRequest`, `net.ladenthin.srcmorph.prompt.AiPromptSupport`, `net.ladenthin.srcmorph.support.Java8CompatibilityHelper`, `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `generate` declares `throws IOException`. +- `model()` may throw unchecked exceptions from native calls. +- `close` handles null model gracefully. + +#### Concurrency +- No explicit synchronization; `model` is lazily initialized without double‑checked locking, relying on single‑threaded usage or external coordination. +- `AutoCloseable` ensures deterministic cleanup. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..09e84ca4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,99 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:40:40Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Builds an immutable configuration for llama.cpp JNI provider, exposing all model‑generation knobs and defaults. + +#### Purpose +- Holds 37 configuration parameters for llama.cpp JNI generation. +- Provides a fluent builder that applies `AiGenerationConfig.DEFAULT_*` values. + +#### Type +- `final class LlamaCppJniConfig` (class, final) + - Extends `Object`. + - Annotated with `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. + - 37 private final fields (String, int, float, boolean, `@Nullable Boolean`, `List`). +- `public static final class Builder` (class, final) + - No supertype beyond `Object`. + - 37 private fields (matching config fields, with defaults from `AiGenerationConfig`). + - Annotated with Lombok annotations via builder methods. + +#### Input +- `Builder(String modelPath)` requires non‑null `modelPath`. +- Setter methods accept primitive or object values for each config knob. +- `build()` consumes the populated builder. + +#### Output +- `LlamaCppJniConfig` immutable instance with all fields set. +- Getter methods return primitive or object values; list getters return unmodifiable views. + +#### Core logic +- Constructor copies all builder fields to immutable fields. +- Builder setters assign values and return `this`. +- `build()` creates a new `LlamaCppJniConfig` from the builder. + +#### Public API +- `static Builder builder(String)` → builder with defaults. +- `String modelPath()` → model file path. +- `int contextSize()` → context window size. +- `int maxOutputTokens()` → max output tokens. +- `float temperature()` → sampling temperature. +- `int threads()` → CPU thread count. +- `float topP()` → nucleus‑sampling threshold. +- `int topK()` → top‑k limit. +- `float minP()` → min‑p threshold. +- `float topNSigma()` → top‑n‑sigma threshold. +- `float repeatPenalty()` → repetition penalty. +- `@Nullable Boolean chatTemplateEnableThinking()` → chat‑template thinking flag. +- `boolean cachePrompt()` → prompt caching enabled. +- `boolean swaFull()` → full‑size SWA cache kept. +- `int cacheReuse()` → KV prefix‑reuse chunk size. +- `int gpuLayers()` → GPU layers offloaded. +- `int seed()` → RNG seed. +- `int cpuMoeLayers()` → CPU MoE layers. +- `int cpuFfnLayers()` → CPU FFN layers. +- `int kvUnifiedPerSlot()` → per‑slot KV cap. +- `String lazyMode()` → tensor‑read laziness. +- `int repeatLastN()` → repeat‑penalty window. +- `String cacheTypeK()` → KV‑cache type K. +- `String cacheTypeV()` → KV‑cache type V. +- `boolean flashAttn()` → Flash Attention enabled. +- `int batchSize()` → logical batch size. +- `int ubatchSize()` → physical batch size. +- `int threadsBatch()` → batch/prompt‑processing threads. +- `int mainGpu()` → primary GPU index. +- `String devices()` → device selection. +- `String provider()` → AI provider. +- `String remoteModel()` → remote model ID. +- `String baseUrl()` → OpenAI‑compatible base URL. +- `String apiKeyEnv()` → API key environment variable name. +- `String reasoningEffort()` → reasoning‑effort value. +- `int reasoningBudgetTokens()` → reasoning token budget. +- `float dryMultiplier()` → DRY multiplier. +- `float dryBase()` → DRY base. +- `int dryAllowedLength()` → DRY allowed length. +- `int dryPenaltyLastN()` → DRY penalty look‑back. +- `List drySequenceBreakers()` → unmodifiable DRY sequence breakers. +- `List stopStrings()` → unmodifiable stop strings. +- Builder setters: `contextSize(int)`, `maxOutputTokens(int)`, `temperature(float)`, `threads(int)`, `topP(float)`, `topK(int)`, `minP(float)`, `topNSigma(float)`, `repeatPenalty(float)`, `chatTemplateEnableThinking(@Nullable Boolean)`, `cachePrompt(boolean)`, `swaFull(boolean)`, `cacheReuse(int)`, `gpuLayers(int)`, `seed(int)`, `cpuMoeLayers(int)`, `cpuFfnLayers(int)`, `kvUnifiedPerSlot(int)`, `lazyMode(String)`, `repeatLastN(int)`, `cacheTypeK(String)`, `cacheTypeV(String)`, `flashAttn(boolean)`, `batchSize(int)`, `ubatchSize(int)`, `threadsBatch(int)`, `mainGpu(int)`, `devices(String)`, `provider(String)`, `remoteModel(String)`, `baseUrl(String)`, `apiKeyEnv(String)`, `reasoningEffort(String)`, `reasoningBudgetTokens(int)`, `dryMultiplier(float)`, `dryBase(float)`, `dryAllowedLength(int)`, `dryPenaltyLastN(int)`, `drySequenceBreakers(List)`, `stopStrings(List)`, `build()` → `LlamaCppJniConfig`. + +#### Dependencies +- `java.util.Collections`, `java.util.List`, `java.util.Objects`. +- `lombok.EqualsAndHashCode`, `lombok.ToString`. +- `net.ladenthin.srcmorph.config.AiGenerationConfig`. +- `net.ladenthin.srcmorph.support.ConvertToRecord`. +- `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `Objects.requireNonNull` throws `NullPointerException` if `modelPath` is null. +- No other explicit exceptions. + +#### Concurrency +- Immutable `LlamaCppJniConfig` is thread‑safe. +- `Builder` is not thread‑safe; intended for single‑thread use. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..dd55dd9c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,100 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:40:46Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Builds JSON request bodies, validates endpoints, and handles API key security for OpenAI‑compatible chat‑completion services. + +#### Purpose +- Constructs chat‑completion request payloads with sampling knobs. +- Validates and normalises endpoint URLs. +- Secures API key transmission over HTTP. +- Provides helper utilities for status checks and error messaging. + +#### Type +- `final class OpenAiCompatibleProviderSupport` (class, final) + - Extends `Object`. + - Annotations: `@ToString`. + - Fields: + - `private final LlamaCppJniConfig config` + - `@ToString.Exclude private final AiPromptSupport promptSupport` + - `@ToString.Exclude private final Function environment` + - `private final Java8CompatibilityHelper compatibilityHelper` + - Static fields: + - `static final String CHAT_COMPLETIONS_PATH` + - `static final int ERROR_BODY_EXCERPT` + - `private static final int HTTP_OK_FIRST` + - `private static final int HTTP_OK_END` + - `static final String HTTP_SCHEME` + - `static final String HTTPS_SCHEME` + - `private static final String LOOPBACK_HOST_NAME` + - `private static final Pattern IPV4_LOOPBACK` + - `private static final String IPV6_LOOPBACK` + - `private static final String ELLIPSIS` + - `private static final ObjectMapper MAPPER` + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, `Function environment`. +- `requestBody(AiGenerationRequest request)` consumes request data, config sampling knobs, and prompt definitions. +- `endpoint()` uses `config.baseUrl()`. +- `apiKey()` reads `config.apiKeyEnv()` and environment lookup. +- `apiKeyFor(String endpoint)` uses `apiKey()` and parses `endpoint`. +- `isLoopbackHost(String host)` receives host string. +- `isSuccess(int status)` receives HTTP status. +- `errorMessage(String endpoint, int status, String body)` receives endpoint, status, and body. +- `timings(String text, ChatResponse response, double seconds)` consumes parsed text, response usage, and elapsed time. + +#### Output +- `requestBody` returns JSON string. +- `endpoint` returns full chat‑completions URL. +- `apiKey` returns trimmed key or `null`. +- `apiKeyFor` returns key or `null`; throws `IOException` on insecure HTTP. +- `isLoopbackHost` returns boolean. +- `isSuccess` returns boolean. +- `errorMessage` returns formatted message string. +- `timings` returns `AiGenerationTimings` instance. + +#### Core logic +- **requestBody**: builds `ObjectNode` with model, messages, token limits, temperature, top‑p, optional top‑k, min‑p, repetition penalty, seed, stop strings, reasoning effort, and disables streaming; serialises to JSON. +- **endpoint**: trims `baseUrl`, ensures it starts with `http://` or `https://`, removes trailing slashes, appends `/chat/completions`. +- **apiKey**: retrieves env var, trims, returns `null` if unset or blank. +- **apiKeyFor**: if key present and endpoint uses plain `http`, parses host; if host not loopback, throws `IOException`; otherwise returns key. +- **isLoopbackHost**: checks host against `localhost`, IPv4 loopback regex, or `[::1]`. +- **isSuccess**: checks status in 200–299 range. +- **errorMessage**: truncates body to 500 chars, appends ellipsis if truncated, formats message. +- **timings**: extracts token counts from `ChatResponse.usage`, computes decode rate, constructs `AiGenerationTimings`. + +#### Public API +- `String requestBody(AiGenerationRequest request) -> JSON body` +- `String endpoint() -> full URL` +- `@Nullable String apiKey() -> key or null` +- `@Nullable String apiKeyFor(String endpoint) -> key or null` +- `static boolean isLoopbackHost(String host) -> true if loopback` +- `static boolean isSuccess(int status) -> true if 2xx` +- `static String errorMessage(String endpoint, int status, String body) -> message` +- `static AiGenerationTimings timings(String text, ChatResponse response, double seconds) -> timings` + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper`, `ArrayNode`, `ObjectNode` +- `java.io.IOException`, `java.net.URL`, `java.util.List`, `java.util.Objects`, `java.util.function.Function`, `java.util.regex.Pattern` +- `lombok.ToString`, `org.jspecify.annotations.Nullable` +- `net.ladenthin.llama.value.ChatResponse`, `net.ladenthin.llama.value.Usage` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `net.ladenthin.srcmorph.provider.LlamaCppJniConfig` +- `net.ladenthin.srcmorph.provider.AiGenerationTimings` + +#### Exceptions / Errors +- `IllegalArgumentException` in `endpoint()` if `baseUrl` not HTTP(S). +- `IOException` in `apiKeyFor()` if plain HTTP to non‑loopback host or URL parsing fails. +- `IOException` in `requestBody()` if JSON serialization fails. + +#### Concurrency +- All fields are immutable after construction; no mutable shared state. +- Thread‑safe by design. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..1f91f9d6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,60 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:41:38Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Provides a pluggable AI generation engine for source‑code transformation, supporting local llama.cpp models, OpenAI‑compatible APIs, and a mock provider, with utilities for request construction, response parsing, and timing metrics. + +#### Purpose +- Enable AI‑driven text generation for source‑morphing workflows. +- Offer multiple backend strategies (local, cloud‑compatible, mock). + +#### Responsibilities +- **Provider selection** – `AiGenerationProviderFactory` resolves provider keys and instantiates the appropriate `AiGenerationProvider`. +- **Request handling** – `OpenAiCompatibleProviderSupport` builds JSON payloads, validates endpoints, and secures API keys for OpenAI‑compatible services. +- **Local inference** – `LlamaCppJniAiGenerationProvider` loads a GGUF model via JNI, executes chat completions, and parses responses. +- **Response cleaning** – `AiCompletionParser` strips internal “thinking” blocks from raw LLM outputs. +- **Configuration** – `LlamaCppJniConfig` encapsulates all llama.cpp tuning knobs in an immutable record‑style object. + +#### Key units +- **AiGenerationProvider** – interface defining `generate`, `generateWithTimings`, and `close`. +- **AiGenerationProviderFactory** – creates providers based on a key; exposes `PROVIDER_MOCK`, `PROVIDER_LLAMACPP_JNI`, `PROVIDER_OPENAI_COMPATIBLE`. +- **LlamaCppJniAiGenerationProvider** – local provider that lazily loads `LlamaModel`, runs chat completions, and returns text or `AiGenerationTimings`. +- **OpenAiCompatibleProviderSupport** – helper for building request bodies, normalising URLs, and handling API keys for OpenAI‑compatible endpoints. +- **AiCompletionParser** – removes Gemma‑style “thinking” blocks from completions. +- **LlamaCppJniConfig** – immutable configuration holder with a fluent builder for 37 llama.cpp parameters. + +#### Data flow +1. **Factory** receives a provider key → resolves to a concrete provider. +2. **Provider** receives an `AiGenerationRequest` (prompt key, source file, text, header). +3. For OpenAI‑compatible providers: + - `OpenAiCompatibleProviderSupport.requestBody` builds JSON. + - HTTP client (not shown) sends request → receives JSON response. + - `AiCompletionParser` cleans the response. +4. For local llama.cpp provider: + - `LlamaCppJniAiGenerationProvider.chatResponse` invokes native `chatComplete`. + - `AiCompletionParser` extracts the answer. +5. Provider returns plain text or `AiGenerationTimings` (including token counts and rates). + +#### Dependencies +- **Internal**: `AiPromptSupport`, `Java8CompatibilityHelper`, `AiGenerationTimings`, `AiGenerationRequest`. +- **External**: `net.ladenthin.llama` (model, args, JSON parser), Jackson `ObjectMapper`, `org.jspecify.annotations.Nullable`. +- **Configuration**: `LlamaCppJniConfig` supplies all tuning knobs. + +#### Cross‑cutting +- **Immutability**: `LlamaCppJniConfig` and provider support classes are immutable, ensuring thread safety. +- **Error handling**: `IOException` is the primary failure mode for missing markers, truncated responses, or insecure HTTP usage. +- **Timing metrics**: `generateWithTimings` is a default implementation that wraps `generate` and supplies zeroed metrics unless overridden. +- **Logging & warnings**: Local provider logs truncation and prompt‑cache reuse via `support` utilities (not detailed in summaries). + +This package equips a source‑morphing system with flexible AI backends, robust request/response handling, and comprehensive configuration for both local and cloud‑based inference. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..9333ebd7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,49 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:41:12Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Computes a 256‑bin histogram of a byte stream in two OpenCL kernel passes. + +#### Purpose +- Builds a byte histogram for image or arbitrary byte data. +- Uses two‑pass reduction: per‑group partial histograms then global reduction. + +#### Type +- OpenCL C 1.2 kernels (`__kernel` functions) in a single source file. + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms into `partial`. +- `histogram_reduce`: writes final 256‑bin histogram into `histogram`. + +#### Core logic +- **histogram_partial** + 1. Zero local bins in parallel (`local_bins[b] = 0`). + 2. Each work‑item scans its assigned input slice, atomically incrementing `local_bins[input[i]]`. + 3. After synchronization, each work‑item writes its local bin counts to the global `partial` buffer at offset `group_id * BINS`. +- **histogram_reduce** + 1. One work‑item per bin (`bin = get_global_id(0)`). + 2. Sums the corresponding bin across all `group_count` partial histograms. + 3. Stores the sum into `histogram[bin]`. + +#### Public API +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – global reduction to final histogram. + +#### Constants and configuration +- `#define BINS 256` – number of histogram bins. + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- None; kernels assume valid pointers and sizes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..f35ec946 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,39 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:41:54Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Provides OpenCL kernels for computing a 256‑bin histogram of byte data via two‑pass reduction. + +#### Purpose +- Compute a byte histogram for image or arbitrary byte streams. +- Perform a two‑pass reduction: per‑group partial histograms followed by global aggregation. + +#### Responsibilities +- **Partial histogram generation** – per‑group accumulation of byte counts using local memory and atomic increments. +- **Global reduction** – summing per‑group partial histograms into a final 256‑bin histogram. + +#### Key units +- `histogram_partial` kernel – builds per‑group partial histograms (`__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`). +- `histogram_reduce` kernel – aggregates partial histograms into the final histogram (`__global const uint *partial`, `uint group_count`, `__global uint *histogram`). +- `#define BINS 256` – constant for the number of histogram bins. + +#### Data flow +1. **Input**: byte stream (`uchar *input`) → `histogram_partial`. +2. **Partial stage**: each work‑group writes its local bin counts to `partial` buffer. +3. **Reduction stage**: `histogram_reduce` reads all partial histograms, sums per bin, writes final `histogram`. + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. +- Requires `__global` and `__local` memory spaces for input, partial, and local bins. + +#### Cross-cutting +- Use of local memory (`__local uint *local_bins`) for intra‑group accumulation. +- Atomic increments (`atomic_inc`) to avoid race conditions on local bins. +- Synchronization via `barrier(CLK_LOCAL_MEM_FENCE)` after local accumulation. +- One‑work‑item-per‑bin strategy in `histogram_reduce` for efficient global summation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..705656e7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,47 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:42:21Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides a unified toolkit for byte‑level data processing, including GPU‑accelerated histograms, a lock‑free ring buffer, and utility scripts for backup and sales reporting. + +#### Purpose +- Deliver high‑performance byte‑histogram computation via OpenCL. +- Offer a reusable, lock‑free circular buffer for single‑producer/single‑consumer byte streams. +- Supply shell and Python utilities for backup rotation and sales data aggregation. + +#### Responsibilities +- **GPU Histogram Engine** – two‑pass reduction kernels for 256‑bin byte histograms. +- **Ring Buffer API** – power‑of‑two circular buffer with init, free, read, write, and capacity queries. +- **Utility Scripts** – Bash backup rotation and Python monthly sales reporting. + +#### Key units +- `histogram_partial` / `histogram_reduce` kernels (OpenCL) – build and aggregate per‑group histograms. +- `ringbuf_t`, `ringbuf_status_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read` – core ring buffer types and operations. +- `rotate_backups.sh` – backup creation and pruning script. +- `sales_report.py` – CSV parser, `revenue_by_month_and_region`, CLI entry point. + +#### Data flow +1. **Histogram**: byte stream → `histogram_partial` (per‑group local bins) → `histogram_reduce` (global sum) → final 256‑bin histogram. +2. **Ring Buffer**: producer writes via `ringbuf_write`; consumer reads via `ringbuf_read`; indices wrap modulo power‑of‑two capacity; metrics via `ringbuf_used` / `ringbuf_free_space`. +3. **Utilities**: source directory → `tar` archive → backup directory; old archives removed. CSV files → `parse_orders` → aggregated revenue → printed report. + +#### Dependencies +- OpenCL built‑ins (`get_local_id`, `atomic_inc`, `barrier`, etc.) for histogram kernels. +- Standard C headers (`stddef.h`, `stdint.h`, `stdlib.h`, `string.h`) for ring buffer implementation. +- Bash utilities (`tar`, `date`, `du`, `ls`, `rm`, `mv`) for backup script. +- Python standard library (`argparse`, `csv`, `collections`, `dataclasses`, `datetime`, `decimal`) for sales report. + +#### Cross-cutting +- **Power‑of‑two constraint** in ring buffer capacity checks. +- **Lock‑free design**: single‑producer/single‑consumer model, no mutexes. +- **Atomic operations** and **barriers** for intra‑group synchronization in OpenCL kernels. +- **Consistent error handling**: `ringbuf_status_t` codes, Bash `set -euo pipefail`, Python `ValueError` for CSV parsing. +- **UTC timestamps** for backup naming and report dates. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..6e1c3d65 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,49 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:42:17Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides a lock‑free, power‑of‑two sized circular buffer for byte streams, enabling efficient single‑producer/single‑consumer data transfer. + +#### Purpose +- Offer a reusable ring buffer API for byte‑level data streams. +- Support initialization, cleanup, read/write, and capacity queries. + +#### Responsibilities +- **Buffer Management** – allocate, free, and maintain head/tail indices. +- **Data Transfer** – read/write operations that wrap around the buffer. +- **Capacity Tracking** – expose used bytes and free space metrics. +- **Error Handling** – validate capacity and report allocation failures. + +#### Key units +- `ringbuf_t` – struct holding buffer pointer, capacity, head, tail. +- `ringbuf_status_t` enum – `RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`. +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `ringbuf_free(ringbuf_t *rb)` – release resources. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `ringbuf_free_space(const ringbuf_t *rb)` – available space. + +#### Data flow +1. **Initialization** – caller supplies a power‑of‑two `capacity`; `ringbuf_init` allocates memory and sets indices to zero. +2. **Writing** – producer calls `ringbuf_write`; data is copied into the buffer, possibly in two contiguous chunks if wrapping occurs; head index advances. +3. **Reading** – consumer calls `ringbuf_read`; data is copied out, possibly in two chunks; tail index advances. +4. **Querying** – `ringbuf_used` and `ringbuf_free_space` compute metrics via modulo arithmetic. +5. **Cleanup** – `ringbuf_free` releases the allocated memory. + +#### Dependencies +- Standard C headers: ``, ``, ``, ``. +- Internal: `ringbuf.h` defines types and API; `ringbuf.c` implements the logic. + +#### Cross-cutting +- **Power‑of‑two constraint** – all capacity checks enforce this rule. +- **Lock‑free design** – single‑producer/single‑consumer model; no mutexes. +- **Error codes** – consistent `ringbuf_status_t` return values for init failures. +- **Memory management** – explicit allocation/free; caller responsible for lifecycle. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..0978a3fe --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,59 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:41:15Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Implements a fixed‑size circular buffer with power‑of‑two capacity, providing read/write and memory management. + +#### Purpose +- Provides a ring buffer for byte streams. +- Supports initialization, deallocation, reading, writing, and space queries. + +#### Type +- C source file implementing `ringbuf_t` operations defined in `ringbuf.h`. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_free` releases allocated memory. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates memory, sets head/tail to 0. +- `ringbuf_free` frees memory and resets fields. +- `ringbuf_used` computes used bytes via modulo arithmetic. +- `ringbuf_free_space` calculates available space. +- `ringbuf_write` writes up to two contiguous chunks to wrap around. +- `ringbuf_read` reads up to two contiguous chunks to wrap around. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free buffer. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – free capacity. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write data. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read data. + +#### Constants and configuration +- None defined in this file. + +#### Dependencies +- `stdlib.h` – `malloc`, `free`. +- `string.h` – `memcpy`. +- `ringbuf.h` – type and status definitions. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity not power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` on allocation failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..95f3616b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,59 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:41:18Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides a fixed‑size byte ring buffer for single‑producer, single‑consumer use. + +#### Purpose +- Implements a lock‑free circular buffer for byte streams. +- Supports initialization, cleanup, read/write, and space queries. + +#### Type +- Header file (`ringbuf.h`) in C. +- Exposes `ringbuf_t` struct, `ringbuf_status_t` enum, and public API functions. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes (must be power of two, >0). +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes actually written. +- `ringbuf_read` returns number of bytes actually read. +- `ringbuf_used` and `ringbuf_free_space` return current usage metrics. + +#### Core logic +- `ringbuf_init` validates capacity, allocates `capacity` bytes, sets head/tail to 0. +- `ringbuf_write` copies up to `len` bytes from `src` into buffer, wrapping at `capacity`. +- `ringbuf_read` copies up to `len` bytes from buffer into `dst`, wrapping at `capacity`. +- `ringbuf_used` computes `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space` computes `(capacity - 1) - ringbuf_used`. +- `ringbuf_free` releases allocated memory. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free resources. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – available space. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- ``, `` for standard types. +- Uses `malloc`, `free`, `memcpy` (implicitly via standard library). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..53ac89ab --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,37 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:42:20Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> A utility package that provides a shell script for rotating directory backups and a Python tool for aggregating monthly sales data from CSV exports. + +#### Purpose +- Automate backup creation and retention for a source directory. +- Generate revenue reports by month and region from order CSV files. + +#### Responsibilities +- **Backup rotation**: timestamped archive generation, cleanup of old archives. +- **Sales reporting**: CSV parsing, currency filtering, monthly‑region aggregation, threshold filtering. + +#### Key units +- `rotate_backups.sh` – Bash script that creates a `.tar.gz` backup and prunes older ones. +- `sales_report.py` – Python script exposing `parse_orders`, `revenue_by_month_and_region`, and `main` for CLI usage. + +#### Data flow +1. **Backup**: `SOURCE_DIR` → `tar` → temporary archive → final archive in `BACKUP_DIR`; old archives listed and removed beyond `KEEP`. +2. **Sales report**: CSV files → `parse_orders` → `Order` objects → `revenue_by_month_and_region` → aggregated totals → printed lines filtered by `--min-revenue`. + +#### Dependencies +- Bash: `tar`, `date`, `du`, `ls`, `rm`, `mv`, `mapfile`. +- Python: `argparse`, `csv`, `collections.defaultdict`, `dataclasses`, `datetime`, `decimal`. + +#### Cross-cutting +- Strict error handling (`set -euo pipefail` in Bash; `ValueError` for CSV issues in Python). +- Use of UTC timestamps for backup naming. +- Consistent output formatting: tab‑separated lines for reports, clear console messages for backup status. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..98489fbc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,61 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:41:26Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates a dated, compressed backup of a directory and prunes older archives, keeping only the newest N. + +#### Purpose +- Generates a timestamped `.tar.gz` backup of `SOURCE_DIR` into `BACKUP_DIR`. +- Deletes older backups beyond the specified `KEEP` count. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- `$1` → `SOURCE_DIR` (required). +- `$2` → `BACKUP_DIR` (required). +- `$3` → `KEEP` (optional, defaults to `7`). +- Validates `KEEP` is a positive integer. +- Checks `SOURCE_DIR` exists; creates `BACKUP_DIR` if missing. + +#### Output +- Writes a new archive file `"$BACKUP_DIR/${name}_.tar.gz"`. +- Prints creation and size of the archive. +- Removes older archives beyond `KEEP`; prints each removal. +- Exit status `0` on success, `2` on invalid arguments or missing directory. + +#### Core logic +- Validate inputs and create backup directory. +- Build archive name with UTC timestamp. +- Create temporary partial archive `"$tmp"`. +- `tar -C "$(dirname "$SOURCE_DIR")" -czf "$tmp" "$name"` to compress. +- Move temporary to final archive. +- List existing archives sorted newest first. +- Delete all but the first `KEEP` entries. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR`=`"${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR`=`"${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP`=`"${3:-7}"` +- `name`=`"$(basename "$SOURCE_DIR")"` +- `archive`=`"$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp`=`"$archive.partial"` + +#### Dependencies +- External commands: `tar`, `date`, `du`, `ls`, `rm`, `mv`. +- Uses `mapfile` (bash built‑in) to read archive list. + +#### Errors and exit codes +- `exit 2` if `KEEP` not a positive integer or `SOURCE_DIR` missing. +- `trap` ensures temporary file `$tmp` is removed on exit. +- `set -euo pipefail` causes immediate exit on any command failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..dc83f3be --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,58 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:41:30Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Generates a monthly sales report from CSV order exports, aggregating revenue by month and region for a specified currency. + +#### Purpose +- Aggregate order amounts by month and region. +- Output revenue per month/region in a specified currency. + +#### Type +- Python script (`.py`). + +#### Input +- `csv_files`: list of CSV file paths (positional arguments). +- `--currency`: target currency code (default `EUR`). +- `--min-revenue`: minimum revenue threshold (default `0`). +- CSV rows must contain columns: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints lines: `monthregionrevenue ` for each month/region meeting the threshold. +- Exits with status `1` if no orders found; otherwise `0`. + +#### Core logic +- `parse_orders(path, currency)`: + - Open CSV, validate required columns. + - Skip rows with non‑matching currency. + - Convert `order_date` to `date`, `amount` to `Decimal`. + - Yield `Order` dataclass instances. +- `revenue_by_month_and_region(orders)`: + - Accumulate totals in `defaultdict(Decimal)` keyed by `(YYYY-MM, region)`. + - Return sorted dictionary of totals. +- `main(argv)`: + - Parse CLI arguments. + - Collect all orders from provided files. + - If none, report error. + - Iterate over aggregated totals, filter by `min_revenue`, print formatted output. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` – read and filter orders from a CSV file. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` – aggregate revenue. +- `main(argv=None) -> int` – command‑line entry point. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` if CSV missing required columns or contains invalid data. +- `ValueError` propagated from `parse_orders` for malformed rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..d1bd5c03 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,136 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:42:43Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A modular AI‑driven source‑code transformation engine that selects files, extracts facts, and generates code changes via pluggable local or cloud providers. + +#### Purpose +- Orchestrate AI‑based source‑code analysis and generation for the srcmorph tool. +- Provide configurable file selection, fact extraction, and generation pipelines. + +#### Responsibilities +- **Configuration & Selection** – `SrcMorphConfiguration`, `AiConditionEvaluator`, `AiConditionGroup`. +- **Fact Extraction** – `AiFactExtractor`, `AiFactCounter`. +- **Generation Pipeline** – `AiGenerationConfig`, `AiOversizeStrategy`, `AiGenerationProviderFactory`. +- **Provider Implementation** – `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport`, `AiCompletionParser`. + +#### Key units +- `SrcMorphConfiguration` – mutable holder for file paths, prompts, and model metadata. +- `AiConditionEvaluator` – validates and evaluates file‑selection trees. +- `AiFactExtractor` – regex‑based fact counter for AI prompts. +- `AiGenerationConfig` – JavaBean for AI model, sampling, caching, and DRY settings. +- `AiOversizeStrategy` – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`) for oversized files. +- `AiGenerationProvider` – interface (`generate`, `generateWithTimings`, `close`). +- `AiGenerationProviderFactory` – resolves provider keys to concrete implementations. +- `LlamaCppJniAiGenerationProvider` – local llama.cpp JNI provider with lazy model loading. +- `OpenAiCompatibleProviderSupport` – builds JSON payloads and normalises endpoints for OpenAI‑compatible APIs. +- `AiCompletionParser` – strips internal “thinking” blocks from LLM outputs. +- `LlamaCppJniConfig` – immutable record of 37 llama.cpp tuning knobs. + +#### Data flow +1. **Setup** – `SrcMorphConfiguration` supplies file selection rules, prompts, and AI settings. +2. **Selection** – `AiConditionEvaluator` checks each file against `AiConditionGroup`; selected files may trigger line‑count checks. +3. **Fact Extraction** – `AiFactExtractor` scans source text with `AiFactCounter` patterns, producing a facts block for prompts. +4. **Provider Selection** – `AiGenerationProviderFactory` creates the appropriate `AiGenerationProvider`. +5. **Generation** – Provider receives an `AiGenerationRequest`; for OpenAI‑compatible providers, `OpenAiCompatibleProviderSupport` builds the request body; for local llama.cpp, native chat completion is invoked. +6. **Response Handling** – `AiCompletionParser` cleans the raw output; provider returns plain text or `AiGenerationTimings`. +7. **Output** – Generated code is written to the output directory defined in `SrcMorphConfiguration`. + +#### Dependencies +- **Internal**: `AiCondition`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiSourceExcludeFilter`. +- **External**: `java.time.Instant`, `java.util.regex`, `org.jspecify.annotations.Nullable`, Lombok (`@ToString`), Jackson `ObjectMapper`, `net.ladenthin.llama` (model, args, JSON parser), `net.ladenthin.srcmorph.support`. +- **Configuration Sources**: Maven plugin parameters or external config files populate `SrcMorphConfiguration` and `AiGenerationConfig`. + +#### Cross‑cutting +- Thread‑safe, stateless utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Defensive copying in `AiConditionGroup.setConditions`. +- Immutable configuration objects (`LlamaCppJniConfig`, provider support classes). +- Robust error handling with clear exception messages for invalid configs or missing markers. +- Timing metrics via `generateWithTimings` default implementation. +- Logging of truncation, prompt‑cache reuse, and provider status (details omitted in summaries). + +--- + +#### Purpose +- Deliver high‑performance byte‑histogram computation via OpenCL. +- Offer a reusable, lock‑free circular buffer for single‑producer/single‑consumer byte streams. +- Supply shell and Python utilities for backup rotation and sales data aggregation. + +#### Responsibilities +- **GPU Histogram Engine** – two‑pass reduction kernels for 256‑bin byte histograms. +- **Ring Buffer API** – power‑of‑two circular buffer with init, free, read, write, and capacity queries. +- **Utility Scripts** – Bash backup rotation and Python monthly sales reporting. + +#### Key units +- `histogram_partial` / `histogram_reduce` kernels (OpenCL) – build and aggregate per‑group histograms. +- `ringbuf_t`, `ringbuf_status_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read` – core ring buffer types and operations. +- `rotate_backups.sh` – backup creation and pruning script. +- `sales_report.py` – CSV parser, `revenue_by_month_and_region`, CLI entry point. + +#### Data flow +1. **Histogram**: byte stream → `histogram_partial` (per‑group local bins) → `histogram_reduce` (global sum) → final 256‑bin histogram. +2. **Ring Buffer**: producer writes via `ringbuf_write`; consumer reads via `ringbuf_read`; indices wrap modulo power‑two capacity; metrics via `ringbuf_used` / `ringbuf_free_space`. +3. **Utilities**: source directory → `tar` archive → backup directory; old archives removed. CSV files → `parse_orders` → aggregated revenue → printed report. + +#### Dependencies +- OpenCL built‑ins (`get_local_id`, `atomic_inc`, `barrier`, etc.) for histogram kernels. +- Standard C headers (`stddef.h`, `stdint.h`, `stdlib.h`, `string.h`) for ring buffer implementation. +- Bash utilities (`tar`, `date`, `du`, `ls`, `rm`, `mv`) for backup script. +- Python standard library (`argparse`, `csv`, `collections`, `dataclasses`, `datetime`, `decimal`) for sales report. + +#### Cross‑cutting +- **Power‑of‑two constraint** in ring buffer capacity checks. +- **Lock‑free design**: single‑producer/single‑consumer model, no mutexes. +- **Atomic operations** and **barriers** for intra‑group synchronization in OpenCL kernels. +- **Consistent error handling**: `ringbuf_status_t` codes, Bash `set -euo pipefail`, Python `ValueError` for CSV parsing. +- **UTC timestamps** for backup naming and report dates. + +--- + +#### Purpose +- Persist and enforce business rules for library catalog, shop orders, and warehouse stock. +- Provide reporting, audit logging, and transactional integrity across each domain. + +#### Responsibilities +- **Library** – catalog, member, loan lifecycle, branch‑aware lending, reporting, and audit. +- **Shop** – product catalog, order processing, stock reservation, and order total calculation. +- **Warehouse** – supplier feed ingestion, stock level maintenance, and sync run auditing. + +#### Key units +- **Library** + - Tables: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. + - Views: `overdue_loans`, `member_loan_stats`, `popular_books`. + - Functions: `fn_checkout_book`, `fn_late_fee`. + - Procedure: `sp_return_book`. + - Trigger: `trg_loan_audit` on `loan`. +- **Shop** + - Tables: `product`, `customer_order`, `order_item`. + - Procedure: `add_order_item`. +- **Warehouse** + - Tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. + - Procedure: `dbo.usp_SyncStock`. + +#### Data flow +- **Library** – checkout → `fn_checkout_book` → `loan` insert + audit; return → `sp_return_book` → `loan` update + audit; reporting views aggregate loan/member/book data. +- **Shop** – `add_order_item` locks product, validates stock, inserts/updates `order_item`, decrements `product.stock`, recalculates `customer_order.total_cents`. +- **Warehouse** – `usp_SyncStock` aggregates new `SupplierFeed` rows, merges into `StockLevel`, logs counts/errors in `SyncLog`. + +#### Dependencies +- **Internal** – cross‑package tables referenced by procedures and triggers. +- **External** – PostgreSQL built‑ins (`CURRENT_DATE`, `now()`), MySQL 8 features (`FOR UPDATE`, ENUM), SQL Server system functions (`SYSUTCDATETIME()`, `ERROR_MESSAGE()`). +- **Indexes** – e.g., `idx_book_author`, `idx_loan_member`, `idx_order_customer`, `idx_book_copy`. + +#### Cross‑cutting +- **Integrity & Constraints** – data validity enforced via checks (e.g., `copies_free <= copies_total`, `due_on > loaned_on`). +- **Audit Trails** – `loan_audit` and `SyncLog` capture every state change. +- **Concurrency Control** – row locks in `add_order_item`; transactional boundaries in `usp_SyncStock`. +- **Materialized View Refresh** – `popular_books` requires periodic refresh. +- **Branch‑aware Lending** – post‑migration loans reference `book_copy` tied to `branch`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..53d1abee --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: E181304D +- D: 2026-11-04T07:35:21Z +- T: 2026-11-04T07:43:11Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project centers on an AI‑driven source‑code transformation engine that selects files, extracts facts, and generates code changes through pluggable local or cloud providers, with a dedicated configuration package for pipeline setup. A provider subsystem offers interchangeable AI backends—including local llama.cpp models, OpenAI‑compatible APIs, and a mock provider—alongside utilities for request handling, response parsing, and performance metrics. Complementing the code‑engineering side, a byte‑level data toolkit supplies GPU‑accelerated histograms, a lock‑free ring buffer, and backup utilities, while a SQL layer manages library, e‑commerce, and warehouse data with dedicated schemas, business logic, and audit trails. Together, these subsystems enable automated code transformation, efficient data processing, and robust database operations within a unified framework. + +#### Packages +- java/config — Provides AI‑driven source‑code analysis and generation, including file‑selection, fact extraction, and configurable generation pipelines for the srcmorph tool. +- java — A modular AI‑driven source‑code transformation engine that selects files, extracts facts, and generates code changes via pluggable local or cloud providers. +- java/provider — Provides a pluggable AI generation engine for source‑code transformation, supporting local llama.cpp models, OpenAI‑compatible APIs, and a mock provider, with utilities for request construction, response parsing, and timing metrics. +- other/kernels — Provides OpenCL kernels for computing a 256‑bin histogram of byte data via two‑pass reduction. +- other — Provides a unified toolkit for byte‑level data processing, including GPU‑accelerated histograms, a lock‑free ring buffer, and utility scripts for backup and sales reporting. +- other/ringbuf — Provides a lock‑free, power‑of‑two sized circular buffer for byte streams, enabling efficient single‑producer/single‑consumer data transfer. +- other/scripts — A utility package that provides a shell script for rotating directory backups and a Python tool for aggregating monthly sales data from CSV exports. +- . — A modular AI‑driven source‑code transformation engine that selects files, extracts facts, and generates code changes via pluggable local or cloud providers. +- sql/library — A PostgreSQL library management system that stores catalog, member, and loan data, enforces lending rules, and provides reporting and audit trails. +- sql — A collection of SQL packages that manage library lending, e‑commerce orders, and warehouse inventory, each with dedicated schemas, business logic, and audit trails. +- sql/shop — A MySQL schema for a web shop that stores products, customer orders, and order items, with a stored procedure to add items to an order while reserving stock and updating totals. +- sql/warehouse — Keeps a warehouse inventory in sync with incoming supplier stock feeds, logging each update run. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..75606942 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,70 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:40:51Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Defines the core tables and indexes for a library lending system, tracking authors, books, members, and loans. + +#### Purpose +- Store library catalog and member data. +- Record book loans and enforce business rules (e.g., due dates, copy counts). + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` + +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author (author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` + +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` + +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `member_id BIGINT NOT NULL REFERENCES member (member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` + +- **Indexes** + - `idx_book_author ON book (author_id)` + - `idx_loan_member ON loan (member_id)` + - `idx_loan_open ON loan (due_on) WHERE returned_on IS NULL` + +#### Reads +- None (schema definition only). + +#### Writes +- None (schema definition only). + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (ON DELETE CASCADE) + +#### Dependencies +- None beyond standard PostgreSQL types and constraints. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..9e5f7f12 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,60 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:40:54Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> A set of reporting views and a materialized view for a library system, summarizing overdue loans, member loan statistics, and popular books. + +#### Purpose +- Provide read‑only reporting data for library operations. +- Enable quick access to overdue loans, member activity, and recent popular books. + +#### Type +- PostgreSQL views: `overdue_loans`, `member_loan_stats`. +- PostgreSQL materialized view: `popular_books`. +- PostgreSQL index: `idx_popular_books_id`. + +#### Schema +- **overdue_loans** + - `loan_id` integer + - `member_id` integer + - `email` text + - `title` text + - `due_on` date + - `days_overdue` integer +- **member_loan_stats** + - `member_id` integer + - `full_name` text + - `loans_total` bigint + - `loans_open` bigint + - `last_loan_on` timestamp +- **popular_books** + - `book_id` integer + - `title` text + - `author_name` text + - `times_loaned` bigint +- **idx_popular_books_id** + - Unique index on `popular_books(book_id)`. + +#### Reads +- `overdue_loans`: `loan`, `member`, `book`. +- `member_loan_stats`: `member`, `loan`. +- `popular_books`: `loan`, `book`, `author`. + +#### Writes +- None (views and materialized view are read‑only; index creation does not write data). + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. +- Functions: `CURRENT_DATE`, `CURRENT_DATE - INTERVAL '365 days'`. +- Index: `idx_popular_books_id` on `popular_books`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..948df6fe --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,68 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:40:56Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Handles book lending, returns, late fee calculation, and audit logging for a library system. + +#### Purpose +- Implements checkout, return, and late fee logic. +- Records audit trail of loan actions. + +#### Type +- Table: `loan_audit` +- Function: `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn` +- Procedure: `sp_return_book` +- Trigger: `trg_loan_audit` + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member` (`member_id`, `is_blocked`) – check blocked status. +- `book` (`book_id`, `copies_free`) – verify and decrement free copies. +- `loan` (`loan_id`, `returned_on`) – update return status. +- `loan` (`due_on`, `returned_on`) – late fee calculation. + +#### Writes +- `book` – decrement `copies_free` on checkout; increment on return. +- `loan` – insert new loan record; update `returned_on` on return. +- `loan_audit` – insert audit rows on checkout and return. + +#### Relationships +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` +- `loan_audit.loan_id -> loan.loan_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Abort if member blocked. + - Decrement `book.copies_free`; error if none. + - Insert into `loan` with `due_on = CURRENT_DATE + p_days`; return new `loan_id`. + +- **sp_return_book(p_loan_id)** + - Update `loan.returned_on = CURRENT_DATE` where `returned_on IS NULL`; capture `book_id`. + - Error if loan unknown or already returned. + - Increment `book.copies_free` for returned book. + +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Multiply by 50, cap at 2000, floor at 0. + +- **trg_loan_audit_fn()** + - On `INSERT`: log `CHECKOUT`. + - On `UPDATE` where `returned_on` changes from NULL to non‑NULL: log `RETURN`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit` +- Functions: `fn_late_fee` (used by application logic) +- Trigger: `trg_loan_audit` on `loan` table. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..4e906182 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,68 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:40:59Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds library branches, creates a book_copy table linking books to branches, and updates member and loan tables to reference branches and copies. + +#### Purpose +- Introduces branch management and per‑branch book copies. +- Migrates existing book copy data into the new structure. +- Updates member and loan tables to reference branches and copies. + +#### Type +- Table: `branch` +- Table: `book_copy` +- Table: `loan` (altered) +- Table: `member` (altered) +- Index: `idx_book_copy_book` + +#### Schema +- **branch** + - `branch_id SMALLSERIAL PRIMARY KEY` + - `name VARCHAR(100) NOT NULL UNIQUE` + - `city VARCHAR(100) NOT NULL` +- **book_copy** + - `copy_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `branch_id SMALLINT NOT NULL REFERENCES branch (branch_id)` + - `barcode VARCHAR(32) NOT NULL UNIQUE` + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE','ON_LOAN','LOST'))` +- **loan** + - `copy_id BIGINT REFERENCES book_copy (copy_id)` (new column) +- **member** + - `member_since TIMESTAMP` (renamed from `joined_on`) + - `home_branch_id SMALLINT REFERENCES branch (branch_id)` (new column) +- **Index** + - `idx_book_copy_book` on `book_copy (book_id)` + +#### Reads +- `book` (SELECT book_id, isbn, copies_total, copies_free) +- `branch` (INSERT default branch) +- `member` (UPDATE home_branch_id where NULL) + +#### Writes +- `branch`: 1 row (`Main`, `Springfield`) +- `book_copy`: 1 + 1 = 2 INSERT statements + - First INSERT: 1 row (default branch) + - Second INSERT: `b.copies_total` rows per book (family) +- `member`: 1 UPDATE (set `home_branch_id` to 1 where NULL) +- `loan`: 1 ALTER TABLE (adds column) + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- `book` table (existing) +- `loan` table (existing) +- `member` table (existing) + +--- diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..86e4636d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,62 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:41:01Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Seeds the lending library database with authors, books, members, and loan records. + +#### Purpose +- Populate the `author`, `book`, `member`, and `loan` tables with initial data for testing or benchmarking. + +#### Type +- Data insertion script (PostgreSQL). + +#### Schema +- **author** + - `author_id` integer PK + - `full_name` text NOT NULL + - `birth_year` integer + - `country_code` char(2) +- **book** + - `book_id` integer PK + - `isbn` text NOT NULL + - `title` text NOT NULL + - `author_id` integer FK → `author(author_id)` + - `published_year` integer + - `copies_total` integer + - `copies_free` integer +- **member** + - `member_id` integer PK + - `email` text NOT NULL + - `full_name` text NOT NULL + - `joined_on` date + - `is_blocked` boolean +- **loan** + - `loan_id` integer PK + - `book_id` integer FK → `book(book_id)` + - `member_id` integer FK → `member(member_id)` + - `loaned_on` date + - `due_on` date + - `returned_on` date + +#### Reads +- None. + +#### Writes +- `author`: 15 rows +- `book`: 150 rows +- `member`: 50 rows +- `loan`: 150 rows (ids 1‑150) + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- Tables: `author`, `book`, `member`, `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..a153378e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,59 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:42:24Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL library management system that stores catalog, member, and loan data, enforces lending rules, and provides reporting and audit trails. + +#### Purpose +- Persist library catalog, member, and loan information. +- Enforce lending business rules (availability, due dates, late fees). +- Supply read‑only reporting views and audit logs. + +#### Responsibilities +- **Data Modeling** – core tables (`author`, `book`, `member`, `loan`) and constraints. +- **Reporting** – views (`overdue_loans`, `member_loan_stats`) and materialized view (`popular_books`). +- **Lending Logic** – checkout, return, late fee calculation, and audit logging. +- **Branch & Copy Management** – migration to per‑branch book copies (`branch`, `book_copy`) and updated loan/member references. +- **Seeding** – initial data population for testing. + +#### Key units +- **Tables** + - `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. +- **Views** + - `overdue_loans`, `member_loan_stats`, `popular_books`. +- **Functions** + - `fn_checkout_book(member_id, book_id, days) → loan_id` + - `fn_late_fee(due_on, returned_on) → fee` + - `trg_loan_audit_fn()` (trigger function). +- **Procedure** + - `sp_return_book(loan_id)` – handles book return. +- **Triggers** + - `trg_loan_audit` on `loan` (audit INSERT/UPDATE). + +#### Data flow +1. **Checkout** – `fn_checkout_book` checks member status, decrements `book.copies_free`, inserts a `loan` row, and logs `CHECKOUT` in `loan_audit`. +2. **Return** – `sp_return_book` updates `loan.returned_on`, increments `book.copies_free`, and logs `RETURN` via trigger. +3. **Late fee** – `fn_late_fee` calculates fee based on `due_on` and `returned_on` (or current date). +4. **Reporting** – Views aggregate `loan`, `member`, `book`, and `author` data for overdue loans, member statistics, and popular books. +5. **Branch migration** – `04_migration_v2.sql` creates `branch` and `book_copy`, adds `copy_id` to `loan`, and sets `home_branch_id` for members. + +#### Dependencies +- **Internal** – `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. +- **External** – PostgreSQL built‑in functions (`CURRENT_DATE`, `now()`, interval arithmetic). +- **Indexes** – `idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_book_copy_book`, `idx_popular_books_id`. + +#### Cross-cutting +- **Constraints & Checks** – enforce data integrity (e.g., `copies_free <= copies_total`, `due_on > loaned_on`, status enums). +- **Audit Trail** – `loan_audit` records every checkout and return with timestamps. +- **Branch‑aware Lending** – after migration, loans reference specific `book_copy` records tied to branches. +- **Materialized View Refresh** – `popular_books` requires periodic refresh to stay current. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..5b1a7832 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,53 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:42:32Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A collection of SQL packages that manage library lending, e‑commerce orders, and warehouse inventory, each with dedicated schemas, business logic, and audit trails. + +#### Purpose +- Persist and enforce business rules for library catalog, shop orders, and warehouse stock. +- Provide reporting, audit logging, and transactional integrity across each domain. + +#### Responsibilities +- **Library** – catalog, member, loan lifecycle, branch‑aware lending, reporting, and audit. +- **Shop** – product catalog, order processing, stock reservation, and order total calculation. +- **Warehouse** – supplier feed ingestion, stock level maintenance, and sync run auditing. + +#### Key units +- **Library** + - Tables: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. + - Views: `overdue_loans`, `member_loan_stats`, `popular_books`. + - Functions: `fn_checkout_book`, `fn_late_fee`. + - Procedure: `sp_return_book`. + - Trigger: `trg_loan_audit` on `loan`. +- **Shop** + - Tables: `product`, `customer_order`, `order_item`. + - Procedure: `add_order_item`. +- **Warehouse** + - Tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. + - Procedure: `dbo.usp_SyncStock`. + +#### Data flow +- **Library** – checkout → `fn_checkout_book` → `loan` insert + audit; return → `sp_return_book` → `loan` update + audit; reporting views aggregate loan/member/book data. +- **Shop** – `add_order_item` locks product, validates stock, inserts/updates `order_item`, decrements `product.stock`, recalculates `customer_order.total_cents`. +- **Warehouse** – `usp_SyncStock` aggregates new `SupplierFeed` rows, merges into `StockLevel`, logs counts/errors in `SyncLog`. + +#### Dependencies +- **Internal** – cross‑package tables referenced by procedures and triggers. +- **External** – PostgreSQL built‑ins (`CURRENT_DATE`, `now()`), MySQL 8 features (`FOR UPDATE`, ENUM), SQL Server system functions (`SYSUTCDATETIME()`, `ERROR_MESSAGE()`). +- **Indexes** – e.g., `idx_book_author`, `idx_loan_member`, `idx_order_customer`, `idx_book_copy_book`. + +#### Cross-cutting +- **Integrity & Constraints** – data validity enforced via checks (e.g., `copies_free <= copies_total`, `due_on > loaned_on`). +- **Audit Trails** – `loan_audit` and `SyncLog` capture every state change. +- **Concurrency Control** – row locks in `add_order_item`; transactional boundaries in `usp_SyncStock`. +- **Materialized View Refresh** – `popular_books` requires periodic refresh. +- **Branch‑aware Lending** – post‑migration loans reference `book_copy` tied to `branch`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..1dccea8c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,71 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:41:04Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> A MySQL schema for a web shop that stores products, customer orders, and order items, with a stored procedure to add items to an order while reserving stock and updating totals. + +#### Purpose +- Stores product catalog, customer orders, and line items. +- Provides a procedure to add an item to an order, reserve stock, and recalculate the order total. + +#### Type +- Table: `product` +- Table: `customer_order` +- Table: `order_item` +- Procedure: `add_order_item` (MySQL 8) + +#### Schema +**product** +- `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT` PK +- `sku VARCHAR(40) NOT NULL` UNIQUE `uk_product_sku` +- `name VARCHAR(200) NOT NULL` +- `price_cents INT UNSIGNED NOT NULL` +- `stock INT NOT NULL DEFAULT 0` + +**customer_order** +- `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT` PK +- `customer_id BIGINT UNSIGNED NOT NULL` +- `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW'` +- `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` +- `total_cents INT UNSIGNED NOT NULL DEFAULT 0` +- Index `idx_order_customer` on `(customer_id, created_at)` + +**order_item** +- `order_id BIGINT UNSIGNED NOT NULL` +- `product_id INT UNSIGNED NOT NULL` +- `quantity SMALLINT UNSIGNED NOT NULL` +- `unit_price_cents INT UNSIGNED NOT NULL` +- PK `(order_id, product_id)` +- FK `fk_item_order` references `customer_order(order_id)` ON DELETE CASCADE +- FK `fk_item_product` references `product(product_id)` + +#### Reads +- `product` (SELECT product_id, price_cents WHERE sku = p_sku AND stock >= p_qty FOR UPDATE) +- `order_item` (SELECT SUM(quantity * unit_price_cents) WHERE order_id = p_order_id) + +#### Writes +- `order_item`: INSERT one row (or UPDATE existing) +- `product`: UPDATE stock (one row) +- `customer_order`: UPDATE total_cents (one row) + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (FK `fk_item_order`) +- `order_item.product_id -> product.product_id` (FK `fk_item_product`) + +#### Routine logic +- Parameters: `p_order_id BIGINT UNSIGNED`, `p_sku VARCHAR(40)`, `p_qty SMALLINT UNSIGNED` +- Lookup product by SKU with stock check, lock row (`FOR UPDATE`). +- If not found or insufficient stock, raise error. +- Insert or update `order_item` with quantity and unit price. +- Decrement `product.stock` by `p_qty`. +- Recalculate `customer_order.total_cents` from all items of the order. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item` +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..db92eb62 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,43 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:42:27Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> A MySQL schema for a web shop that stores products, customer orders, and order items, with a stored procedure to add items to an order while reserving stock and updating totals. + +#### Purpose +- Persist product catalog, customer orders, and line items. +- Provide a transactional routine to add an item to an order, reserve stock, and recalculate the order total. + +#### Responsibilities +- **Data persistence** – tables for products, orders, and order items. +- **Business logic** – stored procedure `add_order_item` that enforces stock availability, updates inventory, and maintains order totals. + +#### Key units +- **Table `product`** – holds SKU, name, price, and stock. +- **Table `customer_order`** – tracks order status, timestamps, and total amount. +- **Table `order_item`** – links orders to products with quantity and unit price. +- **Procedure `add_order_item`** – accepts order ID, SKU, and quantity; locks product row, validates stock, inserts/updates item, decrements stock, and updates order total. + +#### Data flow +1. Caller supplies `p_order_id`, `p_sku`, `p_qty`. +2. Procedure selects product row with `FOR UPDATE`. +3. If stock insufficient → error. +4. Insert or update `order_item` row. +5. Update `product.stock` by subtracting `p_qty`. +6. Recalculate `customer_order.total_cents` from all items of the order. + +#### Dependencies +- Internal: `product`, `customer_order`, `order_item` tables. +- No external functions or sequences; relies on MySQL 8 features (`FOR UPDATE`, ENUM, auto‑increment). + +#### Cross-cutting +- **Concurrency control** – row locking on product to prevent overselling. +- **Atomicity** – all updates occur within the stored procedure’s transaction. +- **Error handling** – raises error when product not found or stock insufficient. +- **Indexing** – `idx_order_customer` on `(customer_id, created_at)` for order queries. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..54bd6329 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,45 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:42:30Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Keeps a warehouse inventory in sync with incoming supplier stock feeds, logging each update run. + +#### Purpose +- Aggregate supplier feed quantities into the warehouse stock table. +- Record each sync run’s statistics and errors. + +#### Responsibilities +- **Data ingestion**: read `dbo.SupplierFeed` rows since a given timestamp. +- **Inventory update**: merge aggregated quantities into `dbo.StockLevel`. +- **Audit logging**: insert a record into `dbo.SyncLog` with counts of inserted/updated rows or error details. + +#### Key units +- **`dbo.StockLevel`** – table storing current on‑hand quantities per `(WarehouseId, Sku)`. +- **`dbo.SupplierFeed`** – table holding raw supplier feed rows. +- **`dbo.SyncLog`** – table logging each sync run. +- **`dbo.usp_SyncStock`** – stored procedure orchestrating the sync: aggregates, merges, logs, and handles errors. + +#### Data flow +1. `dbo.usp_SyncStock(@Since)` starts a transaction. +2. Aggregates `SupplierFeed` rows received after `@Since` by `(WarehouseId, Sku)` → `Quantity`. +3. `MERGE` into `StockLevel`: + - `WHEN MATCHED`: increment `OnHand` and update `UpdatedAt`. + - `WHEN NOT MATCHED`: insert new row. +4. Capture `$action` counts for inserts/updates. +5. Insert a row into `SyncLog` with `RowsInserted`, `RowsUpdated`, and any `ErrorMessage`. +6. Commit or rollback on error. + +#### Dependencies +- Internal tables: `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog`. +- SQL Server system functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. + +#### Cross-cutting +- Transactional integrity: all operations wrapped in a single transaction. +- Error handling: rollback on failure, log error message in `SyncLog`. +- Time‑based filtering: uses `@Since` to process only new feed rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..206c42be --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run2/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,80 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:41:09Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Synchronises supplier stock feed into the warehouse inventory, recording insert/update counts and errors. + +#### Purpose +- Updates `dbo.StockLevel` with aggregated supplier quantities. +- Logs each sync run in `dbo.SyncLog`. + +#### Type +- **Table**: `dbo.StockLevel` (SQL Server, T-SQL) +- **Table**: `dbo.SupplierFeed` (SQL Server, T-SQL) +- **Table**: `dbo.SyncLog` (SQL Server, T-SQL) +- **Procedure**: `dbo.usp_SyncStock` (SQL Server, T-SQL) + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT (0)` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())` + - **PK**: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + - **PK**: `PK_SupplierFeed (FeedRowId)` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + - **PK**: `PK_SyncLog (SyncLogId)` + +#### Reads +- `dbo.SupplierFeed` – `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt` (filtered by `@Since`). +- `dbo.StockLevel` – `WarehouseId`, `Sku`, `OnHand` (for merge target). + +#### Writes +- `dbo.StockLevel` + - `INSERT`: one row per distinct `(WarehouseId, Sku)` not present in target. + - `UPDATE`: one row per matched `(WarehouseId, Sku)`; `OnHand` incremented, `UpdatedAt` set. +- `dbo.SyncLog` + - `INSERT`: one row per sync run; counts derived from merge output. + +#### Relationships +- None (no foreign keys defined). + +#### Routine logic (`dbo.usp_SyncStock`) +- Parameters: `@Since DATETIME2(0)` +- Steps: + 1. Begin transaction. + 2. Aggregate `SupplierFeed` rows received since `@Since` by `(WarehouseId, Sku)` → `Quantity`. + 3. `MERGE` into `StockLevel`: + - `WHEN MATCHED`: `OnHand += Quantity`, `UpdatedAt = SYSUTCDATETIME()`. + - `WHEN NOT MATCHED BY TARGET`: `INSERT (WarehouseId, Sku, OnHand)`. + - Capture `$action` into `@Changes`. + 4. Insert into `SyncLog`: + - `RowsInserted` = count of `INSERT` actions. + - `RowsUpdated` = count of `UPDATE` actions. + 5. Commit transaction. + 6. On error: rollback, insert error message into `SyncLog`, rethrow. + +#### Dependencies +- `dbo.SupplierFeed` +- `dbo.StockLevel` +- `dbo.SyncLog` +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/meta/gpt-6-luna.json new file mode 100644 index 00000000..392509bc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/meta/gpt-6-luna.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:50:25Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 163.3, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 77.9, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.9, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:54:29Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 86143, + "cachedPromptTokens": 86071, + "completionTokens": 19263, + "seconds": 162.6282331 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.010499, + "costUsd": 0.016795, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/meta/gpt-oss-20b.json new file mode 100644 index 00000000..69d18c92 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:54:30Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 114.7, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 59.7, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 4.3, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:57:28Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 87679, + "cachedPromptTokens": 57334, + "completionTokens": 17979, + "seconds": 114.0484371 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.004968, + "costUsd": 0.003187, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..d89d1dd1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,59 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:50:26Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> File-condition rules select source files by extension, size, line count, modification time, and path pattern, including nested Boolean combinations. + +#### Purpose +- Evaluates `AiCondition` trees against `AiFileContext` file facts. +- Validates condition configuration and detects whether a tree requires line counts. + +#### Type +- `public final class AiConditionEvaluator` — class; no supertypes; no notable annotations. + +#### Input +- `AiConditionEvaluator()` — no inputs. +- `matches(AiCondition condition, AiFileContext context)` — condition tree and file facts. +- `validate(AiCondition condition)` — condition tree. +- `usesLines(AiCondition condition)` — condition tree. +- Reads condition branches, groups, ranges, date strings and glob; reads context file name, size, line count, modification time and relative path. + +#### Output +- `matches(...)` returns whether the file satisfies the selected condition. +- `validate(...)` returns no value; throws on invalid configuration. +- `usesLines(...)` returns whether any traversed node has a `lines` condition. +- No persistent state or resource writes. + +#### Core logic +- `matches` evaluates the first set branch: `and` requires all children; `or` requires any child; `not` negates its child. +- Leaf matching checks extension suffixes, byte-size or line-count ranges, strict after/before epoch-millisecond comparisons, or path glob matching through `AiSourceExcludeFilter`. +- `validate` requires exactly one of 9 branch/leaf fields per node; recursively validates combinator children. +- Rejects empty `and`/`or` groups and empty extension lists; requires bounds for `size` and `lines`; parses date conditions as ISO-8601 instants; rejects blank path globs. +- `usesLines` searches the node and recursively traverses `and`, `or`, and `not` branches. +- Extension matching ignores null entries; glob matching delegates to `AiSourceExcludeFilter.isExcluded`. + +#### Public API +- `AiConditionEvaluator()` -> `AiConditionEvaluator` — creates evaluator. +- `matches(AiCondition, AiFileContext)` -> `boolean` — test file against condition. +- `validate(AiCondition)` -> `void` — validate condition tree. +- `usesLines(AiCondition)` -> `boolean` — detect line-count requirements. + +#### Dependencies +- `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext` +- `AiSourceExcludeFilter` +- `Instant`, `DateTimeParseException`, `Collections`, `List` +- `@Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for invalid branch counts, empty groups or extensions, unbounded ranges, invalid dates, or blank globs. +- Invalid ISO-8601 dates are wrapped in `IllegalArgumentException` with the parse exception as cause. +- `matches` throws `IllegalStateException` if no branch is set; it assumes prior validation. + +#### Concurrency +- No synchronization or shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..7028786c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,46 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:50:32Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Groups child AI conditions for Maven-configured `and`/`or` combinators. + +#### Purpose +- Stores the child `AiCondition` items bound from Maven `…` configuration. + +#### Type +- `public class AiConditionGroup` — class; annotated `@ToString`; no supertypes declared. + +#### Input +- `setConditions(Collection conditions)` accepts child conditions, including `null`. +- Private nullable `conditions: List` stores the configured children. + +#### Output +- `getConditions()` returns the stored list or `null`. +- `setConditions(...)` copies non-null input into a new `ArrayList`; does not retain the input collection. + +#### Core logic +- Holds child conditions under the `conditions` field name for Maven collection-item binding. +- Converts assigned collections to a mutable `ArrayList`; preserves `null` when no children are configured. + +#### Public API +- `AiConditionGroup()` — creates an empty group. +- `getConditions() -> @Nullable List` — returns child conditions. +- `setConditions(@Nullable Collection) -> void` — replaces children with a defensive copy. + +#### Dependencies +- `AiCondition` +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No explicit exceptions or validation. +- Nullable input and field; `null` input sets `conditions` to `null`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..d8b619a5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,58 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:50:36Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Computes exact whole-source counts for configured regex facts, producing a facts block to accompany AI-generated summaries. + +#### Purpose +- `AiFactExtractor` counts configured regex matches across source text and formats the counts as a facts block. +- Validates fact-counter labels and regex patterns before use. + +#### Type +- `public final class AiFactExtractor` — class; utility class with a private constructor. + +#### Input +- `factsBlock(@Nullable List counters, String source)` — configured counters and full source text. +- `validate(@Nullable List counters)` — counters to validate. +- Reads each counter’s label and pattern. + +#### Output +- `factsBlock(...)` returns `String`: formatted facts block ending in a blank line, or `""` when no entries are available. +- `validate(...)` returns `void`; no state is mutated. + +#### Core logic +- `factsBlock` returns `""` for null or empty counter lists. +- Skips null counters or counters with null labels or patterns. +- Counts non-overlapping regex matches over the full source using `Matcher.find()`. +- Formats entries as `label: count`, separated by `; `, prefixed by `**Facts (exact, whole file):** ` and suffixed by `\n\n`. +- `validate` skips null lists and null counters; rejects missing labels or patterns and patterns that fail compilation. + +#### Public API +- `FACTS_HEADER: String` — facts block prefix. +- `LABEL_COUNT_SEPARATOR: String` — label/count separator. +- `ENTRY_SEPARATOR: String` — entry separator. +- `FACTS_SUFFIX: String` — facts/body separator. +- `factsBlock(@Nullable List, String) -> String` — build exact facts block. +- `validate(@Nullable List) -> void` — validate counter configuration. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` +- `AiFactCounter` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for a missing label or pattern, or an invalid regex; invalid-regex errors retain the `PatternSyntaxException` as cause. +- `factsBlock` skips null counters and counters with null labels or patterns. +- `countMatches` compiles each pattern; invalid regexes can therefore throw `PatternSyntaxException` if validation was not performed first. + +#### Concurrency +- Stateless and performs no I/O; no shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..047ddd46 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,102 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:50:41Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Carries per-model AI generation, prompt-trimming, sampling, provider-routing, and llama.cpp runtime settings from configuration into generation workflows. + +#### Purpose +- `AiGenerationConfig` stores mutable defaults and per-model overrides for one AI generation step. +- Covers model selection, input limits, sampling/repetition controls, provider credentials configuration, hardware tuning, stop strings, and optional timing calibration. + +#### Type +- `public class AiGenerationConfig` — class; annotated `@ToString`, `@SuppressWarnings`; no supertypes declared. +- `DEFAULT_*` constants define defaults for context/output limits, sampling, trimming, threads, cache, hardware, provider routing, reasoning, and DRY settings. + +#### Input +- No-argument constructor; values are populated through setters. +- Configuration values include nullable `modelPath`, nullable tri-state `chatTemplateEnableThinking`, model/runtime parameters, provider URL/model and API-key environment-variable name, reasoning and DRY settings. +- `drySequenceBreakers` and `stopStrings` accept lists; `calibration` accepts nullable `AiCalibration`. +- `DEFAULT_THREADS` reads `Runtime.getRuntime().availableProcessors()`. + +#### Output +- Getters expose configured values; list getters return unmodifiable views. +- Setters mutate instance fields. Nullable strings for lazy/cache types and nullable lists reset to defaults or empty lists as applicable. +- Lombok `@ToString` generates diagnostic string output; no `equals`/`hashCode` generation. + +#### Core logic +- Initializes fields from constants, including sampling defaults (`temperature`, `topP`, `topK`, `minP`, `topNSigma`, repetition penalty) and input-trimming defaults. +- Uses `charsPerToken` and `maxInputChars` as configuration for automatic input-limit calculation elsewhere; this class does not calculate the limit. +- Represents unset options with sentinels such as `-1`, empty strings, and nullable values; forwarding decisions are delegated to providers. +- Supports provider overrides (`llamacpp-jni`, `openai-compatible`, `mock`), remote model selection, base URL, and API-key environment-variable naming. +- Stores inference runtime controls including prompt/SWA cache reuse, GPU/CPU layer allocation, KV cache types, batch sizes, devices, and thread counts. +- Stores stop strings, DRY sequence breakers, and optional per-machine calibration. + +#### Public API +- `AiGenerationConfig()` -> `void` — initialize defaults. +- Constants: `DEFAULT_CONTEXT_SIZE: int`, `DEFAULT_MAX_OUTPUT_TOKENS: int`, `DEFAULT_TEMPERATURE: float`, `DEFAULT_THREADS: int`, `DEFAULT_MAX_INPUT_CHARS: int`, `DEFAULT_CHARS_PER_TOKEN: int`, `DEFAULT_SAFETY_MARGIN_CHARS: int`, `DEFAULT_WARN_ON_TRIM: boolean`, `DEFAULT_TOP_P: float`, `DEFAULT_TOP_K: int`, `DEFAULT_MIN_P: float`, `DEFAULT_TOP_N_SIGMA: float`, `DEFAULT_REPEAT_PENALTY: float`, `DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING: @Nullable Boolean`, `DEFAULT_CACHE_PROMPT: boolean`, `DEFAULT_REASONING_EFFORT: String`, `DEFAULT_REASONING_BUDGET_TOKENS: int`, `DEFAULT_SWA_FULL: boolean`, `DEFAULT_CACHE_REUSE: int`, `DEFAULT_GPU_LAYERS: int`, `DEFAULT_SEED: int`, `DEFAULT_CPU_MOE_LAYERS: int`, `DEFAULT_CPU_FFN_LAYERS: int`, `DEFAULT_KV_UNIFIED_PER_SLOT: int`, `DEFAULT_LAZY_MODE: String`, `DEFAULT_REPEAT_LAST_N: int`, `DEFAULT_CACHE_TYPE_K: String`, `DEFAULT_CACHE_TYPE_V: String`, `DEFAULT_FLASH_ATTN: boolean`, `DEFAULT_BATCH_SIZE: int`, `DEFAULT_UBATCH_SIZE: int`, `DEFAULT_THREADS_BATCH: int`, `DEFAULT_MAIN_GPU: int`, `DEFAULT_DEVICES: String`, `DEFAULT_PROVIDER: String`, `DEFAULT_REMOTE_MODEL: String`, `DEFAULT_BASE_URL: String`, `DEFAULT_API_KEY_ENV: String`, `DEFAULT_DRY_MULTIPLIER: float`, `DEFAULT_DRY_BASE: float`, `DEFAULT_DRY_ALLOWED_LENGTH: int`, `DEFAULT_DRY_PENALTY_LAST_N: int`. +- `getModelPath()` -> `@Nullable String` / `setModelPath(@Nullable String)` -> model path. +- `getContextSize()` -> `int` / `setContextSize(int)` -> context window. +- `getMaxOutputTokens()` -> `int` / `setMaxOutputTokens(int)` -> output token limit. +- `getTemperature()` -> `float` / `setTemperature(float)` -> sampling temperature. +- `getThreads()` -> `int` / `setThreads(int)` -> inference thread count. +- `getCharsPerToken()` -> `int` / `setCharsPerToken(int)` -> input sizing ratio. +- `getMaxInputChars()` -> `int` / `setMaxInputChars(int)` -> input character limit. +- `isWarnOnTrim()` -> `boolean` / `setWarnOnTrim(boolean)` -> trim warning toggle. +- `getTopP()` -> `float` / `setTopP(float)` -> nucleus sampling. +- `getTopK()` -> `int` / `setTopK(int)` -> top-k sampling. +- `getRepeatPenalty()` -> `float` / `setRepeatPenalty(float)` -> repetition penalty. +- `getMinP()` -> `float` / `setMinP(float)` -> min-p sampling. +- `getTopNSigma()` -> `float` / `setTopNSigma(float)` -> top-n-sigma sampling. +- `getChatTemplateEnableThinking()` -> `@Nullable Boolean` / `setChatTemplateEnableThinking(@Nullable Boolean)` -> chat-template thinking mode. +- `isCachePrompt()` -> `boolean` / `setCachePrompt(boolean)` -> prompt caching. +- `isSwaFull()` -> `boolean` / `setSwaFull(boolean)` -> full SWA KV cache. +- `getCacheReuse()` -> `int` / `setCacheReuse(int)` -> KV prefix reuse threshold. +- `getGpuLayers()` -> `int` / `setGpuLayers(int)` -> GPU layer offload. +- `getCpuMoeLayers()` -> `int` / `setCpuMoeLayers(int)` -> CPU MoE layers. +- `getSeed()` -> `int` / `setSeed(int)` -> generation RNG seed. +- `getCpuFfnLayers()` -> `int` / `setCpuFfnLayers(int)` -> CPU FFN layers. +- `getKvUnifiedPerSlot()` -> `int` / `setKvUnifiedPerSlot(int)` -> per-slot KV cap. +- `getLazyMode()` -> `String` / `setLazyMode(@Nullable String)` -> tensor read laziness. +- `getRepeatLastN()` -> `int` / `setRepeatLastN(int)` -> repetition window. +- `getCacheTypeK()` -> `String` / `setCacheTypeK(@Nullable String)` -> K-cache data type. +- `getCacheTypeV()` -> `String` / `setCacheTypeV(@Nullable String)` -> V-cache data type. +- `isFlashAttn()` -> `boolean` / `setFlashAttn(boolean)` -> Flash Attention toggle. +- `getBatchSize()` -> `int` / `setBatchSize(int)` -> logical batch size. +- `getUbatchSize()` -> `int` / `setUbatchSize(int)` -> physical batch size. +- `getThreadsBatch()` -> `int` / `setThreadsBatch(int)` -> batch thread count. +- `getMainGpu()` -> `int` / `setMainGpu(int)` -> primary GPU index. +- `getDevices()` -> `String` / `setDevices(String)` -> backend device selection. +- `getProvider()` -> `String` / `setProvider(String)` -> model provider. +- `getRemoteModel()` -> `String` / `setRemoteModel(String)` -> remote model id. +- `getBaseUrl()` -> `String` / `setBaseUrl(String)` -> API base URL. +- `getApiKeyEnv()` -> `String` / `setApiKeyEnv(String)` -> API-key environment variable name. +- `getReasoningEffort()` -> `String` / `setReasoningEffort(String)` -> reasoning-effort setting. +- `getReasoningBudgetTokens()` -> `int` / `setReasoningBudgetTokens(int)` -> reasoning token cap. +- `getDryMultiplier()` -> `float` / `setDryMultiplier(float)` -> DRY repetition penalty. +- `getDryBase()` -> `float` / `setDryBase(float)` -> DRY growth base. +- `getDryAllowedLength()` -> `int` / `setDryAllowedLength(int)` -> DRY unpenalized n-gram length. +- `getDryPenaltyLastN()` -> `int` / `setDryPenaltyLastN(int)` -> DRY look-back window. +- `getDrySequenceBreakers()` -> `List` / `setDrySequenceBreakers(@Nullable List)` -> DRY reset tokens. +- `getStopStrings()` -> `List` / `setStopStrings(@Nullable List)` -> generation stop strings. +- `getCalibration()` -> `@Nullable AiCalibration` / `setCalibration(@Nullable AiCalibration)` -> machine timing calibration. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `AiCalibration` +- `net.ladenthin.llama.parameters.ModelParameters` (documentation reference) + +#### Exceptions / Errors +- No explicit exceptions or validation checks. +- Nullable model path, chat-template thinking mode, and calibration are preserved; nullable lazy/cache-type/list inputs reset to defaults or empty lists. +- `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, and `setApiKeyEnv` map `null` to their defaults. + +#### Concurrency +- Mutable JavaBean with no synchronization; not thread-safe by implementation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..7e90cfc9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,45 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:50:55Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Routing rules choose whether oversized source files fail, are sampled, are summarized in chunks, or receive a deterministic model-free summary. + +#### Purpose +- Defines oversize handling strategies and parses routing-rule `` values. +- Defaults to aborting when no strategy is configured. + +#### Type +- `AiOversizeStrategy` — enum; no supertypes explicitly declared. + +#### Input +- `fromConfig(String value)` accepts a nullable configuration token. +- Enum constructor receives each strategy’s configuration token. + +#### Output +- `configValue()` returns the strategy’s configuration token. +- `fromConfig(String)` returns the matching strategy or `DEFAULT`. + +#### Core logic +- `FAIL` aborts processing; `SAMPLE` summarizes the trimmed file head in one call. +- `MAP_REDUCE` summarizes line-boundary chunks, then combines partial summaries. +- `DETERMINISTIC` emits metadata and head/tail samples without a model. +- `fromConfig` maps null, blank, or case-insensitive matching tokens to the default or corresponding strategy; unknown nonblank values cause an error. + +#### Public API +- `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` — strategy constants. +- `DEFAULT: AiOversizeStrategy` — default strategy (`FAIL`). +- `configValue() -> String` — return configuration token. +- `fromConfig(String) -> AiOversizeStrategy` — parse configuration token. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `fromConfig` throws `IllegalArgumentException` for an unknown nonblank token. +- Null and blank values resolve to `DEFAULT`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..9b993768 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,83 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:50:59Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Configures source-file selection, AI prompt/model routing, llama.cpp fallbacks, and metadata for generating `.ai.md` files. + +#### Purpose +- `SrcMorphConfiguration` holds the shared mutable settings for a `srcmorph` run, independent of configuration source. +- Provides defaults and JavaBean accessors for file selection, AI generation, and output metadata. + +#### Type +- `public class SrcMorphConfiguration` — class; no explicit superclass or interfaces. +- Annotated `@ToString`; suppresses `NullAway.Init` and `initialization.fields.uninitialized` warnings. + +#### Input +- Setters accept base/output directories, file-selection rules, AI definitions and routing, llama.cpp settings, versions, and project name. +- Nullable lists and values represent omitted optional configuration. +- Defaults: output directory `src/site/ai`; provider `mock`; llama.cpp context size `2048`, max output tokens `128`, temperature `0.15f`, threads `AiGenerationConfig.DEFAULT_THREADS`; AI version `0.0.0`. + +#### Output +- Getters expose the configured values; setters mutate the bean’s fields. +- Configuration describes `.ai.md` output location, input scope, AI generation behavior, and generated-file metadata. +- Lombok `@ToString` provides a string representation. + +#### Core logic +- Stores run configuration without executing generation or validating settings. +- `subtrees`, `excludes`, and `fileExtensions` control source scope and file selection; non-positive minimum size disables the lower bound, and non-positive maximum size means unlimited. +- `force` enables regenerating populated AI fields; `planOnly` requests stopping after routing-plan output. +- `generationProvider` selects the default provider; model definitions may override it. +- `promptDefinitions`, `aiDefinitions`, `fieldGenerations`, and `factDefinitions` define prompts, models, per-field routing, and reusable fact groups. +- `modelDirectory` is the base for relative model paths; absolute paths remain usable. `llamaModelPath` and llama.cpp parameters are fallback settings when `fieldGenerations` is empty. +- `pluginVersion` and `aiVersion` are recorded in generated headers; `projectName` supplies the aggregate-project index title. + +#### Public API +- `DEFAULT_OUTPUT_DIRECTORY: String` — default output directory. +- `DEFAULT_GENERATION_PROVIDER: String` — default provider name. +- `DEFAULT_LLAMA_CONTEXT_SIZE: int` — default llama.cpp context size. +- `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS: int` — default llama.cpp output-token limit. +- `DEFAULT_LLAMA_TEMPERATURE: float` — default llama.cpp sampling temperature. +- `DEFAULT_LLAMA_THREADS: int` — default llama.cpp CPU thread count. +- `DEFAULT_AI_VERSION: String` — default summarisation version. +- `SrcMorphConfiguration()` — initializes defaults. +- `getBaseDirectory()` / `setBaseDirectory(File)` -> project base directory. +- `getOutputDirectory()` / `setOutputDirectory(File)` -> `.ai.md` output directory. +- `isForce()` / `setForce(boolean)` -> regenerate populated fields. +- `getSubtrees()` / `setSubtrees(List)` -> source subdirectory scope. +- `getExcludes()` / `setExcludes(List)` -> excluded file globs. +- `getFileExtensions()` / `setFileExtensions(List)` -> indexed extensions. +- `getMinFileSizeBytes()` / `setMinFileSizeBytes(long)` -> exclusive lower size bound. +- `getMaxFileSizeBytes()` / `setMaxFileSizeBytes(long)` -> inclusive upper size bound. +- `isPlanOnly()` / `setPlanOnly(boolean)` -> stop after routing plan. +- `getGenerationProvider()` / `setGenerationProvider(String)` -> default generation provider. +- `getPromptDefinitions()` / `setPromptDefinitions(List)` -> prompt templates. +- `getAiDefinitions()` / `setAiDefinitions(List)` -> AI model definitions. +- `getModelDirectory()` / `setModelDirectory(File)` -> relative model-path base. +- `getFieldGenerations()` / `setFieldGenerations(List)` -> per-field routing rules. +- `getFactDefinitions()` / `setFactDefinitions(List)` -> reusable fact groups. +- `getLlamaModelPath()` / `setLlamaModelPath(String)` -> llama.cpp fallback model path. +- `getLlamaContextSize()` / `setLlamaContextSize(int)` -> llama.cpp fallback context size. +- `getLlamaMaxOutputTokens()` / `setLlamaMaxOutputTokens(int)` -> llama.cpp fallback token limit. +- `getLlamaTemperature()` / `setLlamaTemperature(float)` -> llama.cpp fallback temperature. +- `getLlamaThreads()` / `setLlamaThreads(int)` -> llama.cpp fallback thread count. +- `getPluginVersion()` / `setPluginVersion(String)` -> generated-header plugin version. +- `getAiVersion()` / `setAiVersion(String)` -> generated-header AI version. +- `getProjectName()` / `setProjectName(String)` -> aggregate index title. + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `AiGenerationConfig`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No explicit exceptions, validation, or null checks. +- Nullable fields include source-selection lists, AI definition lists, model directory/path, and project name; `baseDirectory` is not annotated nullable. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/package.ai.md new file mode 100644 index 00000000..4c154f15 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/config/package.ai.md @@ -0,0 +1,51 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:53:09Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> Configures source-file selection, AI generation and model routing, exact source facts, and oversized-file handling for generated `.ai.md` summaries. + +#### Purpose +- Defines the settings and rules that govern which source files are processed and how AI summaries are generated. +- Supplies condition evaluation, regex-based fact extraction, model-generation parameters, and oversize strategies. + +#### Responsibilities +- **Run configuration and routing:** `SrcMorphConfiguration` holds source scope, output location, prompt and model definitions, per-field routing, fact definitions, fallback llama.cpp settings, and generated-file metadata. +- **Generation parameters:** `AiGenerationConfig` carries defaults and overrides for input limits, sampling, provider selection, runtime tuning, stop strings, reasoning, and calibration. +- **File selection:** `AiConditionGroup` stores nested condition children; `AiConditionEvaluator` validates and evaluates condition trees against file facts. +- **Facts and oversize behavior:** `AiFactExtractor` validates regex counters and formats exact whole-source counts; `AiOversizeStrategy` selects failure, sampling, map-reduce, or deterministic handling. + +#### Key units +- `SrcMorphConfiguration` — mutable run-level settings for source selection, AI routing, fallback models, and output metadata. +- `AiGenerationConfig` — mutable per-generation settings with defaults for provider, sampling, token limits, and inference runtime. +- `AiConditionEvaluator` — validates and evaluates nested file conditions, including extension, size, line count, modification time, and path glob. +- `AiConditionGroup` — Maven-bindable collection of child `AiCondition` items. +- `AiFactExtractor` — counts regex matches in source text and formats the results as a facts block. +- `AiOversizeStrategy` — enum and configuration parser for oversized-file handling (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`). + +#### Data flow +- `SrcMorphConfiguration` supplies file-selection and generation settings; `AiConditionEvaluator` checks condition trees against `AiFileContext` facts. +- Configured fact counters are validated and applied by `AiFactExtractor` to full source text, producing an optional facts block. +- Oversize routing tokens are parsed by `AiOversizeStrategy`; the selected strategy describes how oversized input is handled. +- Generation workflows consume `AiGenerationConfig` values; this package stores settings but does not itself execute generation. + +#### Dependencies +- Internal configuration and domain types: `AiCondition`, `AiFileContext`, `AiRangeCondition`, `AiFactCounter`, `AiCalibration`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, and `AiPromptDefinition`. +- `AiConditionEvaluator` delegates path-glob exclusion checks to `AiSourceExcludeFilter`. +- Uses Java collections, regex, and time APIs; `SrcMorphConfiguration` also uses `java.io.File`. + +#### Cross-cutting +- Configuration is primarily mutable JavaBeans with getters and setters; `AiConditionEvaluator`, `AiFactExtractor`, and `AiOversizeStrategy` provide stateless rule or utility behavior. +- Nullable settings represent omitted options; defaults and sentinel values are used for generation parameters and run configuration. +- Validation is explicit for condition trees and fact counters; generation and run configuration beans do not perform general validation. +- No synchronization is described; mutable configuration beans are not thread-safe by implementation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..7f4761d1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,54 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:53:25Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Configures source-summary generation and routes requests to mock, local llama.cpp, or OpenAI-compatible AI providers. + +#### Purpose +- Defines source selection, generation settings, and oversized-file handling for `.ai.md` summaries. +- Provides provider selection and completion generation, with optional timing metrics and output cleanup. + +#### Responsibilities +- **Configuration and selection:** `SrcMorphConfiguration`, `AiGenerationConfig`, and condition rules define source scope, output and model settings, per-field routing, and file eligibility. +- **Facts and oversized inputs:** `AiFactExtractor` validates and applies regex counters to source text; `AiOversizeStrategy` represents failure, sampling, map-reduce, or deterministic handling. +- **Provider routing and inference:** `AiGenerationProviderFactory` selects mock, llama.cpp JNI, or OpenAI-compatible generation; provider implementations turn requests into completions. +- **Provider support and output handling:** `LlamaCppJniConfig` configures inference; shared helpers build remote requests and resolve endpoints, while `AiCompletionParser` cleans leading thinking blocks. + +#### Key units +- `SrcMorphConfiguration` — mutable run-level source-selection, output, routing, fallback-model, and metadata settings. +- `AiGenerationConfig` — generation defaults and overrides for provider, sampling, limits, runtime tuning, stop strings, reasoning, and calibration. +- `AiConditionEvaluator` / `AiConditionGroup` — validate and evaluate nested file-selection conditions against `AiFileContext`. +- `AiFactExtractor` — count configured regex matches in full source text and format a facts block. +- `AiOversizeStrategy` — parse and represent the configured oversized-input strategy. +- `AiGenerationProvider` — generation contract with optional timing support and resource cleanup. +- `AiGenerationProviderFactory` — resolve provider settings and dispatch to mock, `llamacpp-jni`, or `openai-compatible`. +- `LlamaCppJniAiGenerationProvider` — lazily load a GGUF model and run local chat completions. +- `LlamaCppJniConfig` / `LlamaCppJniConfig.Builder` — immutable local and remote provider settings with fluent construction. +- `OpenAiCompatibleProviderSupport` — assemble chat-completion requests, resolve endpoints and keys, check responses, and calculate timings. +- `AiCompletionParser` — remove a leading Gemma 4 thinking block or raise `IOException` for an unterminated block. +- `AiGenerationTimings` — carry generation timing and usage data. + +#### Data flow +- `SrcMorphConfiguration` supplies selection and generation settings; `AiConditionEvaluator` checks condition trees against file facts. +- `AiFactExtractor` applies configured counters to source text, while `AiOversizeStrategy` parses how oversized inputs are to be handled. +- `AiGenerationProviderFactory` resolves provider settings and creates the selected implementation for an `AiGenerationRequest`. +- The llama.cpp path builds inference parameters through `LlamaCppJniProviderSupport`, runs chat completion, and parses the result; the OpenAI-compatible support path builds a JSON request and maps response usage to timing data. +- Providers return completion text and, where supported, timing metrics; implementations without timing data use the contract’s zero-valued defaults. + +#### Dependencies +- Internal types include `AiCondition`, `AiFileContext`, `AiRangeCondition`, `AiFactCounter`, `AiCalibration`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiPromptDefinition`, `AiGenerationRequest`, and `AiGenerationTimings`. +- Condition evaluation delegates path-glob exclusions to `AiSourceExcludeFilter`; provider support uses `AiPromptSupport`, `LlamaCppJniProviderSupport`, and `Java8CompatibilityHelper`. +- External dependencies include Java collections, regex, time and file APIs; llama.cpp JNI model and response types; and Jackson JSON nodes and mapper. + +#### Cross-cutting +- Configuration uses mutable JavaBeans, nullable omitted settings, defaults, and sentinel values; general validation is limited, with explicit checks for condition trees and fact counters. +- Providers implement `AutoCloseable`; llama.cpp model loading is lazy and cleanup occurs only if initialized. +- The llama.cpp provider’s lazy model initialization is unsynchronized; the configuration beans and builder are not thread-safe. +- An unrecognized nonblank provider key raises `IllegalArgumentException`; OpenAI-compatible support restricts API keys over plain HTTP to recognized loopback hosts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..a9b0aa34 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,48 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:51:08Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Removes leading Gemma 4 internal reasoning from model completions so only the answer is stored in AI index files. + +#### Purpose +- `AiCompletionParser` cleans raw LLM completion text by stripping a leading thinking block. +- Preserves markers appearing elsewhere in the answer and rejects incomplete leading thinking blocks. + +#### Type +- `public class AiCompletionParser` — class; non-final; annotated `@ToString`. +- No supertypes explicitly declared. + +#### Input +- `AiCompletionParser()` — no arguments. +- `parseCompletion(final String response)` — raw completion text; accepts `null`. +- Uses `THINKING_BLOCK_START_MARKER` (`"<|channel>thought"`) and `THINKING_BLOCK_END_MARKER` (`""`). + +#### Output +- `parseCompletion` returns trimmed answer text, never `null`. +- Returns `""` for `null` input. +- No state mutation or resource writes. + +#### Core logic +- `null` input becomes an empty string; otherwise trims the response. +- If the trimmed response does not start with the thinking-block start marker, returns it unchanged apart from trimming. +- For a leading thinking block, finds the first end marker after the start marker and returns the trimmed text after it. +- Throws `IOException` if the leading thinking block has no end marker. + +#### Public API +- `AiCompletionParser()` — creates parser. +- `THINKING_BLOCK_START_MARKER: String` — opening thinking-block token. +- `THINKING_BLOCK_END_MARKER: String` — closing thinking-block token. +- `parseCompletion(String) -> String` — strips a leading thinking block. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `parseCompletion` throws `IOException` when a leading thinking block lacks its closing marker; message recommends increasing `maxOutputTokens` and includes response length. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..aabbf412 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,47 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:51:12Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Produces AI-generated text from source-generation requests and optionally reports model timing for calibration. + +#### Purpose +- Defines a pluggable backend contract for generating text from `AiGenerationRequest`. +- Supports providers that expose generation timings and providers that do not. + +#### Type +- `public interface AiGenerationProvider` — interface extending `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume an `AiGenerationRequest` containing prompt key, source file, source text, and current header. + +#### Output +- `generate` returns generated `String`; it is documented as non-null but may be blank. +- `generateWithTimings` returns `AiGenerationTimings`; default implementation supplies zero timing rates. +- Default `close()` has no side effects. + +#### Core logic +- `generate` is the required provider operation; implementations supply text generation. +- Default `generateWithTimings` calls `generate(request)` and wraps its text with zero-valued timing fields. +- Providers with timing data may override `generateWithTimings`. +- Default `close()` does nothing. + +#### Public API +- `generate(AiGenerationRequest)` -> `String` — generate text with default sampling parameters. +- `generateWithTimings(AiGenerationRequest)` -> `AiGenerationTimings` — generate text with timing data. +- `close()` -> `void` — close provider resources. + +#### Dependencies +- `java.io.IOException` +- `java.lang.AutoCloseable` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `AiGenerationTimings` + +#### Exceptions / Errors +- `generate` and `generateWithTimings` declare `IOException` for provider failures. +- `close` declares `IOException`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..f6506cb7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,61 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:51:16Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Selects a mock, llama.cpp JNI, or OpenAI-compatible AI generation provider using run-level and model-level configuration. + +#### Purpose +- `AiGenerationProviderFactory` resolves the effective provider key and creates the matching `AiGenerationProvider`. +- Falls back to the deterministic mock provider when no provider key is configured. + +#### Type +- `public class AiGenerationProviderFactory` — class; annotated `@ToString`. +- No explicit superclass or interfaces. + +#### Input +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` — run provider key, model configuration, and prompt lookup support. +- `effectiveProvider(String runProvider, String modelProvider)` — nullable run and model provider keys. +- Private `compatibilityHelper` — `Java8CompatibilityHelper` used to check blank provider names. + +#### Output +- `create(...)` returns a newly created `AiGenerationProvider`. +- `effectiveProvider(...)` returns the trimmed model provider when nonblank; otherwise the run provider. +- Creates `MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, or `OpenAiCompatibleAiGenerationProvider`. + +#### Core logic +- `effectiveProvider` prefers a non-null, nonblank model provider, trimming it; otherwise returns the run provider. +- `create` resolves the effective key and uses the mock provider if it is null or blank. +- Dispatches `mock`, `llamacpp-jni`, and `openai-compatible` keys to their corresponding provider implementations. +- Passes `llamaConfig` and `promptSupport` to the llama.cpp JNI and OpenAI-compatible providers. + +#### Public API +- `AiGenerationProviderFactory()` — creates a factory. +- `PROVIDER_MOCK: String` — mock provider key. +- `PROVIDER_LLAMACPP_JNI: String` — llama.cpp JNI provider key. +- `PROVIDER_OPENAI_COMPATIBLE: String` — OpenAI-compatible provider key. +- `effectiveProvider(String runProvider, String modelProvider) -> @Nullable String` — resolves the provider key. +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport) -> AiGenerationProvider` — creates the configured provider. + +#### Dependencies +- `AiGenerationProvider` +- `MockAiGenerationProvider` +- `LlamaCppJniAiGenerationProvider` +- `OpenAiCompatibleAiGenerationProvider` +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `Java8CompatibilityHelper` +- Lombok `@ToString` +- JSpecify `@Nullable` + +#### Exceptions / Errors +- Throws `IllegalArgumentException` with `Unsupported AI provider: ` for unrecognized nonblank provider keys. +- `effectiveProvider` accepts nullable run and model provider keys. + +#### Concurrency +- No synchronization or concurrency behavior is defined in this file. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..f71bb4c8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,59 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:51:21Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Generates local AI completions from GGUF models through llama.cpp, with configurable inference, cache reuse, and measured generation timings. + +#### Purpose +- Implements local AI generation for `AiGenerationRequest` using the `net.ladenthin:llama` JNI binding. +- Lazily loads and reuses a configured GGUF model; exposes completion text and model-reported timing and cache metrics. + +#### Type +- `public final class LlamaCppJniAiGenerationProvider` — implements `AiGenerationProvider`, `AutoCloseable`; annotated `@ToString`. +- Fields excluded from Lombok `toString`: native `model` (`@Nullable`), `support`. + +#### Input +- Constructor takes `LlamaCppJniConfig config` and `AiPromptSupport promptSupport`; both are required and null-checked. +- `generate` and `generateWithTimings` consume `AiGenerationRequest`. +- Reads model path, context size, thread counts, GPU and CPU layer settings, cache and batching options, lazy mode, Flash Attention, devices, and prompt/inference settings from config and support. + +#### Output +- `generate` returns parsed completion text; warns on truncated answers and logs prompt-cache reuse. +- `generateWithTimings` returns `AiGenerationTimings` with text, prompt/predicted token counts, cache token count, and throughput rates. +- Lazily creates and caches `LlamaModel`; `close` closes it if initialized. + +#### Core logic +- Constructor creates `LlamaCppJniProviderSupport` from config and prompt support without loading native model resources. +- On first model access, builds `ModelParameters` with model path, context size, threads, automatic reasoning format, and chat-template kwargs. +- Applies optional parameters only under their respective guards: SWA full, positive cache reuse, nonnegative GPU/CPU layer counts and main GPU, positive unified KV/batch/ubatch/batch-thread sizes, nonblank lazy mode and cache types, enabled Flash Attention, and nonempty device selection. +- Constructs and stores `LlamaModel`; later calls reuse the cached handle. +- Builds inference parameters through `support`, runs `chatComplete`, and parses the full response. +- `generate` checks truncation and logs cache reuse before parsing first response content. +- `generateWithTimings` returns zero counts/rates if response timings are absent; otherwise maps prompt, cache, predicted token counts and rates into `AiGenerationTimings`. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport)` — creates provider; defers model loading. +- `generate(AiGenerationRequest) -> String` — generate completion text; throws `IOException`. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` — generate text and model timings. +- `close() -> void` — close initialized model. + +#### Dependencies +- `AiGenerationProvider`, `AiGenerationRequest`, `AiGenerationTimings` +- `LlamaCppJniConfig`, `LlamaCppJniProviderSupport` +- `LlamaModel`, `ModelParameters`, `FlashAttn`, `ReasoningFormat`, `ChatResponseParser`, `ChatResponse`, `Timings` +- `AiPromptSupport`, `AiCompletionParser`, `Java8CompatibilityHelper` +- `IOException`, `Map`, `Objects`, Lombok `ToString`, JSpecify `Nullable` + +#### Exceptions / Errors +- Constructor rejects null config or prompt support via `Objects.requireNonNull`. +- `generate` declares `IOException`; `generateWithTimings` does not. +- `close` is a no-op when the model was never initialized. + +#### Concurrency +- Model initialization uses an unsynchronized nullable field; concurrent first calls are not guarded against duplicate initialization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..646063a9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,97 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:51:28Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Configures llama.cpp and OpenAI-compatible text generation, including model loading, sampling, hardware, caching, reasoning, and stop controls. + +#### Purpose +- `LlamaCppJniConfig` carries provider and generation settings; `Builder` applies `AiGenerationConfig` defaults and constructs the configuration. + +#### Type +- `LlamaCppJniConfig` — final class; annotated `@ConvertToRecord`, Lombok `@ToString`, and `@EqualsAndHashCode`; 41 private final configuration fields; nullable `Boolean chatTemplateEnableThinking`. +- `Builder` — public static final nested class; fluent mutable builder with a required `modelPath`. + +#### Input +- `builder(String modelPath)` requires the GGUF model path. +- `Builder` setters accept sampling, token limits, threading, KV cache, GPU/device, provider/API, reasoning, DRY, and stop-string settings. +- Defaults come from `AiGenerationConfig.DEFAULT_*`; list defaults are empty lists. +- `apiKeyEnv` accepts the name of an environment variable, not an API key. + +#### Output +- `build()` returns an immutable `LlamaCppJniConfig`. +- Accessors return configured settings; `drySequenceBreakers()` and `stopStrings()` return unmodifiable views. +- Stores 41 settings, including model path, generation parameters, provider configuration, and list-valued controls. + +#### Core logic +- `builder(modelPath)` creates a builder and rejects a null model path. +- Builder fields initialize from `AiGenerationConfig.DEFAULT_*` (or empty lists); setter calls replace values fluently. +- String setters for lazy mode, cache types, devices, provider, remote model, URL, API-key environment name, and reasoning effort restore their defaults on `null`; list setters restore empty lists on `null`. +- `build()` copies builder field references and values into the configuration; constructor performs no normalization. +- Configuration fields are final, but list inputs are not copied; accessors prevent mutation through the returned view, not through an external list reference. + +#### Public API +- `builder(String)` -> `Builder` — start configuration. +- `modelPath()` -> `String` — model file path. +- `contextSize()` -> `int` — context window. +- `maxOutputTokens()` -> `int` — output token limit. +- `temperature()` -> `float` — sampling temperature. +- `threads()` -> `int` — CPU thread count. +- `topP()` -> `float` — nucleus threshold. +- `topK()` -> `int` — top-k limit. +- `minP()` -> `float` — min-p threshold. +- `topNSigma()` -> `float` — top-n-sigma threshold. +- `repeatPenalty()` -> `float` — repetition penalty. +- `chatTemplateEnableThinking()` -> `@Nullable Boolean` — chat-template thinking mode. +- `cachePrompt()` -> `boolean` — prompt caching toggle. +- `swaFull()` -> `boolean` — full SWA KV cache toggle. +- `cacheReuse()` -> `int` — KV prefix-reuse chunk size. +- `gpuLayers()` -> `int` — GPU offload layer count. +- `seed()` -> `int` — generation RNG seed. +- `cpuMoeLayers()` -> `int` — CPU MoE layer count. +- `cpuFfnLayers()` -> `int` — CPU FFN layer count. +- `kvUnifiedPerSlot()` -> `int` — per-slot unified KV cap. +- `lazyMode()` -> `String` — tensor-read laziness. +- `repeatLastN()` -> `int` — repetition penalty window. +- `cacheTypeK()` -> `String` — K cache data type. +- `cacheTypeV()` -> `String` — V cache data type. +- `flashAttn()` -> `boolean` — Flash Attention toggle. +- `batchSize()` -> `int` — logical batch size. +- `ubatchSize()` -> `int` — physical batch size. +- `threadsBatch()` -> `int` — batch-processing thread count. +- `mainGpu()` -> `int` — primary GPU index. +- `devices()` -> `String` — selected devices. +- `provider()` -> `String` — AI provider selection. +- `remoteModel()` -> `String` — remote provider model ID. +- `baseUrl()` -> `String` — OpenAI-compatible API base URL. +- `apiKeyEnv()` -> `String` — API-key environment variable name. +- `reasoningEffort()` -> `String` — reasoning-effort setting. +- `reasoningBudgetTokens()` -> `int` — reasoning token budget. +- `dryMultiplier()` -> `float` — DRY sampling multiplier. +- `dryBase()` -> `float` — DRY base. +- `dryAllowedLength()` -> `int` — DRY allowed length. +- `dryPenaltyLastN()` -> `int` — DRY penalty look-back. +- `drySequenceBreakers()` -> `List` — DRY sequence breakers. +- `stopStrings()` -> `List` — generation stop strings. +- `Builder.contextSize(int)`, `maxOutputTokens(int)`, `temperature(float)`, `threads(int)`, `topP(float)`, `topK(int)`, `minP(float)`, `topNSigma(float)`, `repeatPenalty(float)`, `chatTemplateEnableThinking(@Nullable Boolean)`, `cachePrompt(boolean)`, `swaFull(boolean)`, `cacheReuse(int)`, `gpuLayers(int)`, `seed(int)`, `cpuMoeLayers(int)`, `cpuFfnLayers(int)`, `kvUnifiedPerSlot(int)`, `lazyMode(String)`, `repeatLastN(int)`, `cacheTypeK(String)`, `cacheTypeV(String)`, `flashAttn(boolean)`, `batchSize(int)`, `ubatchSize(int)`, `threadsBatch(int)`, `mainGpu(int)`, `devices(String)`, `provider(String)`, `remoteModel(String)`, `baseUrl(String)`, `apiKeyEnv(String)`, `reasoningEffort(String)`, `reasoningBudgetTokens(int)`, `dryMultiplier(float)`, `dryBase(float)`, `dryAllowedLength(int)`, `dryPenaltyLastN(int)`, `drySequenceBreakers(List)`, `stopStrings(List)` -> `Builder` — set corresponding option. +- `Builder.build()` -> `LlamaCppJniConfig` — create configuration. + +#### Dependencies +- `AiGenerationConfig` +- `ConvertToRecord` +- `Collections`, `List`, `Objects` +- Lombok `EqualsAndHashCode`, `ToString` +- JSpecify `Nullable` + +#### Exceptions / Errors +- `Objects.requireNonNull(modelPath, "modelPath")` throws `NullPointerException` for a null model path. +- Nullable thinking mode remains unset when null; several string and list setters map null to their configured defaults. + +#### Concurrency +- `Builder` is explicitly not thread-safe. +- `LlamaCppJniConfig` fields are final; list references are not defensively copied. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..d1a9c988 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,65 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:51:39Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Builds OpenAI-compatible chat-completion requests and protects API keys from being sent over non-local plain HTTP. + +#### Purpose +- `OpenAiCompatibleProviderSupport` prepares request JSON, endpoint and API-key handling, HTTP response checks, error messages, and generation timings for an OpenAI-compatible provider. +- Keeps provider support logic independent of network I/O. + +#### Type +- `final class OpenAiCompatibleProviderSupport` — final class; package-private; annotated `@ToString`. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, and `Function environment`. +- `requestBody(AiGenerationRequest request)` reads the prompt key, source file and text, plus model and sampling settings from `config`. +- `endpoint()` reads and trims `config.baseUrl()`. +- `apiKey()` reads `config.apiKeyEnv()` and looks up that environment variable. +- `apiKeyFor(String endpoint)` parses the endpoint host when a key is configured for plain HTTP. +- `errorMessage(String endpoint, int status, String body)` consumes the response body. +- `timings(String text, ChatResponse response, double seconds)` reads usage counts from `response`. + +#### Output +- `requestBody` returns serialized JSON with system and user messages, sampling settings, and `"stream": false`. +- `endpoint` returns the base URL with trailing slashes removed and `/chat/completions` appended. +- `apiKey` and `apiKeyFor` return a trimmed key or `null`. +- `errorMessage` returns a message containing the endpoint, HTTP status, and up to 500 body characters. +- `timings` returns `AiGenerationTimings` with usage counts, zero prefill rate, and decode rate calculated from completion tokens and elapsed seconds. +- Static helpers return loopback-host, success-status, and error-message results. +- Holds final `config`, `promptSupport`, `environment`, and `compatibilityHelper` fields. + +#### Core logic +- `requestBody` omits blank `remoteModel` and `reasoningEffort`; always includes `max_tokens`, `temperature`, `top_p`, `repetition_penalty`, two prompt messages, and `stream: false`. +- Adds `top_k` and `min_p` only when positive, `seed` only when non-negative, and `stop` only when stop strings are present. +- `endpoint` accepts only `http://` or `https://` prefixes, strips trailing slashes, then appends `/chat/completions`. +- `apiKey` returns `null` if the environment-variable name is blank, the lookup is unset, or the value is blank; otherwise returns the trimmed value. +- `apiKeyFor` allows a configured key over HTTPS or plain HTTP to an accepted loopback host; rejects other plain-HTTP destinations. +- `isLoopbackHost` recognizes exactly `localhost`, matching IPv4 `127.x.x.x` literals, and `[::1]`. +- `isSuccess` recognizes HTTP statuses from 200 through 299. +- `errorMessage` truncates bodies longer than 500 characters and appends `...`. +- `timings` casts prompt, cached, and completion token counts to `int`; decode rate is zero when elapsed seconds are not positive. + +#### Dependencies +- `LlamaCppJniConfig`, `AiPromptSupport`, `AiGenerationRequest`, `AiGenerationTimings` +- `ChatResponse`, `Usage` +- Jackson `ObjectMapper`, `ObjectNode`, `ArrayNode` +- `Java8CompatibilityHelper` +- `Function`, `List`, `Objects`, `Pattern`, `URL`, `IOException` +- Lombok `@ToString`; JSpecify `@Nullable` + +#### Exceptions / Errors +- Constructor uses `Objects.requireNonNull` for all three arguments. +- `requestBody` declares `IOException` for JSON serialization failure. +- `endpoint` throws `IllegalArgumentException` for a base URL without an HTTP(S) prefix. +- `apiKeyFor` declares `IOException` for URL parsing failure or a configured key sent to a non-loopback plain-HTTP host. +- `errorMessage` truncates oversized error bodies; it does not throw. + +#### Concurrency +- No synchronization or concurrency controls; fields are final. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/package.ai.md new file mode 100644 index 00000000..64bf7e58 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/java/provider/package.ai.md @@ -0,0 +1,54 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:53:16Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Converts source-generation requests into cleaned AI completions through selectable mock, local llama.cpp, or OpenAI-compatible backends. + +#### Purpose +- Defines provider selection and generation contracts, with shared configuration and support for local and OpenAI-compatible inference. +- Cleans model output and optionally returns generation timing and token-usage metrics. + +#### Responsibilities +- **Provider abstraction and selection:** `AiGenerationProvider` defines text generation, optional timings, and resource cleanup; `AiGenerationProviderFactory` resolves run- and model-level provider settings and dispatches to mock, llama.cpp JNI, or OpenAI-compatible implementations. +- **Local inference:** `LlamaCppJniAiGenerationProvider` lazily configures and reuses a GGUF `LlamaModel`, generates completions, and exposes model timing and cache metrics. +- **Provider configuration:** `LlamaCppJniConfig` and its builder collect model, sampling, hardware, cache, reasoning, provider, and stop-control settings. +- **Output and remote-request support:** `AiCompletionParser` strips a leading Gemma 4 thinking block; `OpenAiCompatibleProviderSupport` assembles chat-completion request bodies, resolves endpoints and API keys, checks responses, and calculates timings. + +#### Key units +- `AiGenerationProvider` — pluggable generation contract with default zero-valued timing support and no-op `close()`. +- `AiGenerationProviderFactory` — selects `mock`, `llamacpp-jni`, or `openai-compatible`, defaulting to mock when no provider key is set. +- `LlamaCppJniAiGenerationProvider` — runs local llama.cpp chat completions with lazy model loading and timing extraction. +- `LlamaCppJniConfig` / `LlamaCppJniConfig.Builder` — immutable settings and fluent construction for generation providers. +- `AiCompletionParser` — removes a leading `<|channel>thought` block and rejects an unterminated leading block with `IOException`. +- `OpenAiCompatibleProviderSupport` — package-private request, endpoint, API-key, error-message, and timing utilities for an OpenAI-compatible provider. +- `AiGenerationTimings` — generation result type used by the provider contract and timing-producing support. + +#### Data flow +- Provider settings are resolved by `AiGenerationProviderFactory`; `LlamaCppJniConfig` supplies local inference and remote-provider options. +- A provider receives an `AiGenerationRequest`; the llama.cpp path builds inference parameters through `LlamaCppJniProviderSupport`, runs `chatComplete`, and parses the completion with `AiCompletionParser`. +- The OpenAI-compatible support path builds JSON from the request and configuration, resolves the completion endpoint and optional API key, and maps response usage into `AiGenerationTimings`. +- `generateWithTimings` returns generated text with timing data where available; the provider interface supplies zero timing rates by default when an implementation does not report timings. + +#### Dependencies +- Internal collaborators: `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, `LlamaCppJniProviderSupport`, and `Java8CompatibilityHelper`. +- Provider implementations selected by the factory: `MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, and `OpenAiCompatibleAiGenerationProvider`. +- External inference and response types: llama.cpp JNI (`LlamaModel`, `ModelParameters`, `ChatResponse`, `Timings`) and Jackson JSON nodes and mapper. +- Configuration defaults come from `AiGenerationConfig`; the OpenAI-compatible support uses `ChatResponse` and `Usage` for response timing data. + +#### Cross-cutting +- Providers implement `AutoCloseable`; the llama.cpp provider loads its model lazily and closes it only if initialized. +- `LlamaCppJniConfig` fields are final, but builder list inputs are not defensively copied; the builder is not thread-safe. +- The llama.cpp provider’s lazy model field is unsynchronized, so concurrent first calls are not guarded against duplicate initialization. +- OpenAI-compatible support permits API keys over HTTPS or plain HTTP to recognized loopback hosts; it rejects configured keys for other plain-HTTP hosts. +- A leading but incomplete thinking block raises `IOException`; an unrecognized nonblank provider key raises `IllegalArgumentException`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..141e919b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/kernels/histogram.cl.ai.md @@ -0,0 +1,46 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:52:39Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Counts the frequency of each byte value in an image or byte stream using a two-pass 256-bin histogram. + +#### Purpose +- Computes a 256-bin byte histogram, partitioning counts across work-groups before reducing them. +- Supports image data or any byte stream. + +#### Type +- OpenCL C 1.2 kernel source; defines two `__kernel` entry points. + +#### Input +- `histogram_partial`: `input` byte buffer, `length`, `partial` output buffer, and caller-provided `local_bins` local-memory buffer. +- `histogram_reduce`: `partial` buffer and `group_count`. + +#### Output +- `histogram_partial` writes one 256-counter partial histogram per work-group to `partial`. +- `histogram_reduce` writes the final 256-bin histogram to `histogram`. + +#### Core logic +- `histogram_partial` initializes local counters cooperatively, then synchronizes the work-group. +- Each work-item processes input indices in strides of the global work size and atomically increments the local counter for each byte value. +- After another local-memory barrier, work-items cooperatively copy local counters to the group’s slice of `partial`. +- `histogram_reduce` assigns one work-item per bin, sums that bin across `group_count` partial histograms, and stores the result in `histogram`; out-of-range bin IDs return without writing. + +#### Public API +- `histogram_partial(input, length, partial, local_bins) -> void` — count bytes per work-group. +- `histogram_reduce(partial, group_count, histogram) -> void` — combine partial counts per bin. + +#### Constants and configuration +- `BINS = 256` — number of byte-value bins. + +#### Dependencies +- OpenCL built-ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `barrier`, `atomic_inc`. +- OpenCL memory fences: `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- `histogram_reduce` skips work-items whose bin index is `>= BINS`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/kernels/package.ai.md new file mode 100644 index 00000000..ee1f73e7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/kernels/package.ai.md @@ -0,0 +1,34 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:53:34Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes byte-value frequency distributions for image data or arbitrary byte streams. + +#### Purpose +- Produces a 256-bin histogram using per-work-group counts followed by reduction. +- Supports histogramming any byte buffer, including image data. + +#### Responsibilities +- **Partial counting:** `histogram_partial` counts byte values into work-group-local bins and writes each group’s partial histogram. +- **Reduction:** `histogram_reduce` sums each bin across work groups into the final histogram. + +#### Key units +- `BINS` — constant defining 256 byte-value bins. +- `histogram_partial` — OpenCL kernel that partitions input processing across work-items and emits one partial histogram per work group. +- `histogram_reduce` — OpenCL kernel that combines partial histograms into the final 256-bin result. + +#### Data flow +- `input` bytes and `length` → work-group-local counters in `local_bins` → per-group slices in `partial` → reduced counts in `histogram`. + +#### Dependencies +- OpenCL C 1.2 built-ins for work-item, work-group, synchronization, and atomic operations; uses `CLK_LOCAL_MEM_FENCE`. + +#### Cross-cutting +- Uses cooperative local-memory initialization and copying, with work-group barriers around shared counter updates. +- `histogram_reduce` skips work-items whose bin index is outside the 256-bin range. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..8c0214dd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,47 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:53:47Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides low-level byte processing and buffering utilities alongside command-line tools for backup retention and sales reporting. + +#### Purpose +- Compute byte-frequency histograms and manage bounded circular byte streams. +- Automate compressed backup rotation and produce monthly regional revenue reports from order CSVs. + +#### Responsibilities +- **Byte analysis (`kernels/`):** Count byte values into 256-bin partial histograms and reduce them to final totals. +- **Byte-stream buffering (`ringbuf/`):** Allocate, query, read, and write fixed-capacity circular buffers with wraparound and partial transfers. +- **Operational scripts (`scripts/`):** Create timestamped compressed archives with retention pruning; parse currency-filtered orders and report qualifying monthly regional revenue. + +#### Key units +- `histogram_partial` / `histogram_reduce` — OpenCL kernels for per-work-group byte counting and histogram reduction. +- `BINS` — Defines the 256 byte-value histogram bins. +- `ringbuf_t` / `ringbuf_status_t` — Ring-buffer state and initialization status codes. +- `ringbuf_init`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space`, `ringbuf_free` — Ring-buffer lifecycle, transfer, and capacity API. +- `rotate_backups.sh` — Creates UTC-timestamped `.tar.gz` archives and prunes older matching backups. +- `Order`, `parse_orders(path, currency)`, `revenue_by_month_and_region(orders)`, `main(argv=None)` — Sales data model, CSV filtering, aggregation, and report CLI. + +#### Data flow +- **Histogram:** Input bytes and length → local work-group counters → partial histograms → reduced 256-bin output. +- **Ring buffer:** Initialize storage → write available bytes and read buffered bytes while advancing indices → query occupancy or free storage. +- **Backups:** Source directory and retention settings → compressed partial archive → timestamped archive → retention pruning. +- **Sales report:** CSV files → currency-matched `Order` records → monthly regional revenue totals → threshold filtering → tab-separated output. + +#### Dependencies +- **Kernels:** OpenCL C 1.2 work-item, work-group, synchronization, and atomic built-ins. +- **Ring buffer:** `ringbuf.h`, C standard allocation and memory-copy facilities. +- **Backup rotation:** Bash utilities including `tar`, `date`, `mv`, `du`, `ls`, and `rm`. +- **Sales reporting:** Python standard library for CLI parsing, CSV input, dates, decimals, and aggregation. + +#### Cross-cutting +- `ringbuf_t` uses power-of-two capacity, masked wraparound indices, and one reserved slot; its volatile indices are described for single-producer/single-consumer use. +- Histogram kernels coordinate shared local-memory counters with work-group barriers. +- Backup and sales utilities are separate command-line workflows; no shared data pipeline is specified. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/ringbuf/package.ai.md new file mode 100644 index 00000000..5c3dcbb7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/ringbuf/package.ai.md @@ -0,0 +1,45 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:53:37Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides bounded circular byte-stream buffering for passing data between a producer and a consumer. + +#### Purpose +- Initialize, manage, and query fixed-capacity byte ring buffers. +- Transfer bytes partially according to available space or buffered data. + +#### Responsibilities +- **Buffer lifecycle:** allocate and initialize storage; free storage and reset buffer state. +- **Byte transfer:** write into and read from the circular buffer, including wraparound copies. +- **Capacity accounting:** report used and writable bytes while reserving one slot to distinguish full from empty. + +#### Key units +- `ringbuf_t` — stores the byte array, capacity, and `head`/`tail` indices. +- `ringbuf_status_t` — reports initialization success or invalid-capacity and allocation errors. +- `ringbuf_init` — validates power-of-two capacity and allocates buffer storage. +- `ringbuf_write` / `ringbuf_read` — copy up to the requested byte count, limited by free space or available data. +- `ringbuf_used` / `ringbuf_free_space` — report occupancy and writable capacity. +- `ringbuf_free` — releases storage and resets buffer fields. + +#### Data flow +- `ringbuf_init` allocates storage and sets indices to zero; usable capacity is `capacity - 1`. +- `ringbuf_write` copies available input bytes into the buffer and advances `head`. +- `ringbuf_read` copies available buffered bytes to the destination and advances `tail`. +- Occupancy queries derive used and free byte counts from the indices; `ringbuf_free` releases and resets the buffer. + +#### Dependencies +- `ringbuf.c` uses `ringbuf.h` for the API and status codes, `` for allocation, and `` for copying. +- `ringbuf.h` uses `` and `` for `size_t` and `uint8_t`. + +#### Cross-cutting +- Capacity must be a nonzero power of two; masked index updates provide wraparound. +- One slot is reserved to distinguish full from empty. +- `ringbuf_t` uses `volatile size_t` indices and is described as supporting a single producer and a single consumer. +- Initialization reports `RINGBUF_EINVAL` for invalid capacity and `RINGBUF_ENOMEM` for allocation failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..b204f8f7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,61 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:52:43Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Buffers byte streams in a fixed-capacity circular queue, accepting and returning as many bytes as available space or data permits. + +#### Purpose +- Implements initialization, cleanup, occupancy queries, and partial byte reads and writes for `ringbuf_t`. +- Uses power-of-two capacity for masked index wraparound and reserves one slot to distinguish full from empty. + +#### Type +- C implementation file; exports the `ringbuf_*` functions declared by `ringbuf.h`. + +#### Input +- `ringbuf_init`: ring-buffer pointer `rb`, requested byte `capacity`. +- `ringbuf_write`: `rb`, source buffer `src`, requested length `len`. +- `ringbuf_read`: `rb`, destination buffer `dst`, requested length `len`. +- Occupancy queries and `ringbuf_free`: `rb`. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`; on success allocates storage and initializes `capacity`, `head`, and `tail`. +- `ringbuf_write` and `ringbuf_read` return the number of bytes transferred; each may transfer fewer than `len`. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. +- `ringbuf_free` releases storage and resets the buffer fields. + +#### Core logic +- `ringbuf_init` rejects capacities that are zero or not powers of two; allocates `capacity` bytes and initializes indices to zero. +- `ringbuf_used` computes wrapped occupancy as `(head - tail) & (capacity - 1)`; `ringbuf_free_space` subtracts that occupancy and the reserved slot from capacity. +- `ringbuf_write` limits transfer to free space, copies across the array end in at most two chunks, then advances `head` with a capacity mask. +- `ringbuf_read` limits transfer to available bytes, copies across the array end in at most two chunks, then advances `tail` with a capacity mask. +- `ringbuf_free` frees the allocated data and resets pointers, capacity, and indices. + +#### Public API +- `ringbuf_init(rb, capacity) -> ringbuf_status_t` — allocate and initialize buffer +- `ringbuf_free(rb) -> void` — release and reset buffer +- `ringbuf_used(rb) -> size_t` — report occupied bytes +- `ringbuf_free_space(rb) -> size_t` — report writable bytes +- `ringbuf_write(rb, src, len) -> size_t` — append available bytes +- `ringbuf_read(rb, dst, len) -> size_t` — retrieve available bytes +- Internal helpers: `is_power_of_two`, `min_size` + +#### Constants and configuration +- `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`, `RINGBUF_OK` — initialization status codes; values are not shown. +- No configuration or environment variables. + +#### Dependencies +- `"ringbuf.h"` — ring-buffer types and status codes. +- `` — `malloc`, `free`. +- `` — `memcpy`. +- `uint8_t` — byte-buffer element type. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` for zero or non-power-of-two capacity. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if allocation fails. +- No checks are shown for null pointers or invalid buffer state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..1692d4ec --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,56 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:52:50Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides fixed-capacity byte buffering between a single producer and a single consumer. + +#### Purpose +- Declares a ring buffer API for writing and reading bytes without exceeding available capacity. +- Uses one reserved slot to distinguish full from empty; usable capacity is `capacity - 1`. + +#### Type +- C header; declares `ringbuf_t` and `ringbuf_status_t`, with C++ linkage compatibility. +- `ringbuf_t`: `data` byte pointer, `capacity`, producer-owned `head`, and consumer-owned `tail`; indices are `volatile size_t`. + +#### Input +- `ringbuf_init`: buffer pointer and requested capacity; capacity must be a nonzero power of two. +- `ringbuf_write`: buffer, source byte pointer, and requested length. +- `ringbuf_read`: buffer, destination byte pointer, and requested length. +- `ringbuf_used` / `ringbuf_free_space`: buffer pointer. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`; `ringbuf_write` and `ringbuf_read` return bytes copied. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. +- `ringbuf_free` releases buffer resources. + +#### Core logic +- Declares fixed-capacity storage with head and tail indices for producer and consumer access. +- Write and read operations copy up to the requested length, limited by available space or data. +- Requires power-of-two capacity and reserves one slot, yielding `capacity - 1` usable bytes. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — initialize buffer. +- `ringbuf_free(ringbuf_t *rb) -> void` — release buffer resources. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — copy bytes into buffer. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — copy bytes out. +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report occupied bytes. +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report writable bytes. + +#### Constants and configuration +- `RINGBUF_OK = 0` — successful status. +- `RINGBUF_EINVAL = -1` — capacity is zero or not a power of two. +- `RINGBUF_ENOMEM = -2` — allocation failed. +- Capacity requirement: nonzero power of two; usable size is capacity minus one. + +#### Dependencies +- ``: `size_t`. +- ``: `uint8_t`. + +#### Exceptions / Errors +- `ringbuf_init` reports invalid capacity with `RINGBUF_EINVAL` and allocation failure with `RINGBUF_ENOMEM`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/scripts/package.ai.md new file mode 100644 index 00000000..3b6e4081 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/scripts/package.ai.md @@ -0,0 +1,35 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:53:42Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides command-line utilities for rotating compressed directory backups and reporting monthly sales revenue by region and currency. + +#### Purpose +- Create timestamped backups while enforcing per-source archive retention. +- Convert order CSV exports into filtered monthly regional revenue summaries. + +#### Responsibilities +- **Backup rotation:** validate inputs, archive a source directory, and remove older matching archives beyond the retention limit. +- **Sales reporting:** read and validate order CSVs, select a currency, aggregate revenue by month and region, and print qualifying totals. + +#### Key units +- `rotate_backups.sh` — creates a UTC-timestamped `.tar.gz` archive and retains the newest configured number. +- `Order` — immutable sales order data containing date, region, and amount. +- `parse_orders(path, currency)` — validates CSV columns and yields orders matching the selected currency. +- `revenue_by_month_and_region(orders)` — returns sorted monthly revenue totals by region. +- `main(argv=None)` — parses report options, filters totals, and prints the sales report. + +#### Data flow +- **Backups:** source directory and backup settings → compressed partial archive → finalized timestamped archive → newest-first retention pruning. +- **Sales:** one or more CSV files → currency-filtered `Order` records → month/region aggregation → minimum-revenue filtering → tab-separated output. + +#### Dependencies +- **Backup rotation:** Bash utilities including `tar`, `date`, `mv`, `du`, `ls`, and `rm`; archive names are matched by source basename. +- **Sales reporting:** Python standard library modules for CLI parsing, CSV reading, date and decimal handling, and aggregation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..43fb995d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,61 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:52:55Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates timestamped compressed archives of a directory and removes older archives beyond the configured retention count. + +#### Purpose +- Back up one source directory and retain only the newest `KEEP` archives for that directory. +- Run directly with source directory, backup directory, and optional retention count. + +#### Type +- Bash (`#!/usr/bin/env bash`); strict mode: `set -euo pipefail`. + +#### Input +- Positional arguments: `$1` → `SOURCE_DIR`; `$2` → `BACKUP_DIR`; `$3` → `KEEP` (defaults to `7`). +- No named options or environment variables are read. +- Reads `SOURCE_DIR` and lists matching archives in `BACKUP_DIR`. + +#### Output +- Creates `BACKUP_DIR` if needed and writes a dated `.tar.gz` archive there. +- Removes archives beyond the newest `KEEP` matching archives. +- Prints archive creation with its human-readable size, and each removed archive. +- Exits `2` for invalid `KEEP` or a missing source directory; strict mode can exit nonzero on command failures. + +#### Core logic +- Assigns arguments; rejects `KEEP` unless it is a positive integer. +- Verifies `SOURCE_DIR` exists as a directory and creates `BACKUP_DIR`. +- Builds an archive name from the source basename and UTC timestamp; registers cleanup for the `.partial` file on exit. +- Archives the source directory with `tar`, then renames the partial archive to its final path. +- Prints the archive path and size. +- Lists matching archives newest-first and removes entries after the first `KEEP`. + +#### Functions +- No functions defined. + +#### Constants and configuration +- `SOURCE_DIR="${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR="${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP="${3:-7}"` +- `name="$(basename "$SOURCE_DIR")"` +- `archive="$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp="$archive.partial"` +- `archives` = array populated from the newest-first archive listing. +- `old` = each archive selected for removal. + +#### Dependencies +- External commands: `basename`, `date`, `mkdir`, `tar`, `dirname`, `mv`, `echo`, `du`, `cut`, `ls`, `rm`. +- Bash builtins/features: `mapfile`, process substitution, arrays, `[[ ... =~ ... ]]`. +- Archive contents are rooted at `dirname "$SOURCE_DIR"` and include the source basename; archive matching uses `${name}_*.tar.gz` in `BACKUP_DIR`. + +#### Errors and exit codes +- Exit `2` if `KEEP` is not a positive integer or `SOURCE_DIR` is not a directory. +- `${1:?…}` or `${2:?…}` terminates on missing required arguments. +- `set -e` makes command failures terminate with a nonzero status; `set -u` rejects unset-variable use; `set -o pipefail` propagates pipeline failures. +- `EXIT` trap removes `tmp` with `rm -f`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..07c13f75 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/other/scripts/sales_report.py.ai.md @@ -0,0 +1,52 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:53:03Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Summarizes CSV order exports as monthly revenue totals by region in a selected currency. + +#### Purpose +- Reads one or more order CSV files, filters orders by currency, and reports revenue grouped by month and region. +- Omits totals below a configurable minimum revenue. + +#### Type +- Python script; defines immutable `Order` dataclass. + +#### Input +- `parse_orders(path, currency)`: CSV file with `order_date`, `region`, `amount`, and `currency` columns. +- `main(argv=None)`: positional `csv_files` and CLI options `--currency` and `--min-revenue`. +- Order dates use ISO format; amounts are parsed as `Decimal`. + +#### Output +- Prints qualifying rows as tab-separated month, region, and revenue with two decimal places and currency. +- Prints `no orders found` to stderr and returns `1` if no matching orders exist; otherwise returns `0`. + +#### Core logic +- `parse_orders` validates required CSV columns, skips rows in other currencies, and yields `Order` values with stripped region names. +- `revenue_by_month_and_region` sums amounts by `(YYYY-MM, region)` and returns totals in sorted key order. +- `main` combines orders from all input files, filters grouped totals using the minimum revenue, and prints qualifying results. + +#### Public API +- `Order(order_date, region, amount) -> Order` — immutable order data. +- `parse_orders(path, currency) -> iterator[Order]` — yields matching-currency orders. +- `revenue_by_month_and_region(orders) -> dict` — aggregates monthly regional revenue. +- `main(argv=None) -> int` — parses arguments and prints the report. +- Entry point: `sys.exit(main())`. +- CLI: `csv_files` — one or more CSV paths; `--currency` — currency filter; `--min-revenue` — minimum included total. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` +- `--currency`: default `EUR`. +- `--min-revenue`: default `Decimal("0")`. + +#### Dependencies +- Standard library: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `parse_orders` raises `ValueError` when required columns are missing or a matching-currency row has an invalid date or amount; row errors include file path and line number. +- File-opening and CSV parsing errors are not handled here. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..13595a59 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/package.ai.md @@ -0,0 +1,54 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:54:17Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> Supports AI-assisted source summarization, byte and operations utilities, and database workflows for lending, order fulfillment, and warehouse inventory. + +#### Purpose +- Configure AI generation for source summaries, including file selection, provider choice, and oversized-input handling. +- Provide standalone byte-processing and reporting tools alongside SQL-backed library, shop, and warehouse operations. + +#### Responsibilities +- **AI generation (`java/`):** Configure source and model settings, evaluate file conditions, extract source facts, route requests to mock, llama.cpp JNI, or OpenAI-compatible providers, and clean generated completions. +- **Byte processing (`other/`):** Count byte frequencies with OpenCL histogram kernels and provide fixed-capacity circular buffering through `ringbuf_t`. +- **Command-line operations (`other/`):** Create and prune compressed backups; parse currency-filtered order CSVs and report monthly regional revenue. +- **Database workflows (`sql/`):** Manage library catalog and lending, shop order lines and stock reservation, and supplier-driven warehouse stock synchronization, with supporting audits and reports. + +#### Key units +- `SrcMorphConfiguration` / `AiGenerationConfig` — hold source-selection, provider-routing, model, and generation settings. +- `AiConditionEvaluator` / `AiFactExtractor` / `AiOversizeStrategy` — evaluate file eligibility, count configured source facts, and represent oversized-input handling. +- `AiGenerationProviderFactory` / `AiGenerationProvider` — select and define completion-generation providers; `AiCompletionParser` cleans generated text. +- `histogram_partial` / `histogram_reduce` / `BINS` — compute and combine 256-bin byte histograms. +- `ringbuf_t` / `ringbuf_init` / `ringbuf_write` / `ringbuf_read` — represent and operate a bounded circular byte buffer. +- `rotate_backups.sh` — create timestamped compressed archives and apply retention pruning. +- `Order` / `parse_orders` / `revenue_by_month_and_region` — model, filter, aggregate, and report sales data. +- `fn_checkout_book` / `sp_return_book` / `fn_late_fee` — implement library checkout, return, and late-fee operations. +- `loan_audit` / `trg_loan_audit` / `overdue_loans` / `member_loan_stats` / `popular_books` — record lending events and provide loan-related reports. +- `add_order_item` — place or increment order lines while reserving product stock and recalculating order totals. +- `dbo.usp_SyncStock` — merge aggregated supplier quantities into warehouse stock and record synchronization outcomes. + +#### Data flow +- AI settings and file context determine eligible source inputs; fact extraction and oversize strategy support requests routed through the provider factory to completion text and optional timing data. +- Histogram inputs are counted into work-group partials and reduced to final bins; ring-buffer writes and reads transfer available bytes while updating circular indices. +- Backup settings drive archive creation followed by retention pruning; sales CSV rows become currency-matched orders, then monthly regional totals and threshold-filtered output. +- Library records feed checkout and return routines, audit events, and reports; shop item placement updates order lines, inventory, and totals; warehouse feed rows are filtered and aggregated before stock merging and sync logging. + +#### Dependencies +- AI generation uses internal condition, request, prompt, fact, and provider-support types; external integrations include llama.cpp JNI and Jackson. +- OpenCL kernels use work-item, work-group, barrier, and atomic built-ins; ring-buffer code uses `ringbuf.h` and C allocation and memory-copy facilities. +- Backup rotation uses Bash utilities including `tar`, `date`, `mv`, and `rm`; sales reporting uses Python standard-library CSV, date, decimal, and aggregation facilities. +- Library routines and reports depend on catalog, member, branch, copy, and loan tables; shop logic uses `product`, `customer_order`, and `order_item`; warehouse synchronization uses `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. + +#### Cross-cutting +- AI configuration uses mutable beans and defaults; providers are `AutoCloseable`, and llama.cpp model initialization is lazy and unsynchronized. +- Ring buffers use power-of-two capacity, masked wraparound, and a reserved slot; volatile indices are intended for single-producer/single-consumer use. +- SQL integrity relies on relational constraints and indexes; transactions, audit records, and domain-specific error handling protect operational workflows. +- Monetary values are stored in cents in the SQL domains, and warehouse synchronization uses UTC timestamps. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..568b82fa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: DF7E2B61 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:54:27Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +Source summarization is configured in `java/config` and routed through `java` and `java/provider` to mock, local llama.cpp, or OpenAI-compatible backends, with exact source facts and oversized-file handling. Byte-processing utilities include image and stream frequency analysis, buffering, and ring buffers, while command-line tools handle backup retention and sales reporting. The SQL workflows cover library lending, shop orders and inventory, and warehouse stock synchronization. + +#### Packages +- java/config — Configures source-file selection, AI generation and model routing, exact source facts, and oversized-file handling for generated `.ai.md` summaries. +- java — Configures source-summary generation and routes requests to mock, local llama.cpp, or OpenAI-compatible AI providers. +- java/provider — Converts source-generation requests into cleaned AI completions through selectable mock, local llama.cpp, or OpenAI-compatible backends. +- other/kernels — Computes byte-value frequency distributions for image data or arbitrary byte streams. +- other — Provides low-level byte processing and buffering utilities alongside command-line tools for backup retention and sales reporting. +- other/ringbuf — Provides bounded circular byte-stream buffering for passing data between a producer and a consumer. +- other/scripts — Provides command-line utilities for rotating compressed directory backups and reporting monthly sales revenue by region and currency. +- . — Supports AI-assisted source summarization, byte and operations utilities, and database workflows for lending, order fulfillment, and warehouse inventory. +- sql/library — Manages a lending library’s catalog, members, branch-specific copies, checkout and return workflows, overdue reporting, and loan history. +- sql — Defines database schemas and transactional workflows for library lending, shop order fulfillment, and warehouse stock synchronization. +- sql/shop — Manages a web shop’s product inventory, customer orders, and order-line pricing, including stock reservation and order-total updates. +- sql/warehouse — Applies recent supplier-feed quantities to warehouse stock by SKU and records synchronization results or errors. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..5902bcc9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/01_schema.sql.ai.md @@ -0,0 +1,62 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:51:47Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models authors, catalog books and copies, library members, and book loans with due-date and return tracking. + +#### Purpose +- Defines the core lending-library schema for books, authors, members, and loans. +- Enforces copy-count, loan-date, uniqueness, and referential-integrity constraints. + +#### Type +- PostgreSQL tables: `author`, `book`, `member`, `loan` +- No extensions or custom types declared. + +#### Schema +- `author` + - `author_id BIGSERIAL` — primary key + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT` — `CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` +- `book` + - `book_id BIGSERIAL` — primary key + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL` — foreign key to `author.author_id` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1` — `CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1` — `CHECK (copies_free >= 0)` + - `book_free_le_total CHECK (copies_free <= copies_total)` +- `member` + - `member_id BIGSERIAL` — primary key + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` +- `loan` + - `loan_id BIGSERIAL` — primary key + - `book_id BIGINT NOT NULL` — foreign key to `book.book_id` + - `member_id BIGINT NOT NULL` — foreign key to `member.member_id`, `ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `loan_due_after_loan CHECK (due_on > loaned_on)` +- Indexes: + - `idx_book_author` on `book (author_id)`, default method + - `idx_loan_member` on `loan (member_id)`, default method + - `idx_loan_open` on `loan (due_on)`, default method; partial predicate `returned_on IS NULL` + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (`ON DELETE CASCADE`) + +#### Dependencies +- `book` references `author`. +- `loan` references `book` and `member`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..f21d6375 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/02_views.sql.ai.md @@ -0,0 +1,41 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:51:53Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Provides overdue-loan, member borrowing-statistics, and recently popular-book reports for a lending library. + +#### Purpose +- `overdue_loans` reports unreturned loans past their due date and days overdue. +- `member_loan_stats` aggregates borrowing activity per member; `popular_books` ranks books loaned at least five times in the past 365 days. + +#### Type +- PostgreSQL views: `overdue_loans`, `member_loan_stats`; materialized view: `popular_books`. +- Index: `idx_popular_books_id`. + +#### Schema +- `overdue_loans`: `loan_id` (from `loan.loan_id`), `member_id` (from `member.member_id`), `email` (from `member.email`), `title` (from `book.title`), `due_on` (from `loan.due_on`), `days_overdue` (date subtraction: `CURRENT_DATE - due_on`). +- `member_loan_stats`: `member_id` (from `member.member_id`), `full_name` (from `member.full_name`), `loans_total` (`COUNT`, bigint), `loans_open` (filtered `COUNT`, bigint), `last_loan_on` (`MAX` of `loan.loaned_on`). +- `popular_books`: `book_id` (from `book.book_id`), `title` (from `book.title`), `author_name` (from `author.full_name`), `times_loaned` (`COUNT`, bigint). +- Index `idx_popular_books_id`: unique B-tree on `popular_books (book_id)`. + +#### Reads +- `overdue_loans`: `loan.loan_id`, `loan.member_id`, `loan.book_id`, `loan.due_on`, `loan.returned_on`; `member.member_id`, `member.email`; `book.book_id`, `book.title`. +- `member_loan_stats`: `member.member_id`, `member.full_name`; `loan.loan_id`, `loan.member_id`, `loan.returned_on`, `loan.loaned_on`. +- `popular_books`: `loan.book_id`, `loan.loaned_on`; `book.book_id`, `book.title`, `book.author_id`; `author.author_id`, `author.full_name`. + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` +- `member_loan_stats`: `member.member_id -> loan.member_id` (left join) +- `popular_books`: `book.book_id -> loan.book_id`; `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. +- View index: `idx_popular_books_id` on `popular_books`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..75cb0a46 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/03_routines.sql.ai.md @@ -0,0 +1,59 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:52:00Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Implements library book checkout and return workflows, calculates capped overdue fees, and records loan checkout and return events. + +#### Purpose +- Enforces member and copy availability during checkout; updates loan and copy status on return. +- Audits loan events and computes late fees in cents. + +#### Type +- PostgreSQL / PL/pgSQL; creates table `loan_audit`, function `fn_checkout_book`, procedure `sp_return_book`, function `fn_late_fee`, trigger function `trg_loan_audit_fn`, and trigger `trg_loan_audit`. + +#### Schema +- `loan_audit` + - `audit_id BIGSERIAL` — primary key; `NOT NULL` (declared `PRIMARY KEY`) + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL` — CHECK `action IN ('CHECKOUT', 'RETURN')` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` +- Index: `loan_audit_pkey` — `loan_audit(audit_id)`, primary-key index (name generated by PostgreSQL). + +#### Reads +- `fn_checkout_book`: `member.member_id`, `member.is_blocked`; `book.book_id`, `book.copies_free`. +- `sp_return_book`: `loan.loan_id`, `loan.returned_on`, `loan.book_id`. +- `fn_late_fee`: parameters `p_due_on`, `p_returned_on`; reads `CURRENT_DATE`. +- `trg_loan_audit_fn`: trigger row fields `NEW.loan_id`, `NEW.returned_on`, `OLD.returned_on`; reads `TG_OP`. + +#### Writes +- `fn_checkout_book`: updates `book.copies_free`; inserts one row into `loan(book_id, member_id, due_on)` per successful call. +- `sp_return_book`: updates `loan.returned_on`; updates `book.copies_free`. +- `trg_loan_audit_fn`: inserts into `loan_audit(loan_id, action)` when invoked for checkout or a newly returned loan; at most one row per trigger invocation. +- `trg_loan_audit`: fires after `INSERT` or `UPDATE OF returned_on` on `loan`. + +#### Relationships +- `loan_audit.loan_id -> loan.loan_id` — audit records refer to loans; no foreign key is declared. +- `loan.book_id -> book.book_id` — used to restore copy availability; no foreign key is declared. +- `loan.member_id -> member.member_id` — checkout records the member; no foreign key is declared. + +#### Routine logic +- `fn_checkout_book(p_member_id BIGINT, p_book_id BIGINT, p_days INTEGER DEFAULT 21) RETURNS BIGINT` + - Raises an exception if the member is blocked or no free copy is available. + - Decrements `book.copies_free`, inserts a loan due on `CURRENT_DATE + p_days`, returns the new `loan_id`. +- `sp_return_book(p_loan_id BIGINT)` + - Sets `loan.returned_on` to `CURRENT_DATE` only for an unreturned loan; raises an exception if unknown or already returned. + - Increments the associated book’s `copies_free`. +- `fn_late_fee(p_due_on DATE, p_returned_on DATE) RETURNS INTEGER` + - Immutable SQL function; calculates overdue days using `p_returned_on` or `CURRENT_DATE`, floors at zero, charges 50 cents per day, caps at 2000 cents. +- `trg_loan_audit_fn() RETURNS TRIGGER` + - Inserts `CHECKOUT` audit on loan insertion; inserts `RETURN` audit when `returned_on` changes from NULL to non-NULL; returns `NEW`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Built-ins: `now()`, `CURRENT_DATE`, `COALESCE`, `GREATEST`, `LEAST`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..7c6fde5b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,56 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:52:10Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds branch-aware copy inventory to a lending library, assigns existing copies to the main branch, links loans and members to copies and branches, and removes per-book copy counters. + +#### Purpose +- Migrate library inventory from book-level copy counts to individual, branch-specific copy records. +- Add member home-branch and loan copy references; rename the member join-date column. + +#### Type +- PostgreSQL migration script; transaction (`BEGIN` / `COMMIT`). +- Creates tables `branch` and `book_copy`. + +#### Schema +- `branch` + - `branch_id SMALLSERIAL` — primary key (`branch_pkey`, declared inline). + - `name VARCHAR(100) NOT NULL UNIQUE` — unique constraint (`branch_name_key`, declared inline). + - `city VARCHAR(100) NOT NULL`. +- `book_copy` + - `copy_id BIGSERIAL` — primary key (`book_copy_pkey`, declared inline). + - `book_id BIGINT NOT NULL` — FK to `book(book_id)` (`book_copy_book_id_fkey`, declared inline). + - `branch_id SMALLINT NOT NULL` — FK to `branch(branch_id)` (`book_copy_branch_id_fkey`, declared inline). + - `barcode VARCHAR(32) NOT NULL UNIQUE` — unique constraint (`book_copy_barcode_key`, declared inline). + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE', 'ON_LOAN', 'LOST'))` — check constraint (`book_copy_status_check`, declared inline). +- `loan`: adds `copy_id BIGINT`, FK to `book_copy(copy_id)` (`loan_copy_id_fkey`, declared inline in `ALTER TABLE`). +- `member`: renames `joined_on` to `member_since`; adds `home_branch_id SMALLINT`, FK to `branch(branch_id)` (`member_home_branch_id_fkey`, declared inline in `ALTER TABLE`). +- `book`: drops constraint `book_free_le_total`; drops columns `copies_free`, `copies_total`. +- Index: `idx_book_copy_book` on `book_copy(book_id)`, default PostgreSQL index method and operator class. + +#### Reads +- `book`: `book_id`, `isbn`, `copies_total`, `copies_free` (copy-generation query). +- `member`: `home_branch_id` (NULL filter in update). + +#### Writes +- `branch`: inserts 1 row — `Main`, `Springfield`. +- `book_copy`: inserts one row per generated copy; total equals the sum of `book.copies_total` across selected books. Branch is set to `1`; barcode is derived from `isbn` and series number; status is derived from `copies_free`. +- `loan`: adds `copy_id`. +- `member`: renames `joined_on` to `member_since`; adds `home_branch_id`; updates NULL `home_branch_id` values to `1`. +- `book`: drops `book_free_le_total`, `copies_free`, and `copies_total`. + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- Tables: `book`, `loan`, `member`. +- Function: `generate_series`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..20bc4857 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,32 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:52:18Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Seeds a lending-library catalog with authors, books, members, and loan-history records. + +#### Purpose +- Populate lending-library data for catalog, membership, and borrowing scenarios. +- Execute all seed inserts within one transaction. + +#### Type +- PostgreSQL DML seed script. + +#### Writes +- `author`: 15 rows; IDs 1–15. +- `book`: 110 rows; IDs 1–110. +- `member`: 50 rows; IDs 1–50. +- `loan`: 150 rows; IDs 1–150. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- Target tables: `author`, `book`, `member`, `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/package.ai.md new file mode 100644 index 00000000..6ae9db24 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/library/package.ai.md @@ -0,0 +1,55 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:53:53Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> Manages a lending library’s catalog, members, branch-specific copies, checkout and return workflows, overdue reporting, and loan history. + +#### Purpose +- Define and evolve PostgreSQL data structures for authors, books, members, loans, branches, and individual book copies. +- Support lending operations, audit records, fee calculation, reporting, and representative seed data. + +#### Responsibilities +- **Catalog and lending schema:** `author`, `book`, `member`, and `loan` tables with identifiers, relationships, validation constraints, and indexes. +- **Inventory migration:** Add `branch` and `book_copy`, generate branch-assigned copies from legacy book-level counters, connect loans and members to copies and branches, and remove the counters. +- **Checkout, return, and auditing:** Validate checkout eligibility and availability, record loans and returns, restore availability, and audit checkout and return events. +- **Fees and reporting:** Calculate capped late fees; expose overdue loans, member borrowing statistics, and recently popular books. +- **Seed data:** Populate authors, books, members, and loan-history records in a transaction. + +#### Key units +- `author`, `book`, `member`, `loan` — core catalog, membership, inventory-count, and borrowing records. +- `branch`, `book_copy` — branch locations and individually identified copies with availability status. +- `fn_checkout_book` — checks member and copy availability, creates a loan, and returns its ID. +- `sp_return_book` — marks an open loan returned and restores book availability. +- `fn_late_fee` — calculates overdue charges in cents, with a maximum of 2,000. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — record checkout and newly completed return events. +- `overdue_loans` — reports unreturned loans past their due dates and days overdue. +- `member_loan_stats` — aggregates total and open loans and the latest loan date per member. +- `popular_books` — materialized report of books loaned at least five times in the past 365 days. +- `idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_popular_books_id`, `idx_book_copy_book` — indexes supporting relationships and report or inventory lookups. + +#### Data flow +- The schema establishes authors, books, members, and loans; seed inserts populate these entities and their borrowing history. +- Checkout validates a member and available book copy, decrements the legacy `book.copies_free` counter, and inserts a loan; the loan trigger records checkout. +- Return marks an open loan returned, increments the associated book’s free-copy count, and triggers a return audit entry. +- The migration creates a main branch and individual `book_copy` records from legacy book counters, assigns members to that branch, and adds loan-to-copy references. +- Views derive overdue, member-activity, and popular-book reports from loan, member, book, and author records; the fee function derives charges from due and return dates. + +#### Dependencies +- Views and routines depend on the `author`, `book`, `member`, and `loan` tables; the migration also alters these tables and adds branch and copy relationships. +- `loan_audit` records refer to `loan` IDs without a declared foreign key; routine logic also uses `CURRENT_DATE`, `now()`, and standard SQL functions. +- The migration uses `generate_series` to generate book-copy records; the seed script targets the core catalog and lending tables. + +#### Cross-cutting +- PostgreSQL constraints enforce identifiers, uniqueness, valid copy counts and statuses, valid loan dates, and declared foreign-key relationships. +- The migration and seed script use transactions. +- Loan auditing is trigger-based; checkout and return routines raise exceptions for blocked members, unavailable copies, unknown loans, or already-returned loans. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/package.ai.md new file mode 100644 index 00000000..bef41497 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/package.ai.md @@ -0,0 +1,46 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:54:11Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> Defines database schemas and transactional workflows for library lending, shop order fulfillment, and warehouse stock synchronization. + +#### Purpose +- Model operational data and implement SQL routines for catalog and lending, product orders and inventory, and supplier-driven warehouse stock updates. +- Provide supporting reports, audit records, and synchronization outcomes across these domains. + +#### Responsibilities +- **Library lending:** Maintain authors, books, members, branches, copies, and loans; support checkout, return, late-fee calculation, audit, and borrowing reports. +- **Shop orders:** Store products, customers’ orders, and priced order lines; add order items while reserving stock and recalculating totals. +- **Warehouse synchronization:** Aggregate recent supplier-feed quantities by warehouse and SKU, merge them into stock levels, and log run results or errors. + +#### Key units +- `author`, `book`, `member`, `loan`, `branch`, `book_copy` — library catalog, membership, branch inventory, and borrowing records. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee` — library checkout, return, and capped late-fee operations. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — record checkout and completed-return events. +- `overdue_loans`, `member_loan_stats`, `popular_books` — library overdue, member activity, and popular-title reports. +- `product`, `customer_order`, `order_item`, `add_order_item` — shop catalog, order records, line items, and stock-reserving item placement. +- `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog`, `dbo.usp_SyncStock` — supplier quantities, warehouse stock, synchronization logs, and the stock-sync procedure. + +#### Data flow +- Library catalog and lending records feed checkout and return routines, trigger-based audit entries, and reports derived from loan history. +- Shop item placement looks up and locks a SKU, inserts or increments its order line, deducts stock, and recalculates the order total. +- Warehouse synchronization filters supplier feeds by cutoff time, aggregates quantities by warehouse and SKU, merges stock changes, and logs success or failure. + +#### Dependencies +- Library routines and reports depend on `author`, `book`, `member`, and `loan`; migrations add `branch` and `book_copy` relationships. +- Shop `add_order_item` reads and updates `product`, `order_item`, and `customer_order`; order lines reference orders and products. +- `dbo.usp_SyncStock` uses SQL Server tables `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. + +#### Cross-cutting +- Relational constraints, foreign keys, and indexes support integrity and lookups; shop line items and warehouse stock use composite keys. +- Transactions protect library migration and seed operations, and warehouse stock merging and success logging. +- Error handling is domain-specific: library routines raise exceptions for invalid operations, shop item placement signals insufficient stock or unknown SKU, and warehouse sync rolls back, logs errors, and rethrows. +- Monetary amounts are stored in cents; warehouse synchronization uses UTC run timestamps. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..57bf21c5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,65 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:52:23Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Models web-shop products, customer orders, and line items, with order placement reserving inventory and recalculating totals. + +#### Purpose +- Stores product catalog and stock, customer orders, and priced order lines. +- `add_order_item` adds or increments an order line, reserves product stock, and updates the order total. + +#### Type +- MySQL 8 tables: `product`, `customer_order`, `order_item`; procedure: `add_order_item`. +- `customer_order.status` enum: `NEW`, `PAID`, `SHIPPED`, `CANCELLED`. + +#### Schema +- `product` + - `product_id INT UNSIGNED` — NOT NULL, AUTO_INCREMENT, PK. + - `sku VARCHAR(40)` — NOT NULL, UNIQUE KEY `uk_product_sku`. + - `name VARCHAR(200)` — NOT NULL. + - `price_cents INT UNSIGNED` — NOT NULL. + - `stock INT` — NOT NULL, DEFAULT `0`. +- `customer_order` + - `order_id BIGINT UNSIGNED` — NOT NULL, AUTO_INCREMENT, PK. + - `customer_id BIGINT UNSIGNED` — NOT NULL. + - `status ENUM('NEW', 'PAID', 'SHIPPED', 'CANCELLED')` — NOT NULL, DEFAULT `'NEW'`. + - `created_at DATETIME` — NOT NULL, DEFAULT `CURRENT_TIMESTAMP`. + - `total_cents INT UNSIGNED` — NOT NULL, DEFAULT `0`. + - Index `idx_order_customer`: `(customer_id, created_at)`; method not specified. +- `order_item` + - `order_id BIGINT UNSIGNED` — NOT NULL, PK component, FK `fk_item_order` → `customer_order.order_id`, ON DELETE CASCADE. + - `product_id INT UNSIGNED` — NOT NULL, PK component, FK `fk_item_product` → `product.product_id`. + - `quantity SMALLINT UNSIGNED` — NOT NULL. + - `unit_price_cents INT UNSIGNED` — NOT NULL. + - Composite PK: `(order_id, product_id)`. + +#### Reads +- `product`: `product_id`, `price_cents`, `sku`, `stock`; selects matching SKU with sufficient stock and locks the row. +- `order_item`: `quantity`, `unit_price_cents`, `order_id`; aggregates line totals for the specified order. +- `customer_order`: `order_id` used to select the row to update. + +#### Writes +- `order_item`: inserts `order_id`, `product_id`, `quantity`, `unit_price_cents`; on duplicate key, increments `quantity` by `p_qty`. +- `product`: updates `stock` by subtracting `p_qty` for the selected product. +- `customer_order`: updates `total_cents` to the sum of `quantity * unit_price_cents` for the specified order. + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (`fk_item_order`, ON DELETE CASCADE). +- `order_item.product_id -> product.product_id` (`fk_item_product`). +- `add_order_item` selects `product.product_id` by `product.sku`, then uses it for the order-item write and stock update. + +#### Routine logic +- `add_order_item(IN p_order_id BIGINT UNSIGNED, IN p_sku VARCHAR(40), IN p_qty SMALLINT UNSIGNED)` + - Locks a matching product row if its stock is at least `p_qty`; captures its ID and price. + - Signals SQLSTATE `45000` with message `unknown SKU or not enough stock` if no product is selected. + - Inserts an order line or increments its existing quantity. + - Decrements product stock and recalculates the order total. + +#### Dependencies +- Tables: `product`, `order_item`, `customer_order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/shop/package.ai.md new file mode 100644 index 00000000..4ffcc5d3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/shop/package.ai.md @@ -0,0 +1,40 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:54:02Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Manages a web shop’s product inventory, customer orders, and order-line pricing, including stock reservation and order-total updates. + +#### Purpose +- Stores product catalog and inventory, customer orders, and their priced line items. +- Adds or increments order lines while reserving stock and recalculating the order total. + +#### Responsibilities +- **Catalog and inventory:** `product` stores SKU, name, price, and available stock. +- **Orders and line items:** `customer_order` tracks customer, status, creation time, and total; `order_item` records product quantities and unit prices. +- **Order-item placement:** `add_order_item` validates SKU and stock, updates the line, deducts inventory, and refreshes the total. + +#### Key units +- `product` — product catalog and stock table, with a unique SKU. +- `customer_order` — customer order record with `NEW`, `PAID`, `SHIPPED`, or `CANCELLED` status. +- `order_item` — order-product lines keyed by `(order_id, product_id)`. +- `add_order_item` — MySQL procedure that adds or increments an order line and applies inventory and total changes. + +#### Data flow +- `add_order_item` looks up a product by SKU, requiring sufficient stock and locking the matching row. +- If no eligible product is found, it signals SQLSTATE `45000` with `unknown SKU or not enough stock`. +- It inserts the order line or increments its quantity, deducts the requested quantity from product stock, then recalculates `customer_order.total_cents` from the order’s line items. + +#### Dependencies +- `order_item.order_id` references `customer_order.order_id` with `ON DELETE CASCADE`. +- `order_item.product_id` references `product.product_id`. +- `add_order_item` reads and updates `product`, `order_item`, and `customer_order`. + +#### Cross-cutting +- `order_item` uses a composite primary key on `(order_id, product_id)`; duplicate-key handling increments the existing quantity. +- Order totals are computed as the sum of `quantity * unit_price_cents`; monetary values are stored in cents. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/warehouse/package.ai.md new file mode 100644 index 00000000..6f871ade --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/warehouse/package.ai.md @@ -0,0 +1,39 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:54:06Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Applies recent supplier-feed quantities to warehouse stock by SKU and records synchronization results or errors. + +#### Purpose +- Consolidate supplier feed rows from a cutoff time into stock updates or new warehouse/SKU stock records. +- Track successful merge counts and failed runs in a synchronization log. + +#### Responsibilities +- Aggregate qualifying `dbo.SupplierFeed` quantities by `WarehouseId` and `Sku`. +- Merge aggregates into `dbo.StockLevel`, updating existing quantities and timestamps or inserting new rows. +- Record run start time, insert/update counts, and any error message in `dbo.SyncLog`. + +#### Key units +- `dbo.usp_SyncStock(@Since DATETIME2(0))` — performs the transactional stock synchronization and records its outcome. +- `dbo.StockLevel` — stores on-hand quantity per warehouse and SKU. +- `dbo.SupplierFeed` — provides timestamped warehouse/SKU quantities. +- `dbo.SyncLog` — stores synchronization counts or error details. + +#### Data flow +- Filter `dbo.SupplierFeed` on `ReceivedAt >= @Since` and aggregate `Quantity` by `WarehouseId` and `Sku`. +- `MERGE` aggregates into `dbo.StockLevel`; capture insert/update actions in `@Changes`. +- Count actions and write a success row to `dbo.SyncLog`; on error, roll back if needed, log the error, and rethrow. + +#### Dependencies +- SQL Server tables `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. +- `SYSUTCDATETIME()` for the run start time and `ERROR_MESSAGE()` for error logging. + +#### Cross-cutting +- The stock merge and success logging run in a transaction; errors trigger rollback when needed, error logging, and rethrow. +- `dbo.StockLevel` uses `(WarehouseId, Sku)` as its composite primary key; quantity and update-time columns have defaults. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..8c01af62 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,64 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:52:31Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Synchronizes warehouse stock quantities from recent supplier feed rows and records the run outcome. + +#### Purpose +- Aggregate supplier quantities since a cutoff by warehouse and SKU. +- Add quantities to existing stock or create stock records; log merge counts or errors. + +#### Type +- SQL Server (T-SQL): tables `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`; procedure `dbo.usp_SyncStock`. + +#### Schema +- `dbo.StockLevel` + - `WarehouseId INT NOT NULL` — composite primary key `PK_StockLevel`. + - `Sku NVARCHAR(40) NOT NULL` — composite primary key `PK_StockLevel`. + - `OnHand INT NOT NULL DEFAULT (0)` — default constraint `DF_StockLevel_OnHand`. + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())` — default constraint `DF_StockLevel_UpdatedAt`. +- `dbo.SupplierFeed` + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL` — primary key `PK_SupplierFeed`. + - `WarehouseId INT NOT NULL`. + - `Sku NVARCHAR(40) NOT NULL`. + - `Quantity INT NOT NULL`. + - `ReceivedAt DATETIME2(0) NOT NULL`. +- `dbo.SyncLog` + - `SyncLogId INT IDENTITY(1,1) NOT NULL` — primary key `PK_SyncLog`. + - `StartedAt DATETIME2(0) NOT NULL`. + - `RowsInserted INT NOT NULL`. + - `RowsUpdated INT NOT NULL`. + - `ErrorMessage NVARCHAR(4000) NULL`. + +#### Reads +- `dbo.SupplierFeed`: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`. +- `dbo.StockLevel`: `WarehouseId`, `Sku`, `OnHand` (MERGE match and update). +- `@Changes`: `MergeAction` (aggregate merge outcomes). + +#### Writes +- `dbo.StockLevel`: MERGE inserts unmatched warehouse/SKU pairs (`WarehouseId`, `Sku`, `OnHand`) or updates matched rows (`OnHand`, `UpdatedAt`); row counts depend on qualifying feed groups and matches. +- `dbo.SyncLog`: one row per successful execution with `StartedAt`, `RowsInserted`, `RowsUpdated`; on error, one row with `StartedAt`, zero counts, and `ErrorMessage`. + +#### Relationships +- `dbo.StockLevel.WarehouseId -> dbo.SupplierFeed.WarehouseId` — MERGE match. +- `dbo.StockLevel.Sku -> dbo.SupplierFeed.Sku` — MERGE match. + +#### Routine logic +- `dbo.usp_SyncStock(@Since DATETIME2(0))` + - Captures UTC start time; aggregates feed quantities by `WarehouseId`, `Sku` where `ReceivedAt >= @Since`. + - In a transaction, adds aggregated quantities to matching stock or inserts new stock rows; captures INSERT/UPDATE actions. + - Writes action counts to `dbo.SyncLog` and commits. + - On error, rolls back if needed, logs `ERROR_MESSAGE()`, then rethrows. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` +- `SYSUTCDATETIME()` +- `ERROR_MESSAGE()` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..fdd272f4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,62 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:54:30Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Evaluates and validates file‑selection conditions against file metadata. + +#### Purpose +- Provides matching logic for `AiCondition` trees. +- Validates condition trees for correctness. +- Determines if line counting is required. + +#### Type +- `final class AiConditionEvaluator` + - extends `Object` + - no annotations + +#### Input +- `AiCondition condition` (root of condition tree) +- `AiFileContext context` (file facts) +- `List extensions` (file extensions) +- `AiRangeCondition size/lines` (size or line bounds) +- `String modifiedAfter/modifiedBefore` (ISO‑8601 timestamps) +- `String pathGlob` (glob pattern) + +#### Output +- `boolean` from `matches`, `usesLines` +- `void` from `validate` (throws `IllegalArgumentException` on error) +- `long` from `parseEpochMilli` (epoch milliseconds) + +#### Core logic +- `matches`: recursively evaluates `and`, `or`, `not`, and leaf conditions; throws if node invalid. +- `validate`: ensures exactly one branch/leaf per node; checks non‑empty lists, bounds, and parsable dates. +- `usesLines`: traverses tree to detect any `lines` condition. +- `validateGroup`: ensures group has at least one child and validates each child. +- `branchCount`: counts non‑null branch/leaf fields. +- `matchesExtension`: checks file name ends with any listed extension. +- `globMatches`: uses `AiSourceExcludeFilter` to test path glob. +- `parseEpochMilli`: parses ISO‑8601 instant to epoch milliseconds, throws on failure. + +#### Public API +- `matches(AiCondition, AiFileContext) -> boolean` – evaluate condition tree. +- `validate(AiCondition) -> void` – validate tree structure. +- `usesLines(AiCondition) -> boolean` – detect line‑count requirement. + +#### Dependencies +- `java.time.Instant`, `java.time.format.DateTimeParseException` +- `java.util.Collections`, `java.util.List` +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalStateException` in `matches` if node has no branch/leaf. +- `IllegalArgumentException` in `validate` for misconfigured nodes, empty lists, missing bounds, or unparsable dates. + +#### Concurrency +- Stateless; no shared mutable state. Thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..b601facb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,51 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:54:34Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> A container for child AI conditions used by the `` / `` combinators in the AI configuration. + +#### Purpose +- Holds a list of `AiCondition` objects for combinator bodies. +- Provides defensive copying when setting the list. + +#### Type +- `public class AiConditionGroup` + - Modifiers: public, final (implicit), no superclass. + - Fields: `private @Nullable List conditions`. + - Annotations: `@ToString`, `@SuppressWarnings({"NullAway.Init","initialization.fields.uninitialized"})`. + +#### Input +- Constructor: no parameters. +- `setConditions(Collection conditions)` receives a nullable collection of `AiCondition`. + +#### Output +- `getConditions()` returns the internal `List` or `null`. +- `setConditions` stores a defensive copy (`new ArrayList<>(conditions)`) or `null`. + +#### Core logic +- `setConditions`: + 1. If `conditions` is non‑null, create a new `ArrayList` from it. + 2. Assign the new list to the field; otherwise assign `null`. + +#### Public API +- `AiConditionGroup()` → constructs an empty group. +- `List getConditions()` → child conditions or null. +- `void setConditions(Collection conditions)` → set child conditions defensively. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List`. +- `lombok.ToString`. +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.config.AiCondition`. + +#### Exceptions / Errors +- No explicit exceptions thrown; defensive copy handles null safely. + +#### Concurrency +- No synchronization; the class is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..9fff8344 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,56 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:54:37Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Computes deterministic, language‑agnostic fact counts from source text using regex counters. + +#### Purpose +- Generates a facts block summarizing exact counts of language constructs. +- Validates fact counter configurations. + +#### Type +- `final class AiFactExtractor` – utility class, no instances. + +#### Input +- `factsBlock(List counters, String source)` – list of counters, source text. +- `validate(List counters)` – list of counters. +- `countMatches(String pattern, String source)` – regex pattern, source text. + +#### Output +- `factsBlock` returns a formatted facts string or empty string. +- `validate` throws `IllegalArgumentException` on invalid counters. +- `countMatches` returns integer match count. + +#### Core logic +- `factsBlock`: iterate counters, skip nulls or missing label/pattern, append `label: count` entries separated by `; `, prepend header, append suffix. +- `validate`: for each counter, ensure non‑null label/pattern, compile pattern, throw `IllegalArgumentException` on failure. +- `countMatches`: compile pattern, use `Matcher.find()` loop to count non‑overlapping matches. + +#### Public API +- `factsBlock(List counters, String source) -> String` – build facts block. +- `validate(List counters) -> void` – validate counters. +- `FACTS_HEADER: String` – header prefix. +- `LABEL_COUNT_SEPARATOR: String` – label‑count separator. +- `ENTRY_SEPARATOR: String` – entry separator. +- `FACTS_SUFFIX: String` – suffix after facts block. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiFactCounter` + +#### Exceptions / Errors +- `IllegalArgumentException` from `validate` for missing label/pattern or invalid regex. +- `PatternSyntaxException` caught and wrapped in `IllegalArgumentException`. + +#### Concurrency +- Stateless, thread‑safe; no shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..1aafbf9c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,186 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:54:40Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> A mutable JavaBean that holds all AI‑generation parameters for a single model run, used by the Maven plugin to configure the AI provider. + +#### Purpose +- Stores configuration for a single AI generation step (model path, sampling, retry, prompt trimming, stop strings, etc.). +- Exposes getters/setters for Maven plugin binding and provider code. + +#### Type +- `public class AiGenerationConfig` + - Modifiers: `public` + - Annotations: `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`, `@ToString` (Lombok) + - No supertype declared. + +#### Input +- Constructor: no arguments (defaults applied). +- Fields (mutable via setters): + - `modelPath` (`String?`) + - `contextSize` (`int`) + - `maxOutputTokens` (`int`) + - `temperature` (`float`) + - `threads` (`int`) + - `charsPerToken` (`int`) + - `maxInputChars` (`int`) + - `warnOnTrim` (`boolean`) + - `topP` (`float`) + - `topK` (`int`) + - `minP` (`float`) + - `topNSigma` (`float`) + - `repeatPenalty` (`float`) + - `chatTemplateEnableThinking` (`Boolean?`) + - `cachePrompt` (`boolean`) + - `swaFull` (`boolean`) + - `cacheReuse` (`int`) + - `gpuLayers` (`int`) + - `seed` (`int`) + - `cpuMoeLayers` (`int`) + - `cpuFfnLayers` (`int`) + - `kvUnifiedPerSlot` (`int`) + - `lazyMode` (`String`) + - `repeatLastN` (`int`) + - `cacheTypeK` (`String`) + - `cacheTypeV` (`String`) + - `flashAttn` (`boolean`) + - `batchSize` (`int`) + - `ubatchSize` (`int`) + - `threadsBatch` (`int`) + - `mainGpu` (`int`) + - `devices` (`String`) + - `provider` (`String`) + - `remoteModel` (`String`) + - `baseUrl` (`String`) + - `apiKeyEnv` (`String`) + - `reasoningEffort` (`String`) + - `reasoningBudgetTokens` (`int`) + - `dryMultiplier` (`float`) + - `dryBase` (`float`) + - `dryAllowedLength` (`int`) + - `dryPenaltyLastN` (`int`) + - `drySequenceBreakers` (`List`) + - `stopStrings` (`List`) + - `calibration` (`AiCalibration?`) + +#### Output +- Getter methods return current field values. +- Setter methods mutate fields; some normalize `null` to defaults. +- `getDrySequenceBreakers()` and `getStopStrings()` return unmodifiable lists. +- `toString()` (via Lombok) prints all fields for diagnostics. + +#### Core logic +- All fields initialized to static defaults. +- Setters perform simple assignments; some guard against `null` by resetting to default constants. +- No additional computation or side effects beyond field mutation. + +#### Public API +- `AiGenerationConfig()` -> void (default constructor) +- `getModelPath()` -> String? (model file path) +- `setModelPath(String?)` -> void +- `getContextSize()` -> int +- `setContextSize(int)` -> void +- `getMaxOutputTokens()` -> int +- `setMaxOutputTokens(int)` -> void +- `getTemperature()` -> float +- `setTemperature(float)` -> void +- `getThreads()` -> int +- `setThreads(int)` -> void +- `getCharsPerToken()` -> int +- `setCharsPerToken(int)` -> void +- `getMaxInputChars()` -> int +- `setMaxInputChars(int)` -> void +- `isWarnOnTrim()` -> boolean +- `setWarnOnTrim(boolean)` -> void +- `getTopP()` -> float +- `setTopP(float)` -> void +- `getTopK()` -> int +- `setTopK(int)` -> void +- `getRepeatPenalty()` -> float +- `setRepeatPenalty(float)` -> void +- `getMinP()` -> float +- `setMinP(float)` -> void +- `getTopNSigma()` -> float +- `setTopNSigma(float)` -> void +- `getChatTemplateEnableThinking()` -> Boolean? (nullable) +- `setChatTemplateEnableThinking(Boolean?)` -> void +- `isCachePrompt()` -> boolean +- `setCachePrompt(boolean)` -> void +- `isSwaFull()` -> boolean +- `setSwaFull(boolean)` -> void +- `getCacheReuse()` -> int +- `setCacheReuse(int)` -> void +- `getGpuLayers()` -> int +- `setGpuLayers(int)` -> void +- `getSeed()` -> int +- `setSeed(int)` -> void +- `getCpuMoeLayers()` -> int +- `setCpuMoeLayers(int)` -> void +- `getCpuFfnLayers()` -> int +- `setCpuFfnLayers(int)` -> void +- `getKvUnifiedPerSlot()` -> int +- `setKvUnifiedPerSlot(int)` -> void +- `getLazyMode()` -> String +- `setLazyMode(String?)` -> void +- `getRepeatLastN()` -> int +- `setRepeatLastN(int)` -> void +- `getCacheTypeK()` -> String +- `setCacheTypeK(String?)` -> void +- `getCacheTypeV()` -> String +- `setCacheTypeV(String?)` -> void +- `isFlashAttn()` -> boolean +- `setFlashAttn(boolean)` -> void +- `getBatchSize()` -> int +- `setBatchSize(int)` -> void +- `getUbatchSize()` -> int +- `setUbatchSize(int)` -> void +- `getThreadsBatch()` -> int +- `setThreadsBatch(int)` -> void +- `getMainGpu()` -> int +- `setMainGpu(int)` -> void +- `getDevices()` -> String +- `setDevices(String)` -> void +- `getProvider()` -> String +- `setProvider(String)` -> void +- `getRemoteModel()` -> String +- `setRemoteModel(String)` -> void +- `getBaseUrl()` -> String +- `setBaseUrl(String)` -> void +- `getApiKeyEnv()` -> String +- `setApiKeyEnv(String)` -> void +- `getReasoningEffort()` -> String +- `setReasoningEffort(String)` -> void +- `getReasoningBudgetTokens()` -> int +- `setReasoningBudgetTokens(int)` -> void +- `getDryMultiplier()` -> float +- `setDryMultiplier(float)` -> void +- `getDryBase()` -> float +- `setDryBase(float)` -> void +- `getDryAllowedLength()` -> int +- `setDryAllowedLength(int)` -> void +- `getDryPenaltyLastN()` -> int +- `setDryPenaltyLastN(int)` -> void +- `getDrySequenceBreakers()` -> List (unmodifiable) +- `setDrySequenceBreakers(List?)` -> void +- `getStopStrings()` -> List (unmodifiable) +- `setStopStrings(List?)` -> void +- `getCalibration()` -> AiCalibration? (nullable) +- `setCalibration(AiCalibration?)` -> void + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCalibration` (used as a field type) + +#### Exceptions / Errors +- No explicit exceptions thrown; setters accept `null` and replace with defaults. + +#### Concurrency +- No synchronization; intended for single‑threaded configuration usage. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..ed94f919 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,61 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:54:49Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Defines how to handle source files that exceed the context window of the routed model. + +#### Purpose +- Enumerates oversize handling strategies for source files. +- Provides default strategy and parsing from configuration. + +#### Type +- `public enum AiOversizeStrategy` + - Modifiers: `public` + - Supertypes: `java.lang.Enum` + - Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` + - Field: `public static final AiOversizeStrategy DEFAULT = FAIL` + - Field: `private final String configValue` + - Constructor: `AiOversizeStrategy(String configValue)` + - Methods: + - `public String configValue()` + - `public static AiOversizeStrategy fromConfig(@Nullable String value)` + +#### Input +- Constructor parameter: `String configValue` for each enum constant. +- `fromConfig` parameter: `@Nullable String value` (config token). + +#### Output +- `configValue()` returns the token string. +- `fromConfig` returns an `AiOversizeStrategy` or throws `IllegalArgumentException`. + +#### Core logic +- `fromConfig` + 1. If `value` is `null` → return `DEFAULT`. + 2. Trim `value`; if empty → return `DEFAULT`. + 3. Iterate over `values()`; compare `configValue` case‑insensitively. + 4. Return matching strategy. + 5. If none match → throw `IllegalArgumentException` with message listing valid tokens. + +#### Public API +- `FAIL(String)` – abort build (default). +- `SAMPLE(String)` – trim and summarize head. +- `MAP_REDUCE(String)` – chunk, summarize, combine. +- `DETERMINISTIC(String)` – emit deterministic metadata. +- `DEFAULT: AiOversizeStrategy` – default strategy. +- `configValue(): String` – get config token. +- `fromConfig(@Nullable String): AiOversizeStrategy` – parse config token. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `fromConfig` when token is unknown. + +#### Concurrency +- No mutable state; enum constants are thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..08aa8435 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,117 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:54:52Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Holds all configuration parameters for a srcmorph run, bindable from Maven, JSON/YAML, or code. + +#### Purpose +- Stores mutable configuration for AI‑powered source generation. +- Provides defaults and binding hooks for Maven plugin and future CLI. + +#### Type +- `public class SrcMorphConfiguration` + - Annotations: `@SuppressWarnings({"NullAway.Init","initialization.fields.uninitialized"})`, `@ToString` + - No superclass or interfaces. + - Fields (22): + - `private File baseDirectory;` + - `private File outputDirectory = new File(DEFAULT_OUTPUT_DIRECTORY);` + - `private boolean force;` + - `private @Nullable List subtrees;` + - `private @Nullable List excludes;` + - `private @Nullable List fileExtensions;` + - `private long minFileSizeBytes;` + - `private long maxFileSizeBytes;` + - `private boolean planOnly;` + - `private String generationProvider = DEFAULT_GENERATION_PROVIDER;` + - `private @Nullable List promptDefinitions;` + - `private @Nullable List aiDefinitions;` + - `private @Nullable File modelDirectory;` + - `private @Nullable List fieldGenerations;` + - `private @Nullable List factDefinitions;` + - `private @Nullable String llamaModelPath;` + - `private int llamaContextSize = DEFAULT_LLAMA_CONTEXT_SIZE;` + - `private int llamaMaxOutputTokens = DEFAULT_LLAMA_MAX_OUTPUT_TOKENS;` + - `private float llamaTemperature = DEFAULT_LLAMA_TEMPERATURE;` + - `private int llamaThreads = DEFAULT_LLAMA_THREADS;` + - `private String pluginVersion = "";` + - `private String aiVersion = DEFAULT_AI_VERSION;` + - `private @Nullable String projectName;` + +#### Input +- Constructor: no parameters. +- Setters accept: `File`, `boolean`, `List`, `long`, `String`, `List`, `List`, `File`, `List`, `List`, `int`, `float`. + +#### Output +- Getters return the corresponding field values. +- No state mutation beyond field assignments. +- `toString()` (via Lombok) outputs all fields. + +#### Core logic +- None; purely a JavaBean with default values and accessor methods. + +#### Public API +- `SrcMorphConfiguration()` → constructs with defaults +- `File getBaseDirectory()` → base dir +- `void setBaseDirectory(File)` → set base dir +- `File getOutputDirectory()` → output dir +- `void setOutputDirectory(File)` → set output dir +- `boolean isForce()` → force flag +- `void setForce(boolean)` → set force flag +- `List getSubtrees()` → subtrees +- `void setSubtrees(List)` → set subtrees +- `List getExcludes()` → excludes +- `void setExcludes(List)` → set excludes +- `List getFileExtensions()` → file extensions +- `void setFileExtensions(List)` → set file extensions +- `long getMinFileSizeBytes()` → min size +- `void setMinFileSizeBytes(long)` → set min size +- `long getMaxFileSizeBytes()` → max size +- `void setMaxFileSizeBytes(long)` → set max size +- `boolean isPlanOnly()` → plan‑only flag +- `void setPlanOnly(boolean)` → set plan‑only flag +- `String getGenerationProvider()` → provider name +- `void setGenerationProvider(String)` → set provider +- `List getPromptDefinitions()` → prompt defs +- `void setPromptDefinitions(List)` → set prompt defs +- `List getAiDefinitions()` → AI model defs +- `void setAiDefinitions(List)` → set AI model defs +- `File getModelDirectory()` → model dir +- `void setModelDirectory(File)` → set model dir +- `List getFieldGenerations()` → field generation rules +- `void setFieldGenerations(List)` → set field generation rules +- `List getFactDefinitions()` → fact groups +- `void setFactDefinitions(List)` → set fact groups +- `String getLlamaModelPath()` → llama model path +- `void setLlamaModelPath(String)` → set llama model path +- `int getLlamaContextSize()` → llama context size +- `void setLlamaContextSize(int)` → set llama context size +- `int getLlamaMaxOutputTokens()` → llama max tokens +- `void setLlamaMaxOutputTokens(int)` → set llama max tokens +- `float getLlamaTemperature()` → llama temperature +- `void setLlamaTemperature(float)` → set llama temperature +- `int getLlamaThreads()` → llama thread count +- `void setLlamaThreads(int)` → set llama thread count +- `String getPluginVersion()` → plugin version +- `void setPluginVersion(String)` → set plugin version +- `String getAiVersion()` → AI logic version +- `void setAiVersion(String)` → set AI logic version +- `String getProjectName()` → project title +- `void setProjectName(String)` → set project title + +#### Dependencies +- `java.io.File`, `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No explicit exceptions thrown or caught. + +#### Concurrency +- No synchronization or concurrent constructs; bean is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..f4bbf2ae --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,52 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:56:25Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> A configuration‑driven framework for AI‑powered source‑code generation, validation, and file‑selection logic used by the Maven srcmorph plugin. + +#### Purpose +- Centralizes AI generation parameters and file‑selection rules. +- Validates condition trees and fact counter configurations. +- Provides utilities for fact extraction and oversize handling. + +#### Responsibilities +- **Configuration Management** – `SrcMorphConfiguration` and `AiGenerationConfig` hold mutable settings for the plugin and AI provider. +- **Condition Evaluation** – `AiConditionEvaluator` validates and evaluates file‑selection trees (`AiCondition`/`AiConditionGroup`). +- **Fact Extraction** – `AiFactExtractor` builds deterministic fact blocks from source text. +- **Oversize Strategy** – `AiOversizeStrategy` defines how to handle files that exceed the model context window. + +#### Key units +- `SrcMorphConfiguration` – JavaBean for plugin‑level settings (directories, prompts, models, Llama options). +- `AiGenerationConfig` – mutable bean for a single AI generation step (model path, sampling, retry, stop strings, etc.). +- `AiConditionEvaluator` – stateless validator/evaluator for `AiCondition` trees. +- `AiConditionGroup` – container for child conditions in ``/`` combinators. +- `AiFactExtractor` – utility for counting regex matches and assembling fact blocks. +- `AiOversizeStrategy` – enum of strategies (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`) with parsing logic. + +#### Data flow +1. **Configuration**: `SrcMorphConfiguration` is populated via Maven/JSON/YAML. +2. **Prompt & Model Setup**: `AiPromptDefinition`/`AiModelDefinition` feed into `AiGenerationConfig`. +3. **File Selection**: `AiConditionEvaluator` receives a root `AiCondition` and `AiFileContext` to decide inclusion. +4. **Fact Generation**: `AiFactExtractor` processes source files to produce fact blocks for prompts. +5. **Oversize Handling**: `AiOversizeStrategy.fromConfig` selects a strategy for large files before generation. + +#### Dependencies +- **Internal**: `AiCondition`, `AiConditionGroup`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiSourceExcludeFilter`. +- **External**: `java.time.Instant`, `java.util.regex`, Lombok (`@ToString`), `org.jspecify.annotations.Nullable`. + +#### Cross‑cutting +- Defensive copying in `AiConditionGroup.setConditions`. +- Stateless, thread‑safe utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Validation throws `IllegalArgumentException` for misconfigurations. +- Lombok `@ToString` used for diagnostic output across beans. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..77cd34a0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,67 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:56:34Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A Maven plugin framework that orchestrates AI‑driven source‑code generation, validation, and file‑selection through configurable prompts, models, and pluggable inference backends. + +#### Purpose +- Centralize AI generation parameters and file‑selection logic for the srcmorph Maven plugin. +- Provide a unified, pluggable provider interface for local llama.cpp, mock, and OpenAI‑compatible backends. + +#### Responsibilities +- **Configuration Management** – `SrcMorphConfiguration` & `AiGenerationConfig` store plugin‑level and per‑step settings. +- **Condition Evaluation** – `AiConditionEvaluator` validates and evaluates file‑selection trees (`AiCondition`, `AiConditionGroup`). +- **Fact Extraction** – `AiFactExtractor` builds deterministic fact blocks from source text. +- **Oversize Handling** – `AiOversizeStrategy` selects how to process files exceeding the model context window. +- **Provider Abstraction** – `AiGenerationProvider` defines the generation contract; `AiGenerationProviderFactory` resolves the concrete implementation. +- **Local Inference** – `LlamaCppJniAiGenerationProvider` loads GGUF models, applies chat templates, and parses completions. +- **Remote Inference** – `OpenAiCompatibleProviderSupport` constructs HTTP requests, validates endpoints, secures API keys, and interprets responses. +- **Parsing Utilities** – `AiCompletionParser` removes internal thinking blocks from raw completions. + +#### Key units +- `SrcMorphConfiguration` – plugin‑level settings (directories, prompts, models, llama options). +- `AiGenerationConfig` – mutable bean for a single AI generation step (model path, sampling, retry, stop strings, etc.). +- `AiConditionEvaluator` – stateless validator/evaluator for `AiCondition` trees. +- `AiFactExtractor` – utility for counting regex matches and assembling fact blocks. +- `AiOversizeStrategy` – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`) with parsing logic. +- `AiGenerationProvider` – interface (`generate`, `generateWithTimings`, `close`). +- `AiGenerationProviderFactory` – resolves provider key and creates the appropriate provider. +- `LlamaCppJniAiGenerationProvider` – lazy model loading, chat completion, timing extraction. +- `OpenAiCompatibleProviderSupport` – HTTP request construction, endpoint validation, API key handling, timing calculation. +- `LlamaCppJniConfig.Builder` – fluent builder for 37 llama.cpp parameters. +- `AiCompletionParser` – strips Gemma‑4 thinking blocks from raw completions. + +#### Data flow +1. **Configuration** – `SrcMorphConfiguration` is populated via Maven/JSON/YAML. +2. **Prompt & Model Setup** – `AiPromptDefinition`/`AiModelDefinition` feed into `AiGenerationConfig`. +3. **File Selection** – `AiConditionEvaluator` receives a root `AiCondition` and `AiFileContext` to decide inclusion. +4. **Fact Generation** – `AiFactExtractor` processes source files to produce fact blocks for prompts. +5. **Oversize Handling** – `AiOversizeStrategy.fromConfig` selects a strategy for large files before generation. +6. **Provider Selection** – `AiGenerationProviderFactory` resolves the provider key (run or model config) and creates the appropriate provider instance. +7. **Generation** – + - *Local*: `LlamaCppJniAiGenerationProvider` builds inference parameters, calls `model.chatComplete`, parses JSON, extracts text, and optionally timing metrics. + - *Remote*: `OpenAiCompatibleProviderSupport` builds a JSON body, validates the endpoint, secures the API key, sends the HTTP request, parses the response, and extracts timing data. +8. **Post‑processing** – `AiCompletionParser` removes any internal thinking block from the raw completion before returning the final answer. + +#### Dependencies +- **Internal** – `AiCondition`, `AiConditionGroup`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiSourceExcludeFilter`, `AiPromptSupport`, `Java8CompatibilityHelper`, `ChatResponseParser`. +- **External** – `java.time.Instant`, `java.util.regex`, Lombok (`@ToString`), `org.jspecify.annotations.Nullable`, `net.ladenthin.llama` (model, parameters, JSON parsing), `com.fasterxml.jackson.databind` (JSON serialization). +- **Configuration** – `LlamaCppJniConfig` supplies all runtime knobs; `AiGenerationConfig.DEFAULT_*` values are used in the builder. + +#### Cross‑cutting +- Defensive copying in `AiConditionGroup.setConditions`. +- Stateless, thread‑safe utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Validation throws `IllegalArgumentException` for misconfigurations. +- Lombok `@ToString` used for diagnostic output across beans. +- Providers are stateless except for the lazy `LlamaModel`; no explicit synchronization, potential race on first `generate` call. +- Error handling: `IOException` for missing markers, HTTP errors, or JSON issues; `IllegalArgumentException` for unknown provider keys. +- Timing metrics captured in `AiGenerationTimings` (prompt/cache tokens, throughput, predicted token counts). +- `LlamaCppJniConfig` is immutable; builder is single‑threaded. +- API keys fetched from environment variables; insecure HTTP to non‑loopback hosts is rejected. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..5dd8af46 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,58 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:55:02Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Strips a Gemma‑4 model’s internal thinking block from a raw LLM completion, returning only the final answer. + +#### Purpose +- Removes leading Gemma‑4 thinking block from model output. +- Validates presence of closing marker; throws `IOException` if missing. +- Handles `null` input as empty string. + +#### Type +- `public class AiCompletionParser` + - Modifiers: public + - Annotations: `@ToString` + - Supertypes: none + - Fields: + - `public static final String THINKING_BLOCK_START_MARKER` – marker for block start. + - `public static final String THINKING_BLOCK_END_MARKER` – marker for block end. + - Methods: + - `public AiCompletionParser()` – no‑op constructor. + - `public String parseCompletion(final String response) throws IOException` – core parsing logic. + +#### Input +- `response: String` – raw completion text, may be `null`. + +#### Output +- `String` – cleaned answer text, never `null`. +- Throws `IOException` if a start marker is present but no end marker. + +#### Core logic +- If `response` is `null`, return empty string. +- Trim `response`. +- If trimmed text does **not** start with `THINKING_BLOCK_START_MARKER`, return trimmed text. +- Extract substring after start marker. +- Find first occurrence of `THINKING_BLOCK_END_MARKER`. +- If not found, throw `IOException` with detailed message. +- Return substring after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` – constructs parser. +- `String parseCompletion(final String response) throws IOException` – parses completion. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` when a start marker is present but the end marker is missing, indicating token budget exhaustion. + +#### Concurrency +- Stateless; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..6b760874 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,49 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:55:05Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Provides an interface for AI backends that generate text for a generation request and optionally report timing metrics. + +#### Purpose +- Declares contract for AI text generation providers. +- Supplies default timing wrapper for calibration. + +#### Type +- `public interface AiGenerationProvider extends AutoCloseable` + - Methods: `String generate(AiGenerationRequest) throws IOException`; `default AiGenerationTimings generateWithTimings(AiGenerationRequest) throws IOException`; `default void close() throws IOException`. + - Extends `AutoCloseable`. + +#### Input +- `AiGenerationRequest request` parameter in `generate` and `generateWithTimings`. +- `AiGenerationRequest` contains prompt key, source file, source text, current header. + +#### Output +- `String` from `generate`; never `null`, may be blank. +- `AiGenerationTimings` from `generateWithTimings`; default rates all zero. +- `close()` performs no action. + +#### Core logic +- `generate` is abstract; implementation must produce text. +- `generateWithTimings` calls `generate`, wraps result in `AiGenerationTimings` with zeroed timing fields. +- `close` is a no‑op default. + +#### Public API +- `generate(AiGenerationRequest) -> String` – produce text for request. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – produce text with timing. +- `close() -> void` – release resources. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` + +#### Exceptions / Errors +- `generate` and `generateWithTimings` declare `throws IOException` for provider failures. + +#### Concurrency +- No explicit concurrency handling; interface is stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..5f0db625 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,74 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:55:08Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Creates an AI generation provider instance based on a provider key or model configuration. + +#### Purpose +- Instantiates an `AiGenerationProvider` implementation. +- Resolves the effective provider key from run or model configuration. + +#### Type +- `public class AiGenerationProviderFactory` + - Modifiers: public, @ToString + - Supertypes: none + - Fields: + - `private final Java8CompatibilityHelper compatibilityHelper` – helper for blank checks + - Constants: + - `public static final String PROVIDER_MOCK = "mock"` + - `public static final String PROVIDER_LLAMACPP_JNI = "llamacpp-jni"` + - `public static final String PROVIDER_OPENAI_COMPATIBLE = "openai-compatible"` + - Methods: + - `public AiGenerationProviderFactory()` – no‑op constructor + - `public static @Nullable String effectiveProvider(String runProvider, String modelProvider)` – resolves provider key + - `public AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` – factory method + +#### Input +- `providerName` – run’s provider key (may be null or blank) +- `llamaConfig` – model configuration (`LlamaCppJniConfig`) +- `promptSupport` – `AiPromptSupport` for prompt lookup +- `runProvider` and `modelProvider` parameters in `effectiveProvider` + +#### Output +- Returns an `AiGenerationProvider` instance: + - `MockAiGenerationProvider` for mock or blank provider + - `LlamaCppJniAiGenerationProvider` for `llamacpp-jni` + - `OpenAiCompatibleAiGenerationProvider` for `openai-compatible` +- Throws `IllegalArgumentException` for unknown provider key + +#### Core logic +- `effectiveProvider` trims `modelProvider`; if empty, returns `runProvider`. +- `create` obtains `effective` provider key via `effectiveProvider`. +- If `effective` is null or blank, instantiate `MockAiGenerationProvider`. +- Switch on `effective`: + - `"mock"` → `MockAiGenerationProvider` + - `"llamacpp-jni"` → `LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)` + - `"openai-compatible"` → `OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)` + - default → throw `IllegalArgumentException` + +#### Public API +- `AiGenerationProviderFactory()` – constructs factory +- `static @Nullable String effectiveProvider(String runProvider, String modelProvider)` – resolves provider key +- `AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` – creates provider instance + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.provider.MockAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.OpenAiCompatibleAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniConfig` + +#### Exceptions / Errors +- `IllegalArgumentException` if provider key is unrecognized in `create`. + +#### Concurrency +- No explicit synchronization; instance fields are immutable after construction. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..45d6ed04 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,64 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:55:13Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Provides local AI text generation by loading a GGUF model via llama.cpp and exposing a prompt‑based completion API. + +#### Purpose +- Loads a GGUF model lazily and caches the native handle. +- Generates text completions from `AiGenerationRequest` using llama.cpp. +- Parses full chat responses, including timings and cache metrics. + +#### Type +- `final class LlamaCppJniAiGenerationProvider` – implements `AiGenerationProvider`, `AutoCloseable`. + - Extends `Object`. + - Annotations: `@ToString`. + - Fields: + - `private final LlamaCppJniConfig config` – configuration. + - `@ToString.Exclude private @Nullable LlamaModel model` – native handle. + - `private final AiPromptSupport promptSupport` – prompt lookup. + - `@ToString.Exclude private final LlamaCppJniProviderSupport support` – helper. + - `private final AiCompletionParser completionParser` – parses completion text. + - `private final ChatResponseParser chatResponseParser` – parses chat JSON. + - `private final Java8CompatibilityHelper compatibilityHelper` – helper for string checks. + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` accept `AiGenerationRequest`. +- `chatResponse(AiGenerationRequest request)` builds inference parameters via `support.buildInferenceParameters(request)`. + +#### Output +- `generate` returns `String` completion. +- `generateWithTimings` returns `AiGenerationTimings` containing text, prompt tokens, cache tokens, prompt throughput, predicted tokens, predicted throughput. +- `close` releases native `LlamaModel`. + +#### Core logic +- `model()` lazily constructs `LlamaModel` with `ModelParameters` built from `config` and `support.buildChatTemplateKwargs()`. +- Configures GPU layers, CPU MoE/FFN layers, KV cache settings, flash attention, quantization, batch sizes, device selection. +- `generate` calls `chatResponse`, warns on truncation, logs cache reuse, parses completion. +- `chatResponse` invokes `model().chatComplete` with inference parameters, parses JSON via `chatResponseParser`. +- `generateWithTimings` extracts timings from `ChatResponse` and constructs `AiGenerationTimings`. +- `close` calls `model.close()` if model exists. + +#### Public API +- `generate(AiGenerationRequest request) -> String` – produce completion text. +- `generateWithTimings(AiGenerationRequest request) -> AiGenerationTimings` – produce completion with metrics. +- `close() -> void` – release native resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.args.FlashAttn`, `net.ladenthin.llama.args.ReasoningFormat`, `net.ladenthin.llama.json.ChatResponseParser`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.ChatResponse`, `net.ladenthin.llama.value.Timings`, `net.ladenthin.srcmorph.document.AiGenerationRequest`, `net.ladenthin.srcmorph.prompt.AiPromptSupport`, `net.ladenthin.srcmorph.support.Java8CompatibilityHelper`, `org.jspecify.annotations.Nullable`, `lombok.ToString`. + +#### Exceptions / Errors +- Constructor throws `NullPointerException` if `config` or `promptSupport` is null. +- `generate` declares `throws IOException` (though underlying chat path throws unchecked). +- `model()` may throw runtime exceptions from native binding if parameters invalid. + +#### Concurrency +- No explicit synchronization; native `LlamaModel` is assumed thread‑safe or used single‑threaded. +- Lazy initialization of `model` is not synchronized; potential race if multiple threads call `generate` concurrently. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..416ee4b6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,104 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:55:20Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Immutable configuration holder for llama.cpp JNI provider, exposing all model‑generation knobs and defaults. + +#### Purpose +- Stores 37 llama.cpp runtime parameters. +- Provides a fluent builder that applies `AiGenerationConfig.DEFAULT_*` values. + +#### Type +- `final class LlamaCppJniConfig` (class, final) + - Extends `Object`. + - Annotations: `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. + - 37 private final fields (see Input). +- `public static final class Builder` (class, final) + - Annotations: none. + - 40 private fields (builder state). + - Constructor `Builder(String modelPath)` (private). + - 40 public setter methods. + - `build()` returns `LlamaCppJniConfig`. + +#### Input +- Constructor: `Builder` receives `String modelPath` (required). +- Builder setters accept values for each of the 37 configuration knobs (ints, floats, booleans, `String`, `List`, `@Nullable Boolean`). +- Default values are sourced from `AiGenerationConfig.DEFAULT_*`. + +#### Output +- `LlamaCppJniConfig` instances expose: + - 37 public getter methods returning the configured values. + - Unmodifiable views for `drySequenceBreakers` and `stopStrings`. +- Builder produces immutable configuration via `build()`. + +#### Core logic +- `LlamaCppJniConfig` constructor copies all builder fields into final fields. +- Builder setters assign provided values to mutable fields; many accept `null` to restore defaults. +- `build()` creates a new `LlamaCppJniConfig` with the current builder state. + +#### Public API +- `Builder builder(String modelPath) -> Builder` – creates a builder with defaults. +- `String modelPath() -> String` – model file path. +- `int contextSize() -> int` – context window size. +- `int maxOutputTokens() -> int` – max output tokens. +- `float temperature() -> float` – sampling temperature. +- `int threads() -> int` – CPU threads. +- `float topP() -> float` – nucleus‑sampling threshold. +- `int topK() -> int` – top‑k limit. +- `float minP() -> float` – min‑p threshold. +- `float topNSigma() -> float` – top‑n‑sigma threshold. +- `float repeatPenalty() -> float` – repetition penalty. +- `@Nullable Boolean chatTemplateEnableThinking() -> Boolean` – chat‑template thinking flag. +- `boolean cachePrompt() -> boolean` – prompt caching. +- `boolean swaFull() -> boolean` – full‑size SWA cache. +- `int cacheReuse() -> int` – KV prefix‑reuse chunk size. +- `int gpuLayers() -> int` – GPU layers offloaded. +- `int seed() -> int` – RNG seed. +- `int cpuMoeLayers() -> int` – CPU MoE layers. +- `int cpuFfnLayers() -> int` – CPU FFN layers. +- `int kvUnifiedPerSlot() -> int` – KV unified per‑slot cap. +- `String lazyMode() -> String` – tensor‑read laziness. +- `int repeatLastN() -> int` – repeat‑penalty window. +- `String cacheTypeK() -> String` – KV cache type K. +- `String cacheTypeV() -> String` – KV cache type V. +- `boolean flashAttn() -> boolean` – Flash Attention. +- `int batchSize() -> int` – logical batch size. +- `int ubatchSize() -> int` – physical batch size. +- `int threadsBatch() -> int` – batch/prompt thread count. +- `int mainGpu() -> int` – primary GPU index. +- `String devices() -> String` – device list. +- `String provider() -> String` – AI provider. +- `String remoteModel() -> String` – remote model ID. +- `String baseUrl() -> String` – OpenAI‑compatible base URL. +- `String apiKeyEnv() -> String` – API key environment variable. +- `String reasoningEffort() -> String` – reasoning‑effort level. +- `int reasoningBudgetTokens() -> int` – reasoning token budget. +- `float dryMultiplier() -> float` – DRY multiplier. +- `float dryBase() -> float` – DRY base. +- `int dryAllowedLength() -> int` – DRY allowed length. +- `int dryPenaltyLastN() -> int` – DRY penalty look‑back. +- `List drySequenceBreakers() -> List` – unmodifiable list. +- `List stopStrings() -> List` – unmodifiable list. +- Builder setters (40 total) each return `Builder` for chaining. +- `LlamaCppJniConfig build() -> LlamaCppJniConfig` – creates immutable config. + +#### Dependencies +- `java.util.Collections`, `java.util.List`, `java.util.Objects`. +- `lombok.EqualsAndHashCode`, `lombok.ToString`. +- `net.ladenthin.srcmorph.config.AiGenerationConfig`. +- `net.ladenthin.srcmorph.support.ConvertToRecord`. +- `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `Objects.requireNonNull(modelPath, "modelPath")` throws `NullPointerException` if `modelPath` is null. +- No other explicit exceptions. + +#### Concurrency +- Builder is not thread‑safe; intended for single‑thread use. +- `LlamaCppJniConfig` is immutable and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..5a8f1eb4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,90 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:55:30Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +--- +> Builds the HTTP request body, endpoint, and key handling for an OpenAI‑compatible chat‑completion provider, and interprets responses and errors. + +#### Purpose +- Constructs JSON bodies for chat‑completion requests. +- Validates and builds endpoint URLs. +- Retrieves and secures API keys. +- Interprets HTTP status and error bodies. +- Calculates generation timings. + +#### Type +`final class OpenAiCompatibleProviderSupport` – class +- Extends `Object`. +- Modifiers: `final`. +- Fields: + - `private final LlamaCppJniConfig config` – model configuration. + - `@ToString.Exclude private final AiPromptSupport promptSupport` – prompt definitions. + - `@ToString.Exclude private final Function environment` – env lookup. + - `private final Java8CompatibilityHelper compatibilityHelper` – null/blank checks. + - `private static final ObjectMapper MAPPER` – JSON serializer. +- Static constants: `CHAT_COMPLETIONS_PATH`, `ERROR_BODY_EXCERPT`, `HTTP_OK_FIRST`, `HTTP_OK_END`, `HTTP_SCHEME`, `HTTPS_SCHEME`, `LOOPBACK_HOST_NAME`, `IPV4_LOOPBACK`, `IPV6_LOOPBACK`, `ELLIPSIS`. + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, `Function environment`. +- `requestBody(AiGenerationRequest request)` consumes `AiGenerationRequest` fields: `promptKey()`, `sourceFile()`, `sourceText()`. +- `endpoint()` uses `config.baseUrl()`. +- `apiKey()` uses `config.apiKeyEnv()` and `environment`. +- `apiKeyFor(String endpoint)` uses `endpoint` and `apiKey()`. +- `isLoopbackHost(String host)` receives host string. +- `isSuccess(int status)` receives status code. +- `errorMessage(String endpoint, int status, String body)` receives endpoint, status, body. +- `timings(String text, ChatResponse response, double seconds)` receives parsed text, `ChatResponse`, and elapsed seconds. + +#### Output +- `requestBody` returns JSON string. +- `endpoint` returns URL string. +- `apiKey` returns trimmed key or `null`. +- `apiKeyFor` returns key or `null`; throws `IOException` on insecure HTTP to non‑loopback. +- `isLoopbackHost` returns boolean. +- `isSuccess` returns boolean. +- `errorMessage` returns formatted message string. +- `timings` returns `AiGenerationTimings` with token counts and decode rate. + +#### Core logic +- **requestBody**: builds `ObjectNode` with model, messages, sampling knobs, stop strings, reasoning effort, and `stream=false`; serialises to JSON. +- **endpoint**: trims `baseUrl`, ensures `http://` or `https://`, removes trailing slashes, appends `/chat/completions`. +- **apiKey**: retrieves env var, trims, returns `null` if unset or blank. +- **apiKeyFor**: if key present and endpoint uses plain `http`, parses host; if host not loopback, throws `IOException`; otherwise returns key. +- **isLoopbackHost**: checks host against `localhost`, IPv4 loopback regex, or `[::1]`. +- **isSuccess**: status in [200,300). +- **errorMessage**: truncates body to 500 chars, appends ellipsis, formats message. +- **timings**: extracts token counts from `ChatResponse.usage`, computes decode rate, constructs `AiGenerationTimings`. + +#### Public API +- `String requestBody(AiGenerationRequest request) -> JSON body` +- `String endpoint() -> URL` +- `String apiKey() -> key or null` +- `String apiKeyFor(String endpoint) -> key or null` +- `boolean isLoopbackHost(String host) -> true if loopback` +- `boolean isSuccess(int status) -> true if 2xx` +- `String errorMessage(String endpoint, int status, String body) -> message` +- `AiGenerationTimings timings(String text, ChatResponse response, double seconds) -> timings` + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper`, `ArrayNode`, `ObjectNode` +- `java.io.IOException`, `java.net.URL`, `java.util.List`, `java.util.Objects`, `java.util.function.Function`, `java.util.regex.Pattern` +- `lombok.ToString` +- `net.ladenthin.llama.value.ChatResponse`, `net.ladenthin.llama.value.Usage` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` in `endpoint()` if `baseUrl` not HTTP(S). +- `IOException` in `apiKeyFor()` if plain HTTP to non‑loopback host or URL parsing fails. +- `IOException` in `requestBody()` if JSON serialization fails. + +#### Concurrency +- No mutable shared state beyond final fields; thread‑safe. +- `MAPPER` is thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..604c7777 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,57 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:56:31Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Provides a pluggable AI generation framework that supports local llama.cpp inference, mock generation, and OpenAI‑compatible HTTP backends, exposing a unified request/response API and timing metrics. + +#### Purpose +- Centralize AI text generation across multiple backends. +- Offer a consistent request/response contract with optional timing data. +- Enable configuration‑driven provider selection and runtime tuning. + +#### Responsibilities +- **Provider abstraction** – `AiGenerationProvider` defines the contract for generating text. +- **Factory logic** – `AiGenerationProviderFactory` resolves and instantiates the correct provider implementation. +- **Local inference** – `LlamaCppJniAiGenerationProvider` loads a GGUF model via llama.cpp, handles chat templates, and parses completions. +- **Remote inference** – `OpenAiCompatibleProviderSupport` builds HTTP requests, validates endpoints, secures API keys, and interprets responses. +- **Configuration** – `LlamaCppJniConfig` holds 37 llama.cpp knobs and offers a fluent builder. +- **Parsing utilities** – `AiCompletionParser` strips Gemma‑4 thinking blocks from raw completions. + +#### Key units +- `AiGenerationProvider` (interface) – `generate`, `generateWithTimings`, `close`. +- `AiGenerationProviderFactory` – `effectiveProvider`, `create`. +- `LlamaCppJniAiGenerationProvider` – lazy model loading, chat completion, timing extraction. +- `OpenAiCompatibleProviderSupport` – request body construction, endpoint validation, API key handling, error formatting, timing calculation. +- `LlamaCppJniConfig.Builder` – fluent builder for 37 llama.cpp parameters. +- `AiCompletionParser` – removes Gemma‑4 thinking block. + +#### Data flow +1. **Request creation** – `AiGenerationRequest` (prompt key, source file/text, header) is passed to a provider. +2. **Provider selection** – `AiGenerationProviderFactory` resolves the provider key (run or model config) and creates the appropriate provider instance. +3. **Generation** – + - *Local*: `LlamaCppJniAiGenerationProvider` builds inference parameters, calls `model.chatComplete`, parses JSON, extracts text, and optionally timing metrics. + - *Remote*: `OpenAiCompatibleProviderSupport` builds a JSON body, validates the endpoint, secures the API key, sends the HTTP request, parses the response, and extracts timing data. +4. **Post‑processing** – `AiCompletionParser` removes any internal thinking block from the raw completion before returning the final answer. + +#### Dependencies +- **Internal** – `AiPromptSupport` for prompt lookup, `Java8CompatibilityHelper` for string checks, `AiCompletionParser`, `ChatResponseParser`. +- **External** – `net.ladenthin.llama` (model, parameters, JSON parsing), `com.fasterxml.jackson.databind` (JSON serialization), `org.jspecify.annotations.Nullable`, `lombok` annotations. +- **Configuration** – `LlamaCppJniConfig` supplies all runtime knobs; `AiGenerationConfig.DEFAULT_*` values are used in the builder. + +#### Cross‑cutting +- **Thread safety** – Providers are stateless except for the lazy `LlamaModel`; no explicit synchronization, potential race on first `generate` call. +- **Error handling** – `IOException` is the primary failure mode for missing markers, HTTP errors, or JSON issues; `IllegalArgumentException` signals unknown provider keys. +- **Timing metrics** – `AiGenerationTimings` captures prompt/cache tokens, throughput, and predicted token counts for both local and remote providers. +- **Configuration immutability** – `LlamaCppJniConfig` is immutable; builder is single‑threaded. +- **Environment integration** – API keys are fetched from environment variables via a supplied lookup function; insecure HTTP to non‑loopback hosts is rejected. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..ac668234 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,49 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:56:05Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Computes a 256‑bin byte histogram of an input byte stream in two OpenCL kernel passes. + +#### Purpose +- Builds a byte histogram for image or arbitrary byte data. +- Uses two‑pass reduction: per‑group partial histograms then global reduction. + +#### Type +- OpenCL C 1.2 kernels (`__kernel` functions) in file `histogram.cl`. + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms to `partial`. +- `histogram_reduce`: writes final 256‑bin histogram to `histogram`. + +#### Core logic +- **histogram_partial** + 1. Zero local bin array in parallel (`local_bins[b] = 0`). + 2. Each work‑item iterates over its assigned input indices (`i = gid; i < length; i += gsize`) and atomically increments the corresponding local bin. + 3. After synchronization, each work‑item writes its local bin values to the global `partial` buffer at offset `group_id * BINS`. +- **histogram_reduce** + 1. Each work‑item handles one bin (`bin = get_global_id(0)`). + 2. Sums the partial counts for that bin across all groups (`sum += partial[g * BINS + bin]`). + 3. Stores the sum into the global `histogram[bin]`. + +#### Public API +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – final histogram reduction. + +#### Constants and configuration +- `#define BINS 256` – number of histogram bins. + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- None; kernels return early if `bin >= BINS` in `histogram_reduce`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..248771f5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,37 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:56:40Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes a 256‑bin byte histogram of an input byte stream using two OpenCL kernel passes. + +#### Purpose +- Generate a byte histogram for image or arbitrary byte data. +- Perform two‑pass reduction: per‑group partial histograms followed by global aggregation. + +#### Responsibilities +- **Partial histogram kernel**: build per‑work‑group local histograms and write them to global memory. +- **Reduce kernel**: aggregate all partial histograms into a final 256‑bin result. + +#### Key units +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram builder. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – global reduction to final histogram. +- `#define BINS 256` – constant defining histogram size. + +#### Data flow +1. **Input**: byte stream (`uchar *input`) and its length. +2. **Partial pass**: each work‑group processes a slice of the input, atomically updates a local 256‑bin array, then writes the local bins to a global `partial` buffer. +3. **Reduce pass**: each work‑item sums the corresponding bin across all partial buffers and writes the total to the final `histogram` array. + +#### Dependencies +- OpenCL C 1.2 built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Cross-cutting +- Two‑pass reduction pattern: local accumulation → global aggregation. +- Atomic increments used for thread‑safe local bin updates. +- No explicit error handling; kernels exit early if a bin index exceeds `BINS`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..91ff5849 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,59 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:56:56Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides low‑level utilities for byte‑level data processing, circular buffering, and simple command‑line tooling for backups and revenue reporting. + +#### Purpose +- Deliver reusable OpenCL kernels for histogram generation. +- Offer a lock‑free ring buffer for byte streams. +- Supply shell/Python scripts for backup rotation and CSV revenue analysis. + +#### Responsibilities +- **Histogram kernels**: compute 256‑bin byte histograms via two‑pass OpenCL reduction. +- **Ring buffer**: manage a power‑of‑two circular FIFO for single‑producer/single‑consumer byte streams. +- **Scripts**: automate tar‑gzip backup rotation and generate monthly revenue reports from CSV orders. + +#### Key units +- **OpenCL** + - `histogram_partial` – per‑group local histogram builder. + - `histogram_reduce` – global aggregation of partial histograms. + - `#define BINS 256` – histogram size constant. +- **Ring buffer** + - `ringbuf_t` – buffer descriptor (`data`, `capacity`, `head`, `tail`). + - `ringbuf_status_t` – status enum (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). + - `ringbuf_init`, `ringbuf_free`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space`. +- **Scripts** + - `rotate_backups.sh` – Bash backup rotation utility. + - `sales_report.py` – Python module with `parse_orders`, `revenue_by_month_and_region`, `main`. + +#### Data flow +1. **Histogram** + - Input byte stream → `histogram_partial` writes per‑group partials → `histogram_reduce` aggregates into final 256‑bin histogram. +2. **Ring buffer** + - `ringbuf_init` allocates buffer → `ringbuf_write` copies data to `head` → `ringbuf_read` retrieves from `tail` → `ringbuf_used`/`ringbuf_free_space` report usage. +3. **Scripts** + - `rotate_backups.sh`: source dir → tar‑gzip → timestamped archive → prune old archives. + - `sales_report.py`: CSV files → `parse_orders` → filter by currency → `revenue_by_month_and_region` aggregates → stdout report. + +#### Dependencies +- **OpenCL**: C99 built‑ins (`get_local_id`, `atomic_inc`, `barrier`, etc.). +- **Ring buffer**: C standard library (`malloc`, `free`, `memcpy`, ``, ``, ``, ``). +- **Scripts**: + - Bash: `tar`, `date`, `du`, `ls`, `rm`, `mv`. + - Python: `argparse`, `csv`, `sys`, `collections`, `dataclasses`, `datetime`, `decimal`. + +#### Cross‑cutting +- Power‑of‑two ring buffer uses bitwise modulo (`capacity - 1`) for wrap‑around. +- Single‑producer/single‑consumer design eliminates locks; indices updated by distinct threads. +- Two‑pass reduction pattern (local accumulation → global aggregation) in histogram kernels. +- Consistent error handling: ring buffer returns `ringbuf_status_t`; scripts use exit codes 0/1/2 and clear usage messages. +- Timestamp formatting follows UTC ISO‑8601 (`YYYYMMDDTHHMMSSZ`) for backup names. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..f525f987 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,48 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:56:44Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> A lock‑free, power‑of‑two ring buffer for single‑producer/single‑consumer byte streams. + +#### Purpose +- Provide a circular FIFO buffer that avoids dynamic reallocation. +- Enable efficient, contiguous read/write with minimal copying. + +#### Responsibilities +- **Buffer lifecycle** – initialization, allocation, and cleanup. +- **Data movement** – write to head, read from tail, handling wrap‑around. +- **Space accounting** – expose used bytes and free space. +- **Error handling** – validate capacity and report allocation failures. + +#### Key units +- **`ringbuf_t`** – struct holding `data`, `capacity`, `head`, `tail`. +- **`ringbuf_status_t`** – enum (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- **`ringbuf_init`** – allocates buffer, validates power‑of‑two capacity. +- **`ringbuf_free`** – releases allocated memory. +- **`ringbuf_write`** – copies up to `len` bytes, updates `head`. +- **`ringbuf_read`** – copies up to `len` bytes, updates `tail`. +- **`ringbuf_used`** – returns `(head - tail) & (capacity - 1)`. +- **`ringbuf_free_space`** – returns `capacity - 1 - ringbuf_used`. + +#### Data flow +1. **Init** → allocate `capacity` bytes, set indices to 0. +2. **Write** → copy from source to buffer, wrap at `capacity`, advance `head`. +3. **Read** → copy from buffer to destination, wrap at `capacity`, advance `tail`. +4. **Query** → `ringbuf_used`/`ringbuf_free_space` compute counts via modulo arithmetic. +5. **Free** → deallocate buffer memory. + +#### Dependencies +- Standard C headers: ``, ``, ``, ``. +- Uses `malloc`, `free`, `memcpy` for memory management and copying. + +#### Cross-cutting +- **Power‑of‑two constraint** – all operations rely on bitwise modulo via `capacity - 1`. +- **Single‑producer/single‑consumer** – no locking; indices are updated atomically by one thread each. +- **Error codes** – consistent `ringbuf_status_t` for init failures; write/read return actual byte counts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..81588390 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,59 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:56:08Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Implements a fixed‑size ring buffer with power‑of‑two capacity, providing init, free, read, write, and status queries. + +#### Purpose +- Provides a circular FIFO buffer for byte streams. +- Ensures efficient wrap‑around copying without extra allocations. + +#### Type +- C source file implementing `ringbuf_t` operations defined in `ringbuf.h`. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity must be power of two. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source data buffer. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- `ringbuf_write` returns number of bytes actually written. +- `ringbuf_read` returns number of bytes actually read. +- `ringbuf_free` deallocates internal buffer. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates buffer, sets indices to zero. +- `ringbuf_free` frees buffer and resets fields. +- `ringbuf_used` computes bytes in buffer via modulo arithmetic. +- `ringbuf_free_space` computes available space (`capacity - 1 - used`). +- `ringbuf_write` copies up to two contiguous chunks: from current head to end, then from start if needed; updates head. +- `ringbuf_read` copies similarly from tail; updates tail. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – release resources. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – space left for writing. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write data. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read data. + +#### Constants and configuration +- None defined in this file. + +#### Dependencies +- `stdlib.h` – `malloc`, `free`. +- `string.h` – `memcpy`. +- `ringbuf.h` – type and status definitions. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity not power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if `malloc` fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..5b6d550a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,63 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:56:12Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Provides a fixed‑size byte ring buffer for single‑producer/single‑consumer use. + +#### Purpose +- Implements a lock‑free circular buffer for byte streams. +- Supports initialization, cleanup, read/write, and space queries. + +#### Type +- Header (`ringbuf.h`) in C (C99). +- Defines `ringbuf_t` struct, `ringbuf_status_t` enum, and function prototypes. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity (must be power of two, >0). +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. +- `ringbuf_used(const ringbuf_t *rb)` – reads current used bytes. +- `ringbuf_free_space(const ringbuf_t *rb)` – reads available space. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- `ringbuf_write` returns number of bytes actually written. +- `ringbuf_read` returns number of bytes actually read. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. +- `ringbuf_free` deallocates internal buffer. + +#### Core logic +- `ringbuf_init`: validates capacity, allocates `capacity` bytes, sets head/tail to 0. +- `ringbuf_write`: copies up to `len` bytes from `src` into buffer, wrapping at `capacity`; updates `head`. +- `ringbuf_read`: copies up to `len` bytes from buffer into `dst`, wrapping at `capacity`; updates `tail`. +- `ringbuf_used`: computes `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space`: computes `capacity - 1 - ringbuf_used`. +- `ringbuf_free`: frees allocated `data`. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free resources. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – free capacity. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- `` for `size_t`. +- `` for `uint8_t`. +- Standard C library `malloc`, `free`, `memcpy` (implied by implementation). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..8ddc0293 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,48 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:56:52Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides command‑line utilities for backing up directories and generating monthly revenue reports from order CSV exports. + +#### Purpose +- Automate creation and rotation of compressed backups. +- Compute and output revenue summaries by month and region from CSV order data. + +#### Responsibilities +- **Backup rotation**: `rotate_backups.sh` handles archive creation, naming, and pruning. +- **Revenue reporting**: `sales_report.py` parses CSVs, filters by currency, aggregates by month/region, and prints tab‑separated reports. + +#### Key units +- **`rotate_backups.sh`** – Bash script that builds a timestamped `.tar.gz`, keeps the newest N archives, and cleans up old ones. +- **`sales_report.py`** – Python module exposing + - `parse_orders(path, currency)` → `Iterator[Order]` + - `revenue_by_month_and_region(orders)` → `Dict[(month, region), Decimal]` + - `main(argv)` → `int` (CLI entry point). + +#### Data flow +1. **Backup**: + - Input: source directory, backup directory, optional keep count. + - Process: validate, tar‑compress, rename, list existing archives, delete excess. + - Output: new archive file, console logs, exit status. + +2. **Report**: + - Input: list of CSV file paths, optional currency filter, min‑revenue threshold. + - Process: parse each CSV, filter by currency, aggregate amounts per month/region. + - Output: stdout lines `YYYY-MMregionrevenuecurrency`, exit status. + +#### Dependencies +- **`rotate_backups.sh`**: external utilities `tar`, `date`, `du`, `ls`, `rm`, `mv`. +- **`sales_report.py`**: standard library modules `argparse`, `csv`, `sys`, `collections`, `dataclasses`, `datetime`, `decimal`. + +#### Cross‑cutting +- Both scripts use strict error handling: exit codes `0`/`1`/`2`, clear usage messages. +- Timestamp formatting follows UTC ISO‑8601 (`YYYYMMDDTHHMMSSZ`). +- Data validation: `sales_report.py` checks required CSV columns and numeric/decimal conversion. +- Cleanup: `rotate_backups.sh` removes temporary partial archives on exit via `trap`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..8dbff618 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,60 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:56:19Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Creates a dated, compressed backup of a directory and prunes older archives to keep only the newest N. + +#### Purpose +- Generates a `.tar.gz` backup of `SOURCE_DIR` into `BACKUP_DIR`. +- Keeps only the most recent `KEEP` archives, deleting older ones. +- Intended to be run directly from the command line. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- `$1` → `SOURCE_DIR` (required). +- `$2` → `BACKUP_DIR` (required). +- `$3` → `KEEP` (optional, defaults to `7`). +- No external options or environment variables. + +#### Output +- Creates file `"$BACKUP_DIR/${name}_YYYYMMDDTHHMMSSZ.tar.gz"`. +- Prints creation and size of the new archive. +- Deletes older archives beyond the `KEEP` count, printing each removal. +- Exit status `0` on success, `2` on invalid arguments or missing directory. + +#### Core logic +- Validate `KEEP` is a positive integer. +- Ensure `SOURCE_DIR` exists; create `BACKUP_DIR` if missing. +- Build archive name with UTC timestamp. +- Create temporary archive `"$tmp"`, then rename to final name. +- List existing archives sorted newest first. +- Remove all but the first `KEEP` entries. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR`=`"${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR`=`"${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP`=`"${3:-7}"` +- `name`=`"$(basename "$SOURCE_DIR")"` +- `archive`=`"$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp`=`"$archive.partial"` + +#### Dependencies +- External commands: `tar`, `date`, `du`, `ls`, `rm`, `mv`. +- No sourced files. + +#### Errors and exit codes +- `exit 2` if `KEEP` not a positive integer. +- `exit 2` if `SOURCE_DIR` does not exist. +- `trap` ensures temporary file `$tmp` is removed on exit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..82752eea --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,62 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:56:22Z +- G: +- A: 0.0.0 +- X: file +- P: 0732CA46 +--- +> Generates monthly revenue reports from CSV order exports, filtering by currency and minimum revenue. + +#### Purpose +- Compute revenue per month and region from order CSV files. +- Output tab‑separated lines: month, region, revenue. + +#### Type +- Python script (`.py`). + +#### Input +- Positional arguments: list of CSV file paths (`csv_files`). +- Optional arguments: + - `--currency` (default `"EUR"`): filter orders by this currency. + - `--min-revenue` (Decimal, default `0`): minimum revenue threshold for output. +- CSV columns required: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints to stdout lines: `YYYY-MMregionrevenuecurrency`. +- Returns exit code `0` on success, `1` if no orders found. + +#### Core logic +- `parse_orders(path, currency)`: + - Open CSV, validate required columns. + - Iterate rows; skip rows with different currency. + - Convert `order_date` to `date`, `amount` to `Decimal`. + - Yield `Order` dataclass instances. +- `revenue_by_month_and_region(orders)`: + - Aggregate amounts into `defaultdict(Decimal)` keyed by `(month, region)`. + - Return sorted dictionary of totals. +- `main(argv)`: + - Parse CLI arguments. + - Collect all orders from provided files. + - If none, print error and exit with code `1`. + - For each `(month, region)` with revenue ≥ `min_revenue`, print formatted line. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` + Yields orders from a CSV file in the specified currency. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` + Aggregates revenue by month and region. +- `main(argv=None) -> int` + Entry point; processes CLI, outputs report. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` if CSV missing required columns or contains invalid data. +- `ValueError` propagated from `parse_orders` for malformed rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..d268067a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,76 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:57:18Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A Maven‑based framework that orchestrates AI‑driven source‑code generation, validation, and file‑selection, backed by pluggable local or remote inference engines and a set of low‑level utilities for data processing and database‑centric business logic. + +#### Purpose +- Centralize AI generation parameters and file‑selection logic for the srcmorph Maven plugin. +- Provide a unified, pluggable provider interface for local llama.cpp, mock, and OpenAI‑compatible backends. +- Offer reusable OpenCL kernels, a lock‑free ring buffer, and auxiliary scripts for backup and reporting. +- Persist and enforce business rules for library lending, e‑commerce order lines, and warehouse stock synchronization. + +#### Responsibilities +- **AI Generation Framework** – configuration, condition evaluation, fact extraction, oversize handling, provider abstraction, local/remote inference, and completion parsing. +- **Low‑Level Utilities** – OpenCL histogram kernels, power‑of‑two ring buffer, and command‑line scripts for backups and revenue reports. +- **Database Modules** – library catalog and loan logic, shop order line and stock management, warehouse stock sync and audit. + +#### Key units +- **Java AI Core** + - `SrcMorphConfiguration`, `AiGenerationConfig` – plugin‑level and step‑level settings. + - `AiConditionEvaluator`, `AiCondition`, `AiConditionGroup` – file‑selection logic. + - `AiFactExtractor` – deterministic fact block builder. + - `AiOversizeStrategy` – enum for handling files that exceed context window. + - `AiGenerationProvider`, `AiGenerationProviderFactory` – provider contract and resolver. + - `LlamaCppJniAiGenerationProvider` – local llama.cpp inference. + - `OpenAiCompatibleProviderSupport` – HTTP‑based remote inference. + - `AiCompletionParser` – strips internal thinking blocks. +- **Other Utilities** + - `histogram_partial`, `histogram_reduce` – OpenCL kernels for 256‑bin byte histograms. + - `ringbuf_t`, `ringbuf_*` – lock‑free single‑producer/single‑consumer byte buffer. + - `rotate_backups.sh`, `sales_report.py` – backup rotation and revenue reporting scripts. +- **SQL Modules** + - **Library** – tables (`author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`), functions (`fn_checkout_book`, `fn_late_fee`), procedures (`sp_return_book`), trigger (`trg_loan_audit_fn`), views (`overdue_loans`, `member_loan_stats`, `popular_books`). + - **Shop** – tables (`product`, `customer_order`, `order_item`), procedure (`add_order_item`). + - **Warehouse** – tables (`StockLevel`, `SupplierFeed`, `SyncLog`), procedure (`usp_SyncStock`). + +#### Data flow +1. **AI Pipeline** + - Load `SrcMorphConfiguration` → build `AiGenerationConfig` per step. + - Evaluate `AiCondition` tree against `AiFileContext` to select files. + - Extract facts with `AiFactExtractor` and assemble prompt. + - Apply `AiOversizeStrategy` if file size exceeds model context. + - Resolve provider via `AiGenerationProviderFactory` → instantiate `LlamaCppJniAiGenerationProvider` or `OpenAiCompatibleProviderSupport`. + - Generate completion → parse with `AiCompletionParser` → return final text. +2. **Utility Flow** + - Histogram: input byte stream → `histogram_partial` → `histogram_reduce` → 256‑bin result. + - Ring buffer: `ringbuf_init` → `ringbuf_write`/`ringbuf_read` → status queries. + - Scripts: `rotate_backups.sh` archives source → prunes old archives; `sales_report.py` parses CSV → aggregates revenue → outputs report. +3. **Database Flow** + - Library: `fn_checkout_book` validates, inserts `loan`, updates `book.copies_free`, triggers audit; `sp_return_book` updates `loan`, restores copies, triggers audit; `fn_late_fee` calculates overdue charges; views aggregate data. + - Shop: `add_order_item` locks `product`, checks stock, inserts/updates `order_item`, decrements stock, recomputes order total. + - Warehouse: `usp_SyncStock` aggregates `SupplierFeed` since a timestamp, merges into `StockLevel`, logs run in `SyncLog`. + +#### Dependencies +- **Internal** – AI core classes (`AiCondition`, `AiPromptDefinition`, `AiModelDefinition`, etc.), OpenCL kernels, ring buffer structs, SQL tables and procedures. +- **External** – `net.ladenthin.llama` for local inference, `com.fasterxml.jackson.databind` for JSON, Lombok, Java time and regex, OpenCL runtime, standard C libraries, Bash utilities (`tar`, `date`, etc.), Python modules (`argparse`, `csv`, `datetime`), database engines (PostgreSQL, MySQL 8, SQL Server). + +#### Cross‑cutting +- Defensive copying and stateless utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Immutable configuration builders (`LlamaCppJniConfig.Builder`). +- Validation via `IllegalArgumentException`; I/O errors via `IOException`. +- Timing metrics captured in `AiGenerationTimings`. +- Thread‑safe provider usage; first‑call race on lazy `LlamaModel` noted. +- Ring buffer uses bitwise modulo for wrap‑around; single‑producer/single‑consumer design removes locks. +- Two‑pass reduction pattern in histogram kernels. +- Consistent error handling across utilities and scripts (status enums, exit codes). +- Audit tables (`loan_audit`, `SyncLog`) and triggers enforce transactional integrity. +- Concurrency controls: row‑level locking on `product` in Shop, transactional sync in Warehouse. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..110e31ca --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: EF44F5E8 +- D: 2026-11-04T07:50:25Z +- T: 2026-11-04T07:57:25Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard project is a Maven‑based framework that orchestrates AI‑driven source‑code generation, validation, and file‑selection through a configuration‑driven plugin architecture. It exposes a pluggable inference provider layer that supports local llama.cpp, mock, and OpenAI‑compatible HTTP backends, while low‑level utilities in the other package provide byte‑level data processing, lock‑free ring buffers, and command‑line tools for backups and revenue reporting. The SQL sub‑packages supply a PostgreSQL library management system and a MySQL‑based shop and warehouse modules, each offering stored procedures, functions, and audit mechanisms to enforce business rules and maintain transactional integrity across lending, e‑commerce, and inventory synchronization. Together, these subsystems enable end‑to‑end AI‑assisted code generation, validation, and data‑centric business logic within a single Maven project. + +#### Packages +- java/config — A configuration‑driven framework for AI‑powered source‑code generation, validation, and file‑selection logic used by the Maven srcmorph plugin. +- java — A Maven plugin framework that orchestrates AI‑driven source‑code generation, validation, and file‑selection through configurable prompts, models, and pluggable inference backends. +- java/provider — Provides a pluggable AI generation framework that supports local llama.cpp inference, mock generation, and OpenAI‑compatible HTTP backends, exposing a unified request/response API and timing metrics. +- other/kernels — Computes a 256‑bin byte histogram of an input byte stream using two OpenCL kernel passes. +- other — Provides low‑level utilities for byte‑level data processing, circular buffering, and simple command‑line tooling for backups and revenue reporting. +- other/ringbuf — A lock‑free, power‑of‑two ring buffer for single‑producer/single‑consumer byte streams. +- other/scripts — Provides command‑line utilities for backing up directories and generating monthly revenue reports from order CSV exports. +- . — A Maven‑based framework that orchestrates AI‑driven source‑code generation, validation, and file‑selection, backed by pluggable local or remote inference engines and a set of low‑level utilities for data processing and database‑centric business logic. +- sql/library — A PostgreSQL library management system that stores catalog, member, and loan data, enforces business rules, and provides reporting and audit capabilities. +- sql — A collection of database‑centric modules that manage library lending, e‑commerce order lines, and warehouse stock synchronization, each exposing stored procedures, functions, and audit mechanisms for transactional integrity and reporting. +- sql/shop — A MySQL 8 stored procedure that adds or updates an order line, reserves stock, and updates the order total in a web‑shop. +- sql/warehouse — Keeps the warehouse inventory in sync with incoming supplier feeds and records each sync run. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..5a95b66c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,71 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:55:38Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Defines the core tables and indexes for a library lending system, tracking authors, books, members, and loan transactions. + +#### Purpose +- Store library catalog and member data. +- Record book loans and enforce business rules. + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author(author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book(book_id)` + - `member_id BIGINT NOT NULL REFERENCES member(member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` +- **Indexes** + - `idx_book_author ON book(author_id)` + - `idx_loan_member ON loan(member_id)` + - `idx_loan_open ON loan(due_on) WHERE returned_on IS NULL` + +#### Reads +- `author` (via `book.author_id` FK) +- `book` (via `loan.book_id`) +- `member` (via `loan.member_id`) + +#### Writes +- `author` – INSERT (1 row per author) +- `book` – INSERT (1 row per book) +- `member` – INSERT (1 row per member) +- `loan` – INSERT (1 row per loan) + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (ON DELETE CASCADE) + +#### Dependencies +- `author`, `book`, `member`, `loan` tables referenced by foreign keys and indexes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..9a394011 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,61 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:55:42Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> A set of reporting views and a materialized view for a library system, summarizing overdue loans, member loan statistics, and popular books. + +#### Purpose +- Provide read‑only reports on loan status and book popularity. +- Enable quick access to overdue loan details, member loan summaries, and recent popular books. + +#### Type +- PostgreSQL +- Views: `overdue_loans`, `member_loan_stats` +- Materialized view: `popular_books` +- Index: `idx_popular_books_id` + +#### Schema +- **overdue_loans** + - `loan_id` integer + - `member_id` integer + - `email` text + - `title` text + - `due_on` date + - `days_overdue` integer +- **member_loan_stats** + - `member_id` integer + - `full_name` text + - `loans_total` bigint + - `loans_open` bigint + - `last_loan_on` timestamp +- **popular_books** + - `book_id` integer + - `title` text + - `author_name` text + - `times_loaned` bigint + - **Index** `idx_popular_books_id` on `popular_books(book_id)` + +#### Reads +- `overdue_loans`: `loan`, `member`, `book` +- `member_loan_stats`: `member`, `loan` +- `popular_books`: `loan`, `book`, `author` + +#### Writes +- None (all objects are read‑only). + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author` +- Views: none +- Functions: none +- Sequences: none diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..073df923 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,69 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:55:44Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Records and manages book loans, including checkout, return, late fee calculation, and audit trail. + +#### Purpose +- Handles checkout and return of library books. +- Calculates late fees. +- Audits loan actions. + +#### Type +- Table: `loan_audit` (PostgreSQL). +- Function: `fn_checkout_book` (plpgsql), `fn_late_fee` (sql), `trg_loan_audit_fn` (plpgsql). +- Procedure: `sp_return_book` (plpgsql). +- Trigger: `trg_loan_audit` (AFTER INSERT OR UPDATE OF returned_on ON loan). + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member` (`member_id`, `is_blocked`) – check blocked status. +- `book` (`book_id`, `copies_free`) – verify free copy. +- `loan` (`loan_id`, `book_id`, `returned_on`) – update return status. +- `loan` (`loan_id`, `book_id`, `due_on`, `returned_on`) – trigger audit. + +#### Writes +- `book` – decrement `copies_free` on checkout; increment on return. +- `loan` – insert new loan record; update `returned_on` on return. +- `loan_audit` – insert audit rows for checkout and return actions. + +#### Relationships +- `loan_audit.loan_id -> loan.loan_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Verify member not blocked. + - Decrease `book.copies_free`; error if none. + - Insert into `loan` with `due_on = CURRENT_DATE + p_days`; return new `loan_id`. + +- **sp_return_book(p_loan_id)** + - Update `loan.returned_on` to `CURRENT_DATE`; capture `book_id`. + - If no row updated, raise exception. + - Increment `book.copies_free`. + +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Multiply by 50, cap at 2000. + +- **trg_loan_audit_fn()** + - On INSERT: log `CHECKOUT`. + - On UPDATE where `returned_on` changes from NULL to non‑NULL: log `RETURN`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Trigger function: `trg_loan_audit_fn`. +- Trigger: `trg_loan_audit`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..aff131a7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,72 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:55:48Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds library branches, moves book copies to branch-specific rows, and updates member and loan tables to reference branches and copies. + +#### Purpose +- Introduces branch dimension for library locations. +- Normalizes book copies per branch. +- Updates member and loan schemas to reference new entities. + +#### Type +- Table: `branch` +- Table: `book_copy` +- Table alterations: `loan`, `member`, `book` +- Index: `idx_book_copy_book` + +#### Schema +- **branch** + - `branch_id SMALLSERIAL PRIMARY KEY` + - `name VARCHAR(100) NOT NULL UNIQUE` + - `city VARCHAR(100) NOT NULL` +- **book_copy** + - `copy_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `branch_id SMALLINT NOT NULL REFERENCES branch (branch_id)` + - `barcode VARCHAR(32) NOT NULL UNIQUE` + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE', 'ON_LOAN', 'LOST'))` +- **loan** (altered) + - Adds `copy_id BIGINT REFERENCES book_copy (copy_id)` +- **member** (altered) + - Renames `joined_on` → `member_since` + - Adds `home_branch_id SMALLINT REFERENCES branch (branch_id)` + - Updates existing rows: `home_branch_id = 1` where NULL +- **book** (altered) + - Drops constraint `book_free_le_total` + - Drops columns `copies_free`, `copies_total` +- **Index** + - `idx_book_copy_book` on `book_copy (book_id)` + +#### Reads +- `book` (SELECT book_id, isbn, copies_free, copies_total) +- `branch` (INSERT default row) +- `loan` (no reads) +- `member` (no reads) + +#### Writes +- `branch`: 1 row inserted (`Main`, `Springfield`) +- `book_copy`: 1 INSERT with `SELECT` generating `copies_total` rows per book +- `loan`: adds column `copy_id` (no data changes) +- `member`: adds column `home_branch_id`; updates existing rows to `1` +- `book`: drops columns and constraint (no data changes) + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- Table `book` (existing) +- Table `loan` (existing) +- Table `member` (existing) +- Index `idx_book_copy_book` (created on `book_copy`) + +--- diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..2d1c4b9d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,67 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:55:51Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Seed data for a lending library: populates authors, books, members, and loan records. + +#### Purpose +- Populate the library database with initial test data. +- Provide a realistic dataset for benchmarking and development. + +#### Type +- Data insertion script (PostgreSQL `INSERT` statements). + +#### Schema +**author** +`author_id integer` +`full_name text` +`birth_year integer` +`country_code char(2)` + +**book** +`book_id integer` +`isbn text` +`title text` +`author_id integer` +`published_year integer` +`copies_total integer` +`copies_free integer` + +**member** +`member_id integer` +`email text` +`full_name text` +`joined_on date` +`is_blocked boolean` + +**loan** +`loan_id integer` +`book_id integer` +`member_id integer` +`loaned_on date` +`due_on date` +`returned_on date` + +#### Reads +None – the script only performs `INSERT` operations. + +#### Writes +- `author`: 15 rows +- `book`: 150 rows +- `member`: 50 rows +- `loan`: 150 rows + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- Tables: `author`, `book`, `member`, `loan` +- No functions, triggers, or extensions referenced. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..3b980615 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,55 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:57:02Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL library management system that stores catalog, member, and loan data, enforces business rules, and provides reporting and audit capabilities. + +#### Purpose +- Persist library catalog, member, and loan information. +- Enforce lending rules (availability, member status, due dates). +- Offer read‑only reporting and audit trails. + +#### Responsibilities +- **Data definition** – tables, indexes, and constraints for authors, books, members, loans, and audit. +- **Business logic** – checkout, return, late‑fee calculation, and audit triggers. +- **Reporting** – overdue loans, member statistics, and popular books views. +- **Schema evolution** – branch and book‑copy normalization in migration v2. +- **Seeding** – initial test data for authors, books, members, and loans. + +#### Key units +- `author`, `book`, `member`, `loan` tables – core entities. +- `loan_audit` table – audit trail for checkout/return actions. +- `fn_checkout_book(p_member_id, p_book_id, p_days)` – checkout logic. +- `sp_return_book(p_loan_id)` – return logic. +- `fn_late_fee(p_due_on, p_returned_on)` – late‑fee calculation. +- `trg_loan_audit_fn()` – audit trigger function. +- `overdue_loans`, `member_loan_stats`, `popular_books` views – reporting objects. +- `branch`, `book_copy` tables – branch and copy dimension added in migration v2. + +#### Data flow +1. **Checkout**: `fn_checkout_book` verifies member and copy availability, decrements `book.copies_free`, inserts a `loan` record, and triggers `loan_audit` with action `CHECKOUT`. +2. **Return**: `sp_return_book` updates `loan.returned_on`, increments `book.copies_free`, and triggers `loan_audit` with action `RETURN`. +3. **Late fee**: `fn_late_fee` computes overdue days and caps the fee. +4. **Reporting**: Views join `loan`, `member`, `book`, and `author` (or `book_copy` after migration) to expose overdue loans, member loan stats, and popular books. +5. **Migration**: `04_migration_v2.sql` introduces `branch` and `book_copy`, removes aggregate copy columns from `book`, and adds foreign keys to `loan` and `member`. + +#### Dependencies +- **Internal**: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. +- **External**: PostgreSQL built‑in types, sequences, and standard functions (`now()`, `CURRENT_DATE`). +- **Triggers**: `trg_loan_audit` on `loan` after insert or update of `returned_on`. + +#### Cross-cutting +- **Constraints**: foreign keys, uniqueness, check constraints (e.g., `copies_free <= copies_total`, `status` enum, `birth_year` range). +- **Indexes**: `idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_book_copy_book`, `idx_popular_books_id`. +- **Audit pattern**: `loan_audit` table and trigger function log every checkout and return. +- **Branch normalization**: migration replaces total/free copy counts with per‑copy status, enabling multi‑branch support. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..5c013d89 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,51 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:57:11Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A collection of database‑centric modules that manage library lending, e‑commerce order lines, and warehouse stock synchronization, each exposing stored procedures, functions, and audit mechanisms for transactional integrity and reporting. + +#### Purpose +- Persist and enforce business rules for library catalog, member, and loan data. +- Handle order line creation, stock reservation, and order total updates in a web shop. +- Synchronize warehouse inventory with supplier feeds and log each sync run. + +#### Responsibilities +- **Library** – data definition, business logic (checkout/return, late fees), reporting views, schema evolution, and seeding. +- **Shop** – order line CRUD, stock reservation with row locking, and order total recalculation. +- **Warehouse** – ingest supplier feed, reconcile stock levels, and audit sync runs. + +#### Key units +- **Library** + - Tables: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. + - Functions/Procedures: `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `trg_loan_audit_fn`. + - Views: `overdue_loans`, `member_loan_stats`, `popular_books`. +- **Shop** + - Tables: `product`, `customer_order`, `order_item`. + - Procedure: `add_order_item(p_order_id, p_sku, p_qty)`. +- **Warehouse** + - Tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. + - Procedure: `dbo.usp_SyncStock(@Since)`. + +#### Data flow +1. **Library** – `fn_checkout_book` validates member/copy, inserts `loan`, updates `book.copies_free`, triggers `loan_audit`. `sp_return_book` updates `loan.returned_on`, restores `book.copies_free`, triggers audit. `fn_late_fee` calculates overdue charges. Views aggregate loan data for reporting. +2. **Shop** – `add_order_item` locks `product`, checks stock, inserts/updates `order_item`, decrements `product.stock`, recomputes `customer_order.total_cents`. +3. **Warehouse** – `usp_SyncStock` aggregates `SupplierFeed` since a timestamp, merges into `StockLevel`, records counts, and logs the run in `SyncLog`. + +#### Dependencies +- **Internal** – cross‑module tables (`author`, `book`, `member`, `loan`, `product`, `customer_order`, `order_item`, `StockLevel`, `SupplierFeed`, `SyncLog`). +- **External** – PostgreSQL built‑in functions (`now()`, `CURRENT_DATE`), MySQL 8 features (`SELECT … FOR UPDATE`, `ON DUPLICATE KEY`, `SIGNAL`), SQL Server system functions (`SYSUTCDATETIME()`, `ERROR_MESSAGE()`). + +#### Cross-cutting +- **Audit** – `loan_audit` table and trigger log every checkout/return; `SyncLog` records each warehouse sync. +- **Constraints & Indexes** – foreign keys, uniqueness, check constraints (e.g., `copies_free <= copies_total`), and indexes (`idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_book_copy_book`). +- **Concurrency** – row‑level locking on `product` in Shop; transactional integrity in Warehouse sync. +- **Error handling** – MySQL `SIGNAL` for stock errors; SQL Server error capture in `SyncLog` and rethrow. +- **Schema evolution** – Library migration v2 normalizes branches and book copies, replacing aggregate copy counts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..4043ab11 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,70 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:55:56Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Adds an item to an existing order, reserves product stock, and updates the order total in a MySQL 8 web‑shop. + +#### Purpose +- Insert or update an order line. +- Reserve product stock. +- Recalculate the order total. + +#### Type +- Table: `product`, `customer_order`, `order_item`. +- Procedure: `add_order_item`. +- Dialect: MySQL 8. + +#### Schema +- **product** + - `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `sku VARCHAR(40) NOT NULL` UNIQUE `uk_product_sku` + - `name VARCHAR(200) NOT NULL` + - `price_cents INT UNSIGNED NOT NULL` + - `stock INT NOT NULL DEFAULT 0` +- **customer_order** + - `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `customer_id BIGINT UNSIGNED NOT NULL` + - `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW' + - `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` + - `total_cents INT UNSIGNED NOT NULL DEFAULT 0` + - Index `idx_order_customer (customer_id, created_at)` +- **order_item** + - `order_id BIGINT UNSIGNED NOT NULL` + - `product_id INT UNSIGNED NOT NULL` + - `quantity SMALLINT UNSIGNED NOT NULL` + - `unit_price_cents INT UNSIGNED NOT NULL` + - PK `(order_id, product_id)` + - FK `fk_item_order` → `customer_order(order_id)` ON DELETE CASCADE + - FK `fk_item_product` → `product(product_id)` + +#### Reads +- `product` (sku, stock, price_cents) – SELECT FOR UPDATE. +- `order_item` (order_id, quantity, unit_price_cents) – subquery for total. +- `customer_order` (order_id) – subquery for total. + +#### Writes +- `order_item` – INSERT 1 row (or UPDATE existing row via ON DUPLICATE KEY). +- `product` – UPDATE 1 row (stock decrement). +- `customer_order` – UPDATE 1 row (total_cents recalculated). + +#### Relationships +- `order_item.order_id` → `customer_order.order_id` (FK, cascade delete). +- `order_item.product_id` → `product.product_id` (FK). + +#### Routine logic +- Parameters: `p_order_id`, `p_sku`, `p_qty`. +- Lookup `product_id` and `price_cents` where `sku` matches and `stock >= p_qty`; lock row. +- If not found, SIGNAL error. +- INSERT into `order_item`; if duplicate, increment `quantity`. +- Decrement `product.stock` by `p_qty`. +- Recalculate `customer_order.total_cents` as sum of `quantity * unit_price_cents` for the order. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item`. +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..c70b4005 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,47 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:57:06Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> A MySQL 8 stored procedure that adds or updates an order line, reserves stock, and updates the order total in a web‑shop. + +#### Purpose +- Manage order line creation/updating. +- Reserve product inventory. +- Keep order totals accurate. + +#### Responsibilities +- **Order line handling** – insert or merge into `order_item`. +- **Stock reservation** – decrement `product.stock` with row locking. +- **Order total recalculation** – update `customer_order.total_cents` after changes. + +#### Key units +- **Tables** + - `product` – product catalog, price, stock. + - `customer_order` – order header, status, total. + - `order_item` – line items linking orders to products. +- **Procedure** + - `add_order_item(p_order_id, p_sku, p_qty)` – core routine. + +#### Data flow +1. `add_order_item` receives order ID, SKU, and quantity. +2. Locks the matching `product` row (`SELECT … FOR UPDATE`). +3. Validates stock ≥ quantity; signals error if insufficient. +4. Inserts or updates `order_item` (using `ON DUPLICATE KEY`). +5. Decrements `product.stock` by quantity. +6. Recalculates `customer_order.total_cents` as the sum of all line totals for that order. + +#### Dependencies +- **Internal** – `product`, `customer_order`, `order_item` tables. +- **External** – MySQL 8 features: `SELECT … FOR UPDATE`, `ON DUPLICATE KEY`, `SIGNAL`. + +#### Cross-cutting +- Row‑level locking on `product` to prevent race conditions. +- Consistent use of `INT UNSIGNED` for monetary amounts (`price_cents`, `total_cents`). +- Error handling via `SIGNAL` for insufficient stock. +- Cascading delete from `customer_order` to `order_item` via FK. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..879d02da --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,43 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:57:09Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Keeps the warehouse inventory in sync with incoming supplier feeds and records each sync run. + +#### Purpose +- Aggregate supplier feed data into the warehouse stock level table. +- Persist a log of each synchronization run. + +#### Responsibilities +- **Data ingestion** – read `dbo.SupplierFeed` rows since a given timestamp. +- **Stock reconciliation** – merge aggregated quantities into `dbo.StockLevel`. +- **Audit trail** – write a summary of the operation to `dbo.SyncLog`. + +#### Key units +- **`dbo.StockLevel`** – table holding current on‑hand quantities per warehouse and SKU. +- **`dbo.SupplierFeed`** – staging table for raw supplier feed rows. +- **`dbo.SyncLog`** – table recording each sync run (start time, rows inserted/updated, error message). +- **`dbo.usp_SyncStock`** – stored procedure that orchestrates the sync: aggregates, merges, logs, and handles errors. + +#### Data flow +1. Caller supplies `@Since` timestamp to `usp_SyncStock`. +2. Procedure aggregates `SupplierFeed` rows (`WarehouseId, Sku, SUM(Quantity)`) where `ReceivedAt >= @Since`. +3. `MERGE` into `StockLevel`: update existing rows or insert new ones, adjusting `OnHand` and `UpdatedAt`. +4. Capture counts of inserted and updated rows. +5. Insert a single row into `SyncLog` with the counts and any error message. +6. Commit or rollback the transaction. + +#### Dependencies +- **Internal** – `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. +- **System** – `SYSUTCDATETIME()`, `@@TRANCOUNT`, `ERROR_MESSAGE()`. + +#### Cross-cutting +- Transactional integrity: all changes are wrapped in a single transaction with rollback on error. +- Error handling: logs error message in `SyncLog` and rethrows for external handling. +- Timestamping: uses UTC (`SYSUTCDATETIME()`) for consistency across warehouses. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..01f65e77 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/benchmark-oop/run3/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,73 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T07:56:01Z +- G: +- A: 0.0.0 +- X: file +- P: D53C8943 +--- +> Synchronises supplier stock feed into the warehouse stock level table and records the operation outcome. + +#### Purpose +- Updates `dbo.StockLevel` with aggregated supplier feed data. +- Logs each sync run in `dbo.SyncLog`. + +#### Type +- **Table**: `dbo.StockLevel` (SQL Server T‑SQL) +- **Table**: `dbo.SupplierFeed` (SQL Server T‑SQL) +- **Table**: `dbo.SyncLog` (SQL Server T‑SQL) +- **Procedure**: `dbo.usp_SyncStock` (SQL Server T‑SQL) + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT 0` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT SYSUTCDATETIME()` + - **PK**: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + - **PK**: `PK_SupplierFeed (FeedRowId)` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + - **PK**: `PK_SyncLog (SyncLogId)` + +#### Reads +- `dbo.SupplierFeed` – `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt` (filtered by `@Since`). +- `dbo.StockLevel` – `WarehouseId`, `Sku`, `OnHand` (for merge match). + +#### Writes +- `dbo.StockLevel` – `OnHand`, `UpdatedAt` (UPDATE) or new rows (INSERT). +- `dbo.SyncLog` – one row per sync run (`StartedAt`, `RowsInserted`, `RowsUpdated`, optional `ErrorMessage`). + +#### Relationships +- None (no foreign keys defined). + +#### Routine logic +- **Parameters**: `@Since DATETIME2(0)` +- **Steps**: + 1. Capture start time `@Started`. + 2. Aggregate `SupplierFeed` rows since `@Since` by `WarehouseId, Sku` → `Quantity`. + 3. `MERGE` into `StockLevel`: + - `WHEN MATCHED`: add `Quantity` to `OnHand`, update `UpdatedAt`. + - `WHEN NOT MATCHED`: insert new row with `OnHand = Quantity`. + 4. Capture merge actions in table variable `@Changes`. + 5. Insert a log row into `SyncLog` with counts of INSERT and UPDATE actions. + 6. Commit transaction; on error rollback, log error, rethrow. + +#### Dependencies +- Tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. +- Functions: `SYSUTCDATETIME()`. +- System objects: `@@TRANCOUNT`, `ERROR_MESSAGE()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/meta/gpt-6-luna.json new file mode 100644 index 00000000..5e67f3b4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/meta/gpt-6-luna.json @@ -0,0 +1,99 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "bpmn-facts.tsv": "6c40615d07d1f0971e6cbf6068428021551f3155a3024650b28478ada9af1066", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "004e053df906af334fbd182adb450ecd3b82dac9c45366d491695c6990fffcd3", + "java-facts.tsv": "9e91b340d71dd08fca2a0a59e34e99ba11f31e612a261ea74fc39ef08f256daf", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T08:06:43Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 97.0, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 101.6, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.4, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T08:10:05Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 27671, + "cachedPromptTokens": 15837, + "completionTokens": 9601, + "seconds": 96.3549674 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.006142, + "costUsd": 0.014451, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/meta/gpt-oss-20b.json new file mode 100644 index 00000000..e349510c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/meta/gpt-oss-20b.json @@ -0,0 +1,99 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "bpmn-facts.tsv": "6c40615d07d1f0971e6cbf6068428021551f3155a3024650b28478ada9af1066", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "004e053df906af334fbd182adb450ecd3b82dac9c45366d491695c6990fffcd3", + "java-facts.tsv": "9e91b340d71dd08fca2a0a59e34e99ba11f31e612a261ea74fc39ef08f256daf", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T08:10:05Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 70.6, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 106.0, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.4, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T08:13:05Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 28741, + "cachedPromptTokens": 4864, + "completionTokens": 8832, + "seconds": 70.0132154 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.00201, + "costUsd": 0.002137, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..b2414826 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,38 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:08:25Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> Backoffice order management supports order lookup, cancellation with payment refunds, and scheduled cleanup of long-cancelled orders. + +#### Purpose +- Provides role-restricted order operations for backoffice users. +- Maintains cancelled-order retention and audit records. + +#### Responsibilities +- Order API: list open orders, fetch an order by ID, and cancel an order with a refund. +- Scheduled maintenance: purge cancelled orders older than 30 days and record the purge count. + +#### Key units +- `OrderResource` — JAX-RS resource at `/orders` implementing order operations and nightly purge. +- `PURGE_AFTER_DAYS` — configures the cancelled-order retention age to 30 days. + +#### Data flow +- Open-order listing runs `Order.open`; lookup retrieves an order and returns 404 if it is absent. +- Cancellation retrieves the order, refunds its payment reference and total through `PaymentGateway`, marks it `CANCELLED`, records `order.cancelled`, and returns 204. +- Daily purge runs `Order.purgeCancelled` with the age threshold and records the number removed as `order.purged`. + +#### Dependencies +- Persistence: injected `EntityManager`, `Order`, `OrderStatus`, and named queries `Order.open` and `Order.purgeCancelled`. +- Integrations: `PaymentGateway` for refunds and `AuditLog` for event recording. +- Jakarta EE: JAX-RS, EJB, persistence injection, and dependency injection APIs. + +#### Cross-cutting +- Access is restricted to the `backoffice` and `admin` roles. +- Cancellation uses `TransactionAttributeType.REQUIRED`; purging runs daily at 02:15. +- Missing orders return HTTP 404; refund, persistence, and audit failures are not explicitly handled. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..13c0a9b1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/java/shop/OrderResource.java.ai.md @@ -0,0 +1,55 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:06:43Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 50211B16 +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Backoffice users can review orders, retrieve an order, cancel it with a payment refund, and purge old cancelled orders nightly. + +#### Purpose +- Provides the `/orders` backoffice API for listing, finding, and cancelling orders. +- Purges cancelled orders older than 30 days and records order audit events. + +#### Type +- `public class OrderResource` — stateless EJB; annotated `@Path("/orders")`, produces JSON, and restricted by `@RolesAllowed({"backoffice", "admin"})`. + +#### Input +- Injected `EntityManager em` for order lookup and named queries. +- Injected `PaymentGateway payments` for refunds. +- Injected `AuditLog audit` for event recording. +- `find(long id)` and `cancel(long id)` receive the order ID as a path parameter. +- `PURGE_AFTER_DAYS = 30` supplies the purge age parameter. + +#### Output +- `openOrders()` returns the result list of open orders. +- `find(long id)` returns HTTP 404 when absent, otherwise HTTP 200 with the order. +- `cancel(long id)` returns HTTP 404 when absent, otherwise HTTP 204 after refund, status update, and audit recording. +- `purgeCancelled()` executes the purge query and records the number removed. + +#### Core logic +- `openOrders()` executes named query `Order.open`. +- `find(long id)` loads an `Order` by ID and builds a not-found or success response. +- `cancel(long id)` loads the order; if found, refunds its payment reference and total, sets status to `OrderStatus.CANCELLED`, and records `order.cancelled`. +- `cancel(long id)` uses `@TransactionAttribute(TransactionAttributeType.REQUIRED)`. +- `purgeCancelled()` runs daily at 02:15, binds `days` to `PURGE_AFTER_DAYS`, executes `Order.purgeCancelled`, and records `order.purged`. + +#### Public API +- `openOrders()` -> `List` — list open orders +- `find(long id)` -> `Response` — retrieve order by ID +- `cancel(long id)` -> `Response` — refund and cancel order + +#### Dependencies +- `Order`, `OrderStatus`, `PaymentGateway`, `AuditLog` +- `EntityManager`, `List`, `Response`, `MediaType` +- Jakarta annotations: `@Stateless`, `@Path`, `@Produces`, `@RolesAllowed`, `@PersistenceContext`, `@Inject`, `@EJB`, `@GET`, `@POST`, `@PathParam`, `@TransactionAttribute`, `@Schedule` + +#### Exceptions / Errors +- Missing orders produce HTTP 404 for lookup and cancellation. +- No explicit exception handling; refund, persistence, or audit failures are not handled here. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/java/shop/package.ai.md new file mode 100644 index 00000000..6ad471b9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/java/shop/package.ai.md @@ -0,0 +1,38 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:08:20Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Backoffice users can review orders, retrieve individual orders, cancel them with payment refunds, and automatically purge old cancelled orders. + +#### Purpose +- Exposes order listing, lookup, and cancellation operations for backoffice users. +- Purges cancelled orders older than 30 days and records audit events. + +#### Responsibilities +- Order API: list open orders, retrieve an order by ID, and cancel an order with a refund. +- Scheduled maintenance: purge aged cancelled orders and record the purge count. + +#### Key units +- `OrderResource` — stateless JAX-RS resource at `/orders`, providing the order API and nightly purge. +- `PURGE_AFTER_DAYS` — sets the purge age to 30 days. + +#### Data flow +- `openOrders()` runs `Order.open` and returns its result list; `find(id)` loads an `Order` and returns 404 if absent. +- `cancel(id)` loads the order, returns 404 if absent, or refunds its payment reference and total, marks it `CANCELLED`, records `order.cancelled`, and returns 204. +- `purgeCancelled()` runs `Order.purgeCancelled` with the age parameter, then records the number removed as `order.purged`. + +#### Dependencies +- Persistence: injected `EntityManager`, `Order`, `OrderStatus`, and named queries `Order.open` and `Order.purgeCancelled`. +- Integrations: `PaymentGateway` for refunds and `AuditLog` for event recording. +- Jakarta EE APIs: JAX-RS `Response` and annotations, EJB annotations, persistence injection, and dependency injection. + +#### Cross-cutting +- Access is restricted to the `backoffice` and `admin` roles. +- Cancellation uses `TransactionAttributeType.REQUIRED`; purging is scheduled daily at 02:15. +- Missing orders return HTTP 404; refund, persistence, and audit failures are not explicitly handled. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/.github/package.ai.md new file mode 100644 index 00000000..43487e13 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/.github/package.ai.md @@ -0,0 +1,23 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:08:34Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Automates verification, container release, and production deployment of the orders backoffice. + +#### Purpose +- Coordinate release checks, version-tagged image publishing, and production deployment. + +#### Responsibilities +- **Release workflow routing:** Expose the `workflows/` automation that builds, publishes, and deploys the backoffice. + +#### Key units +- `workflows/` — Contains the release workflow and its build, image-publication, and deployment stages. + +#### Data flow +- Release workflow details and execution flow are summarized under `workflows/`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..38537116 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,43 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:08:29Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Automates verification, container publishing, and production deployment of the orders backoffice for releases. + +#### Purpose +- Build and test the orders backoffice, publish a version-tagged container image, and trigger its production Kubernetes deployment. + +#### Responsibilities +- **Release verification:** Run Maven `verify -Pci` on Java 21 and 25 using a build matrix. +- **Image publication:** Authenticate to the container registry and push `registry.shop.example/orders-backoffice` with the version tag. +- **Deployment handoff:** Invoke the reusable Kubernetes deployment workflow for the production environment. + +#### Key units +- `release-backoffice` — GitHub Actions workflow triggered by `v*` tag pushes or manual dispatch. +- `build` — Checks out the repository and runs CI verification across the Java matrix. +- `image` — Depends on `build`; builds and pushes the version-tagged backoffice image. +- `deploy` — Depends on `image`; calls `./.github/workflows/deploy-k8s.yml` with `environment: production`. + +#### Data flow +- A version-tag push or manual dispatch starts the workflow. +- `build` verifies the application on Java 21 and 25; successful completion gates `image`. +- `image` logs in with registry secrets and pushes the image tagged from `GITHUB_REF_NAME` with the leading `v` removed. +- Successful publication gates `deploy`, which passes the production environment and inherits secrets. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Build tool and runtime distribution: Maven, Temurin. +- Container registry: `registry.shop.example`; image `registry.shop.example/orders-backoffice`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. + +#### Cross-cutting +- Build, image publication, and deployment are ordered through job dependencies. +- Build verification uses a Java-version matrix; registry publishing uses the `production` environment. +- Workflow permissions are limited to `contents: read` and `packages: write`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..95686ce9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,65 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:06:49Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds and tests the orders backoffice on Java 21 and 25, publishes its container image on version-tagged releases, and invokes the production Kubernetes deployment workflow. + +#### Purpose +- Release pipeline for the orders backoffice application. +- Builds and tests with Maven, pushes a container image, then delegates deployment. + +#### Type +- GitHub Actions workflow named `release-backoffice`. + +#### Definitions +- Triggers: + - `push` tags matching `v*`. + - `workflow_dispatch`. +- Permissions: `contents: read`, `packages: write`. +- Job `build`: + - Runner: `ubuntu-24.04`. + - Matrix: `java` values `21`, `25`. + - Steps, in order: + 1. `actions/checkout@v4`. + 2. `actions/setup-java@v4` with Temurin and `${{ matrix.java }}`. + 3. `Build and test`: `mvn -B verify -Pci`. +- Job `image`: + - Needs `build`; runner `ubuntu-24.04`; environment `production`. + - Steps, in order: + 1. `actions/checkout@v4`. + 2. `Log in to the registry`: `docker/login-action@v3`. + 3. `Push the image`: builds and pushes `registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v}`. +- Job `deploy`: + - Needs `image`. + - Reusable workflow: `./.github/workflows/deploy-k8s.yml`. + - Passes `environment: production`; inherits secrets. + +#### Configuration +- `name=release-backoffice`. +- `permissions.contents=read`. +- `permissions.packages=write`. +- `strategy.matrix.java`: `21`, `25`. +- `distribution=temurin`. +- `java-version=${{ matrix.java }}`. +- `registry=registry.shop.example`. +- `username=${{ secrets.REGISTRY_USER }}`. +- `password=${{ secrets.REGISTRY_TOKEN }}`. +- `environment=production`. +- Image tag expression: `${GITHUB_REF_NAME#v}`. +- Deploy input `environment=production`; `secrets=inherit`. + +#### Dependencies +- Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Build tool: Maven. +- Registry and image: `registry.shop.example/orders-backoffice`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. +- Secrets: `secrets.REGISTRY_USER`, `secrets.REGISTRY_TOKEN`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/package.ai.md new file mode 100644 index 00000000..c4e1182a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/actions/package.ai.md @@ -0,0 +1,20 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:08:37Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Automates verification, container-image release, and production deployment of the orders backoffice. + +#### Purpose +- Coordinate release checks and production delivery of the orders backoffice. + +#### Responsibilities +- **Release automation:** Route workflow stages for building, publishing version-tagged images, and deploying to production. + +#### Key units +- `workflows/` — Contains the release workflow and its build, image-publication, and deployment stages. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..65d4b3ca --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,50 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:06:56Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 7ADEA688 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1; decisions: 0; decision rules: 0 + +> Defines executable order fulfilment with stock reservation, payment-dependent approval, shipping, invoicing, and cancellation paths. + +#### Purpose +- Orchestrates an order from placement through fulfilment or out-of-stock cancellation. +- Routes large orders for back-office approval and delegates shipping and invoicing. + +#### Type +- BPMN process file; root `bpmn:definitions`. +- Namespaces: `bpmn` = `http://www.omg.org/spec/BPMN/20100524/MODEL`; `bpmndi` = `http://www.omg.org/spec/BPMN/20100524/DI`; `dc` = `http://www.omg.org/spec/DD/20100524/DC`; `camunda` = `http://camunda.org/schema/1.0/bpmn`. + +#### Definitions +- Process `orderFulfilment` (`Order fulfilment`), executable: + - Start event `orderPlaced` → service task `reserveStock` → message catch event `waitForPayment` → exclusive gateway `amountCheck`. + - Gateway routes `large` to user task `approveOrder` when `${order.total > 1000}`; routes `small` to service task `shipOrder` when `${order.total <= 1000}`. Approval also leads to `shipOrder`. + - `shipOrder` → call activity `createInvoice` → end event `orderCompleted`. + - Error boundary event `stockMissing` on `reserveStock` → end event `orderCancelled`. +- Service task `reserveStock` calls class `shop.bpm.ReserveStockDelegate`. +- User task `approveOrder` is assigned to candidate group `backoffice`. +- Service task `shipOrder` uses external topic `shipping`. +- Call activity `createInvoice` invokes `invoicing`. +- Message `msgPaymentReceived` is named `PaymentReceived`; catch event `waitForPayment` waits for it. +- Error `errOutOfStock` is named `OutOfStock`, with error code `STOCK_EMPTY`; boundary event `stockMissing` references it. + +#### Configuration +- `orderFulfilment`: `isExecutable="true"`. +- Gateway conditions: `${order.total > 1000}` and `${order.total <= 1000}`. +- `reserveStock`: `camunda:class="shop.bpm.ReserveStockDelegate"`. +- `approveOrder`: `camunda:candidateGroups="backoffice"`. +- `shipOrder`: `camunda:type="external"`, `camunda:topic="shipping"`. +- `createInvoice`: `calledElement="invoicing"`. + +#### Dependencies +- Delegate class: `shop.bpm.ReserveStockDelegate`. +- External task topic: `shipping`. +- Called process: `invoicing`. +- Message dependency: `PaymentReceived` (`msgPaymentReceived`). +- Error dependency: `OutOfStock` (`errOutOfStock`; code `STOCK_EMPTY`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/bpmn/package.ai.md new file mode 100644 index 00000000..18f22f50 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/bpmn/package.ai.md @@ -0,0 +1,44 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:08:39Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> Coordinates order fulfilment from stock reservation and payment receipt through approval, shipping, invoicing, or out-of-stock cancellation. + +#### Purpose +- Defines an executable BPMN process for order completion and cancellation. +- Applies amount-based approval routing before shipping. + +#### Responsibilities +- Reserve stock and cancel the order when stock is unavailable. +- Wait for payment, route orders over 1000 to back-office approval, and ship eligible or approved orders. +- Invoke invoicing after shipping and mark the order complete. + +#### Key units +- `orderFulfilment` — executable process coordinating the order lifecycle. +- `reserveStock` — service task bound to `shop.bpm.ReserveStockDelegate`. +- `amountCheck` — exclusive gateway routing orders by `order.total`. +- `approveOrder` — user task assigned to candidate group `backoffice`. +- `shipOrder` — external task using topic `shipping`. +- `createInvoice` — call activity invoking `invoicing`. +- `waitForPayment` — message catch event waiting for `PaymentReceived`. +- `stockMissing` — boundary error event for `OutOfStock` (`STOCK_EMPTY`). + +#### Data flow +- `orderPlaced` starts the process; `reserveStock` runs before `waitForPayment`. +- After payment, `amountCheck` routes orders over 1000 to `approveOrder`; orders at or below 1000 proceed directly to `shipOrder`. +- Shipping leads to `createInvoice` and `orderCompleted`; an `OutOfStock` error from stock reservation leads to `orderCancelled`. + +#### Dependencies +- Java delegate: `shop.bpm.ReserveStockDelegate`. +- External task topic: `shipping`; called process: `invoicing`. +- BPMN message: `PaymentReceived`; BPMN error: `OutOfStock` with code `STOCK_EMPTY`. + +#### Cross-cutting +- Camunda configuration binds the stock delegate, shipping topic, and back-office candidate group. +- Routing uses the conditions `${order.total > 1000}` and `${order.total <= 1000}`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..77cc46a7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/docker/Dockerfile.ai.md @@ -0,0 +1,42 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:07:02Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds and runs the Orders Backoffice Java application in a production-configured container. + +#### Purpose +- Packages `orders-backoffice.jar` with Maven, then runs it on a Java 21 JRE Alpine image. +- Runs as the non-root `backoffice` user and checks `http://localhost:8080/health/live`. + +#### Type +- Multi-stage Dockerfile. + +#### Definitions +- `build` stage: `maven:3.9-eclipse-temurin-21`; working directory `/src`. + - Copies `pom.xml` to `/src/pom.xml`; runs `mvn -B dependency:go-offline`. + - Copies `src` to `/src/src`; runs `mvn -B package -DskipTests`. +- Final stage: `eclipse-temurin:21-jre-alpine`. + - Creates group `shop` and user `backoffice` in that group. + - Copies `/src/target/orders-backoffice.jar` to `/opt/shop/orders-backoffice.jar` from `build`. + - Exposes port `8080`; runs as `backoffice`. + - Healthcheck: interval `30s`; runs `wget -qO- http://localhost:8080/health/live || exit 1`. + - Entrypoint: `sh -c "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"`. + +#### Configuration +- `APP_VERSION=2.1.0` build argument. +- `JAVA_OPTS="-XX:MaxRAMPercentage=75"`. +- `SHOP_PROFILE=production`. + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine`. +- Build input: `pom.xml`, `src`. +- Artifact: `/src/target/orders-backoffice.jar`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/docker/package.ai.md new file mode 100644 index 00000000..7c50e84e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/docker/package.ai.md @@ -0,0 +1,33 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:08:44Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> Packages and runs the Orders Backoffice Java application as a production-configured container. + +#### Purpose +- Builds `orders-backoffice.jar` with Maven and runs it on Java 21. +- Exposes the application on port `8080` and checks its `/health/live` endpoint. + +#### Responsibilities +- Build stage: resolves Maven dependencies and packages the application with tests skipped. +- Runtime stage: installs the JAR, configures a non-root `backoffice` user, and launches the application. + +#### Key units +- `Dockerfile`: defines the multi-stage build, production runtime, Java entrypoint, and healthcheck. + +#### Data flow +- `pom.xml` and `src` → Maven build → `/src/target/orders-backoffice.jar` → `/opt/shop/orders-backoffice.jar` → Java process. + +#### Dependencies +- Build image: `maven:3.9-eclipse-temurin-21`; runtime image: `eclipse-temurin:21-jre-alpine`. +- Runtime configuration: `SHOP_PROFILE=production`, `JAVA_OPTS="-XX:MaxRAMPercentage=75"`. + +#### Cross-cutting +- Runs as non-root user `backoffice` in group `shop`. +- Healthcheck polls `http://localhost:8080/health/live` every `30s`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..a08642dd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,46 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:07:07Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> The checkout page collects a delivery address and shipping method, shows the calculated EUR total, and lets the customer place an order. + +#### Purpose +- Capture checkout address and shipping selection. +- Recalculate the displayed total when the shipping method changes; submit the order. + +#### Type +- Jakarta Faces Facelets page; XHTML. +- Namespaces: `h` = Jakarta Faces HTML, `f` = Jakarta Faces core, `ui` = Jakarta Faces Facelets; default namespace = XHTML. + +#### Data +- `checkoutBean.address.street` — street address. +- `checkoutBean.address.zip` — postal code. +- `checkoutBean.shippingMethod` — selected shipping method. +- `checkoutBean.shippingMethods` — options for the shipping selector. +- `checkoutBean.total` — displayed order total. + +#### Actions +- `checkoutForm` — Faces form; no explicit action or method. +- Place order button invokes `checkoutBean.placeOrder`. +- Shipping selector invokes `checkoutBean.recalculate` through Ajax and rerenders `total`. +- Postal code uses `f:validateRegex` with pattern `[0-9]{5}`. +- Total uses `f:convertNumber` with currency type and `EUR`. +- An HTML-commented button references `checkoutBean.saveCart`; it is commented markup. + +#### Structure +- Uses template `/WEB-INF/templates/shop.xhtml`; defines `content`. +- Includes `/WEB-INF/includes/payment-hints.xhtml`. + +#### Dependencies +- `checkoutBean` +- `/WEB-INF/templates/shop.xhtml` +- `/WEB-INF/includes/payment-hints.xhtml` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/facelets/package.ai.md new file mode 100644 index 00000000..bb645aec --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/facelets/package.ai.md @@ -0,0 +1,36 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:08:47Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> Collects a customer’s delivery details and shipping choice, updates the order total, and submits the order. + +#### Purpose +- Capture checkout address and shipping method. +- Display the EUR total and let the customer place an order. + +#### Responsibilities +- `checkout.xhtml` provides the checkout form, validates the five-digit postal code, and formats the total as EUR. +- Shipping-method changes trigger recalculation and update the displayed total through Ajax. + +#### Key units +- `checkout.xhtml` — Jakarta Faces Facelets page defining the checkout form and `content` template section. +- `checkoutBean` — supplies address, shipping options, selected method, and total; handles recalculation and order placement. + +#### Data flow +- The customer enters street and ZIP code and selects a shipping method; the page binds these values to `checkoutBean`. +- Shipping selection invokes `checkoutBean.recalculate` and rerenders the total; the place-order button invokes `checkoutBean.placeOrder`. + +#### Dependencies +- `/WEB-INF/templates/shop.xhtml` — page template. +- `/WEB-INF/includes/payment-hints.xhtml` — included payment guidance. +- Jakarta Faces HTML, core, and Facelets namespaces. + +#### Cross-cutting +- Postal-code validation uses `f:validateRegex` with `[0-9]{5}`; total display uses `f:convertNumber` with currency `EUR`. +- A commented-out button references `checkoutBean.saveCart`; it is not active markup. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..f196c993 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,64 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:07:13Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Calculates parcel shipping charges by order value and weight, including free-shipping eligibility and rejection of overweight parcels. + +#### Purpose +- `ShippingRulesSpec` verifies free shipping, weight-tier pricing, and overweight rejection. +- `ShippingRules` calculates shipping cost using order totals and parcel weights. + +#### Type +- `ShippingRulesSpec` — class; extends `Specification`; defines `FREE_SHIPPING_THRESHOLD` and initializes `rules`. +- `ShippingRules` — class; annotated `@CompileStatic`; has `carrier` and `maxParcelKg` properties. +- `ShippingRules` has no explicitly declared superclass or interfaces beyond Groovy defaults. + +#### Input +- `ShippingRules.costFor(Order order)` reads `order.weightKg` and `order.total`. +- `ShippingRules` receives `carrier` and `maxParcelKg` through property assignment; the spec initializes them as `'DHL'` and `31.5`. +- `ShippingRulesSpec` test cases construct `Order` instances with totals and weights; its private helper accepts `BigDecimal kg`. + +#### Output +- `costFor` returns `BigDecimal` shipping charges: `0`, `4.99`, `9.99`, or `19.99`. +- `costFor` throws `ParcelTooHeavyException` when the parcel exceeds `maxParcelKg`. +- `ShippingRulesSpec` produces Spock assertions for free shipping, tier prices, and rejection behavior. + +#### Core logic +- `costFor` first rejects weights above `maxParcelKg`. +- Orders whose total is at least `ShippingRulesSpec.FREE_SHIPPING_THRESHOLD` receive free shipping. +- Otherwise, it selects the first weight tier whose `upTo` covers the parcel: up to 2 kg costs `4.99`, up to 10 kg costs `9.99`, and up to 31.5 kg costs `19.99`. +- `ShippingRulesSpec` checks a 75.00 order ships free, tests three tier prices with `@Unroll`, and expects `ParcelTooHeavyException` for a 40 kg parcel. +- The private `heavyOrder(BigDecimal kg)` helper creates an order totaling 10. + +#### Public API +- `orders above the threshold ship for free()` -> `def` — verifies free shipping. +- `a parcel of #weight kg costs #expected()` -> `def` — verifies weight-tier prices. +- `an overweight parcel is rejected()` -> `def` — verifies overweight rejection. +- `FREE_SHIPPING_THRESHOLD` — `BigDecimal` constant. +- `rules` — inferred property — configured shipping rules. +- `carrier` — `String` property; `getCarrier()`/`setCarrier(String)` -> carrier value. +- `maxParcelKg` — `BigDecimal` property; `getMaxParcelKg()`/`setMaxParcelKg(BigDecimal)` -> parcel weight limit. +- `costFor(Order order)` -> `BigDecimal` — calculates order shipping charge. + +#### Dependencies +- `groovy.transform.CompileStatic` +- `spock.lang.Specification` +- `spock.lang.Unroll` +- `Order` +- `ParcelTooHeavyException` + +#### Exceptions / Errors +- Throws `ParcelTooHeavyException` when `order.weightKg > maxParcelKg`. +- No explicit null handling. + +#### Concurrency +- No concurrency or synchronization behavior. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/groovy/package.ai.md new file mode 100644 index 00000000..1bfdb384 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/groovy/package.ai.md @@ -0,0 +1,36 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:08:51Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> Calculates order shipping charges from order value and parcel weight, with free-shipping eligibility and overweight-parcel rejection. + +#### Purpose +- Determine shipping costs using a free-shipping threshold and weight-based price tiers. +- Verify shipping rules for free shipping, tier pricing, and overweight parcels. + +#### Responsibilities +- Shipping calculation: reject parcels above the configured weight limit, waive charges for qualifying orders, and otherwise apply the matching weight tier. +- Spock specifications: exercise free-shipping, tier-price, and overweight-rejection behavior. + +#### Key units +- `ShippingRules` — calculates a `BigDecimal` charge in `costFor(Order order)` using `carrier` and `maxParcelKg` properties. +- `ShippingRulesSpec` — configures shipping rules and tests expected charges and rejection behavior; defines `FREE_SHIPPING_THRESHOLD`. +- `heavyOrder(BigDecimal kg)` — test helper that creates an order totaling 10. + +#### Data flow +- `costFor` reads `Order.weightKg` and `Order.total`; it first rejects weight above `maxParcelKg`, then checks the free-shipping threshold, then selects a weight-tier charge. +- Returns `0` for qualifying orders or `4.99`, `9.99`, or `19.99` for parcels up to 2, 10, or 31.5 kg, respectively; overweight parcels raise `ParcelTooHeavyException`. + +#### Dependencies +- Domain types: `Order`, `ParcelTooHeavyException`. +- Groovy and test libraries: `groovy.transform.CompileStatic`, `spock.lang.Specification`, `spock.lang.Unroll`. + +#### Cross-cutting +- `ShippingRules` uses `@CompileStatic`. +- No concurrency or synchronization behavior is reported; no explicit null handling is defined. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..241fe6b6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/integration/order-routes.xml.ai.md @@ -0,0 +1,35 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:07:20Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Defines Camel order-processing routes that validate incoming orders, send high-value orders for review, and translate other orders for ERP submission. + +#### Type +- Spring / Apache Camel integration XML; root element `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` — `http://www.w3.org/2001/XMLSchema-instance`; `camelContext` declares the default namespace `http://camel.apache.org/schema/spring`. + +#### Definitions +- Beans: `orderValidator` — `shop.integration.OrderValidator`; `invoiceTranslator` — `shop.integration.InvoiceTranslator`. +- Camel context `orderIntegration`; property placeholder `properties` loads `classpath:integration.properties`. +- Route `incomingOrders`: consumes `jms:queue:{{orders.incoming.queue}}`; calls `orderValidator.validate`; sends orders where `${body.total} > {{orders.review.threshold}}` to `direct:manualReview`, otherwise to `direct:toErp`; wire-taps to `seda:orderAudit`. +- Route `toErp`: consumes `direct:toErp`; calls `invoiceTranslator`; dynamically sends to `https://{{erp.host}}/api/orders/${header.orderId}`. +- Route `manualReview`: consumes `direct:manualReview`; splits `${body.lines}` and sends each line to `jms:queue:review.lines`. +- Exception handling for `shop.integration.ErpUnavailableException`: retries up to 5 times, with 2000 ms delay and exponential backoff; marks the exception handled and sends to `jms:queue:orders.deadletter`. + +#### Configuration +- `orders.incoming.queue`, `orders.review.threshold`, `erp.host`: externalized placeholders from `classpath:integration.properties`. +- Redelivery: `maximumRedeliveries="5"`, `redeliveryDelay="2000"`, `useExponentialBackOff="true"`. + +#### Dependencies +- `classpath:integration.properties`. +- Classes: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `shop.integration.ErpUnavailableException`. +- JMS queues: configured incoming queue, `orders.deadletter`, `review.lines`; ERP endpoint host configured by `erp.host`; `seda:orderAudit`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/integration/package.ai.md new file mode 100644 index 00000000..e769f3e7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/integration/package.ai.md @@ -0,0 +1,43 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:08:56Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Processes incoming orders through validation, high-value review, and ERP submission, with audit and failure handling. + +#### Purpose +- Integrates order intake with manual review and ERP order submission. +- Routes failed ERP deliveries to a dead-letter queue after retries. + +#### Responsibilities +- **Order routing:** Validate incoming JMS orders, branch on the configured review threshold, and wire-tap orders to an audit stream. +- **Review and ERP processing:** Split review orders into lines for a JMS queue; translate other orders and submit them to the ERP endpoint. +- **Failure handling:** Retry `ErpUnavailableException` deliveries and route exhausted failures to the dead-letter queue. + +#### Key units +- `orderIntegration` — Camel context containing the order routes and property placeholder. +- `incomingOrders` — validates, branches, and audits incoming orders. +- `toErp` — translates orders and sends them to the configured ERP URL. +- `manualReview` — splits orders into lines for review. +- `orderValidator` (`shop.integration.OrderValidator`) — validates orders. +- `invoiceTranslator` (`shop.integration.InvoiceTranslator`) — translates orders for ERP submission. + +#### Data flow +- Configured incoming JMS queue → `OrderValidator.validate` → audit wire-tap to `seda:orderAudit` and threshold-based routing. +- High-value orders → `manualReview` → split order lines → `review.lines` JMS queue. +- Other orders → `toErp` → `InvoiceTranslator` → ERP URL using the order ID. +- `ErpUnavailableException` → up to five retries with delay and exponential backoff → `orders.deadletter`. + +#### Dependencies +- `classpath:integration.properties` supplies the incoming queue, review threshold, and ERP host. +- `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, and `shop.integration.ErpUnavailableException`. +- JMS queues, `seda:orderAudit`, and the configured ERP HTTP endpoint. + +#### Cross-cutting +- Spring/Camel XML configuration with externalized property placeholders. +- ERP failures use five redeliveries, a 2000 ms delay, and exponential backoff; handled failures go to the dead-letter queue. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..4e168023 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,39 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:07:26Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Configures stock reservation and checkout session beans, an order-placement message listener, timing interception, and transaction behavior. + +#### Purpose +- Declares EJB components and their container-managed environment, messaging, interception, and transaction settings. + +#### Type +- Jakarta EE EJB descriptor; root `ejb-jar`, version `4.0`. +- Namespace: default `https://jakarta.ee/xml/ns/jakartaee`. + +#### Definitions +- Session bean `StockReservationBean`: class `shop.stock.StockReservationBean`, type `Stateless`; environment entry `reservationMinutes` of type `java.lang.Integer`, value `45`. +- Session bean `CheckoutSessionBean`: class `shop.checkout.CheckoutSessionBean`, type `Stateful`; local EJB reference `ejb/StockReservation` to `shop.stock.StockReservation`. +- Message-driven bean `OrderPlacedListener`: class `shop.events.OrderPlacedListener`; activation property `destinationLookup` is `java:/jms/queue/OrderPlaced`. +- Interceptor `shop.audit.TimingInterceptor`; bound to all EJBs via `ejb-name` `*`. +- Transaction attribute `RequiresNew` for method `reserve` on `StockReservationBean`. + +#### Configuration +- `reservationMinutes=45`. +- `destinationLookup=java:/jms/queue/OrderPlaced`. +- `StockReservationBean.reserve` transaction attribute: `RequiresNew`. +- `shop.audit.TimingInterceptor` applies to `*`. + +#### Dependencies +- Classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`. +- Local EJB interface: `shop.stock.StockReservation`. +- JMS destination: `java:/jms/queue/OrderPlaced`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jee/package.ai.md new file mode 100644 index 00000000..16f53bc4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jee/package.ai.md @@ -0,0 +1,45 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:09:01Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> Configures the shop back office’s web access and the EJB services that reserve stock, process checkout, and receive order-placement events. + +#### Purpose +- Defines Jakarta EE web application and EJB deployment settings for shop reporting, admin access, stock reservation, checkout, and order events. +- Declares component wiring, runtime configuration, and transaction behavior. + +#### Responsibilities +- **Web application:** Maps report downloads, applies request-ID filtering, configures startup auditing and session lifetime, and protects admin URLs with the `admin` role. +- **EJB services and messaging:** Declares stock reservation and checkout session beans, an order-placement message listener, and a JMS queue destination. +- **Runtime and resources:** Configures the report directory, JDBC data source reference, stock reservation duration, timing interception, and reservation transaction attribute. + +#### Key units +- `ReportDownloadServlet` (`shop.web.ReportDownloadServlet`) — serves requests at `/reports/*` and loads on startup. +- `RequestIdFilter` (`shop.web.RequestIdFilter`) — filters requests matching `/*`. +- `StartupAuditListener` (`shop.web.StartupAuditListener`) — declared as a web application listener. +- `StockReservationBean` (`shop.stock.StockReservationBean`) — stateless session bean with `reservationMinutes=45`; `reserve` uses `RequiresNew`. +- `CheckoutSessionBean` (`shop.checkout.CheckoutSessionBean`) — stateful session bean with a local reference to `shop.stock.StockReservation`. +- `OrderPlacedListener` (`shop.events.OrderPlacedListener`) — message-driven bean configured for `java:/jms/queue/OrderPlaced`. +- `TimingInterceptor` (`shop.audit.TimingInterceptor`) — bound to all EJBs. + +#### Data flow +- Web requests pass through `RequestIdFilter`; report requests route to `ReportDownloadServlet`, with the report directory configured as `/var/shop/reports`. +- `CheckoutSessionBean` references `StockReservation`; the reservation bean’s `reserve` method runs with `RequiresNew`. +- Order-placement messages are received by `OrderPlacedListener` from the configured JMS destination. + +#### Dependencies +- EJB classes and interface: `shop.stock.StockReservationBean`, `shop.stock.StockReservation`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`. +- Web classes: `shop.web.ReportDownloadServlet`, `shop.web.RequestIdFilter`, `shop.web.StartupAuditListener`. +- External resources: JMS destination `java:/jms/queue/OrderPlaced`; `javax.sql.DataSource` reference `jdbc/ShopDS`. + +#### Cross-cutting +- Descriptors use Jakarta EE namespaces: EJB descriptor version `4.0` and web descriptor version `6.0`. +- EJB timing interception applies to `*`; web security requires the `admin` role for `/admin/*`. +- Web sessions time out after 20 minutes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jee/web.xml.ai.md new file mode 100644 index 00000000..ceda2a9d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jee/web.xml.ai.md @@ -0,0 +1,43 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:07:30Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Configures the shop back-office web application’s report endpoint, request filtering, startup audit, session lifetime, admin access control, and database resource reference. + +#### Purpose +- Declares web application settings and components for `shop-backoffice`. +- Protects admin URLs and configures a JDBC data source reference. + +#### Type +- Jakarta EE web application descriptor; root element `web-app`, version `6.0`. +- Namespace: default `https://jakarta.ee/xml/ns/jakartaee`. + +#### Definitions +- Display name: `shop-backoffice`. +- Servlet: `ReportDownloadServlet` → `shop.web.ReportDownloadServlet`; URL pattern `/reports/*`. +- Filter: `RequestIdFilter` → `shop.web.RequestIdFilter`; URL pattern `/*`. +- Listener: `shop.web.StartupAuditListener`. +- Session timeout: `20` minutes. +- Security constraint `backoffice` protects `/admin/*`; required role: `admin`. +- Security role: `admin`. +- Resource reference: `jdbc/ShopDS`, type `javax.sql.DataSource`. + +#### Configuration +- Context parameter `shop.reportDirectory` = `/var/shop/reports`. +- `ReportDownloadServlet` load-on-startup value: `1`. +- Session timeout: `20` minutes. + +#### Dependencies +- Servlet class: `shop.web.ReportDownloadServlet`. +- Filter class: `shop.web.RequestIdFilter`. +- Listener class: `shop.web.StartupAuditListener`. +- Resource type: `javax.sql.DataSource`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..1c8ab760 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,46 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:07:34Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> The open-orders page lets staff search orders by customer email or status, review totals and overdue status, and cancel an order. + +#### Purpose +- Display open orders and provide order search and cancellation controls. +- Show the effective page size from the order filter, defaulting to 25. + +#### Type +- JSP page; `text/html;charset=UTF-8`. +- `c` = Jakarta Tags core; `fmt` = Jakarta Tags fmt. + +#### Data +- Request attribute `orderFilter`; scriptlet reads `getPageSize()`. +- `${orders}` iterated as `order`; reads `order.number`, `order.total`, `order.overdue`, `order.id`. +- Request parameters: `param.customerEmail`. +- Implicit object: `pageContext.request.contextPath`. + +#### Actions +- GET form to `${pageContext.request.contextPath}/orders/search`; fields: `customerEmail` (text), `status` (select: `OPEN`, `SHIPPED`); submit button `Search`. +- Link `orders/${order.id}/cancel` for each order; no HTTP method specified. + +#### Structure +- Statically includes `/WEB-INF/jspf/header.jspf`. +- Dynamically includes `/WEB-INF/jspf/footer.jspf`. + +#### Server code +- Imports `java.util.List`, `shop.Order`, `shop.OrderFilter`. +- Reads request attribute `orderFilter` as `OrderFilter`; computes `pageSize` using its `getPageSize()` or defaults to 25. + +#### Dependencies +- Tag libraries: `jakarta.tags.core`, `jakarta.tags.fmt`. +- Imported classes: `java.util.List`, `shop.Order`, `shop.OrderFilter`. +- Included files: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf`. +- URLs: `/orders/search`, `orders/${order.id}/cancel`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jsp/package.ai.md new file mode 100644 index 00000000..41c27b9d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/jsp/package.ai.md @@ -0,0 +1,30 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:09:07Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> Staff can search and review open orders, including totals and overdue status, and access order cancellation actions. + +#### Purpose +- Render the open-orders page with customer-email and status search controls. +- Display the effective page size from `orderFilter`, defaulting to 25. + +#### Responsibilities +- Present `${orders}` as order number, total, overdue status, and cancellation link. +- Submit search criteria to `/orders/search` using a GET form. + +#### Key units +- `order-list.jsp` — renders order search and results, reads `orderFilter`, and provides cancellation links. + +#### Data flow +- Reads `orderFilter` from the request to determine page size and iterates `${orders}` for display. +- Sends `customerEmail` and selected status to `/orders/search`; exposes each order’s cancellation URL as `orders/${order.id}/cancel`. + +#### Dependencies +- Uses `shop.Order` and `shop.OrderFilter`, plus Jakarta Tags core and fmt libraries. +- Includes `/WEB-INF/jspf/header.jspf` statically and `/WEB-INF/jspf/footer.jspf` dynamically. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..9a08eb01 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,47 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:07:39Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the shop orders back office with three application replicas, internal service access, and HTTP ingress at `backoffice.shop.example`. + +#### Purpose +- Runs the orders back-office application in Kubernetes. +- Exposes it internally and routes external HTTP traffic to it. + +#### Type +- Kubernetes multi-resource manifest: `Deployment` (`apps/v1`), `Service` (`v1`), `Ingress` (`networking.k8s.io/v1`). + +#### Definitions +- `Deployment` `orders-backoffice`: + - Replicas: `3`; selector and pod label: `app: orders-backoffice`. + - Container `backoffice`: image `registry.shop.example/orders-backoffice:2.1.0`; container port `8080`. + - Readiness probe: HTTP GET `/health/ready` on port `8080`. + - Resource limits: memory `768Mi`, CPU `"1"`. +- `Service` `orders-backoffice`: + - Selects `app: orders-backoffice`. + - Port `80` targets container port `8080`. +- `Ingress` `orders-backoffice`: + - Host `backoffice.shop.example`; `/` with `Prefix` path type routes to service `orders-backoffice` port `80`. + +#### Configuration +- `replicas=3` +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD=***` — sourced from Secret `orders-db-credentials`, key `password`. +- Container port: `8080`; service port: `80`. +- Readiness path: `/health/ready`. +- Resource limits: memory `768Mi`; CPU `"1"`. +- Ingress host: `backoffice.shop.example`; path `/`. + +#### Dependencies +- Image: `registry.shop.example/orders-backoffice:2.1.0`. +- Secret: `orders-db-credentials`, key `password`. +- Database endpoint: `orders-db:5432`, database `shop`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/k8s/package.ai.md new file mode 100644 index 00000000..77758dd9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/k8s/package.ai.md @@ -0,0 +1,39 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:09:10Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Runs the shop orders back office and makes it available internally and through an HTTP endpoint. + +#### Purpose +- Deploys the orders back-office application in Kubernetes with three replicas. +- Routes traffic from `backoffice.shop.example` to the application. + +#### Responsibilities +- **Workload:** Runs `orders-backoffice` and checks readiness at `/health/ready`. +- **Service and ingress:** Exposes container port `8080` internally on service port `80` and routes `/` traffic to that service. +- **Runtime configuration:** Sets the shop database URL and supplies the database password from a Kubernetes Secret. + +#### Key units +- `Deployment/orders-backoffice` — runs image `registry.shop.example/orders-backoffice:2.1.0` with three replicas. +- `Service/orders-backoffice` — selects the back-office pods and targets port `8080`. +- `Ingress/orders-backoffice` — routes requests for `backoffice.shop.example` to the service on port `80`. + +#### Data flow +- HTTP requests for `backoffice.shop.example/` route through the Ingress to the Service, then to an `orders-backoffice` pod. +- The application receives `SHOP_DB_URL` for `orders-db:5432/shop` and `SHOP_DB_PASSWORD` from Secret `orders-db-credentials`, key `password`. + +#### Dependencies +- Image: `registry.shop.example/orders-backoffice:2.1.0`. +- Kubernetes Secret: `orders-db-credentials`. +- Database endpoint: `orders-db:5432`, database `shop`. + +#### Cross-cutting +- Pod selection uses the shared label `app: orders-backoffice`. +- Readiness is determined by HTTP GET `/health/ready` on port `8080`. +- Resource limits are memory `768Mi` and CPU `"1"`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..e659ab39 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,79 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:07:44Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Issues invoices for completed orders, assigns payment deadlines, applies category-based tax rates, and stores invoice records. + +#### Purpose +- `InvoiceService` converts non-empty `CompletedOrder` values into stored invoices with numbered identifiers and due dates. +- `InvoiceLine` calculates line amounts; `List.total()` sums them. + +#### Type +- `InvoiceNumber` — value class (`@JvmInline`), wraps `String`. +- `InvoiceLine` — data class; constructor properties `sku: String`, `quantity: Int`, `unitPrice: BigDecimal`. +- `InvoiceResult` — sealed interface. +- `InvoiceResult.Issued` — data class implementing `InvoiceResult`; properties `number: InvoiceNumber`, `dueDate: LocalDate`. +- `InvoiceResult.Rejected` — data class implementing `InvoiceResult`; property `reason: String`. +- `InvoiceService` — class; primary constructor takes `InvoiceRepository` and a `() -> LocalDate` clock defaulting to `LocalDate::now`. +- `InvoiceService.Companion` — companion object; contains private constant `PREFIX` and public tax-category set. +- Top-level constant `PAYMENT_TERM_DAYS: Int`. +- Top-level extension function on `List`. + +#### Input +- `InvoiceService` receives an `InvoiceRepository` and a date-producing clock. +- `issue` consumes a `CompletedOrder` with `id`, `customerId`, and `lines`. +- `taxRate` consumes a category string. +- `InvoiceLine` receives SKU, quantity, and unit price; `InvoiceNumber` receives a string. + +#### Output +- `issue` returns `InvoiceResult`; successful issuance saves an `Invoice` and returns its number and due date. +- Empty orders produce `InvoiceResult.Rejected` with an order-specific reason. +- `taxRate` returns a `BigDecimal`. +- `InvoiceLine.amount` multiplies unit price by quantity; `total()` sums line amounts. +- `InvoiceService` mutates its private invoice sequence; `defaultCurrency` is publicly readable and writable. + +#### Core logic +- `issue` runs its work in `Dispatchers.IO`. +- Rejects orders with no lines before allocating an invoice number. +- Increments the sequence and formats the number as `INV-N`. +- Sets the due date to the clock date plus `PAYMENT_TERM_DAYS` (14). +- Constructs and saves the invoice, then returns `Issued`. +- `taxRate` returns `0.07` for categories in `REDUCED_TAX_CATEGORIES` (`books`, `food`), otherwise `0.19`. +- `InvoiceLine.total()` folds from `BigDecimal.ZERO`, adding each line’s `amount`. + +#### Public API +- `PAYMENT_TERM_DAYS: Int` — payment term in days. +- `InvoiceNumber(value: String)` — wraps an invoice number. +- `InvoiceLine(sku: String, quantity: Int, unitPrice: BigDecimal)` — creates a priced line. +- `amount: BigDecimal` — calculated line amount. +- `InvoiceResult.Issued(number: InvoiceNumber, dueDate: LocalDate)` — represents issuance. +- `InvoiceResult.Rejected(reason: String)` — represents rejection. +- `InvoiceService(repository: InvoiceRepository, clock: () -> LocalDate = LocalDate::now)` — creates the issuer. +- `REDUCED_TAX_CATEGORIES: Set` — categories receiving reduced tax. +- `defaultCurrency: String` — default currency property. +- `issue(order: CompletedOrder): InvoiceResult` — issues and stores an invoice. +- `taxRate(category: String): BigDecimal` — returns the category tax rate. +- `List.total(): BigDecimal` — sums line amounts. + +#### Dependencies +- `BigDecimal`, `LocalDate` +- `Dispatchers`, `withContext` +- `InvoiceRepository`, `CompletedOrder`, `Invoice` + +#### Exceptions / Errors +- Empty order lines yield `Rejected`; no exception is thrown for this case. +- Repository or clock exceptions are not caught and propagate to the caller. +- `defaultCurrency` is `lateinit`; reading it before initialization fails. + +#### Concurrency +- `issue` is suspending and switches execution to `Dispatchers.IO`. +- Invoice numbering uses a mutable, unsynchronized sequence; concurrent calls are not protected. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/kotlin/package.ai.md new file mode 100644 index 00000000..3204102a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/kotlin/package.ai.md @@ -0,0 +1,44 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:09:15Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> Converts completed orders into numbered invoices, applies payment deadlines and category-based tax rates, and records issued invoices. + +#### Purpose +- Issue and persist invoices for non-empty `CompletedOrder` values, or return a rejection for empty orders. +- Provide invoice-line amount and total calculations plus category tax-rate lookup. + +#### Responsibilities +- Invoice creation and persistence: validate order lines, generate invoice numbers and due dates, construct an `Invoice`, and save it through `InvoiceRepository`. +- Invoice data and calculations: represent invoice numbers, lines, and issuance outcomes; calculate line amounts and list totals. +- Tax and payment terms: apply reduced rates to configured categories and set a 14-day payment deadline. + +#### Key units +- `InvoiceService` — issues invoices, looks up tax rates, and exposes `defaultCurrency`. +- `InvoiceNumber` — value class wrapping an invoice-number string. +- `InvoiceLine` — stores SKU, quantity, and unit price; calculates its amount. +- `InvoiceResult` — sealed outcome type with `Issued` and `Rejected` variants. +- `PAYMENT_TERM_DAYS` — payment deadline interval. +- `REDUCED_TAX_CATEGORIES` — categories receiving the reduced tax rate. +- `List.total()` — sums line amounts. + +#### Data flow +- `issue` receives a `CompletedOrder`; empty `lines` produce an order-specific `Rejected` result before numbering. +- For a non-empty order, the service increments its sequence, formats an `INV-N` number, calculates a due date from the injected clock, constructs and saves an `Invoice`, then returns `Issued`. +- `taxRate` returns `0.07` for `books` and `food`, and `0.19` otherwise; line amounts and totals use `BigDecimal`. + +#### Dependencies +- Domain types: `CompletedOrder`, `Invoice`, `InvoiceRepository`. +- Kotlin/JVM and date, numeric, and coroutine APIs: `BigDecimal`, `LocalDate`, `Dispatchers`, `withContext`. + +#### Cross-cutting +- `issue` is suspending and performs its work in `Dispatchers.IO`. +- The invoice sequence is mutable and unsynchronized; concurrent calls are not protected. +- The clock is injectable and defaults to `LocalDate::now`; repository and clock exceptions propagate. +- `defaultCurrency` is `lateinit`; reading it before initialization fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..5cf896ea --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,43 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:07:53Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Defines MyBatis customer queries and mutations for the `CUSTOMER` table. + +#### Purpose +- Maps customer rows to `shop.customer.Customer`. +- Provides email lookup, conditional search, insertion, promotion, and inactive-customer deletion. + +#### Type +- MyBatis mapper; root element `mapper`; namespace `shop.customer.CustomerMapper`. +- No XML namespaces declared. + +#### Definitions +- Result map `customerResult` → `shop.customer.Customer`: `id` ← `CUSTOMER_ID` (ID), `email` ← `EMAIL`, `loyaltyTier` ← `LOYALTY_TIER`. +- SQL fragment `customerColumns` → `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT`. +- Select `findByEmail`: reads `CUSTOMER`; parameter `email`; result map `customerResult`. +- Select `search`: reads `CUSTOMER`; parameters `tier`, `createdAfter`, `sortColumn`; result map `customerResult`; optional filters on `LOYALTY_TIER` and `CREATED_AT`, ordered by `sortColumn`. +- Insert `insert`: writes `CUSTOMER` (`EMAIL`, `LOYALTY_TIER`, `CREATED_AT`); parameters `email`, `loyaltyTier`; uses generated keys for `id`. +- Update `promote`: updates `CUSTOMER.LOYALTY_TIER` for `CUSTOMER_ID` values in `ids`; parameters `tier`, `ids`. +- Delete `deleteInactive`: deletes from `CUSTOMER` where `LAST_ORDER_AT` precedes `cutoff`; parameter `cutoff`. +- `${sortColumn}` is spliced into the SQL unescaped. + +#### Configuration +- `insert`: `useGeneratedKeys="true"`; `keyProperty="id"`. +- `search`: applies the `tier` condition when `tier != null`; applies the `createdAfter` condition when `createdAfter != null`; sorts by `${sortColumn}`. +- `promote`: `ids` collection rendered with parentheses and comma separators. +- `insert`: sets `CREATED_AT` to `now()`. + +#### Dependencies +- Mapper DTD: `https://mybatis.org/dtd/mybatis-3-mapper.dtd`. +- Java type: `shop.customer.Customer`. +- Database table: `CUSTOMER`; columns referenced include `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/mybatis/package.ai.md new file mode 100644 index 00000000..4a60a44f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/mybatis/package.ai.md @@ -0,0 +1,42 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:09:21Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Supports customer record retrieval, creation, loyalty-tier promotion, and inactive-customer cleanup in the `CUSTOMER` table. + +#### Purpose +- Maps customer database rows to `shop.customer.Customer` and provides customer queries and mutations. +- Supports email lookup, optional-filter search, insertion, bulk promotion, and deletion by last-order cutoff. + +#### Responsibilities +- **Customer reads:** `findByEmail` retrieves by email; `search` applies optional loyalty-tier and creation-date filters and sorts results. +- **Customer writes and cleanup:** `insert` creates a customer with the current timestamp; `promote` updates loyalty tiers for a set of customer IDs; `deleteInactive` removes customers whose last order predates a cutoff. +- **Row mapping and shared SQL:** `customerResult` maps customer columns; `customerColumns` defines a reusable column list. + +#### Key units +- `shop.customer.CustomerMapper` — MyBatis mapper namespace for customer operations. +- `customerResult` — Maps `CUSTOMER_ID`, `EMAIL`, and `LOYALTY_TIER` to `shop.customer.Customer`. +- `customerColumns` — SQL fragment listing `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, and `CREATED_AT`. +- `findByEmail`, `search`, `insert`, `promote`, `deleteInactive` — Customer select, insert, update, and delete statements. + +#### Data flow +- Queries read from `CUSTOMER` and map results through `customerResult`. +- `search` conditionally filters on `LOYALTY_TIER` and `CREATED_AT`; its sort column is inserted using `${sortColumn}`. +- `insert` writes email and loyalty tier, sets `CREATED_AT` to `now()`, and returns the generated key to `id`. +- `promote` renders the supplied `ids` collection into an `IN` list; `deleteInactive` uses `cutoff` against `LAST_ORDER_AT`. + +#### Dependencies +- Database table: `CUSTOMER`; referenced columns include `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, and `LAST_ORDER_AT`. +- Java type: `shop.customer.Customer`. +- MyBatis mapper DTD: `https://mybatis.org/dtd/mybatis-3-mapper.dtd`. + +#### Cross-cutting +- `search` uses dynamic SQL for optional filters. +- `${sortColumn}` is spliced into SQL unescaped. +- `insert` uses MyBatis generated keys with `keyProperty="id"`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..db039e3b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,36 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:08:00Z +- G: +- A: 0.0.0 +- X: file +- P: 34DB4705 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> Specifies backoffice operations for listing, retrieving, and cancelling shop orders with order status and total details. + +#### Purpose +- Read orders and cancel orders in the shop backoffice. + +#### Type +- OpenAPI 3.0.3; `Shop Orders API` version `2.1.0`. + +#### Operations +- `GET /orders` — `listOrders`; query parameters: `status` (`OrderStatus`), `limit` (integer, maximum 200); `200` returns an array of `Order`. +- `GET /orders/{orderId}` — `getOrder`; required path parameter `orderId` (string); `200` returns `Order`; `404` has no response schema specified. +- `POST /orders/{orderId}/cancel` — `cancelOrder`; required path parameter `orderId` (string); requires `backofficeToken` with `orders:write`; `204` and `409` have no response schemas specified. + +#### Schemas +- `OrderStatus` — string enum: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order` — object; required fields: `orderId`, `status`, `total`; `orderId` is string, `status` references `OrderStatus`, `total` is number with `double` format; `couponCode` is a deprecated string. + +#### Security and servers +- Server: `https://api.shop.example/backoffice`. +- `backofficeToken` — OAuth 2.0 client credentials; token URL `https://auth.shop.example/token`; scope `orders:write`. Required by `POST /orders/{orderId}/cancel`. + +#### Dependencies +- None. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/openapi/package.ai.md new file mode 100644 index 00000000..f40746ee --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/openapi/package.ai.md @@ -0,0 +1,38 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:09:26Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> Defines backoffice capabilities for browsing shop orders, viewing order details, and cancelling orders. + +#### Purpose +- Specify the Shop Orders API contract for order retrieval and cancellation. +- Describe order status and total details, including the deprecated `couponCode` field. + +#### Responsibilities +- Order access: list orders by optional status and limit, or retrieve one order by `orderId`. +- Order cancellation: expose a write-authorized cancellation operation for a specified order. + +#### Key units +- `GET /orders` (`listOrders`) — returns an array of `Order` records, with a maximum `limit` of 200. +- `GET /orders/{orderId}` (`getOrder`) — returns an order by its required string identifier. +- `POST /orders/{orderId}/cancel` (`cancelOrder`) — cancels an order; documents `204` and `409` responses. +- `OrderStatus` — string enum: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order` — object requiring `orderId`, `status`, and numeric `total`; includes deprecated string `couponCode`. + +#### Data flow +- Order listing accepts optional `status` and `limit` query parameters and returns `Order` objects. +- Order retrieval and cancellation use the required `orderId` path parameter; cancellation requires the `orders:write` scope. + +#### Dependencies +- Backoffice API server: `https://api.shop.example/backoffice`. +- OAuth 2.0 client-credentials token endpoint: `https://auth.shop.example/token`. + +#### Cross-cutting +- OpenAPI 3.0.3 contract, `Shop Orders API` version `2.1.0`. +- Cancellation is protected by the `backofficeToken` OAuth 2.0 security scheme with scope `orders:write`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..2f595e7d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,70 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:09:41Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> Supports the shop’s order and fulfilment lifecycle through checkout, workflow orchestration, shipping, invoicing, persistence, integrations, and back-office operations. + +#### Purpose +- Defines application and infrastructure artifacts for processing shop orders, from customer checkout and fulfilment through back-office review, reporting, and cancellation. +- Provides supporting contracts, database mappings, deployment configuration, and release automation. + +#### Responsibilities +- **Order processing and fulfilment:** BPMN coordinates stock reservation, payment, amount-based approval, shipping, invoicing, and cancellation; Camel routes incoming orders through validation, audit, manual review, and ERP submission. +- **Checkout and shipping:** Facelets collects delivery details and shipping choice; `ShippingRules` calculates weight-based charges, free shipping, and overweight rejection. +- **Invoicing and stock contracts:** Kotlin units issue invoices for completed orders; WSDL defines the SOAP stock-availability lookup and unknown-SKU fault. +- **Back-office operations and APIs:** Jakarta EE descriptors configure web and EJB services; JSP and OpenAPI describe order search, review, retrieval, and cancellation. +- **Persistence and customer data:** Hibernate/JPA mappings configure shipment and shop/reporting persistence; MyBatis maps customer queries and mutations to `CUSTOMER`. +- **Build and deployment:** Docker packages the Java application; Kubernetes runs and exposes it; actions workflows automate build, image publication, and production deployment. + +#### Key units +- `orderFulfilment` — coordinates order completion and out-of-stock cancellation in BPMN. +- `orderIntegration`, `incomingOrders`, `toErp`, `manualReview` — validate, audit, route, and submit orders through Camel. +- `checkout.xhtml`, `checkoutBean` — capture checkout details and recalculate and submit orders. +- `ShippingRules`, `ShippingRulesSpec` — calculate shipping charges and verify shipping rules. +- `InvoiceService`, `InvoiceLine`, `InvoiceNumber`, `InvoiceResult` — create and represent invoices, line amounts, totals, and issue outcomes. +- `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener` — provide configured EJB stock reservation, checkout, and order-event handling. +- `CustomerMapper` — queries, inserts, promotes, and deletes customer records in `CUSTOMER`. +- `Shipment`, `ExpressShipment`, `shop` and `reporting` persistence units — map shipment entities and configure shop and reporting persistence. +- `order-list.jsp`, Shop Orders OpenAPI operations — present open orders and specify order listing, retrieval, and cancellation. +- `StockPortType`, `StockService` — define and publish the SOAP stock-level operation. +- `Dockerfile`, `Deployment/orders-backoffice`, `Service/orders-backoffice`, `Ingress/orders-backoffice` — package and run the back office and route HTTP traffic. + +#### Data flow +- Checkout binds customer address and shipping selections to `checkoutBean`; shipping changes recalculate the displayed total, and order placement submits the checkout. +- In BPMN, `orderPlaced` triggers stock reservation, followed by payment and amount-based approval routing; successful shipping proceeds to invoicing and completion, while `OutOfStock` leads to cancellation. +- Camel validates incoming JMS orders and wire-taps them to `seda:orderAudit`; high-value orders are split for review, while others are translated and sent to the ERP endpoint, with exhausted failures routed to `orders.deadletter`. +- Completed orders flow into `InvoiceService`, which rejects empty orders or numbers, dates, saves, and returns an invoice for non-empty orders. +- Customer and shipment persistence paths map records and associations to database tables; reporting uses a separately configured persistence unit. +- The Docker build produces `orders-backoffice.jar`; Kubernetes routes requests through Ingress and Service to application pods configured with database connection settings. + +#### Dependencies +- **Shop domain types:** `Order`, `CompletedOrder`, `Invoice`, `Customer`, `Shipment`, `Parcel`, and related repositories and exceptions. +- **Messaging and integration:** JMS queues, `seda:orderAudit`, Camel, ERP HTTP endpoint, BPMN message `PaymentReceived`, and shipping task topic `shipping`. +- **Persistence:** `CUSTOMER`, `SHIPMENT`, `EXPRESS_SHIPMENT`, `SHIPMENT_SEQ`, `ShopDS`, and `ReportingDS`. +- **External contracts:** Shop Orders API with OAuth 2.0, SOAP stock service at `https://erp.shop.example/soap/stock`, and called BPMN process `invoicing`. +- **Runtime and delivery:** Jakarta Faces, Jakarta EE, Hibernate, MyBatis, Kubernetes Secret `orders-db-credentials`, Maven, and Java 21 images. + +#### Cross-cutting +- Configuration is externalized across Camel property placeholders, Jakarta EE descriptors, persistence-unit definitions, container environment settings, and Kubernetes resources. +- Order and shipment workflows use explicit routing and failure outcomes, including approval, cancellation, ERP retries, and dead-letter handling. +- Validation and authorization appear at multiple boundaries: checkout postal-code validation, incoming-order validation, admin-role protection, and OAuth `orders:write` scope. +- Several components expose operational checks or audit behavior, including container liveness, Kubernetes readiness, request filtering, startup auditing, and order audit wire-tapping. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..bc166ddd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,46 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:08:09Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps shipment and express-shipment records, their order and parcel associations, and queries for undelivered shipments and carrier counts. + +#### Purpose +- Define Hibernate persistence mappings for shipments and the `ExpressShipment` subclass. +- Provide HQL and native SQL queries for shipment lookups and aggregation. + +#### Type +- Hibernate mapping XML; root element `hibernate-mapping`; package `shop.shipping`. +- Declares no XML namespaces; references Hibernate Mapping DTD 3.0 at `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. + +#### Definitions +- Entity `Shipment` maps to `SHIPMENT`: + - Identifier `id` → `SHIPMENT_ID`; sequence generator uses `SHIPMENT_SEQ`. + - Properties: `trackingCode` → `TRACKING_CODE` (length 40, not null); `carrier` → `CARRIER` (length 12); `shippedAt` → `SHIPPED_AT` (type `timestamp`). + - Many-to-one `order` uses class `shop.Order`, column `ORDER_ID`, not null. + - Set `parcels` is inverse with cascade `all-delete-orphan`; key column `SHIPMENT_ID`; one-to-many class `Parcel`. +- Joined subclass `ExpressShipment` maps to `EXPRESS_SHIPMENT`; key column `SHIPMENT_ID`; property `deliveryWindow` → `DELIVERY_WINDOW`. +- Named query `Shipment.undelivered`: selects shipments where `deliveredAt` is null and `shippedAt` precedes `:cutoff`. +- Native SQL query `Shipment.countByCarrier`: groups rows in `SHIPMENT` by `CARRIER` and counts each group. + +#### Configuration +- ID generation: `class="sequence"`, `sequence_name=SHIPMENT_SEQ`. +- `trackingCode`: `length=40`, `not-null=true`. +- `carrier`: `length=12`. +- `shippedAt`: `type=timestamp`. +- `order`: `not-null=true`. +- `parcels`: `inverse=true`, `cascade=all-delete-orphan`. +- Undelivered query parameter: `:cutoff`. + +#### Dependencies +- DTD: `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. +- Mapped classes: `shop.shipping.Shipment`, `shop.shipping.ExpressShipment`, `shop.shipping.Parcel`, `shop.Order`. +- Database tables: `SHIPMENT`, `EXPRESS_SHIPMENT`; sequence: `SHIPMENT_SEQ`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/persistence/package.ai.md new file mode 100644 index 00000000..3c0d3cda --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/persistence/package.ai.md @@ -0,0 +1,42 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:09:31Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Persists shop shipments, orders, customers, and reporting data through Hibernate/JPA mappings, persistence units, and shipment queries. + +#### Purpose +- Map `Shipment` and `ExpressShipment` to database tables, including their order and parcel associations. +- Configure JTA persistence for shop operations and resource-local persistence for reporting. + +#### Responsibilities +- **Shipment persistence:** Map shipment fields, sequence-generated IDs, joined inheritance, and order/parcel associations; define undelivered-shipment and carrier-count queries. +- **Persistence-unit configuration:** Set up the `shop` and `reporting` units with their transaction types, data sources, managed classes, mapping file, and Hibernate properties. + +#### Key units +- `Shipment` — maps to `SHIPMENT`, with a required `shop.Order` association and an inverse parcel set using `all-delete-orphan` cascade. +- `ExpressShipment` — joined subclass mapped to `EXPRESS_SHIPMENT`, with a `deliveryWindow` property. +- `Shipment.undelivered` — selects shipments with no delivery date shipped before `:cutoff`. +- `Shipment.countByCarrier` — native SQL query that counts shipment rows grouped by carrier. +- `shop` persistence unit — JTA unit using Hibernate, `ShopDS`, and managed `Order`, `OrderLine`, and `Customer` classes. +- `reporting` persistence unit — resource-local unit using `ReportingDS`, managing `DailyRevenue` and excluding unlisted classes. + +#### Data flow +- Hibernate maps shipment entities to `SHIPMENT` and `EXPRESS_SHIPMENT`, using `SHIPMENT_SEQ` for shipment IDs and linking orders and parcels through `ORDER_ID` and `SHIPMENT_ID`. +- The `shop` persistence unit loads `META-INF/order-queries.xml` and manages shop order and customer classes; the separate `reporting` unit manages `DailyRevenue`. + +#### Dependencies +- Hibernate JPA provider: `org.hibernate.jpa.HibernatePersistenceProvider`; PostgreSQL dialect: `org.hibernate.dialect.PostgreSQLDialect`. +- Data sources: `java:/jdbc/ShopDS` and `java:/jdbc/ReportingDS`. +- Mapped classes include `shop.shipping.Shipment`, `shop.shipping.ExpressShipment`, `shop.shipping.Parcel`, `shop.Order`, `shop.OrderLine`, `shop.Customer`, and `shop.reporting.DailyRevenue`. +- Database objects: `SHIPMENT`, `EXPRESS_SHIPMENT`, and sequence `SHIPMENT_SEQ`. + +#### Cross-cutting +- Hibernate configuration sets JDBC batch size to `50`; connection username is `shop_app` and the password is masked. +- Shipment IDs use sequence generation; `trackingCode` is required and limited to 40 characters, while `carrier` is limited to 12 characters. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..9aba0cea --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/persistence/persistence.xml.ai.md @@ -0,0 +1,38 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:08:05Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Configures JTA persistence for shop orders and customers, plus resource-local persistence for reporting data. + +#### Purpose +- Defines the `shop` and `reporting` persistence units and their data sources, managed classes, and provider settings. + +#### Type +- JPA persistence descriptor (`persistence.xml`); root element `persistence`. +- Declares the default namespace `https://jakarta.ee/xml/ns/persistence` with no prefix; version `3.1`. + +#### Definitions +- Persistence unit `shop`: transaction type `JTA`; provider `org.hibernate.jpa.HibernatePersistenceProvider`; data source `java:/jdbc/ShopDS`; mapping file `META-INF/order-queries.xml`; managed classes `shop.Order`, `shop.OrderLine`, `shop.Customer`. +- Persistence unit `reporting`: transaction type `RESOURCE_LOCAL`; data source `java:/jdbc/ReportingDS`; managed class `shop.reporting.DailyRevenue`; excludes unlisted classes. + +#### Configuration +- `hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect` +- `hibernate.jdbc.batch_size=50` +- `hibernate.connection.username=shop_app` +- `hibernate.connection.password=***` + +#### Dependencies +- Mapping file: `META-INF/order-queries.xml`. +- Managed classes: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue`. +- Provider: `org.hibernate.jpa.HibernatePersistenceProvider`. +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`. +- Hibernate dialect: `org.hibernate.dialect.PostgreSQLDialect`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..501c6f8c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,35 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:08:15Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Defines a SOAP service for retrieving stock availability by SKU, including an unknown-SKU fault. + +#### Type +- WSDL; root `definitions`; namespaces: default `http://schemas.xmlsoap.org/wsdl/`, `soap` `http://schemas.xmlsoap.org/wsdl/soap/`, `tns` `http://shop.example/stock`, `xs` `http://www.w3.org/2001/XMLSchema`. + +#### Definitions +- Schema target namespace `http://shop.example/stock`: + - Elements: `StockLevelRequest` contains `sku` (`xs:string`); `StockLevelResponse` contains `available` (`xs:int`). + - Complex type `UnknownSkuFault` contains `sku` (`xs:string`). +- Messages: `GetStockLevelInput` references `tns:StockLevelRequest`; `GetStockLevelOutput` references `tns:StockLevelResponse`; `UnknownSku` carries `tns:UnknownSkuFault`. +- Port type `StockPortType`: operation `GetStockLevel`, input `tns:GetStockLevelInput`, output `tns:GetStockLevelOutput`, fault `UnknownSku` (`tns:UnknownSku`). +- Binding `StockSoapBinding` for `tns:StockPortType`: document style, SOAP over HTTP; operation `GetStockLevel` uses literal input, output, and `UnknownSku` fault. +- Service `StockService`: port `StockPort` uses `tns:StockSoapBinding`, address `https://erp.shop.example/soap/stock`. + +#### Configuration +- `soapAction`: `http://shop.example/stock/GetStockLevel` +- SOAP address: `https://erp.shop.example/soap/stock` +- Binding style: `document`; transport: `http://schemas.xmlsoap.org/soap/http`; body and fault use: `literal`. + +#### Dependencies +- SOAP endpoint: `https://erp.shop.example/soap/stock` +- XML Schema types: `xs:string`, `xs:int`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/wsdl/package.ai.md new file mode 100644 index 00000000..e3ae1c3f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/other/wsdl/package.ai.md @@ -0,0 +1,33 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:09:37Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Defines the SOAP contract for querying stock availability by SKU and reporting unknown-SKU faults. + +#### Purpose +- Specify the request, response, and fault message shapes for stock-level lookup. +- Publish the `GetStockLevel` operation over document/literal SOAP. + +#### Responsibilities +- **Stock lookup contract:** `StockLevelRequest` accepts a SKU; `StockLevelResponse` returns an available-unit count. +- **Fault contract:** `UnknownSkuFault` carries the SKU associated with an unknown-SKU error. +- **SOAP publication:** Bind and expose the operation at the stock service endpoint. + +#### Key units +- `StockPortType` — declares `GetStockLevel` input, output, and `UnknownSku` fault. +- `StockSoapBinding` — binds the operation to document-style SOAP over HTTP with literal bodies and fault. +- `StockService` / `StockPort` — publish the binding at `https://erp.shop.example/soap/stock`. +- `StockLevelRequest`, `StockLevelResponse`, `UnknownSkuFault` — define the request, response, and fault data. + +#### Data flow +- `GetStockLevelInput` carries `StockLevelRequest` (`sku: xs:string`); the response carries `StockLevelResponse` (`available: xs:int`); an unknown SKU returns the `UnknownSku` fault with `UnknownSkuFault`. + +#### Dependencies +- XML Schema primitives `xs:string` and `xs:int`. +- SOAP over HTTP at `https://erp.shop.example/soap/stock`; action `http://shop.example/stock/GetStockLevel`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..27e62ee6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/package.ai.md @@ -0,0 +1,58 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:09:52Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> Processes shop orders from checkout and fulfilment through invoicing, persistence, and back-office lookup, cancellation, and retention. + +#### Purpose +- Supports the shop order lifecycle across customer-facing checkout, integrations, operational workflows, and back-office management. +- Provides persistence mappings, service contracts, and deployment and release artifacts for order-processing components. + +#### Responsibilities +- **Checkout and shipping:** `checkout.xhtml` and `checkoutBean` collect delivery and shipping choices; `ShippingRules` calculates charges, free shipping, and overweight rejection. +- **Order workflow and integrations:** `orderFulfilment` coordinates stock reservation, payment, approval, shipping, invoicing, and out-of-stock cancellation; Camel routes validate, audit, review, and submit incoming orders to ERP. +- **Invoicing and stock services:** Kotlin invoice units issue invoices for completed orders; SOAP contracts expose stock availability lookup and unknown-SKU faults. +- **Back-office operations:** `OrderResource` lists and retrieves orders, cancels orders with refunds, and purges long-cancelled orders; JSP and OpenAPI artifacts describe order operations. +- **Persistence and customer data:** Hibernate/JPA map shipments and configure shop and reporting persistence; `CustomerMapper` reads and mutates `CUSTOMER`. +- **Runtime and delivery:** Jakarta EE descriptors configure services; Docker, Kubernetes resources, and actions workflows support packaging, deployment, and release automation. + +#### Key units +- `OrderResource` — role-restricted order API and scheduled cancelled-order purge. +- `PURGE_AFTER_DAYS` — sets cancelled-order retention to 30 days. +- `orderFulfilment` — BPMN workflow for stock reservation through order completion or cancellation. +- `orderIntegration`, `incomingOrders`, `toErp`, `manualReview` — Camel validation, audit, review, and ERP routing. +- `checkout.xhtml`, `checkoutBean`, `ShippingRules`, `ShippingRulesSpec` — capture checkout details, calculate shipping, and verify shipping rules. +- `InvoiceService`, `InvoiceLine`, `InvoiceNumber`, `InvoiceResult` — create invoices and represent line amounts, totals, and issue outcomes. +- `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener` — provide configured stock reservation, checkout, and order-event handling. +- `CustomerMapper` — maps customer queries and mutations to `CUSTOMER`. +- `Shipment`, `ExpressShipment`, `shop`, `reporting` — define shipment mappings and shop/reporting persistence units. +- `StockPortType`, `StockService` — define and publish the SOAP stock-level operation. +- `order-list.jsp`, Shop Orders OpenAPI operations — present open orders and describe listing, retrieval, and cancellation. +- `Dockerfile`, `Deployment/orders-backoffice`, `Service/orders-backoffice`, `Ingress/orders-backoffice` — package and route the back-office application. + +#### Data flow +- Checkout selections bind to `checkoutBean`; shipping changes recalculate totals before order submission. +- BPMN processes placed orders through stock reservation, payment, amount-based approval, shipping, and invoicing; `OutOfStock` leads to cancellation. +- Camel validates incoming JMS orders and wire-taps them to `seda:orderAudit`; high-value orders go to manual review, others are translated and sent to ERP, with exhausted failures routed to `orders.deadletter`. +- Completed orders pass to `InvoiceService`, which rejects empty orders or missing invoice inputs and returns an invoice for valid orders. +- Back-office cancellation retrieves an order, refunds its payment reference and total through `PaymentGateway`, marks it `CANCELLED`, and records `order.cancelled`; daily purge removes orders older than 30 days and records `order.purged`. +- Docker builds `orders-backoffice.jar`; Kubernetes routes HTTP traffic through Ingress and Service to application pods configured with database settings. + +#### Dependencies +- **Domain and persistence:** `Order`, `OrderStatus`, `CompletedOrder`, `Invoice`, `Customer`, `Shipment`, `Parcel`; `CUSTOMER`, `SHIPMENT`, `EXPRESS_SHIPMENT`, `SHIPMENT_SEQ`, `ShopDS`, and `ReportingDS`. +- **Integrations:** `PaymentGateway`, `AuditLog`, JMS, Camel, ERP HTTP endpoint, BPMN `PaymentReceived` message, `shipping` topic, and the `invoicing` process. +- **External contracts:** Shop Orders API with OAuth 2.0; SOAP stock service at `https://erp.shop.example/soap/stock`. +- **Platform and delivery:** Jakarta EE and Faces, Hibernate, MyBatis, Maven, Java 21 images, Kubernetes Secret `orders-db-credentials`. + +#### Cross-cutting +- Externalized configuration spans Camel placeholders, Jakarta EE descriptors, persistence units, container environment settings, and Kubernetes resources. +- Workflows define approval, cancellation, ERP retry, and dead-letter outcomes. +- Validation and access controls include checkout postal-code checks, incoming-order validation, back-office `backoffice`/`admin` roles, and OAuth `orders:write` scope. +- Operational and audit behavior includes container liveness, Kubernetes readiness, request filtering, startup auditing, and order audit wire-tapping. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..eb8fdaf1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-6-luna/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: A624A2C6 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:10:02Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The shop order lifecycle spans checkout and delivery selection, shipping calculation, stock reservation, payment, and BPMN-coordinated fulfilment, with integration handling validation, review, and ERP submission. Persistence and supporting services manage orders, shipments, customers, and invoices, while the Java back office provides order lookup, cancellation with refunds, and cleanup of old cancelled orders. OpenAPI, web interfaces, container and Kubernetes configuration, and automated workflows support access, deployment, and operation. + +#### Packages +- java — Backoffice order management supports order lookup, cancellation with payment refunds, and scheduled cleanup of long-cancelled orders. +- java/shop — Backoffice users can review orders, retrieve individual orders, cancel them with payment refunds, and automatically purge old cancelled orders. +- other/actions/.github — Automates verification, container release, and production deployment of the orders backoffice. +- other/actions/.github/workflows — Automates verification, container publishing, and production deployment of the orders backoffice for releases. +- other/actions — Automates verification, container-image release, and production deployment of the orders backoffice. +- other/bpmn — Coordinates order fulfilment from stock reservation and payment receipt through approval, shipping, invoicing, or out-of-stock cancellation. +- other/docker — Packages and runs the Orders Backoffice Java application as a production-configured container. +- other/facelets — Collects a customer’s delivery details and shipping choice, updates the order total, and submits the order. +- other/groovy — Calculates order shipping charges from order value and parcel weight, with free-shipping eligibility and overweight-parcel rejection. +- other/integration — Processes incoming orders through validation, high-value review, and ERP submission, with audit and failure handling. +- other/jee — Configures the shop back office’s web access and the EJB services that reserve stock, process checkout, and receive order-placement events. +- other/jsp — Staff can search and review open orders, including totals and overdue status, and access order cancellation actions. +- other/k8s — Runs the shop orders back office and makes it available internally and through an HTTP endpoint. +- other/kotlin — Converts completed orders into numbered invoices, applies payment deadlines and category-based tax rates, and records issued invoices. +- other/mybatis — Supports customer record retrieval, creation, loyalty-tier promotion, and inactive-customer cleanup in the `CUSTOMER` table. +- other/openapi — Defines backoffice capabilities for browsing shop orders, viewing order details, and cancelling orders. +- other — Supports the shop’s order and fulfilment lifecycle through checkout, workflow orchestration, shipping, invoicing, persistence, integrations, and back-office operations. +- other/persistence — Persists shop shipments, orders, customers, and reporting data through Hibernate/JPA mappings, persistence units, and shipment queries. +- other/wsdl — Defines the SOAP contract for querying stock availability by SKU and reporting unknown-SKU faults. +- . — Processes shop orders from checkout and fulfilment through invoicing, persistence, and back-office lookup, cancellation, and retention. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..6b2d245c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,47 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:11:21Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> A stateless JAX‑RS service that manages back‑office order lifecycle, including retrieval, cancellation with payment refund, and nightly cleanup of stale cancelled orders. + +#### Purpose +- Expose order CRUD‑like operations via REST. +- Process order cancellations with payment refunds and audit logging. +- Schedule nightly purge of cancelled orders older than a configurable threshold. + +#### Responsibilities +- **Order retrieval** – list open orders, fetch by ID. +- **Order cancellation** – refund payment, update status, audit. +- **Scheduled cleanup** – purge cancelled orders older than a threshold. + +#### Key units +- `OrderResource` – stateless EJB, JAX‑RS resource at `/orders`, JSON output, role‑restricted to `backoffice`/`admin`. +- `EntityManager em` – JPA persistence context for `Order` entities. +- `PaymentGateway payments` – external service for refunds. +- `AuditLog audit` – audit trail recorder. +- `@Schedule` method `purgeCancelled()` – nightly cleanup. + +#### Data flow +1. **GET /orders** → `openOrders()` → query `Order.open` → return `List`. +2. **GET /orders/{id}** → `find(id)` → `em.find(Order)` → 200 or 404. +3. **POST /orders/{id}/cancel** → `cancel(id)` → find order → `payments.refund()` → set status `CANCELLED` → `audit.record()` → 204. +4. **@Schedule** → `purgeCancelled()` → query `Order.purgeCancelled(days)` → bulk update → `audit.record()`. + +#### Dependencies +- Jakarta EE: `Stateless`, `EJB`, `Schedule`, `TransactionAttribute`, `RolesAllowed`, `Inject`, `PersistenceContext`. +- JAX‑RS: `GET`, `POST`, `Path`, `PathParam`, `Produces`, `Response`, `MediaType`. +- JPA: `EntityManager`, `Order` entity. +- Domain services: `PaymentGateway`, `AuditLog`. +- Java collections: `List`. + +#### Cross-cutting +- Stateless EJB ensures thread safety. +- Role‑based security via `@RolesAllowed`. +- Transactional boundaries handled by container (`@TransactionAttribute`). +- Audit logging invoked after state changes or scheduled actions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..0b631c4b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md @@ -0,0 +1,67 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:10:06Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 50211B16 +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Provides REST endpoints for back‑office order management, including listing, retrieving, canceling, and nightly purging of cancelled orders. + +#### Purpose +- Exposes order operations via JAX‑RS. +- Handles cancellation and audit logging. +- Schedules nightly purge of old cancelled orders. + +#### Type +- `public class OrderResource` + - `@Stateless`, `@Path("/orders")`, `@Produces(MediaType.APPLICATION_JSON)`, `@RolesAllowed({"backoffice","admin"})` + - Extends `Object`. + - Declares 1 static field, 3 injected fields, 5 public methods, 1 scheduled method. + +#### Input +- `openOrders()` – no parameters. +- `find(long id)` – path parameter `id`. +- `cancel(long id)` – path parameter `id`. +- `purgeCancelled()` – no parameters (scheduled). +- Injected: `EntityManager em`, `PaymentGateway payments`, `AuditLog audit`. + +#### Output +- `openOrders()` – `List` of open orders. +- `find(long)` – `Response` with 200 and order or 404. +- `cancel(long)` – `Response` 204 or 404; triggers refund, status update, audit record. +- `purgeCancelled()` – no return; updates DB, audit record. + +#### Core logic +- `openOrders`: query `Order.open`. +- `find`: `em.find(Order.class, id)` → 200 or 404. +- `cancel`: find order; if null 404; else `payments.refund`, set status to `CANCELLED`, audit record, 204. +- `purgeCancelled`: query `Order.purgeCancelled` with `days` param, execute update, audit record. + +#### Public API +- `openOrders() -> List` – list open orders. +- `find(long) -> Response` – retrieve order by id. +- `cancel(long) -> Response` – cancel order by id. + +#### Dependencies +- `jakarta.annotation.security.RolesAllowed` +- `jakarta.ejb.EJB`, `Schedule`, `Stateless`, `TransactionAttribute`, `TransactionAttributeType` +- `jakarta.inject.Inject` +- `jakarta.persistence.EntityManager`, `PersistenceContext` +- `jakarta.ws.rs.GET`, `POST`, `Path`, `PathParam`, `Produces`, `Response` +- `jakarta.ws.rs.core.MediaType` +- `java.util.List` +- `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog` + +#### Exceptions / Errors +- Returns `Response.Status.NOT_FOUND` when order missing. +- No explicit exception handling; relies on container. + +#### Concurrency +- Stateless EJB; thread‑safe by container. +- `@Schedule` runs non‑persistent, single instance. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/java/shop/package.ai.md new file mode 100644 index 00000000..9cfd38c0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/java/shop/package.ai.md @@ -0,0 +1,47 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:11:17Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Provides a stateless JAX‑RS resource for back‑office order management, exposing CRUD‑like operations, cancellation with refund, and nightly purge of cancelled orders. + +#### Purpose +- Expose order operations via REST. +- Handle order cancellation and audit logging. +- Schedule nightly purge of old cancelled orders. + +#### Responsibilities +- **Order retrieval** – list open orders, fetch by ID. +- **Order cancellation** – refund payment, update status, audit. +- **Scheduled cleanup** – purge cancelled orders older than a threshold. + +#### Key units +- `OrderResource` – stateless EJB, JAX‑RS resource at `/orders`, JSON output, role‑restricted to `backoffice`/`admin`. +- `EntityManager em` – JPA persistence context for `Order` entities. +- `PaymentGateway payments` – external service for refunds. +- `AuditLog audit` – audit trail recorder. +- `@Schedule` method `purgeCancelled()` – nightly cleanup. + +#### Data flow +1. **GET /orders** → `openOrders()` → query `Order.open` → return `List`. +2. **GET /orders/{id}** → `find(id)` → `em.find(Order)` → 200 or 404. +3. **POST /orders/{id}/cancel** → `cancel(id)` → find order → `payments.refund()` → set status `CANCELLED` → `audit.record()` → 204. +4. **@Schedule** → `purgeCancelled()` → query `Order.purgeCancelled(days)` → bulk update → `audit.record()`. + +#### Dependencies +- Jakarta EE: `Stateless`, `EJB`, `Schedule`, `TransactionAttribute`, `RolesAllowed`, `Inject`, `PersistenceContext`. +- JAX‑RS: `GET`, `POST`, `Path`, `PathParam`, `Produces`, `Response`, `MediaType`. +- JPA: `EntityManager`, `Order` entity. +- Domain services: `PaymentGateway`, `AuditLog`. +- Java collections: `List`. + +#### Cross-cutting +- Stateless EJB ensures thread safety. +- Role‑based security via `@RolesAllowed`. +- Transactional boundaries handled by container (`@TransactionAttribute`). +- Audit logging invoked after state changes or scheduled actions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/.github/package.ai.md new file mode 100644 index 00000000..61ff04d1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/.github/package.ai.md @@ -0,0 +1,39 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:11:28Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Automates the CI/CD pipeline for the Backoffice Java application, building, testing, containerizing, and deploying it to production. + +#### Purpose +- Orchestrate continuous integration and delivery for the Backoffice service. + +#### Responsibilities +- Compile and test Java code across multiple Java versions. +- Build and publish Docker images to a private registry. +- Trigger Kubernetes deployments in the production environment. + +#### Key units +- **GitHub Actions workflow** `.github/workflows/release.yml` – defines jobs `build`, `image`, and `deploy`. +- **Build job** – runs Maven `verify` with CI profile on `ubuntu-24.04` for Java 21 and 25. +- **Image job** – logs into `registry.shop.example`, builds and pushes `orders-backoffice` image tagged with the release version. +- **Deploy job** – calls external workflow `.github/workflows/deploy-k8s.yml` to roll out the new image to Kubernetes. + +#### Data flow +`push` to a tag `v*` → `build` job compiles/tests → `image` job builds Docker image → `deploy` job triggers Kubernetes rollout. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- External workflow `.github/workflows/deploy-k8s.yml`. +- Docker registry `registry.shop.example`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. + +#### Cross-cutting +- Matrix strategy for Java versions. +- Unified secret inheritance across jobs. +- Environment variable `GITHUB_REF_NAME` used to derive image tag. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..c58e1237 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,39 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:11:26Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Automates the CI/CD pipeline for the Backoffice service, building, testing, containerizing, and deploying it to production. + +#### Purpose +- Orchestrate continuous integration and delivery for the Backoffice Java application. + +#### Responsibilities +- Build and test the Java code across multiple Java versions. +- Create and publish a Docker image to a private registry. +- Trigger a Kubernetes deployment workflow in the production environment. + +#### Key units +- **GitHub Actions workflow** `.github/workflows/release.yml` – defines jobs `build`, `image`, and `deploy`. +- **Build job** – runs Maven `verify` with CI profile on `ubuntu-24.04` for Java 21 and 25. +- **Image job** – logs into `registry.shop.example`, builds and pushes `orders-backoffice` image tagged with the release version. +- **Deploy job** – calls external workflow `.github/workflows/deploy-k8s.yml` to roll out the new image to Kubernetes. + +#### Data flow +`push` to a tag `v*` → `build` job compiles/tests → `image` job builds Docker image → `deploy` job triggers Kubernetes rollout. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- External workflow `.github/workflows/deploy-k8s.yml`. +- Docker registry `registry.shop.example`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. + +#### Cross-cutting +- Matrix strategy for Java versions. +- Unified secret inheritance across jobs. +- Environment variable `GITHUB_REF_NAME` used to derive image tag. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..659d946d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,48 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:10:12Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds, tests, containerizes, and deploys the Backoffice service to production. + +#### Purpose +- Build and test the Java application. +- Build and push a Docker image to a registry. +- Trigger a Kubernetes deployment workflow. + +#### Type +- GitHub Actions workflow (`.github/workflows/release.yml`), API v4. + +#### Definitions +- **Triggers**: `push` on tags matching `v*`; `workflow_dispatch`. +- **Jobs**: + - `build`: runs on `ubuntu-24.04`; matrix `java: [21, 25]`; steps: + - `actions/checkout@v4` + - `actions/setup-java@v4` with `distribution: temurin`, `java-version: ${{ matrix.java }}` + - `Build and test` runs `mvn -B verify -Pci` + - `image`: depends on `build`; runs on `ubuntu-24.04`; environment `production`; steps: + - `actions/checkout@v4` + - `Log in to the registry` uses `docker/login-action@v3` with `registry: registry.shop.example`, `username: ${{ secrets.REGISTRY_USER }}`, `password: ${{ secrets.REGISTRY_TOKEN }}` + - `Push the image` runs Docker build and push for `registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v}` + - `deploy`: depends on `image`; uses external workflow `.github/workflows/deploy-k8s.yml` with `environment: production`; inherits secrets. + +#### Configuration +- `java-version`: matrix values `21`, `25`. +- Docker image tag: `${GITHUB_REF_NAME#v}` (tag without leading `v`). +- Registry credentials: `REGISTRY_USER`, `REGISTRY_TOKEN` (secrets). + +#### Dependencies +- `actions/checkout@v4` +- `actions/setup-java@v4` +- `docker/login-action@v3` +- External workflow `.github/workflows/deploy-k8s.yml` +- Docker registry `registry.shop.example` +- Secrets `REGISTRY_USER`, `REGISTRY_TOKEN` (inherited for deploy). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/package.ai.md new file mode 100644 index 00000000..ab8269d0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/actions/package.ai.md @@ -0,0 +1,39 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:11:30Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Automates the CI/CD pipeline for the Backoffice Java application, building, testing, containerizing, and deploying it to production. + +#### Purpose +- Orchestrate continuous integration and delivery for the Backoffice service. + +#### Responsibilities +- Compile and test Java code across multiple Java versions. +- Build and publish Docker images to a private registry. +- Trigger Kubernetes deployments in the production environment. + +#### Key units +- **GitHub Actions workflow** `.github/workflows/release.yml` – defines jobs `build`, `image`, and `deploy`. +- **Build job** – runs Maven `verify` with CI profile on `ubuntu-24.04` for Java 21 and 25. +- **Image job** – logs into `registry.shop.example`, builds and pushes `orders-backoffice` image tagged with the release version. +- **Deploy job** – calls external workflow `.github/workflows/deploy-k8s.yml` to roll out the new image to Kubernetes. + +#### Data flow +`push` to a tag `v*` → `build` job compiles/tests → `image` job builds Docker image → `deploy` job triggers Kubernetes rollout. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- External workflow `.github/workflows/deploy-k8s.yml`. +- Docker registry `registry.shop.example`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. + +#### Cross-cutting +- Matrix strategy for Java versions. +- Unified secret inheritance across jobs. +- Environment variable `GITHUB_REF_NAME` used to derive image tag. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..3406b645 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,59 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:10:16Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 7ADEA688 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1; decisions: 0; decision rules: 0 + +> Defines a BPMN process for order fulfilment with payment, stock reservation, approval, shipping, and invoicing. + +#### Purpose +- Models the order fulfilment workflow. +- Handles stock reservation, payment wait, large‑order approval, shipping, and invoice creation. + +#### Type +- BPMN 2.0 XML (`bpmn:definitions` root). +- Namespaces: + - `bpmn` → `http://www.omg.org/spec/BPMN/20100524/MODEL` + - `bpmndi` → `http://www.omg.org/spec/BPMN/20100524/DI` + - `dc` → `http://www.omg.org/spec/DD/20100524/DC` + - `camunda` → `http://camunda.org/schema/1.0/bpmn` + +#### Definitions +- **Messages** + - `msgPaymentReceived` (`name="PaymentReceived"`) +- **Errors** + - `errOutOfStock` (`name="OutOfStock"`, `errorCode="STOCK_EMPTY"`) +- **Process** `orderFulfilment` (`name="Order fulfilment"`, `isExecutable="true"`) + - **Start Event** `orderPlaced` (`name="Order placed"`) + - **Service Task** `reserveStock` (`name="Reserve stock"`, `camunda:class="shop.bpm.ReserveStockDelegate"`) + - **Boundary Event** `stockMissing` (attached to `reserveStock`, error `errOutOfStock`) + - **Intermediate Catch Event** `waitForPayment` (`name="Wait for payment"`, message `msgPaymentReceived`) + - **Exclusive Gateway** `amountCheck` (`name="Large order?"`) + - **Sequence Flow** `large` (`conditionExpression="${order.total > 1000}"`) → `approveOrder` + - **Sequence Flow** `small` (`conditionExpression="${order.total <= 1000}"`) → `shipOrder` + - **User Task** `approveOrder` (`name="Approve large order"`, `camunda:candidateGroups="backoffice"`) + - **Service Task** `shipOrder` (`name="Ship order"`, `camunda:type="external"`, `camunda:topic="shipping"`) + - **Call Activity** `createInvoice` (`name="Create invoice"`, `calledElement="invoicing"`) + - **End Events** + - `orderCompleted` (`name="Order completed"`) + - `orderCancelled` (`name="Order cancelled"`) +- **Diagram** `fulfilmentDiagram` with plane `plane` containing shapes for `orderPlaced`, `reserveStock`, `shipOrder`. + +#### Configuration +- `camunda:class="shop.bpm.ReserveStockDelegate"` +- `camunda:candidateGroups="backoffice"` +- `camunda:type="external"`, `camunda:topic="shipping"` +- `calledElement="invoicing"` + +#### Dependencies +- External delegate class `shop.bpm.ReserveStockDelegate`. +- External topic `shipping` for shipping service. +- Called element `invoicing` (another BPMN process). +- Camunda BPM engine (via `camunda` namespace). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/bpmn/package.ai.md new file mode 100644 index 00000000..70809219 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/bpmn/package.ai.md @@ -0,0 +1,56 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:11:36Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> Provides a Camunda‑based BPMN workflow for end‑to‑end order fulfilment, coordinating stock reservation, payment, approval, shipping, and invoicing. + +#### Purpose +- Model the complete order fulfilment lifecycle. +- Integrate external services (stock, payment, shipping) and internal approval. + +#### Responsibilities +- **Order Placement** – entry point for new orders. +- **Stock Management** – reserve inventory and handle out‑of‑stock errors. +- **Payment Coordination** – wait for payment confirmation. +- **Large‑Order Approval** – gate for orders over a threshold. +- **Shipping** – trigger external shipping service. +- **Invoicing** – invoke separate invoicing process. +- **Completion / Cancellation** – finalise or abort the order. + +#### Key units +- **Process** `orderFulfilment` – orchestrates all tasks and events. +- **Service Task** `reserveStock` (`shop.bpm.ReserveStockDelegate`) – reserves inventory. +- **Boundary Event** `stockMissing` – error handler for `errOutOfStock`. +- **Intermediate Catch Event** `waitForPayment` – listens for `msgPaymentReceived`. +- **Exclusive Gateway** `amountCheck` – routes based on `${order.total > 1000}`. +- **User Task** `approveOrder` – back‑office approval for large orders. +- **Service Task** `shipOrder` – external topic `shipping`. +- **Call Activity** `createInvoice` – delegates to `invoicing` process. +- **End Events** `orderCompleted`, `orderCancelled` – final states. + +#### Data flow +1. **Start** at `orderPlaced`. +2. **Reserve stock** → if `errOutOfStock` → `orderCancelled`. +3. **Wait for payment** via `msgPaymentReceived`. +4. **Check amount** → large → `approveOrder`; small → `shipOrder`. +5. **Ship order** → external `shipping` topic. +6. **Create invoice** → call `invoicing`. +7. **End** with `orderCompleted` or `orderCancelled`. + +#### Dependencies +- **External Java delegate** `shop.bpm.ReserveStockDelegate`. +- **External topic** `shipping` for shipping service. +- **Called BPMN** `invoicing` process. +- **Camunda BPM engine** (via `camunda` namespace). + +#### Cross-cutting +- **Camunda annotations** (`camunda:class`, `camunda:type`, `camunda:topic`, `camunda:candidateGroups`). +- **Error handling** via boundary event `stockMissing` tied to `errOutOfStock`. +- **Message correlation** with `msgPaymentReceived`. +- **Conditional routing** using `${order.total > 1000}` expressions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..b798cd05 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/docker/Dockerfile.ai.md @@ -0,0 +1,50 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:10:22Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds a Java back‑office application, packages it with Maven, and runs it in an Alpine JRE container exposing port 8080. + +#### Purpose +- Compile and package a Maven project into a JAR. +- Deploy the JAR in a lightweight Java runtime. +- Expose a health endpoint and run the application with configurable JVM options. + +#### Type +- `Dockerfile` + Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine`. + +#### Definitions +- **Build stage** (`build`): + - `WORKDIR /src` + - `COPY pom.xml .` + - `RUN mvn -B dependency:go-offline` + - `COPY src ./src` + - `RUN mvn -B package -DskipTests` +- **Runtime stage**: + - `ARG APP_VERSION=2.1.0` + - `ENV JAVA_OPTS="-XX:MaxRAMPercentage=75" SHOP_PROFILE=production` + - `RUN addgroup -S shop && adduser -S backoffice -G shop` + - `COPY --from=build /src/target/orders-backoffice.jar /opt/shop/orders-backoffice.jar` + - `EXPOSE 8080` + - `USER backoffice` + - `HEALTHCHECK --interval=30s CMD wget -qO- http://localhost:8080/health/live || exit 1` + - `ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"]` + +#### Configuration +- `APP_VERSION=2.1.0` +- `JAVA_OPTS="-XX:MaxRAMPercentage=75"` +- `SHOP_PROFILE=production` + +#### Dependencies +- Maven build image: `maven:3.9-eclipse-temurin-21` +- Runtime image: `eclipse-temurin:21-jre-alpine` +- JAR artifact: `orders-backoffice.jar` (built in `/src/target/`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/docker/package.ai.md new file mode 100644 index 00000000..82c3f7c9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/docker/package.ai.md @@ -0,0 +1,38 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:11:41Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> Builds and deploys a Java back‑office service as a Docker image, compiling with Maven and running in an Alpine JRE container. + +#### Purpose +- Compile a Maven project into a JAR. +- Package the JAR into a lightweight Docker image. +- Expose a health endpoint and run the service with configurable JVM options. + +#### Responsibilities +- **Build stage**: resolve dependencies, compile, and package the application. +- **Runtime stage**: set up a non‑root user, configure environment, expose port, healthcheck, and launch the JAR. + +#### Key units +- `Dockerfile` (build & runtime stages) +- `orders-backoffice.jar` (compiled artifact) +- `JAVA_OPTS`, `SHOP_PROFILE` (runtime configuration) + +#### Data flow +`pom.xml → Maven dependencies → source → JAR → Docker image → container → HTTP health endpoint` + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine` +- Maven project files (`pom.xml`, `src/`) +- Runtime environment variables (`JAVA_OPTS`, `SHOP_PROFILE`) + +#### Cross-cutting +- Multi‑stage Docker build pattern. +- Non‑root user (`backoffice`) for security. +- Healthcheck via `wget` on `/health/live`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..98533d65 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,47 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:10:24Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> A checkout page that collects shipping address, selects shipping method, shows total, and places an order. + +#### Purpose +- Collect shipping address and method. +- Display calculated total. +- Submit order. + +#### Type +- Facelets page (`checkout.xhtml`), template `shop.xhtml`. +- Uses namespaces: `h` = `jakarta.faces.html`, `f` = `jakarta.faces.core`, `ui` = `jakarta.faces.facelets`. + +#### Data +- `#{checkoutBean.address.street}` (required) +- `#{checkoutBean.address.zip}` (validated by regex `[0-9]{5}`) +- `#{checkoutBean.shippingMethod}` +- `#{checkoutBean.shippingMethods}` (select items) +- `#{checkoutBean.total}` (converted to EUR currency) +- Includes `/WEB-INF/includes/payment-hints.xhtml`. + +#### Actions +- Form `checkoutForm` submits to `#{checkoutBean.placeOrder}` via `h:commandButton`. +- Ajax on `shipping` menu: listener `#{checkoutBean.recalculate}`, renders component `total`. + +#### Structure +- Defines `content` in `shop.xhtml` template. +- Includes payment hints fragment. + +#### Server code +- No scriptlets or expressions beyond EL. + +#### Dependencies +- Tag libraries: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- Beans: `checkoutBean`. +- Included file: `/WEB-INF/includes/payment-hints.xhtml`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/facelets/package.ai.md new file mode 100644 index 00000000..069d509d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/facelets/package.ai.md @@ -0,0 +1,41 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:11:44Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> A JSF Facelets page that gathers shipping details, lets the user pick a shipping method, shows the order total, and submits the order. + +#### Purpose +- Capture shipping address and method. +- Show calculated total. +- Submit order via `checkoutBean`. + +#### Responsibilities +- **User input collection** – shipping address fields, shipping method selector. +- **Dynamic calculation** – Ajax listener to recalculate total when shipping changes. +- **Order submission** – form submission to `checkoutBean.placeOrder`. + +#### Key units +- **`checkout.xhtml`** – Facelets page, template `shop.xhtml`, includes payment hints. +- **`checkoutBean`** – Managed bean providing `address`, `shippingMethod`, `shippingMethods`, `total`, `recalculate()`, `placeOrder()`. + +#### Data flow +1. User enters address (`address.street`, `address.zip`) and selects `shippingMethod`. +2. Ajax listener `recalculate()` updates `total`. +3. `total` displayed in EUR format. +4. On submit, `placeOrder()` processes the order. + +#### Dependencies +- JSF tag libraries: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- Included fragment: `/WEB-INF/includes/payment-hints.xhtml`. +- Managed bean: `checkoutBean`. + +#### Cross-cutting +- EL expressions for data binding and method calls. +- Validation on ZIP via regex `[0-9]{5}`. +- Currency conversion for `total` to EUR. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..8cd1e053 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,63 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:10:26Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Tests shipping cost calculation and overload handling for DHL parcels. + +#### Purpose +- Verify free shipping threshold logic. +- Validate tiered pricing by weight. +- Ensure overweight parcels throw `ParcelTooHeavyException`. + +#### Type +- `class ShippingRulesSpec` – test specification (extends `Specification`). +- `class ShippingRules` – shipping cost calculator (`@CompileStatic`). + +#### Input +- `ShippingRulesSpec`: + - `rules` instance (`carrier: 'DHL', maxParcelKg: 31.5`). + - Test orders (`Order(total: …, weightKg: …)`). +- `ShippingRules`: + - `carrier: String` + - `maxParcelKg: BigDecimal` + - `costFor(Order order)` parameters. + +#### Output +- `ShippingRules.costFor` returns `BigDecimal` shipping cost or throws `ParcelTooHeavyException`. +- Test methods assert returned cost or exception. + +#### Core logic +- `costFor`: + 1. If `order.weightKg > maxParcelKg` → throw `ParcelTooHeavyException`. + 2. If `order.total >= ShippingRulesSpec.FREE_SHIPPING_THRESHOLD` → return `0`. + 3. Define tiers: `[upTo: 2, price: 4.99]`, `[upTo: 10, price: 9.99]`, `[upTo: 31.5, price: 19.99]`. + 4. Find first tier where `order.weightKg <= tier.upTo` and return `tier.price`. + +#### Public API +- `ShippingRules.costFor(Order) -> BigDecimal` – compute shipping cost. +- `ShippingRulesSpec.orders above the threshold ship for free() -> void` – test. +- `ShippingRulesSpec.a parcel of #weight kg costs #expected() -> void` – parameterized test. +- `ShippingRulesSpec.an overweight parcel is rejected() -> void` – test. +- `ShippingRulesSpec.heavyOrder(BigDecimal) -> Order` – helper (private). + +#### Dependencies +- `groovy.transform.CompileStatic` +- `spock.lang.Specification` +- `spock.lang.Unroll` +- `Order` (external domain class) +- `ParcelTooHeavyException` (external exception) + +#### Exceptions / Errors +- `ParcelTooHeavyException` thrown when parcel weight exceeds `maxParcelKg`. + +#### Concurrency +- None. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/groovy/package.ai.md new file mode 100644 index 00000000..cd1d4414 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/groovy/package.ai.md @@ -0,0 +1,39 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:11:47Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> A Groovy test suite that verifies DHL shipping cost calculations, free‑shipping thresholds, tiered pricing, and overweight handling. + +#### Purpose +- Validate DHL shipping cost logic. +- Ensure correct free‑shipping and tiered pricing behavior. +- Confirm overweight parcels trigger `ParcelTooHeavyException`. + +#### Responsibilities +- **Testing**: Spock specification (`ShippingRulesSpec`) covering free shipping, tiered rates, and overweight rejection. +- **Calculation**: `ShippingRules` class implements `costFor(Order)` with weight limits, thresholds, and tiered pricing. + +#### Key units +- **`ShippingRules`** (`@CompileStatic`): `costFor(Order)` → `BigDecimal`; throws `ParcelTooHeavyException` if `order.weightKg > maxParcelKg`. +- **`ShippingRulesSpec`** (`Specification`): parameterized tests (`@Unroll`) for tiered rates, free‑shipping threshold, and overweight rejection; helper `heavyOrder(BigDecimal)`. + +#### Data flow +1. `ShippingRulesSpec` creates a `ShippingRules` instance with `carrier: 'DHL'` and `maxParcelKg: 31.5`. +2. Test orders (`Order(total, weightKg)`) are passed to `ShippingRules.costFor`. +3. `costFor` checks weight against `maxParcelKg`, applies free‑shipping threshold, selects appropriate tier, and returns the price or throws an exception. +4. Assertions in the spec verify returned cost or exception. + +#### Dependencies +- **Internal**: `Order` domain class, `ParcelTooHeavyException`. +- **External**: Groovy `@CompileStatic`, Spock `Specification`, `Unroll`. + +#### Cross-cutting +- Static type checking via `@CompileStatic`. +- Parameterized testing with Spock’s `@Unroll`. +- Consistent use of `Order` objects and exception handling across tests. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..e2fd99cb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md @@ -0,0 +1,61 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:10:33Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Configures a Camel integration context for processing order messages, validating them, routing to ERP or manual review, and handling exceptions. + +#### Purpose +- Defines order processing routes. +- Validates orders and translates invoices. +- Routes orders to ERP or manual review based on total. +- Handles ERP unavailability with redelivery and dead‑letter queue. + +#### Type +- Spring XML configuration. +- Root element: `beans`. +- Namespaces: `http://www.springframework.org/schema/beans` (default), `http://camel.apache.org/schema/spring` (Camel). + +#### Definitions +- **Beans** + - `orderValidator` – class `shop.integration.OrderValidator`. + - `invoiceTranslator` – class `shop.integration.InvoiceTranslator`. +- **Camel Context** `orderIntegration` + - **Property placeholder** `properties` – location `classpath:integration.properties`. + - **Exception handling** for `shop.integration.ErpUnavailableException`: + - Redelivery: max 5, delay 2000 ms, exponential back‑off. + - Handled, then send to `jms:queue:orders.deadletter`. + - **Routes** + - `incomingOrders` + - From `jms:queue:{{orders.incoming.queue}}`. + - Validates via `orderValidator`. + - Choice: if `${body.total} > {{orders.review.threshold}}` → `direct:manualReview`; else → `direct:toErp`. + - Wire‑tap to `seda:orderAudit`. + - `toErp` + - From `direct:toErp`. + - Translates via `invoiceTranslator`. + - Dynamic to `https://{{erp.host}}/api/orders/${header.orderId}`. + - `manualReview` + - From `direct:manualReview`. + - Splits `${body.lines}` and sends each to `jms:queue:review.lines`. + - (Commented) `legacyFtpImport` route. + +#### Configuration +- `orders.incoming.queue` – queue name for incoming orders. +- `orders.review.threshold` – numeric threshold for manual review. +- `erp.host` – ERP host URL. +- `properties` file: `classpath:integration.properties`. + +#### Dependencies +- `shop.integration.OrderValidator` +- `shop.integration.InvoiceTranslator` +- `shop.integration.ErpUnavailableException` +- External systems: JMS queues (`orders.deadletter`, `review.lines`), SEDA channel (`orderAudit`), HTTP endpoint `https://{{erp.host}}/api/orders/...`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/integration/package.ai.md new file mode 100644 index 00000000..7aa3d183 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/integration/package.ai.md @@ -0,0 +1,49 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:11:51Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Provides a Camel‑based integration layer that validates, audits, and routes order messages to an ERP system or a manual review queue, with retry and dead‑letter handling for ERP failures. + +#### Purpose +- Configure Camel routes for order processing. +- Validate orders and translate invoices. +- Route orders to ERP or manual review based on total amount. +- Handle ERP unavailability with retries and dead‑letter queue. + +#### Responsibilities +- **Order validation** – `orderValidator` bean checks order structure and business rules. +- **Invoice translation** – `invoiceTranslator` bean converts order objects to ERP‑compatible payloads. +- **Routing logic** – Camel routes decide destination (`toErp` or `manualReview`) and audit messages. +- **Error handling** – Redelivery policy for `ErpUnavailableException` and dead‑letter queue. + +#### Key units +- `orderValidator` (`shop.integration.OrderValidator`) – validates incoming orders. +- `invoiceTranslator` (`shop.integration.InvoiceTranslator`) – translates orders to ERP format. +- `ErpUnavailableException` (`shop.integration.ErpUnavailableException`) – signals ERP connectivity issues. +- Camel context `orderIntegration` – hosts all routes and exception handling. +- Routes: `incomingOrders`, `toErp`, `manualReview`, (commented `legacyFtpImport`). + +#### Data flow +1. **Incoming**: `jms:queue:{{orders.incoming.queue}}` → `incomingOrders`. +2. **Validation**: `orderValidator`. +3. **Audit**: wire‑tap to `seda:orderAudit`. +4. **Decision**: if `body.total > {{orders.review.threshold}}` → `manualReview`; else → `toErp`. +5. **Manual review**: split `body.lines` → `jms:queue:review.lines`. +6. **ERP**: translate via `invoiceTranslator` → HTTP POST to `https://{{erp.host}}/api/orders/${header.orderId}`. +7. **Failure**: on `ErpUnavailableException`, retry up to 5 times, then send to `jms:queue:orders.deadletter`. + +#### Dependencies +- **Internal**: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `shop.integration.ErpUnavailableException`. +- **External**: JMS queues (`orders.deadletter`, `review.lines`), SEDA channel (`orderAudit`), HTTP endpoint (`https://{{erp.host}}/api/orders/...`). +- **Configuration**: `integration.properties` for queue names, thresholds, and ERP host. + +#### Cross-cutting +- Property placeholders (`{{…}}`) for runtime configuration. +- Centralized exception handling with redelivery and dead‑letter strategy. +- Wire‑tap for audit logging without affecting main flow. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..3b0c2119 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,48 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:10:37Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Configures Jakarta EE enterprise beans, their environment, transactions, and interceptors for a shop application. + +#### Purpose +- Declares session and message‑driven beans for stock reservation, checkout, and order events. +- Sets environment entry for reservation timeout. +- Defines local reference for checkout bean to stock reservation. +- Configures activation for order‑placed listener. +- Applies timing interceptor globally and specifies transaction attribute for reservation. + +#### Type +- Jakarta EE `ejb-jar` descriptor, root element ``. +- Namespace: `https://jakarta.ee/xml/ns/jakartaee` (prefix `xmlns`). + +#### Definitions +- **Session Beans** + - `StockReservationBean` (`shop.stock.StockReservationBean`, Stateless) + - Env entry `reservationMinutes` (`java.lang.Integer`, `45`). + - `CheckoutSessionBean` (`shop.checkout.CheckoutSessionBean`, Stateful) + - Local reference `ejb/StockReservation` to `shop.stock.StockReservation`. +- **Message‑Driven Bean** + - `OrderPlacedListener` (`shop.events.OrderPlacedListener`) + - Activation property `destinationLookup` → `java:/jms/queue/OrderPlaced`. +- **Interceptor** + - `shop.audit.TimingInterceptor`. +- **Assembly Descriptor** + - Transaction: method `StockReservationBean.reserve` → `RequiresNew`. + - Interceptor binding: applies `shop.audit.TimingInterceptor` to all EJBs (`*`). + +#### Configuration +- `reservationMinutes` = `45`. +- `destinationLookup` = `java:/jms/queue/OrderPlaced`. +- Transaction attribute for `reserve` = `RequiresNew`. + +#### Dependencies +- Java classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`, `shop.stock.StockReservation`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jee/package.ai.md new file mode 100644 index 00000000..38599eaf --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jee/package.ai.md @@ -0,0 +1,47 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:11:57Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> Provides the Jakarta EE configuration for a shop application, wiring enterprise beans, web components, and security. + +#### Purpose +- Declares and configures enterprise beans (session, message‑driven, interceptors) for stock reservation, checkout, and order events. +- Sets up the web layer: servlets, filters, listeners, session timeout, security constraints, and JDBC resource reference. + +#### Responsibilities +- **Enterprise Bean Configuration** – session beans, message‑driven listeners, environment entries, transaction attributes, and interceptor bindings. +- **Web Deployment** – servlet, filter, listener, context parameters, session timeout, security constraints, and resource references. + +#### Key units +- `StockReservationBean` (stateless, `shop.stock.StockReservationBean`) – reserves stock, uses `reservationMinutes` env entry, transaction `RequiresNew`. +- `CheckoutSessionBean` (stateful, `shop.checkout.CheckoutSessionBean`) – references `StockReservation`. +- `OrderPlacedListener` (message‑driven, `shop.events.OrderPlacedListener`) – listens on `java:/jms/queue/OrderPlaced`. +- `TimingInterceptor` (`shop.audit.TimingInterceptor`) – applied to all EJBs. +- `ReportDownloadServlet` (`shop.web.ReportDownloadServlet`) – handles `/reports/*`. +- `RequestIdFilter` (`shop.web.RequestIdFilter`) – applied to all requests. +- `StartupAuditListener` (`shop.web.StartupAuditListener`) – application startup listener. +- `shop.reportDirectory` context param – `/var/shop/reports`. +- `jdbc/ShopDS` DataSource reference. + +#### Data flow +1. **Order Placement** → `OrderPlacedListener` receives JMS message → triggers business logic (not shown) that may call `StockReservationBean.reserve`. +2. **Checkout Process** → `CheckoutSessionBean` interacts with `StockReservationBean` via local reference. +3. **Web Requests** → `RequestIdFilter` assigns request IDs → `ReportDownloadServlet` serves report files from `/var/shop/reports` → audit via `StartupAuditListener`. + +#### Dependencies +- Jakarta EE APIs: EJB, JMS, Servlet, Security. +- External resource: JDBC DataSource `jdbc/ShopDS`. +- Internal classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`, `shop.web.ReportDownloadServlet`, `shop.web.RequestIdFilter`, `shop.web.StartupAuditListener`. + +#### Cross-cutting +- **Timing Interceptor** applied globally to all EJBs. +- **Environment Entry** `reservationMinutes` shared by `StockReservationBean`. +- **Security**: `/admin/*` protected by role `admin`; session timeout set to 20 minutes. +- **Configuration**: context param `shop.reportDirectory` and JDBC resource reference used across web components. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jee/web.xml.ai.md new file mode 100644 index 00000000..8cd9a2a0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jee/web.xml.ai.md @@ -0,0 +1,52 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:10:40Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Configures the Jakarta EE web application “shop-backoffice”, defining servlets, filters, listeners, session timeout, security constraints, and a JDBC resource reference. + +#### Purpose +- Sets up servlet, filter, listener, and security configuration for the web app. + +#### Type +- Jakarta EE web deployment descriptor (`web.xml`), root element `web-app` in namespace `https://jakarta.ee/xml/ns/jakartaee`, version `6.0`. + +#### Definitions +- **Context parameter**: `shop.reportDirectory` → `/var/shop/reports` +- **Servlet**: `ReportDownloadServlet` + - class: `shop.web.ReportDownloadServlet` + - load-on-startup: `1` +- **Servlet mapping**: `ReportDownloadServlet` → `/reports/*` +- **Filter**: `RequestIdFilter` + - class: `shop.web.RequestIdFilter` +- **Filter mapping**: `RequestIdFilter` → `/*` +- **Listener**: `shop.web.StartupAuditListener` +- **Session config**: timeout `20` minutes +- **Security constraint**: + - resource collection `backoffice` → `/admin/*` + - auth constraint role: `admin` +- **Security role**: `admin` +- **Resource reference**: `jdbc/ShopDS` of type `javax.sql.DataSource` + +#### Configuration +- `shop.reportDirectory` = `/var/shop/reports` +- `session-timeout` = `20` +- `load-on-startup` for `ReportDownloadServlet` = `1` +- `url-pattern` for `ReportDownloadServlet` = `/reports/*` +- `url-pattern` for `RequestIdFilter` = `/*` +- `auth-constraint` role `admin` protects `/admin/*` + +#### Dependencies +- Servlet class `shop.web.ReportDownloadServlet` +- Filter class `shop.web.RequestIdFilter` +- Listener class `shop.web.StartupAuditListener` +- JDBC resource `jdbc/ShopDS` (DataSource) +- Security role `admin` (no external definition shown) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..cad78493 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,47 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:10:43Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> Displays a searchable list of open orders, allowing filtering by customer email and status, and providing a cancel link for each order. + +#### Purpose +- Show open orders with details. +- Enable search by customer email and status. +- Offer cancel action per order. + +#### Type +- JSP page +- Content type: `text/html;charset=UTF-8` +- Tag libraries: `c` = `jakarta.tags.core`, `fmt` = `jakarta.tags.fmt` + +#### Data +- Request attribute: `orderFilter` → `OrderFilter` (used for `pageSize`) +- Request attribute: `orders` → `List` (iterated with `var="order"`) +- Request parameters: `customerEmail`, `status` +- Order properties accessed: `order.number`, `order.total`, `order.overdue`, `order.id` + +#### Actions +- Form: `action="${pageContext.request.contextPath}/orders/search"`, method `get` + - Inputs: `customerEmail` (text), `status` (select), submit button +- Link: `href="orders/${order.id}/cancel"` (per order) + +#### Structure +- Includes: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf` + +#### Server code +- Scriptlet: retrieves `OrderFilter` from request, sets `pageSize` (default 25) +- Expression: `<%= pageSize %>` displays page size + +#### Dependencies +- Java classes: `java.util.List`, `shop.Order`, `shop.OrderFilter` +- Tag libraries: `jakarta.tags.core`, `jakarta.tags.fmt` +- Included JSP fragments: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jsp/package.ai.md new file mode 100644 index 00000000..328de8d6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/jsp/package.ai.md @@ -0,0 +1,43 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:12:01Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> Provides a web interface for viewing, searching, and canceling open orders in the shop system. + +#### Purpose +- Display a paginated list of open orders. +- Allow filtering by customer email and order status. +- Offer a cancel link for each order. + +#### Responsibilities +- **Order listing**: iterate over `List` and render order details. +- **Search/filter**: capture `customerEmail` and `status` from query parameters and submit via GET. +- **Pagination**: use `OrderFilter.pageSize` (default 25) to control list length. +- **Order cancellation**: generate a cancel URL per order. + +#### Key units +- **`order-list.jsp`** – JSP page rendering the order table, search form, and cancel links. +- **`OrderFilter`** – request attribute holding pagination settings (e.g., `pageSize`). +- **`Order`** – domain model providing `number`, `total`, `overdue`, `id`. + +#### Data flow +1. Client requests `/orders/list` → `order-list.jsp` rendered. +2. JSP reads `OrderFilter` and `orders` from request attributes. +3. Search form submits to `/orders/search` with `customerEmail` and `status`. +4. Each order row includes a link to `/orders/{id}/cancel`. + +#### Dependencies +- **Java classes**: `java.util.List`, `shop.Order`, `shop.OrderFilter`. +- **Tag libraries**: `jakarta.tags.core` (`c`), `jakarta.tags.fmt` (`fmt`). +- **JSP fragments**: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf`. + +#### Cross-cutting +- Uses EL expressions for dynamic content (`${}`) and JSTL core tags for iteration and conditionals. +- Pagination logic is driven by a request-scoped `OrderFilter` object. +- Standard HTML form with GET method for search parameters. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..88d20220 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,53 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:10:46Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the `orders-backoffice` application, exposing it via a Service and Ingress. + +#### Purpose +- Deploys the `orders-backoffice` microservice. +- Exposes it on HTTP port 80 through a Service and Ingress. + +#### Type +- Kubernetes `Deployment` (apiVersion `apps/v1`), `Service` (apiVersion `v1`), `Ingress` (apiVersion `networking.k8s.io/v1`). + +#### Definitions +- `Deployment` `orders-backoffice` + - 3 replicas + - Container `backoffice` + - Image `registry.shop.example/orders-backoffice:2.1.0` + - Port `8080` + - Env `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` + - Env `SHOP_DB_PASSWORD` from secret `orders-db-credentials` key `password` + - Readiness probe HTTP `/health/ready` on port `8080` + - Resource limits: `memory: 768Mi`, `cpu: "1"` +- `Service` `orders-backoffice` + - Selector `app: orders-backoffice` + - Port `80` → targetPort `8080` +- `Ingress` `orders-backoffice` + - Host `backoffice.shop.example` + - Path `/` (Prefix) → service `orders-backoffice` port `80` + +#### Configuration +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD` from secret `orders-db-credentials` key `password` +- `replicas=3` +- `image=registry.shop.example/orders-backoffice:2.1.0` +- `containerPort=8080` +- `servicePort=80` +- `targetPort=8080` +- `ingressHost=backoffice.shop.example` + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0` +- Secret `orders-db-credentials` (key `password`) +- Service `orders-backoffice` (used by Ingress) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/k8s/package.ai.md new file mode 100644 index 00000000..d35b11ba --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/k8s/package.ai.md @@ -0,0 +1,40 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:12:04Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Deploys and exposes the `orders-backoffice` microservice in a Kubernetes cluster. + +#### Purpose +- Deploy the `orders-backoffice` application. +- Expose it via a Service and Ingress on HTTP port 80. + +#### Responsibilities +- **Deployment**: manage pod replicas, container image, environment, probes, and resource limits. +- **Service**: route internal traffic to the pods. +- **Ingress**: provide external HTTP access with host and path routing. + +#### Key units +- **Deployment `orders-backoffice`** – 3 replicas, container `backoffice` (image `registry.shop.example/orders-backoffice:2.1.0`, port 8080, env `SHOP_DB_URL`, secret‑backed `SHOP_DB_PASSWORD`, readiness probe `/health/ready`, limits `memory:768Mi`, `cpu:1`). +- **Service `orders-backoffice`** – selector `app: orders-backoffice`, port 80 → targetPort 8080. +- **Ingress `orders-backoffice`** – host `backoffice.shop.example`, path `/` → service `orders-backoffice` port 80. + +#### Data flow +1. **Deployment** creates pods with the backoffice container, injecting DB URL and password from the `orders-db-credentials` secret. +2. **Service** forwards internal traffic on port 80 to pod port 8080. +3. **Ingress** receives external HTTP requests on `backoffice.shop.example` and routes them to the Service. + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0`. +- Secret `orders-db-credentials` (key `password`). +- PostgreSQL database at `orders-db:5432/shop`. + +#### Cross-cutting +- Environment variables for DB connectivity. +- Secret usage for sensitive data. +- Readiness probe ensures pod availability before traffic routing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..4e3ad548 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,99 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:10:49Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Generates and stores invoices for completed orders, applying tax rules and payment terms. + +#### Purpose +- Issues invoices for completed orders. +- Applies reduced tax rate to specific categories. +- Persists invoices via `InvoiceRepository`. + +#### Type +- `final class InvoiceService` (class) + - Extends `Any`. + - Implements no interfaces. + - Modifiers: none. + - Annotations: none. +- `value class InvoiceNumber` (value) + - Extends `Any`. + - Modifiers: `@JvmInline`. +- `data class InvoiceLine` (data) + - Extends `Any`. + - Modifiers: none. +- `sealed interface InvoiceResult` (interface) + - Extends `Any`. + - Modifiers: none. + - Nested types: + - `data class Issued` (data) – implements `InvoiceResult`. + - `data class Rejected` (data) – implements `InvoiceResult`. +- Top‑level function `fun List.total()` (extension function). + +#### Input +- `InvoiceService` constructor: + - `repository: InvoiceRepository` – injected persistence. + - `clock: () -> LocalDate` – default `LocalDate::now`. +- `issue(order: CompletedOrder)` parameters: `order: CompletedOrder`. +- `taxRate(category: String)` parameter: `category: String`. +- `nextNumber()` uses internal `sequence` and `PREFIX`. +- `total()` operates on `List`. + +#### Output +- `issue` returns `InvoiceResult` (`Issued` or `Rejected`). +- `taxRate` returns `BigDecimal`. +- `total` returns `BigDecimal`. +- `repository.save(invoice)` writes invoice to storage. +- `InvoiceResult.Issued` contains `InvoiceNumber` and `dueDate`. +- `InvoiceResult.Rejected` contains rejection reason. + +#### Core logic +- `issue` + 1. Validate non‑empty `order.lines`. + 2. Generate next invoice number via `nextNumber()`. + 3. Create `Invoice` with due date `clock().plusDays(PAYMENT_TERM_DAYS)`. + 4. Persist invoice with `repository.save`. + 5. Return `Issued(number, dueDate)`. +- `taxRate` + - Return `0.07` if `category` in `REDUCED_TAX_CATEGORIES`; else `0.19`. +- `total` + - Sum `line.amount` over list. + +#### Public API +- `InvoiceService.issue(order: CompletedOrder) -> InvoiceResult` – issue invoice. +- `InvoiceService.taxRate(category: String) -> BigDecimal` – tax rate lookup. +- `InvoiceNumber.value: String` – invoice identifier. +- `InvoiceLine.amount: BigDecimal` – line total. +- `InvoiceLine.sku: String` – product code. +- `InvoiceLine.quantity: Int` – quantity. +- `InvoiceLine.unitPrice: BigDecimal` – unit price. +- `InvoiceResult.Issued.number: InvoiceNumber` – issued number. +- `InvoiceResult.Issued.dueDate: LocalDate` – due date. +- `InvoiceResult.Rejected.reason: String` – rejection reason. +- `List.total() -> BigDecimal` – total amount. + +#### Dependencies +- `java.math.BigDecimal` +- `java.time.LocalDate` +- `kotlinx.coroutines.Dispatchers` +- `kotlinx.coroutines.withContext` +- `shop.billing.InvoiceRepository` +- `shop.billing.CompletedOrder` +- `shop.billing.Invoice` (used in `issue`) + +#### Exceptions / Errors +- `issue` returns `Rejected` if `order.lines.isEmpty()`. +- No explicit exceptions thrown; relies on repository and coroutine context. + +#### Concurrency +- `issue` runs in `Dispatchers.IO` context. +- No shared mutable state beyond `sequence` (private, not thread‑safe). +- `defaultCurrency` is `lateinit` and mutable; no synchronization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/kotlin/package.ai.md new file mode 100644 index 00000000..b4f58d93 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/kotlin/package.ai.md @@ -0,0 +1,47 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:12:08Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> Generates and stores invoices for completed orders, applying tax rules and payment terms. + +#### Purpose +- Issues invoices for completed orders. +- Applies reduced tax rate to specific categories. +- Persists invoices via `InvoiceRepository`. + +#### Responsibilities +- **Invoice generation** – create `Invoice` objects with sequential numbers and due dates. +- **Tax calculation** – provide tax rates per product category. +- **Invoice line aggregation** – compute total amounts from line items. +- **Persistence** – store issued invoices and report rejections. + +#### Key units +- `InvoiceService` – orchestrates invoice creation, validation, and persistence. +- `InvoiceNumber` – inline value type for unique invoice identifiers. +- `InvoiceLine` – data holder for SKU, quantity, unit price, and line total. +- `InvoiceResult` (sealed) – outcome of an issuance attempt (`Issued` or `Rejected`). +- `List.total()` – extension to sum line amounts. + +#### Data flow +1. `InvoiceService.issue(order)` receives a `CompletedOrder`. +2. Validates `order.lines`; if empty → `Rejected`. +3. Generates next `InvoiceNumber` via internal sequence. +4. Builds `Invoice` with due date (`clock().plusDays(PAYMENT_TERM_DAYS)`). +5. Persists via `InvoiceRepository.save`. +6. Returns `InvoiceResult.Issued(number, dueDate)`. + +#### Dependencies +- **Internal**: `InvoiceRepository`, `CompletedOrder`, `Invoice`. +- **External**: `java.math.BigDecimal`, `java.time.LocalDate`, `kotlinx.coroutines.Dispatchers`, `kotlinx.coroutines.withContext`. + +#### Cross-cutting +- Uses coroutine `Dispatchers.IO` for I/O operations. +- Tax rates are hard‑coded with a reduced‑rate list (`REDUCED_TAX_CATEGORIES`). +- No shared mutable state beyond a non‑thread‑safe sequence counter. +- Rejections are communicated via the `Rejected` sealed data class rather than exceptions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..5a2712dc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,57 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:10:56Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Maps customer data between SQL rows and `shop.customer.Customer` objects, providing CRUD and search operations. + +#### Purpose +- Define SQL mappings for customer entities. +- Provide queries for lookup, search, insert, update, and delete. + +#### Type +- MyBatis mapper XML + Root element: `mapper` + Namespace: `shop.customer.CustomerMapper` + Declared DTD: `mybatis.org/DTD Mapper 3.0` + +#### Definitions +- **ResultMap** `customerResult` + - `id` → `CUSTOMER_ID` + - `result` `email` → `EMAIL` + - `result` `loyaltyTier` → `LOYALTY_TIER` +- **SQL fragment** `customerColumns` → `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT` +- **Select** `findByEmail` + - ResultMap: `customerResult` + - SQL: `select from CUSTOMER where EMAIL = #{email}` +- **Select** `search` + - ResultMap: `customerResult` + - Conditional clauses: `tier`, `createdAfter` + - Order by `${sortColumn}` +- **Insert** `insert` + - `useGeneratedKeys="true"`, `keyProperty="id"` + - Columns: `EMAIL, LOYALTY_TIER, CREATED_AT` (value `now()`) +- **Update** `promote` + - Set `LOYALTY_TIER = #{tier}` + - `WHERE CUSTOMER_ID IN (#{id} …)` +- **Delete** `deleteInactive` + - Condition: `LAST_ORDER_AT < #{cutoff}` + +#### Configuration +- `useGeneratedKeys="true"` on `insert` +- `keyProperty="id"` on `insert` +- `order by ${sortColumn}` in `search` +- `now()` used for `CREATED_AT` in `insert` + +#### Dependencies +- SQL table: `CUSTOMER` +- Columns: `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT` +- Java class: `shop.customer.Customer` (fields: `id`, `email`, `loyaltyTier`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/mybatis/package.ai.md new file mode 100644 index 00000000..ce502845 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/mybatis/package.ai.md @@ -0,0 +1,55 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:12:12Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Provides MyBatis SQL mappings for CRUD and search operations on customer data in the shop domain. + +#### Purpose +- Define SQL mappings for `shop.customer.Customer` entities. +- Expose queries for lookup, search, insert, update, and delete. + +#### Responsibilities +- **Data Access Layer**: Translate between SQL rows and `Customer` objects. +- **Query Composition**: Build dynamic SQL for filtering and ordering. +- **Key Generation**: Handle auto‑generated primary keys on insert. + +#### Key units +- **Mapper XML** `shop.customer.CustomerMapper` + - Namespace: `shop.customer.CustomerMapper` +- **ResultMap** `customerResult` + - Maps `CUSTOMER_ID` → `id`, `EMAIL` → `email`, `LOYALTY_TIER` → `loyaltyTier` +- **SQL Fragment** `customerColumns` + - `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT` +- **Select** `findByEmail` + - Retrieves a single customer by email. +- **Select** `search` + - Dynamic filtering by `tier` and `createdAfter`; orders by `${sortColumn}`. +- **Insert** `insert` + - Inserts a new customer, uses `now()` for `CREATED_AT`, returns generated `id`. +- **Update** `promote` + - Batch updates `LOYALTY_TIER` for given customer IDs. +- **Delete** `deleteInactive` + - Removes customers whose `LAST_ORDER_AT` is older than a cutoff. + +#### Data flow +1. **Input**: Method parameters (`email`, `tier`, `createdAfter`, `sortColumn`, `id`, `cutoff`). +2. **Processing**: MyBatis constructs SQL using fragments, dynamic tags, and parameter placeholders. +3. **Execution**: SQL runs against the `CUSTOMER` table. +4. **Output**: Result maps populate `shop.customer.Customer` objects or affect row counts. + +#### Dependencies +- **Database**: Table `CUSTOMER` with columns `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`. +- **Java**: Class `shop.customer.Customer` (fields `id`, `email`, `loyaltyTier`). +- **MyBatis**: Uses `useGeneratedKeys="true"` and `keyProperty="id"` for inserts. + +#### Cross-cutting +- **Dynamic SQL**: Uses ``, ``, and `` tags for optional clauses. +- **Parameter Binding**: `#{}` for safe binding; `${}` for dynamic column names. +- **Result Mapping**: Single `ResultMap` reused across selects. +- **Fragment Inclusion**: `` promotes DRYness. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..fa35cc9f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,46 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:10:59Z +- G: +- A: 0.0.0 +- X: file +- P: 34DB4705 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> The Shop Orders API lets backoffice users list, retrieve, and cancel shop orders, exposing order status and total amounts. + +#### Purpose +- List orders with optional status filter and limit. +- Retrieve a specific order by ID. +- Cancel an order (requires write scope). + +#### Type +- OpenAPI 3.0.3 +- Title: `Shop Orders API` +- Version: `2.1.0` +- Server: `https://api.shop.example/backoffice` + +#### Operations +- `GET /orders` – `listOrders` – query `status` (`OrderStatus`), `limit` (int, max 200); 200 → array of `Order`. +- `GET /orders/{orderId}` – `getOrder` – path `orderId` (string); 200 → `Order`; 404 → no such order. +- `POST /orders/{orderId}/cancel` – `cancelOrder` – path `orderId` (string); security `backofficeToken` with scope `orders:write`; 204 → cancelled; 409 → already shipped. + +#### Schemas +- `OrderStatus` – enum: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order` – object, required: `orderId`, `status`, `total`; properties: + - `orderId`: string + - `status`: `OrderStatus` + - `total`: number (double) + - `couponCode`: string (deprecated) + +#### Security and servers +- Security scheme `backofficeToken`: OAuth2 client credentials, token URL `https://auth.shop.example/token`, scope `orders:write` (change orders). +- Operation `cancelOrder` requires `backofficeToken` with `orders:write`. +- Server URL: `https://api.shop.example/backoffice`. + +#### Dependencies +- `$ref` to `#/components/schemas/OrderStatus` and `#/components/schemas/Order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/openapi/package.ai.md new file mode 100644 index 00000000..8a2c3317 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/openapi/package.ai.md @@ -0,0 +1,40 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:12:19Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> A back‑office service for managing shop orders: listing, retrieving, and cancelling orders with status and total amount information. + +#### Purpose +- Provide CRUD‑like operations for shop orders via a REST API. +- Expose order status and total amounts to back‑office users. + +#### Responsibilities +- **Order Retrieval** – list orders with optional status filter and limit; fetch a single order by ID. +- **Order Cancellation** – cancel an existing order, enforcing write permissions and handling shipping conflicts. +- **Security** – enforce OAuth2 client‑credentials flow with `orders:write` scope for mutating actions. + +#### Key units +- **OpenAPI Document** – `orders-api.yaml` (v2.1.0, OpenAPI 3.0.3) defining the API surface. +- **Schemas** – `OrderStatus` (enum: OPEN, PAID, SHIPPED, CANCELLED); `Order` (orderId, status, total, optional deprecated couponCode). +- **Operations** – `listOrders`, `getOrder`, `cancelOrder` with corresponding HTTP methods and paths. + +#### Data flow +1. **List**: `GET /orders` → query parameters (`status`, `limit`) → returns array of `Order`. +2. **Retrieve**: `GET /orders/{orderId}` → path parameter → returns single `Order` or 404. +3. **Cancel**: `POST /orders/{orderId}/cancel` → requires `backofficeToken` with `orders:write`; returns 204 or 409 if already shipped. + +#### Dependencies +- **Security** – OAuth2 client‑credentials (`backofficeToken`) with `orders:write` scope. +- **Server** – `https://api.shop.example/backoffice`. +- **Internal references** – `$ref` to `#/components/schemas/OrderStatus` and `#/components/schemas/Order`. + +#### Cross‑cutting +- **Error handling** – 404 for missing orders; 409 for cancellation conflicts. +- **Deprecated fields** – `couponCode` in `Order` schema marked deprecated. +- **Rate limiting / pagination** – implied by `limit` parameter (max 200). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..c176d54d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,79 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:12:33Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> A Java‑based shop back‑office that builds, tests, containerises, and deploys an order‑fulfilment service, exposing REST, SOAP, and BPMN interfaces while persisting orders, shipments, and invoices in a PostgreSQL database. + +#### Purpose +- Deliver a fully‑automated CI/CD pipeline for the Backoffice service. +- Provide order‑fulfilment logic via BPMN, REST, and SOAP. +- Persist order, shipment, and invoice data with Hibernate/MyBatis. +- Expose Kubernetes deployment and Docker images. + +#### Responsibilities +- **CI/CD** – GitHub Actions workflows for build, image, and Kubernetes deployment. +- **Order lifecycle** – Camunda BPMN process (`orderFulfilment`) coordinating stock, payment, approval, shipping, invoicing. +- **Integration** – Camel routes validating orders, routing to ERP or manual review, with retry and dead‑letter handling. +- **Persistence** – Hibernate entities (`Order`, `Shipment`, `ExpressShipment`, `DailyRevenue`) and MyBatis mappers for `Customer`. +- **Web services** – REST API (OpenAPI) for order CRUD, SOAP service for stock queries, JSP/Facelets UI for order listing and checkout. +- **Deployment** – Docker multi‑stage build, Kubernetes manifests, and Helm‑style secrets. + +#### Key units +- **GitHub Actions**: `.github/workflows/release.yml` (build, image, deploy). +- **BPMN**: `orderFulfilment` process, delegates `ReserveStockDelegate`, `shipOrder` topic, `createInvoice` call. +- **Camel**: `orderIntegration` context, routes `incomingOrders`, `toErp`, `manualReview`, `orderValidator`, `invoiceTranslator`. +- **Hibernate**: `Shipment`, `ExpressShipment` mappings; named queries `Shipment.undelivered`, `Shipment.countByCarrier`. +- **MyBatis**: `shop.customer.CustomerMapper` with dynamic `search`, `insert`, `promote`, `deleteInactive`. +- **REST**: `orders-api.yaml` (list, get, cancel) with `OrderStatus` enum. +- **SOAP**: `StockService.wsdl` exposing `GetStockLevel`. +- **Docker**: `Dockerfile` (build & runtime stages), `orders-backoffice.jar`. +- **Kubernetes**: `orders-backoffice` Deployment, Service, Ingress. +- **Facelets/JSP**: `checkout.xhtml`, `checkoutBean`, `order-list.jsp`, `OrderFilter`. +- **Groovy**: `ShippingRules` and `ShippingRulesSpec` for DHL cost logic. + +#### Data flow +1. **CI/CD**: Tag push → build → test → Docker image → push → Kubernetes rollout. +2. **Order placement**: User submits via Facelets → `checkoutBean.placeOrder` → Camel `incomingOrders`. +3. **Camel validation** → audit → decision → ERP or manual review. +4. **BPMN**: `orderFulfilment` reserves stock, waits for payment, approves large orders, ships, creates invoice. +5. **Persistence**: Hibernate persists `Order`, `Shipment`; MyBatis handles `Customer`. +6. **REST**: Backoffice UI or external clients list/get/cancel orders via OpenAPI. +7. **SOAP**: External ERP queries stock via `GetStockLevel`. + +#### Dependencies +- **GitHub Actions**: `actions/checkout`, `actions/setup-java`, `docker/login-action`. +- **Camunda**: `camunda` namespace, Java delegates. +- **Camel**: JMS queues, SEDA, HTTP component, redelivery policy. +- **Hibernate**: PostgreSQL dialect, JTA/RESOURCE_LOCAL units, `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`. +- **MyBatis**: `shop.customer.CustomerMapper`, `CUSTOMER` table. +- **Docker**: Maven, Temurin JRE Alpine, `registry.shop.example`. +- **Kubernetes**: `orders-db-credentials` secret, PostgreSQL service `orders-db`. +- **JSP/Facelets**: Jakarta EE taglibs, `shop.Order`, `shop.OrderFilter`. +- **Groovy/Spock**: `ShippingRules`, `ParcelTooHeavyException`. + +#### Cross‑cutting +- **Security**: OAuth2 client‑credentials (`orders:write`) for REST; role `admin` for `/admin/*`; JMS and HTTP endpoints secured via secrets. +- **Configuration**: Property placeholders (`{{…}}`) in Camel, Kubernetes env vars, Docker `JAVA_OPTS`, `SHOP_PROFILE`. +- **Error handling**: Camel redelivery & dead‑letter, BPMN boundary events, REST 404/409, SOAP fault `UnknownSkuFault`. +- **Concurrency**: Camel retry policy, Hibernate transaction types, Docker non‑root user, coroutine `Dispatchers.IO` in Kotlin invoice service. +- **Testing**: Spock specs for shipping rules, integration tests implied for Camel routes, unit tests for BPMN delegates. +- **Observability**: Camel audit via `seda:orderAudit`, Kubernetes readiness probes, Docker healthcheck, timing interceptor on EJBs. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..5f43a727 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,47 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:11:06Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps the `shop.shipping.Shipment` entity and its subclasses to database tables, defines relationships, and provides named HQL/SQL queries. + +#### Purpose +- Persist `Shipment` and `ExpressShipment` entities. +- Provide queries for undelivered shipments and carrier counts. + +#### Type +- **Hibernate mapping** (`hibernate-mapping` root). +- Namespace: none. +- Declares DTD `-//Hibernate/Hibernate Mapping DTD 3.0//EN`. + +#### Definitions +- **Class** `Shipment` (table `SHIPMENT`): + - `id` (`SHIPMENT_ID`) – sequence `SHIPMENT_SEQ`. + - `trackingCode` (`TRACKING_CODE`, length 40, not-null). + - `carrier` (`CARRIER`, length 12). + - `shippedAt` (`SHIPPED_AT`, type `timestamp`). + - `order` (`ORDER_ID`, many-to-one to `shop.Order`, not-null). + - `parcels` (`Set` of `Parcel`, inverse, cascade `all-delete-orphan`). +- **Joined-subclass** `ExpressShipment` (table `EXPRESS_SHIPMENT`): + - `deliveryWindow` (`DELIVERY_WINDOW`). +- **Queries**: + - `Shipment.undelivered` – HQL: `from Shipment s where s.deliveredAt is null and s.shippedAt < :cutoff`. + - `Shipment.countByCarrier` – SQL: `select CARRIER, count(*) from SHIPMENT group by CARRIER`. + +#### Configuration +- Sequence generator: `sequence_name = SHIPMENT_SEQ`. +- Cascade: `all-delete-orphan` on `parcels`. +- Query parameters: `:cutoff` in `Shipment.undelivered`. + +#### Dependencies +- `shop.Order` (many-to-one reference). +- `Parcel` (one-to-many collection). +- DTD at `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/persistence/package.ai.md new file mode 100644 index 00000000..eb5d1f24 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/persistence/package.ai.md @@ -0,0 +1,49 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:12:24Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Provides Hibernate‑based persistence for shop orders, shipments, and reporting, exposing entity mappings, queries, and persistence unit configuration. + +#### Purpose +- Persist order‑related entities (`Order`, `OrderLine`, `Customer`, `Shipment`, `ExpressShipment`, `DailyRevenue`). +- Supply named queries for shipment status and carrier statistics. +- Configure JTA and RESOURCE_LOCAL persistence units with Hibernate. + +#### Responsibilities +- **Entity mapping** – Hibernate XML for `Shipment` and `ExpressShipment` with relationships to `Order` and `Parcel`. +- **Persistence unit definition** – `persistence.xml` declares two units (`shop`, `reporting`) with data sources, entity classes, and Hibernate properties. +- **Query provisioning** – Named HQL/SQL queries for undelivered shipments and carrier counts. + +#### Key units +- `Shipment` (table `SHIPMENT`): id, trackingCode, carrier, shippedAt, deliveredAt, order FK, parcels collection. +- `ExpressShipment` (joined‑subclass, table `EXPRESS_SHIPMENT`): deliveryWindow. +- `Shipment.undelivered` (HQL): `from Shipment s where s.deliveredAt is null and s.shippedAt < :cutoff`. +- `Shipment.countByCarrier` (SQL): `select CARRIER, count(*) from SHIPMENT group by CARRIER`. +- Persistence unit `shop`: JTA, Hibernate provider, data source `java:/jdbc/ShopDS`, entities `Order`, `OrderLine`, `Customer`, mapping file `order-queries.xml`. +- Persistence unit `reporting`: RESOURCE_LOCAL, data source `java:/jdbc/ReportingDS`, entity `DailyRevenue`. + +#### Data flow +1. Application obtains an `EntityManager` from the `shop` or `reporting` unit. +2. Entities are persisted or queried via Hibernate, using the mappings in `Shipment.hbm.xml`. +3. Named queries (`Shipment.undelivered`, `Shipment.countByCarrier`) are executed against the `SHIPMENT` table. +4. Reporting data is accessed through the `reporting` unit, reading `DailyRevenue` rows. + +#### Dependencies +- Hibernate ORM (`org.hibernate.jpa.HibernatePersistenceProvider`). +- Jakarta Persistence API. +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`. +- Entity classes: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue`. +- External mapping file: `META-INF/order-queries.xml`. + +#### Cross-cutting +- Sequence generator `SHIPMENT_SEQ` for `Shipment.id`. +- Cascade `all-delete-orphan` on `Shipment.parcels`. +- Hibernate properties: PostgreSQL dialect, batch size 50, credentials for `shop_app`. +- JTA transaction type for `shop`; RESOURCE_LOCAL for `reporting`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..7b716193 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md @@ -0,0 +1,58 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:11:03Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Configures two Jakarta Persistence units for a shop application, specifying data sources, entity classes, provider, and Hibernate properties. + +#### Purpose +- Define persistence units for JTA and RESOURCE_LOCAL transactions. +- Map entity classes and query files. +- Set Hibernate configuration properties. + +#### Type +- Jakarta Persistence XML (`persistence.xml`). +- Root element: `persistence`. +- Namespace: `https://jakarta.ee/xml/ns/persistence`. + +#### Definitions +- **Persistence Unit `shop`** + - `transaction-type="JTA"` + - `provider`: `org.hibernate.jpa.HibernatePersistenceProvider` + - `jta-data-source`: `java:/jdbc/ShopDS` + - `mapping-file`: `META-INF/order-queries.xml` + - Entity classes: + - `shop.Order` + - `shop.OrderLine` + - `shop.Customer` + - Properties: + - `hibernate.dialect`: `org.hibernate.dialect.PostgreSQLDialect` + - `hibernate.jdbc.batch_size`: `50` + - `hibernate.connection.username`: `shop_app` + - `hibernate.connection.password`: `***` +- **Persistence Unit `reporting`** + - `transaction-type="RESOURCE_LOCAL"` + - `non-jta-data-source`: `java:/jdbc/ReportingDS` + - Entity class: + - `shop.reporting.DailyRevenue` + - `exclude-unlisted-classes`: `true` + +#### Configuration +- `hibernate.dialect`: `org.hibernate.dialect.PostgreSQLDialect` +- `hibernate.jdbc.batch_size`: `50` +- `hibernate.connection.username`: `shop_app` +- `hibernate.connection.password`: `***` + +#### Dependencies +- `org.hibernate.jpa.HibernatePersistenceProvider` +- `META-INF/order-queries.xml` +- Entity classes: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue` +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..d6a1980b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,64 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:11:10Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Provides a SOAP web service for querying stock levels by SKU. + +#### Purpose +- Exposes a `GetStockLevel` operation to retrieve available stock for a given SKU. +- Defines a fault for unknown SKUs. + +#### Type +- WSDL 1.1 +- Root element: `definitions` +- Namespaces: + - `xmlns` → `http://schemas.xmlsoap.org/wsdl/` + - `xmlns:soap` → `http://schemas.xmlsoap.org/wsdl/soap/` + - `xmlns:tns` → `http://shop.example/stock` + - `xmlns:xs` → `http://www.w3.org/2001/XMLSchema` + +#### Definitions +- **Schema** (`xs:schema` targetNamespace=`http://shop.example/stock`): + - Elements: + - `StockLevelRequest` – complex type with `sku` (`xs:string`) + - `StockLevelResponse` – complex type with `available` (`xs:int`) + - ComplexType: + - `UnknownSkuFault` – sequence with `sku` (`xs:string`) +- **Messages**: + - `GetStockLevelInput` – part `parameters` element `tns:StockLevelRequest` + - `GetStockLevelOutput` – part `parameters` element `tns:StockLevelResponse` + - `UnknownSku` – part `fault` type `tns:UnknownSkuFault` +- **PortType** `StockPortType`: + - Operation `GetStockLevel`: + - Input: `tns:GetStockLevelInput` + - Output: `tns:GetStockLevelOutput` + - Fault: `UnknownSku` message `tns:UnknownSku` +- **Binding** `StockSoapBinding` (type `tns:StockPortType`): + - `soap:binding` style `document`, transport `http://schemas.xmlsoap.org/soap/http` + - Operation `GetStockLevel`: + - `soap:operation` soapAction `http://shop.example/stock/GetStockLevel` + - Input/Output: `soap:body` use `literal` + - Fault `UnknownSku`: `soap:fault` name `UnknownSku` use `literal` +- **Service** `StockService`: + - Port `StockPort` binding `tns:StockSoapBinding` + - `soap:address` location `https://erp.shop.example/soap/stock` + +#### Configuration +- `soap:binding` style: `document` +- `soap:binding` transport: `http://schemas.xmlsoap.org/soap/http` +- `soap:operation` soapAction: `http://shop.example/stock/GetStockLevel` +- `soap:address` location: `https://erp.shop.example/soap/stock` + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema` +- SOAP namespace `http://schemas.xmlsoap.org/wsdl/soap/` +- Target namespace `http://shop.example/stock` (used for elements, types, messages, portType, binding, service). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/wsdl/package.ai.md new file mode 100644 index 00000000..b38709b3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/other/wsdl/package.ai.md @@ -0,0 +1,44 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:12:29Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Provides a SOAP web service for querying stock levels by SKU. + +#### Purpose +- Exposes a `GetStockLevel` operation to retrieve available stock for a given SKU. +- Defines a fault for unknown SKUs. + +#### Responsibilities +- **Service contract**: WSDL definition of the stock query service. +- **Data model**: XML schema types for request, response, and fault payloads. +- **Transport configuration**: SOAP binding and endpoint details. + +#### Key units +- **`StockService.wsdl`** – WSDL 1.1 document defining the service. +- **`StockLevelRequest`** – complex type with `sku` string. +- **`StockLevelResponse`** – complex type with `available` int. +- **`UnknownSkuFault`** – fault type containing the offending `sku`. +- **`GetStockLevel` operation** – port type operation with input, output, and fault messages. +- **`StockSoapBinding`** – SOAP binding (document style, HTTP transport) for the service. +- **`StockService`** – service endpoint at `https://erp.shop.example/soap/stock`. + +#### Data flow +1. Client sends a SOAP request containing a `StockLevelRequest` (SKU). +2. Service processes the request and returns a `StockLevelResponse` with the available quantity. +3. If the SKU is unknown, the service returns a `UnknownSkuFault` fault. + +#### Dependencies +- XML Schema (`http://www.w3.org/2001/XMLSchema`) for type definitions. +- SOAP (`http://schemas.xmlsoap.org/wsdl/soap/`) for binding and transport. +- Target namespace `http://shop.example/stock` used throughout the WSDL. + +#### Cross-cutting +- **Document style SOAP**: all messages use literal XML bodies. +- **Fault handling**: single fault type `UnknownSkuFault` for missing SKUs. +- **Endpoint configuration**: fixed HTTPS address for the service. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..cb26f541 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,66 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:12:50Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> A back‑office order‑fulfilment system that exposes REST, SOAP, and BPMN interfaces, handles order lifecycle, persistence, and automated CI/CD deployment. + +#### Purpose +- Deliver a fully‑automated CI/CD pipeline for the Backoffice service. +- Provide order‑fulfilment logic via BPMN, REST, and SOAP. +- Persist order, shipment, and invoice data in PostgreSQL. +- Expose Kubernetes deployment and Docker images. + +#### Responsibilities +- **CI/CD** – GitHub Actions for build, image, and Kubernetes deployment. +- **Order lifecycle** – Camunda BPMN process (`orderFulfilment`) coordinating stock, payment, approval, shipping, invoicing. +- **Integration** – Camel routes for order validation, ERP routing, retry, and dead‑letter handling. +- **Persistence** – Hibernate entities (`Order`, `Shipment`, `ExpressShipment`, `DailyRevenue`) and MyBatis mapper for `Customer`. +- **Web services** – REST API (OpenAPI) for order CRUD, SOAP service for stock queries, JSP/Facelets UI for order listing and checkout. +- **Deployment** – Docker multi‑stage build, Kubernetes manifests, Helm‑style secrets. + +#### Key units +- `OrderResource` (JAX‑RS) – REST endpoints for orders. +- `orderFulfilment` (Camunda BPMN) – orchestrates stock reservation, payment, approval, shipping, invoicing. +- `ReserveStockDelegate`, `shipOrder` topic – Java delegates in BPMN. +- `orderIntegration` (Camel) – routes `incomingOrders`, `toErp`, `manualReview`, `orderValidator`, `invoiceTranslator`. +- `Shipment`, `ExpressShipment` (Hibernate) – entity mappings and named queries. +- `shop.customer.CustomerMapper` (MyBatis) – dynamic SQL for customer CRUD. +- `StockService.wsdl` – SOAP contract for stock level queries. +- `.github/workflows/release.yml` – GitHub Actions workflow for CI/CD. +- `Dockerfile` – multi‑stage build for `orders-backoffice.jar`. +- `orders-backoffice` Deployment, Service, Ingress – Kubernetes resources. + +#### Data flow +1. **CI/CD** – Tag push → build → test → Docker image → push → Kubernetes rollout. +2. **Order placement** – User submits via Facelets → `checkoutBean.placeOrder` → Camel `incomingOrders`. +3. **Camel validation** → audit → decision → ERP or manual review. +4. **BPMN** – `orderFulfilment` reserves stock, waits for payment, approves large orders, ships, creates invoice. +5. **Persistence** – Hibernate persists `Order`, `Shipment`; MyBatis handles `Customer`. +6. **REST** – Backoffice UI or external clients list/get/cancel orders via OpenAPI. +7. **SOAP** – External ERP queries stock via `GetStockLevel`. + +#### Dependencies +- **GitHub Actions** – `actions/checkout`, `actions/setup-java`, `docker/login-action`. +- **Camunda** – Java delegates, BPMN engine. +- **Camel** – JMS, SEDA, HTTP components, redelivery policy. +- **Hibernate** – PostgreSQL dialect, JTA/RESOURCE_LOCAL units, `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`. +- **MyBatis** – `shop.customer.CustomerMapper`, `CUSTOMER` table. +- **Docker** – Maven, Temurin JRE Alpine, `registry.shop.example`. +- **Kubernetes** – `orders-db-credentials` secret, PostgreSQL service `orders-db`. +- **JSP/Facelets** – Jakarta EE taglibs, `shop.Order`, `shop.OrderFilter`. +- **Groovy/Spock** – `ShippingRules`, `ParcelTooHeavyException`. + +#### Cross‑cutting +- **Security** – OAuth2 client‑credentials (`orders:write`), role `admin` for `/admin/*`, JMS/HTTP endpoints secured via secrets. +- **Configuration** – Property placeholders (`{{…}}`) in Camel, Kubernetes env vars, Docker `JAVA_OPTS`, `SHOP_PROFILE`. +- **Error handling** – Camel redelivery & dead‑letter, BPMN boundary events, REST 404/409, SOAP fault `UnknownSkuFault`. +- **Concurrency** – Camel retry policy, Hibernate transaction types, Docker non‑root user, coroutine `Dispatchers.IO` in Kotlin invoice service. +- **Testing** – Spock specs for shipping rules, integration tests for Camel routes, unit tests for BPMN delegates. +- **Observability** – Camel audit via `seda:orderAudit`, Kubernetes readiness probes, Docker healthcheck, timing interceptor on EJBs. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..93788e47 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run1/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 48A1D4F2 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:13:03Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The back‑office order‑fulfilment system exposes REST, SOAP, and BPMN interfaces for managing the entire order lifecycle, from creation and cancellation with payment refund to nightly cleanup of stale orders. A Camunda‑based BPMN workflow orchestrates stock reservation, payment, approval, shipping, and invoicing, while a Camel integration layer routes validated orders to an ERP system or a manual review queue with retry and dead‑letter handling. Persistence is handled via Hibernate and MyBatis mappings against a PostgreSQL database, and invoices are generated in Kotlin applying tax rules and payment terms. Continuous delivery is automated through GitHub Actions, Docker builds, and Kubernetes deployments, ensuring the service is built, tested, containerised, and deployed to production reliably. + +#### Packages +- java — A stateless JAX‑RS service that manages back‑office order lifecycle, including retrieval, cancellation with payment refund, and nightly cleanup of stale cancelled orders. +- java/shop — Provides a stateless JAX‑RS resource for back‑office order management, exposing CRUD‑like operations, cancellation with refund, and nightly purge of cancelled orders. +- other/actions/.github — Automates the CI/CD pipeline for the Backoffice Java application, building, testing, containerizing, and deploying it to production. +- other/actions/.github/workflows — Automates the CI/CD pipeline for the Backoffice service, building, testing, containerizing, and deploying it to production. +- other/actions — Automates the CI/CD pipeline for the Backoffice Java application, building, testing, containerizing, and deploying it to production. +- other/bpmn — Provides a Camunda‑based BPMN workflow for end‑to‑end order fulfilment, coordinating stock reservation, payment, approval, shipping, and invoicing. +- other/docker — Builds and deploys a Java back‑office service as a Docker image, compiling with Maven and running in an Alpine JRE container. +- other/facelets — A JSF Facelets page that gathers shipping details, lets the user pick a shipping method, shows the order total, and submits the order. +- other/groovy — A Groovy test suite that verifies DHL shipping cost calculations, free‑shipping thresholds, tiered pricing, and overweight handling. +- other/integration — Provides a Camel‑based integration layer that validates, audits, and routes order messages to an ERP system or a manual review queue, with retry and dead‑letter handling for ERP failures. +- other/jee — Provides the Jakarta EE configuration for a shop application, wiring enterprise beans, web components, and security. +- other/jsp — Provides a web interface for viewing, searching, and canceling open orders in the shop system. +- other/k8s — Deploys and exposes the `orders-backoffice` microservice in a Kubernetes cluster. +- other/kotlin — Generates and stores invoices for completed orders, applying tax rules and payment terms. +- other/mybatis — Provides MyBatis SQL mappings for CRUD and search operations on customer data in the shop domain. +- other/openapi — A back‑office service for managing shop orders: listing, retrieving, and cancelling orders with status and total amount information. +- other — A Java‑based shop back‑office that builds, tests, containerises, and deploys an order‑fulfilment service, exposing REST, SOAP, and BPMN interfaces while persisting orders, shipments, and invoices in a PostgreSQL database. +- other/persistence — Provides Hibernate‑based persistence for shop orders, shipments, and reporting, exposing entity mappings, queries, and persistence unit configuration. +- other/wsdl — Provides a SOAP web service for querying stock levels by SKU. +- . — A back‑office order‑fulfilment system that exposes REST, SOAP, and BPMN interfaces, handles order lifecycle, persistence, and automated CI/CD deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/meta/gpt-6-luna.json new file mode 100644 index 00000000..03f10b3f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/meta/gpt-6-luna.json @@ -0,0 +1,99 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "bpmn-facts.tsv": "6c40615d07d1f0971e6cbf6068428021551f3155a3024650b28478ada9af1066", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "004e053df906af334fbd182adb450ecd3b82dac9c45366d491695c6990fffcd3", + "java-facts.tsv": "9e91b340d71dd08fca2a0a59e34e99ba11f31e612a261ea74fc39ef08f256daf", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T08:13:05Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 100.9, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 107.6, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.0, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T08:16:37Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 27671, + "cachedPromptTokens": 27620, + "completionTokens": 9846, + "seconds": 100.301671 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.005204, + "costUsd": 0.013444, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/meta/gpt-oss-20b.json new file mode 100644 index 00000000..c7c6a51f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/meta/gpt-oss-20b.json @@ -0,0 +1,99 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "bpmn-facts.tsv": "6c40615d07d1f0971e6cbf6068428021551f3155a3024650b28478ada9af1066", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "004e053df906af334fbd182adb450ecd3b82dac9c45366d491695c6990fffcd3", + "java-facts.tsv": "9e91b340d71dd08fca2a0a59e34e99ba11f31e612a261ea74fc39ef08f256daf", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T08:16:37Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 70.3, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 90.8, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.4, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T08:19:21Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 28759, + "cachedPromptTokens": 22032, + "completionTokens": 8806, + "seconds": 69.6477043 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.002008, + "costUsd": 0.001988, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..2499069d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,38 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:14:52Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> Backoffice staff can review orders, cancel them with payment refunds, and remove cancelled orders after a retention period. + +#### Purpose +- Provides secured order lookup and cancellation for backoffice users. +- Purges cancelled orders after 30 days. + +#### Responsibilities +- **Order access:** List open orders and retrieve orders by ID. +- **Cancellation and cleanup:** Refund and cancel orders, audit cancellations, and schedule removal of old cancelled orders. + +#### Key units +- `OrderResource` — `/orders` REST resource for order listing, retrieval, cancellation, and scheduled cleanup. +- `PURGE_AFTER_DAYS` — 30-day cancelled-order retention threshold. + +#### Data flow +- `openOrders()` queries `Order.open`; `find(id)` returns an order or `404 NOT_FOUND`. +- `cancel(id)` returns `404 NOT_FOUND` if absent; otherwise refunds the order total through `PaymentGateway`, marks it `CANCELLED`, audits `order.cancelled`, and returns `204 No Content`. +- `purgeCancelled()` runs at 02:15, executes `Order.purgeCancelled`, and audits the removal count as `order.purged`. + +#### Dependencies +- Domain and services: `Order`, `OrderStatus`, `PaymentGateway`, `AuditLog`. +- Persistence: `EntityManager` in persistence unit `shop`; named queries `Order.open` and `Order.purgeCancelled`. +- Jakarta EE: EJB scheduling and transactions, Jakarta REST, injection, persistence, and role-based security. + +#### Cross-cutting +- `@RolesAllowed({"backoffice", "admin"})` protects the resource. +- Cancellation uses `REQUIRED` transaction semantics; scheduled cleanup is non-persistent. +- Missing orders are handled with `404 NOT_FOUND`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..86def140 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/java/shop/OrderResource.java.ai.md @@ -0,0 +1,64 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:13:06Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 50211B16 +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Backoffice users can list and retrieve orders, cancel them with a payment refund, and automatically purge old cancelled orders. + +#### Purpose +- `OrderResource` serves order backoffice operations over the `/orders` REST path. +- Handles open-order lookup, cancellation, and nightly cleanup of cancelled orders. + +#### Type +- `public class OrderResource` — class; annotated `@Stateless`, `@Path("/orders")`, `@Produces(MediaType.APPLICATION_JSON)`, and `@RolesAllowed({"backoffice", "admin"})`. +- `PURGE_AFTER_DAYS` — package-private `static final int`; value `30`. + +#### Input +- `openOrders()` — no parameters; queries the `Order.open` named query. +- `find(long id)` — order ID from the `{id}` path parameter. +- `cancel(long id)` — order ID from the `{id}` path parameter. +- `purgeCancelled()` — no parameters; scheduled invocation. +- Injected `EntityManager em` from persistence unit `shop`, `PaymentGateway payments`, and `AuditLog audit`. +- Purge query receives `days = PURGE_AFTER_DAYS`. + +#### Output +- `openOrders()` returns `List`. +- `find(long id)` and `cancel(long id)` return JAX-RS `Response`. +- `cancel` changes the order status and records an audit event; returns no-content on success. +- `purgeCancelled()` deletes matching orders and records the number removed. + +#### Core logic +- `openOrders()` returns results from named query `Order.open`. +- `find(id)` looks up the `Order`; returns `404 NOT_FOUND` if absent, otherwise `200 OK` with the order. +- `cancel(id)` runs with `REQUIRED` transaction semantics: + - Returns `404 NOT_FOUND` if the order does not exist. + - Refunds its payment reference for its total. + - Sets status to `OrderStatus.CANCELLED` and records `order.cancelled` with the ID. + - Returns `204 No Content`. +- `purgeCancelled()` runs at 02:15 with `persistent = false`; executes `Order.purgeCancelled` using the 30-day threshold and records `order.purged` with the removal count. + +#### Public API +- `openOrders()` -> `List` — list open orders. +- `find(long id)` -> `Response` — retrieve order by ID. +- `cancel(long id)` -> `Response` — refund and cancel order. + +#### Dependencies +- `Order`, `OrderStatus`, `PaymentGateway`, `AuditLog` +- `EntityManager` +- Jakarta EJB: `EJB`, `Schedule`, `Stateless`, `TransactionAttribute`, `TransactionAttributeType` +- Jakarta injection and persistence: `Inject`, `PersistenceContext` +- Jakarta REST: `GET`, `POST`, `Path`, `PathParam`, `Produces`, `MediaType`, `Response` +- Jakarta security: `RolesAllowed` +- `java.util.List` + +#### Exceptions / Errors +- Missing order IDs produce `404 NOT_FOUND` in `find` and `cancel`. +- No explicit exception handling or null checks beyond missing-order handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/java/shop/package.ai.md new file mode 100644 index 00000000..93588ae2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/java/shop/package.ai.md @@ -0,0 +1,38 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:14:47Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Backoffice users can inspect orders, cancel them with payment refunds, and automatically remove long-cancelled orders. + +#### Purpose +- Exposes order lookup and cancellation operations for backoffice users. +- Purges cancelled orders after 30 days. + +#### Responsibilities +- **Order access:** List open orders and retrieve an order by ID. +- **Cancellation and cleanup:** Refund and cancel orders, audit cancellations, and periodically purge old cancelled orders while auditing the removal count. + +#### Key units +- `OrderResource` — `/orders` REST resource for order listing, retrieval, cancellation, and scheduled cleanup. +- `PURGE_AFTER_DAYS` — 30-day retention threshold for cancelled orders. + +#### Data flow +- `openOrders()` queries `Order.open` and returns `List`; `find(id)` returns the matching order or `404 NOT_FOUND`. +- `cancel(id)` returns `404 NOT_FOUND` if absent; otherwise refunds the payment reference for the order total, sets `OrderStatus.CANCELLED`, records `order.cancelled`, and returns `204 No Content`. +- `purgeCancelled()` runs at 02:15, executes `Order.purgeCancelled` with the retention threshold, and records `order.purged` with the removal count. + +#### Dependencies +- Domain and services: `Order`, `OrderStatus`, `PaymentGateway`, `AuditLog`. +- Persistence: `EntityManager` from persistence unit `shop`; named queries `Order.open` and `Order.purgeCancelled`. +- Jakarta EE APIs: EJB scheduling, transactions, and stateless session beans; Jakarta REST; injection and persistence; role-based security. + +#### Cross-cutting +- `@RolesAllowed({"backoffice", "admin"})` protects the resource. +- Cancellation uses `REQUIRED` transaction semantics; cleanup uses a non-persistent EJB schedule. +- Missing orders are handled with `404 NOT_FOUND`; no other explicit exception handling is described. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/.github/package.ai.md new file mode 100644 index 00000000..c11c6612 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/.github/package.ai.md @@ -0,0 +1,38 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:15:02Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Automates validation, publication, and production deployment handoff for versioned Orders Backoffice container images. + +#### Purpose +- Validate release candidates across Java versions, publish a version-tagged image, and trigger Kubernetes deployment. + +#### Responsibilities +- **Release validation:** Run Maven CI verification on Java 21 and 25. +- **Image publishing:** Build and push the Orders Backoffice image to `registry.shop.example`. +- **Deployment handoff:** Invoke the reusable Kubernetes deployment workflow after publishing. + +#### Key units +- `release-backoffice` — workflow triggered by `v*` tag pushes or manual dispatch. +- `build` — runs `mvn -B verify -Pci` across the Java-version matrix. +- `image` — publishes `registry.shop.example/orders-backoffice` using the version without its `v` prefix. +- `deploy` — calls `./.github/workflows/deploy-k8s.yml` for the `production` environment. + +#### Data flow +- A tag push or manual dispatch starts the workflow; successful matrix verification precedes image publishing. +- The image tag is derived from `GITHUB_REF_NAME`; publishing is followed by the Kubernetes deployment workflow. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Maven, Temurin Java, and registry credentials `REGISTRY_USER` and `REGISTRY_TOKEN`. +- Container registry `registry.shop.example/orders-backoffice`; reusable workflow `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Workflow permissions are limited to `contents: read` and `packages: write`. +- Image publishing and deployment use the `production` environment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..d21eafef --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,42 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:14:56Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Validates and releases versioned Orders Backoffice container images, then hands them off for production deployment. + +#### Purpose +- Runs Maven verification across Java 21 and 25 for release candidates. +- Builds and pushes a version-tagged image, then invokes the Kubernetes deployment workflow for production. + +#### Responsibilities +- **Release validation:** Runs `mvn -B verify -Pci` on a Java-version matrix. +- **Image publishing:** Authenticates to `registry.shop.example` and pushes `registry.shop.example/orders-backoffice` using the version tag. +- **Production deployment handoff:** Calls the reusable Kubernetes deployment workflow after image publishing. + +#### Key units +- `release-backoffice` — GitHub Actions workflow triggered by `v*` tag pushes or manual dispatch. +- `build` — verifies the application on `ubuntu-24.04` with Temurin Java 21 and 25. +- `image` — builds and pushes the release-tagged Orders Backoffice image in the `production` environment. +- `deploy` — calls `./.github/workflows/deploy-k8s.yml` with the `production` environment and inherited secrets. + +#### Data flow +- A tag push or manual dispatch starts the workflow; the build matrix must complete before image publishing. +- The image job derives the image tag from `GITHUB_REF_NAME` by removing the `v` prefix. +- After publishing, the deploy job invokes the Kubernetes workflow. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Build tool: Maven (`mvn`); Java distribution: Temurin. +- Registry: `registry.shop.example/orders-backoffice`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Workflow permissions are limited to `contents: read` and `packages: write`. +- The image and deployment stages use the `production` environment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..9d5b3109 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,61 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:13:13Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds and publishes the Orders Backoffice container image on version-tag pushes, then deploys it to production. + +#### Purpose +- Verifies the application with Maven on two Java versions. +- Publishes a version-tagged image and invokes the Kubernetes deployment workflow for production. + +#### Type +- GitHub Actions workflow named `release-backoffice`. + +#### Definitions +- Triggers: + - `push` on tags matching `v*`. + - `workflow_dispatch`. +- Permissions: `contents: read`, `packages: write`. +- Job `build`: + - Runner: `ubuntu-24.04`; matrix: `java: [21, 25]`. + - Steps, in order: + 1. `actions/checkout@v4` + 2. `actions/setup-java@v4` with `distribution: temurin`, `java-version: ${{ matrix.java }}` + 3. `Build and test`: `mvn -B verify -Pci` +- Job `image`: + - Needs `build`; runner: `ubuntu-24.04`; environment: `production`. + - Steps, in order: + 1. `actions/checkout@v4` + 2. `Log in to the registry`: `docker/login-action@v3` + 3. `Push the image`: builds and pushes `registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v}` +- Job `deploy`: + - Needs `image`; calls `./.github/workflows/deploy-k8s.yml`. + - Passes `environment: production`; inherits secrets. + +#### Configuration +- `name`: `release-backoffice` +- `permissions.contents`: `read` +- `permissions.packages`: `write` +- `strategy.matrix.java`: `21`, `25` +- `distribution`: `temurin` +- `registry`: `registry.shop.example` +- `username`: `${{ secrets.REGISTRY_USER }}` +- `password`: `secrets.REGISTRY_TOKEN=***` +- `environment`: `production` +- Image tag expression: `${GITHUB_REF_NAME#v}` + +#### Dependencies +- Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3` +- Reusable workflow: `./.github/workflows/deploy-k8s.yml` +- Build tool: `mvn` +- Registry/image: `registry.shop.example/orders-backoffice` +- Secrets: `secrets.REGISTRY_USER`, `secrets.REGISTRY_TOKEN` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/package.ai.md new file mode 100644 index 00000000..dd8bed6d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/actions/package.ai.md @@ -0,0 +1,37 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:15:06Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Validates, publishes, and hands off versioned Orders Backoffice container releases for production deployment. + +#### Purpose +- Automate release checks and production delivery of Orders Backoffice images. + +#### Responsibilities +- **Release validation:** Run Maven CI verification on Java 21 and 25. +- **Image publishing and deployment handoff:** Publish the version-tagged image, then invoke the reusable Kubernetes deployment workflow. + +#### Key units +- `release-backoffice` — workflow triggered by `v*` tag pushes or manual dispatch. +- `build` — runs `mvn -B verify -Pci` across the Java-version matrix. +- `image` — publishes `registry.shop.example/orders-backoffice` using the version without its `v` prefix. +- `deploy` — calls `./.github/workflows/deploy-k8s.yml` for the `production` environment. + +#### Data flow +- A tag push or manual dispatch starts validation; successful matrix checks precede image publishing. +- The image tag comes from `GITHUB_REF_NAME`; publishing is followed by the Kubernetes deployment workflow. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, and `docker/login-action@v3`. +- Maven, Temurin Java, and registry credentials `REGISTRY_USER` and `REGISTRY_TOKEN`. +- Container registry `registry.shop.example/orders-backoffice` and reusable workflow `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Workflow permissions are limited to `contents: read` and `packages: write`. +- Image publishing and deployment use the `production` environment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..60410677 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,50 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:13:19Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 7ADEA688 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1; decisions: 0; decision rules: 0 + +> Defines an executable order-fulfilment workflow that reserves stock, waits for payment, routes large orders for approval, ships orders, and creates invoices, with an out-of-stock cancellation path. + +#### Purpose +- Orchestrates order fulfilment from order placement through completion or cancellation. +- Integrates stock reservation, payment receipt, shipping, and invoice creation. + +#### Type +- BPMN process definition; root `bpmn:definitions`. +- Namespaces: `bpmn` — `http://www.omg.org/spec/BPMN/20100524/MODEL`; `bpmndi` — `http://www.omg.org/spec/BPMN/20100524/DI`; `dc` — `http://www.omg.org/spec/DD/20100524/DC`; `camunda` — `http://camunda.org/schema/1.0/bpmn`. + +#### Definitions +- Process: `orderFulfilment`, name `Order fulfilment`, executable. +- Message: `msgPaymentReceived`, name `PaymentReceived`. +- Error: `errOutOfStock`, name `OutOfStock`, code `STOCK_EMPTY`. +- Start event: `orderPlaced`, name `Order placed`. +- Service task: `reserveStock`, name `Reserve stock`, class `shop.bpm.ReserveStockDelegate`. +- Boundary event: `stockMissing`, attached to `reserveStock`, catches `errOutOfStock`. +- Intermediate catch event: `waitForPayment`, name `Wait for payment`, waits for `msgPaymentReceived`. +- Exclusive gateway: `amountCheck`, name `Large order?`; flow `large` to `approveOrder` when `${order.total > 1000}`, flow `small` to `shipOrder` when `${order.total <= 1000}`. +- User task: `approveOrder`, name `Approve large order`, candidate group `backoffice`. +- Service task: `shipOrder`, name `Ship order`, external task topic `shipping`. +- Call activity: `createInvoice`, name `Create invoice`, calls `invoicing`. +- End events: `orderCompleted` (`Order completed`), reached after invoice creation; `orderCancelled` (`Order cancelled`), reached from `stockMissing`. +- Sequence flows: `toReserve` (`orderPlaced` → `reserveStock`), `toWaitPayment` (`reserveStock` → `waitForPayment`), `toAmountCheck` (`waitForPayment` → `amountCheck`), `large` and `small` (gateway branches), `approvedToShip` (`approveOrder` → `shipOrder`), `toInvoice` (`shipOrder` → `createInvoice`), `toEnd` (`createInvoice` → `orderCompleted`), `toCancelled` (`stockMissing` → `orderCancelled`). + +#### Configuration +- `isExecutable`: `true`. +- Gateway condition thresholds: `order.total > 1000` routes to approval; `order.total <= 1000` routes to shipping. +- `camunda:candidateGroups`: `backoffice`. +- `camunda:type`: `external`; `camunda:topic`: `shipping`. +- `calledElement`: `invoicing`. + +#### Dependencies +- Delegate class: `shop.bpm.ReserveStockDelegate`. +- Camunda external task topic: `shipping`. +- Called BPMN element: `invoicing`. +- Message: `PaymentReceived` (`msgPaymentReceived`); error: `OutOfStock` (`errOutOfStock`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/bpmn/package.ai.md new file mode 100644 index 00000000..a0286cc8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/bpmn/package.ai.md @@ -0,0 +1,45 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:15:09Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> Coordinates order fulfilment from stock reservation and payment through approval, shipping, invoicing, or out-of-stock cancellation. + +#### Purpose +- Defines an executable BPMN workflow for completing or cancelling an order. +- Integrates stock reservation, payment receipt, large-order approval, shipping, and invoice creation. + +#### Responsibilities +- **Order processing:** Starts on order placement, reserves stock, and waits for payment. +- **Routing and fulfilment:** Routes orders over 1000 for back-office approval; smaller orders proceed directly to shipping. Both paths continue to invoicing. +- **Exception handling:** Catches an out-of-stock error during stock reservation and ends the order as cancelled. + +#### Key units +- `orderFulfilment` — executable BPMN process named `Order fulfilment`. +- `reserveStock` — service task bound to `shop.bpm.ReserveStockDelegate`. +- `waitForPayment` — intermediate catch event for `PaymentReceived`. +- `amountCheck` — exclusive gateway routing by `order.total` threshold. +- `approveOrder` — user task assigned to candidate group `backoffice`. +- `shipOrder` — external task using the `shipping` topic. +- `createInvoice` — call activity invoking `invoicing`. +- `stockMissing` / `errOutOfStock` — boundary error handling for `STOCK_EMPTY`, leading to `orderCancelled`. + +#### Data flow +- `orderPlaced` → `reserveStock` → `waitForPayment` → `amountCheck`. +- Orders with `order.total > 1000` go through `approveOrder`; orders with `order.total <= 1000` proceed directly to `shipOrder`. +- Shipping → `createInvoice` → `orderCompleted`. +- An `OutOfStock` error during reservation → `orderCancelled`. + +#### Dependencies +- Camunda BPMN extensions for the `shipping` external task topic and `backoffice` candidate group. +- Delegate class `shop.bpm.ReserveStockDelegate`. +- Called BPMN element `invoicing`; message `PaymentReceived` and error `OutOfStock`. + +#### Cross-cutting +- Uses Camunda BPMN configuration, including an external task binding and a user-task candidate group. +- Routes and handles outcomes through BPMN sequence flows, an exclusive gateway, and a boundary error event. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..0bdf25da --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/docker/Dockerfile.ai.md @@ -0,0 +1,43 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:13:28Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds the Orders Backoffice Java application into a production container that runs on port 8080. + +#### Purpose +- Packages `orders-backoffice.jar` with Maven and runs it on a Java 21 JRE. +- Configures a non-root runtime user and an HTTP liveness check. + +#### Type +- Multi-stage Dockerfile. + +#### Definitions +- `build` stage: `maven:3.9-eclipse-temurin-21`; working directory `/src`. + - Copies `pom.xml`; runs `mvn -B dependency:go-offline`. + - Copies `src` to `/src/src`; runs `mvn -B package -DskipTests`. +- Runtime stage: `eclipse-temurin:21-jre-alpine`. + - Creates group `shop` and user `backoffice` in `shop`. + - Copies `/src/target/orders-backoffice.jar` from `build` to `/opt/shop/orders-backoffice.jar`. + - Exposes port `8080`; runs as `backoffice`. + - Healthcheck: `--interval=30s`; runs `wget -qO- http://localhost:8080/health/live || exit 1`. + - Entrypoint: `sh -c "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"`. + +#### Configuration +- `APP_VERSION=2.1.0` build argument. +- `JAVA_OPTS="-XX:MaxRAMPercentage=75"`. +- `SHOP_PROFILE=production`. + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine`. +- Build inputs: `pom.xml`, `src`. +- Runtime artifact: `/src/target/orders-backoffice.jar`. +- Health endpoint: `http://localhost:8080/health/live`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/docker/package.ai.md new file mode 100644 index 00000000..798116c8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/docker/package.ai.md @@ -0,0 +1,34 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:15:15Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> Packages the Orders Backoffice Java application as a production container that serves HTTP traffic on port 8080. + +#### Purpose +- Builds `orders-backoffice.jar` with Maven and runs it on a Java 21 JRE. +- Provides a production runtime configured for non-root execution and HTTP liveness monitoring. + +#### Responsibilities +- **Build and packaging:** Resolves Maven dependencies and packages the application from `pom.xml` and `src`, skipping tests. +- **Runtime setup:** Creates the `backoffice` user in the `shop` group, configures the Java process, and exposes port `8080`. +- **Health monitoring:** Checks `http://localhost:8080/health/live` every 30 seconds. + +#### Key units +- `Dockerfile`: Two-stage build using `maven:3.9-eclipse-temurin-21` and `eclipse-temurin:21-jre-alpine`; copies the packaged JAR to `/opt/shop/orders-backoffice.jar` and launches it with Java. + +#### Data flow +- `pom.xml` and `src` → Maven dependency resolution and packaging → `/src/target/orders-backoffice.jar` → runtime image → Java process serving on port `8080`. + +#### Dependencies +- Build inputs: `pom.xml`, `src`; build image: `maven:3.9-eclipse-temurin-21`. +- Runtime image: `eclipse-temurin:21-jre-alpine`; health check uses `wget` against `/health/live`. + +#### Cross-cutting +- Runtime configuration: `APP_VERSION=2.1.0`, `SHOP_PROFILE=production`, and `JAVA_OPTS="-XX:MaxRAMPercentage=75"`. +- Runs as non-root user `backoffice`; Java starts via an `exec`-based shell entrypoint. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..da9cf89f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,44 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:13:33Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> Customers enter a delivery address, choose shipping, review the EUR total, and place an order. + +#### Purpose +- Collect checkout address and shipping details, update the displayed total, and submit the order. + +#### Type +- Jakarta Faces Facelets composition; XHTML. +- `h` = Jakarta Faces HTML, `f` = Jakarta Faces core, `ui` = Jakarta Faces Facelets. + +#### Data +- `checkoutBean.address.street` — delivery street. +- `checkoutBean.address.zip` — postal code. +- `checkoutBean.shippingMethod` — selected shipping method. +- `checkoutBean.shippingMethods` — options supplied to the shipping selector. +- `checkoutBean.total` — displayed order total. + +#### Actions +- `checkoutForm` submits via `h:commandButton` to `checkoutBean.placeOrder`. +- Shipping selector triggers `checkoutBean.recalculate` via `f:ajax`, rendering `total`. +- `zip` uses `f:validateRegex` with pattern `[0-9]{5}`. +- `total` uses `f:convertNumber` with `type="currency"` and `currencyCode="EUR"`. + +#### Structure +- Uses template `/WEB-INF/templates/shop.xhtml`; defines `content`. +- Includes `/WEB-INF/includes/payment-hints.xhtml` in `content`. + +#### Dependencies +- Template: `/WEB-INF/templates/shop.xhtml` +- Include: `/WEB-INF/includes/payment-hints.xhtml` +- Bean: `checkoutBean` +- Methods: `checkoutBean.recalculate`, `checkoutBean.placeOrder` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/facelets/package.ai.md new file mode 100644 index 00000000..b438c5db --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/facelets/package.ai.md @@ -0,0 +1,34 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:15:19Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> Customers provide delivery and shipping details, review an updated EUR order total, and submit checkout. + +#### Purpose +- Provide the customer checkout form for delivery details, shipping selection, total review, and order submission. + +#### Responsibilities +- Collect street and ZIP code, offer shipping methods, and display the order total. +- Recalculate the total when shipping changes and submit the order from `checkoutForm`. + +#### Key units +- `checkout.xhtml` — Facelets composition defining the checkout form and its interactions with `checkoutBean`. + +#### Data flow +- `checkoutBean.shippingMethods` populates the shipping selector; the selection is stored in `checkoutBean.shippingMethod`. +- Changing shipping invokes `checkoutBean.recalculate` via Ajax and rerenders `total`, displaying `checkoutBean.total` as EUR currency. +- The form binds street and ZIP to `checkoutBean.address` and submits through `checkoutBean.placeOrder`; ZIP input is validated against `[0-9]{5}`. + +#### Dependencies +- `checkoutBean` fields and methods: `address.street`, `address.zip`, `shippingMethod`, `shippingMethods`, `total`, `recalculate`, `placeOrder`. +- Facelets template `/WEB-INF/templates/shop.xhtml` and include `/WEB-INF/includes/payment-hints.xhtml`. + +#### Cross-cutting +- Uses Jakarta Faces HTML, core, and Facelets namespaces; combines server-side form submission with Ajax recalculation. +- Applies ZIP regex validation and EUR currency formatting to the displayed total. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..94da6fe4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,66 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:13:39Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Calculates order shipping charges from parcel weight and waives the fee for orders meeting the free-shipping threshold. + +#### Purpose +- `ShippingRulesSpec` verifies free shipping, weight-tier pricing, and rejection of overweight parcels. +- `ShippingRules` selects a shipping price using order total and weight. + +#### Type +- `ShippingRulesSpec` — class; extends `Specification`. +- `ShippingRules` — class; annotated `@CompileStatic`; no explicit superclass or interfaces. + +#### Input +- `ShippingRulesSpec.rules` initializes `ShippingRules` with carrier `DHL` and maximum parcel weight `31.5`. +- `ShippingRules.costFor(Order order)` reads `order.weightKg` and `order.total`. +- `ShippingRules` properties: `carrier: String`, `maxParcelKg: BigDecimal`. +- `heavyOrder(BigDecimal kg)` is a private helper that creates an `Order`; it is not called in the shown tests. + +#### Output +- `costFor(Order)` returns a `BigDecimal` shipping charge: `0`, `4.99`, `9.99`, or `19.99` for matching cases. +- `costFor` throws `ParcelTooHeavyException` when parcel weight exceeds `maxParcelKg`. +- No persistent state or external resources are written. + +#### Core logic +- `ShippingRulesSpec` defines `FREE_SHIPPING_THRESHOLD = 50.00`. +- Tests that an order totaling `75.00` with weight `2` has zero shipping cost. +- Unrolled examples verify prices of `4.99` at `1 kg`, `9.99` at `10 kg`, and `19.99` at `30 kg`. +- Verifies a `40 kg` parcel is rejected. +- `ShippingRules.costFor` checks maximum weight first; excess weight throws with actual and maximum weights in the message. +- For acceptable weight, orders at or above the threshold receive free shipping. +- Otherwise, searches ascending tiers (`2 kg`, `10 kg`, `31.5 kg`) and returns the first matching tier’s price. + +#### Public API +- `FREE_SHIPPING_THRESHOLD: BigDecimal` — free-shipping cutoff. +- `getRules()`/`setRules(Object)` — access test rules property. +- `"orders above the threshold ship for free"()` -> `Object` — verifies free shipping. +- `"a parcel of #weight kg costs #expected"()` -> `Object` — verifies tier prices. +- `"an overweight parcel is rejected"()` -> `Object` — verifies overweight exception. +- `getCarrier()`/`setCarrier(String)` — access carrier property. +- `getMaxParcelKg()`/`setMaxParcelKg(BigDecimal)` — access maximum parcel weight. +- `costFor(Order order)` -> `BigDecimal` — calculate shipping charge. + +#### Dependencies +- `spock.lang.Specification` +- `spock.lang.Unroll` +- `groovy.transform.CompileStatic` +- `Order` +- `ParcelTooHeavyException` + +#### Exceptions / Errors +- `ParcelTooHeavyException` is thrown when `order.weightKg > maxParcelKg`. +- If weight passes `maxParcelKg` but exceeds the final `31.5 kg` tier, no tier matches and `.price` is accessed on a null result. + +#### Concurrency +- No concurrency or synchronization; shipping calculation has no state mutation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/groovy/package.ai.md new file mode 100644 index 00000000..f7c39c7b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/groovy/package.ai.md @@ -0,0 +1,38 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:15:23Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> Calculates order shipping charges by applying a free-shipping threshold, weight-based price tiers, and a maximum parcel-weight limit. + +#### Purpose +- Provides `ShippingRules.costFor(Order)` to determine shipping charges. +- Verifies free-shipping, tier pricing, and overweight rejection behavior with Spock tests. + +#### Responsibilities +- **Shipping calculation:** waive shipping for orders totaling at least `50.00`; otherwise select a price from ascending weight tiers. +- **Behavior verification:** `ShippingRulesSpec` checks representative prices and that a `40 kg` parcel is rejected. + +#### Key units +- `ShippingRules` — holds carrier and maximum parcel weight; calculates an `Order`’s shipping charge. +- `ShippingRulesSpec` — Spock specification covering free shipping, tier prices, and overweight parcels. +- `FREE_SHIPPING_THRESHOLD` — `BigDecimal` cutoff for free shipping. +- `ParcelTooHeavyException` — signals weight above `maxParcelKg`. + +#### Data flow +- `costFor(Order)` reads `weightKg` and `total`; it rejects parcels above the configured maximum, returns zero for qualifying order totals, or selects a price from the `2 kg`, `10 kg`, and `31.5 kg` tiers. +- The specification configures DHL rules with a `31.5 kg` maximum and checks returned prices or the overweight exception. + +#### Dependencies +- `Order` supplies the order total and parcel weight. +- `ParcelTooHeavyException` represents overweight rejection. +- `spock.lang.Specification` and `spock.lang.Unroll` support the tests; `groovy.transform.CompileStatic` annotates `ShippingRules`. + +#### Cross-cutting +- Shipping calculation has no persistent writes, state mutation, or concurrency behavior. +- If weight is within `maxParcelKg` but no price tier matches, the summary reports that accessing `.price` on the null tier result fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..82076a5b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/integration/order-routes.xml.ai.md @@ -0,0 +1,37 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:13:47Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Routes incoming orders through validation and review-or-ERP processing, with audit tapping and dead-letter handling for ERP outages. + +#### Type +- Spring XML / Apache Camel integration routes; root `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` → `http://www.w3.org/2001/XMLSchema-instance`; nested Camel context default → `http://camel.apache.org/schema/spring`. + +#### Definitions +- Beans: `orderValidator` → `shop.integration.OrderValidator`; `invoiceTranslator` → `shop.integration.InvoiceTranslator`. +- Camel context: `orderIntegration`; property placeholder `properties` loads `classpath:integration.properties`. +- Routes: + - `incomingOrders`: consumes `jms:queue:{{orders.incoming.queue}}`; calls `orderValidator.validate`; sends orders with `${body.total} > {{orders.review.threshold}}` to `direct:manualReview`, otherwise to `direct:toErp`; wire-taps `seda:orderAudit`. + - `toErp`: consumes `direct:toErp`; calls `invoiceTranslator`; sends to dynamic URL `https://{{erp.host}}/api/orders/${header.orderId}`. + - `manualReview`: consumes `direct:manualReview`; splits `${body.lines}` and sends each line to `jms:queue:review.lines`. +- Exception handling: `shop.integration.ErpUnavailableException` is handled; routes to `jms:queue:orders.deadletter` after configured redelivery. + +#### Configuration +- `orders.incoming.queue`, `orders.review.threshold`, `erp.host`: values supplied by `classpath:integration.properties`. +- Redelivery for `shop.integration.ErpUnavailableException`: `maximumRedeliveries="5"`, `redeliveryDelay="2000"`, `useExponentialBackOff="true"`. + +#### Dependencies +- Classes: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `shop.integration.ErpUnavailableException`. +- Referenced properties file: `classpath:integration.properties`. +- JMS queues: configured incoming queue, `orders.deadletter`, `review.lines`; other endpoints: `direct:manualReview`, `direct:toErp`, `seda:orderAudit`. +- External ERP API host supplied by `erp.host`; order ID supplied by `${header.orderId}`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/integration/package.ai.md new file mode 100644 index 00000000..dfd7d387 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/integration/package.ai.md @@ -0,0 +1,46 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:15:28Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Processes incoming orders by validating them, routing high-value orders for manual review and others to the ERP, while auditing traffic and handling ERP outages. + +#### Purpose +- Integrates incoming JMS orders with validation, manual review, and external ERP order submission. +- Provides an audit tap and a dead-letter path for ERP availability failures. + +#### Responsibilities +- **Order intake and routing:** Validate messages from the configured incoming queue and route by the configured total threshold. +- **Review processing:** Split orders selected for manual review into lines and send them to the review queue. +- **ERP integration:** Translate orders and submit them to the ERP API using the order ID. +- **Audit and failure handling:** Wire-tap incoming orders to an audit endpoint; retry handled ERP exceptions and then route to the dead-letter queue. + +#### Key units +- `orderIntegration` — Camel context defining the order-processing routes and property placeholder. +- `incomingOrders` — consumes incoming JMS orders, validates and routes them, and wire-taps the audit endpoint. +- `manualReview` — splits reviewed orders into lines for the review queue. +- `toErp` — translates orders and sends them to the ERP API. +- `shop.integration.OrderValidator` (`orderValidator`) — validates incoming orders. +- `shop.integration.InvoiceTranslator` (`invoiceTranslator`) — translates orders for ERP submission. +- `shop.integration.ErpUnavailableException` — exception handled by the configured retry and dead-letter policy. + +#### Data flow +- Incoming JMS message → `OrderValidator.validate` → branch on `${body.total}` versus `orders.review.threshold`; wire-tap to `seda:orderAudit`. +- Above threshold → `manualReview` → split `${body.lines}` → `jms:queue:review.lines`. +- Otherwise → `toErp` → `InvoiceTranslator` → ERP URL using `erp.host` and `${header.orderId}`. +- Handled `ErpUnavailableException` → up to five redeliveries with configured delay and exponential backoff → `jms:queue:orders.deadletter`. + +#### Dependencies +- Application classes: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `shop.integration.ErpUnavailableException`. +- Configuration: `classpath:integration.properties`, supplying the incoming queue, review threshold, and ERP host. +- Messaging endpoints: configured incoming JMS queue, `jms:queue:review.lines`, `jms:queue:orders.deadletter`, `direct:manualReview`, `direct:toErp`, and `seda:orderAudit`. +- External service: ERP API at the configured host. + +#### Cross-cutting +- Spring XML configures Apache Camel routes and loads properties through a placeholder. +- `ErpUnavailableException` uses five retries, a 2-second redelivery delay, and exponential backoff before dead-letter routing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..c6d9274d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,40 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:13:54Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Configures stock reservation, checkout, and order-event EJBs, including their local reference, timing interceptor, and transaction behavior. + +#### Purpose +- Declares session and message-driven beans for stock reservation, checkout, and order-placed event handling. +- Configures an environment entry, local EJB reference, interceptor binding, and transaction attribute. + +#### Type +- Jakarta EE EJB descriptor (`ejb-jar`), version `4.0`. +- Declares the default namespace `https://jakarta.ee/xml/ns/jakartaee` (no prefix). + +#### Definitions +- Session beans: + - `StockReservationBean` — class `shop.stock.StockReservationBean`; type `Stateless`; environment entry `reservationMinutes`, type `java.lang.Integer`. + - `CheckoutSessionBean` — class `shop.checkout.CheckoutSessionBean`; type `Stateful`; local EJB reference `ejb/StockReservation` to `shop.stock.StockReservation`. +- Message-driven bean: + - `OrderPlacedListener` — class `shop.events.OrderPlacedListener`; activation property `destinationLookup`. +- Interceptor: `shop.audit.TimingInterceptor`; bound to all EJBs (`*`). +- Transaction attribute: `RequiresNew` for `StockReservationBean.reserve`. + +#### Configuration +- `reservationMinutes=45`. +- `destinationLookup=java:/jms/queue/OrderPlaced`. +- `StockReservationBean.reserve` transaction attribute: `RequiresNew`. + +#### Dependencies +- Classes: `shop.stock.StockReservationBean`, `shop.stock.StockReservation`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`. +- JMS destination: `java:/jms/queue/OrderPlaced`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jee/package.ai.md new file mode 100644 index 00000000..4a3c88e2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jee/package.ai.md @@ -0,0 +1,46 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:15:35Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> Configures the shop back office’s web access and the EJB services that reserve stock, process checkout, and handle order-placed events. + +#### Purpose +- Declares Jakarta EE web and EJB runtime components and their deployment settings. +- Configures report access, admin authorization, stock reservation, checkout, and order-event handling. + +#### Responsibilities +- **Web application:** Registers report downloads, request-ID filtering, and startup auditing; sets report storage, session timeout, and the `admin`-protected URL space. +- **EJB services:** Declares stock reservation and checkout session beans, plus a message-driven listener for order-placed events. +- **EJB behavior:** Binds timing interception to all EJBs and configures `StockReservationBean.reserve` with `RequiresNew` transaction behavior. + +#### Key units +- `ReportDownloadServlet` (`shop.web.ReportDownloadServlet`) — serves the `/reports/*` endpoint. +- `RequestIdFilter` (`shop.web.RequestIdFilter`) — filters requests mapped to `/*`. +- `StartupAuditListener` (`shop.web.StartupAuditListener`) — registered as the web application listener. +- `StockReservationBean` (`shop.stock.StockReservationBean`) — stateless bean with `reservationMinutes=45`. +- `CheckoutSessionBean` (`shop.checkout.CheckoutSessionBean`) — stateful bean with a local reference to `StockReservation`. +- `OrderPlacedListener` (`shop.events.OrderPlacedListener`) — message-driven bean configured for the order-placed queue. +- `TimingInterceptor` (`shop.audit.TimingInterceptor`) — interceptor bound to all EJBs. + +#### Data flow +- Web requests pass through `RequestIdFilter`; report requests can reach `ReportDownloadServlet`, configured with `/var/shop/reports` as the report directory. +- Checkout’s `StockReservation` local EJB reference connects `CheckoutSessionBean` to stock reservation; `reserve` runs with `RequiresNew`. +- `OrderPlacedListener` consumes events from `java:/jms/queue/OrderPlaced`. + +#### Dependencies +- Jakarta EE 6.0 web descriptor and Jakarta EE EJB 4.0 descriptor. +- JMS destination `java:/jms/queue/OrderPlaced`. +- Web resource reference `jdbc/ShopDS` of type `javax.sql.DataSource`. +- EJB classes `shop.stock.StockReservation`, `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, and `shop.audit.TimingInterceptor`. + +#### Cross-cutting +- `TimingInterceptor` is bound to every EJB. +- `/admin/*` requires the `admin` role; web sessions time out after 20 minutes. +- `StockReservationBean.reserve` uses `RequiresNew`; the servlet is configured to load on startup. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jee/web.xml.ai.md new file mode 100644 index 00000000..5a586847 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jee/web.xml.ai.md @@ -0,0 +1,45 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:13:58Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Configures the shop back office’s report-download endpoint, request filtering, startup auditing, session duration, admin access control, and database resource reference. + +#### Purpose +- Defines Jakarta web application settings for `shop-backoffice`. +- Registers web components and protects the `/admin/*` URL space. + +#### Type +- Jakarta EE descriptor (`web.xml`), root element `web-app`, version `6.0`. +- Namespace: default `https://jakarta.ee/xml/ns/jakartaee`. + +#### Definitions +- Display name: `shop-backoffice`. +- Servlet `ReportDownloadServlet`: class `shop.web.ReportDownloadServlet`; mapped to `/reports/*`. +- Filter `RequestIdFilter`: class `shop.web.RequestIdFilter`; mapped to `/*`. +- Listener: `shop.web.StartupAuditListener`. +- Session timeout: 20 minutes. +- Security constraint `backoffice`: protects `/admin/*`; requires role `admin`. +- Security role: `admin`. +- Resource reference `jdbc/ShopDS`: type `javax.sql.DataSource`. + +#### Configuration +- Context parameter `shop.reportDirectory`: `/var/shop/reports`. +- `ReportDownloadServlet` load-on-startup value: `1`. +- Session timeout: `20` minutes. +- URL mappings: `ReportDownloadServlet` → `/reports/*`; `RequestIdFilter` → `/*`. +- Security URL pattern: `/admin/*`, restricted to role `admin`. + +#### Dependencies +- Servlet class: `shop.web.ReportDownloadServlet`. +- Filter class: `shop.web.RequestIdFilter`. +- Listener class: `shop.web.StartupAuditListener`. +- Data source resource: `jdbc/ShopDS` (`javax.sql.DataSource`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..abd902a5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,46 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:14:02Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> Order listing lets staff search orders by customer email or status, review totals and overdue status, and cancel an order. + +#### Purpose +- Displays orders with their number, total, overdue indicator, and cancel link. +- Provides a customer-email and status search form. + +#### Type +- JSP page; `text/html;charset=UTF-8`. +- `c` = Jakarta Tags core (`jakarta.tags.core`); `fmt` = Jakarta Tags format (`jakarta.tags.fmt`). + +#### Data +- Request attribute `orderFilter`; uses `getPageSize()` to set `pageSize`. +- `orders`; iterated as `order`, using `order.number`, `order.total`, `order.overdue`, and `order.id`. +- Request parameter `param.customerEmail`; used as the search input value. + +#### Actions +- GET form to `${pageContext.request.contextPath}/orders/search`; fields: `customerEmail` (text), `status` (select: `OPEN`, `SHIPPED`). +- Cancel link to `orders/${order.id}/cancel` for each order. + +#### Structure +- Includes `/WEB-INF/jspf/header.jspf` via JSP include directive. +- Includes `/WEB-INF/jspf/footer.jspf` via `jsp:include`. + +#### Server code +- Imports `java.util.List`, `shop.Order`, and `shop.OrderFilter`. +- Reads request attribute `orderFilter`; computes `pageSize` as 25 when the filter is absent, otherwise from `filter.getPageSize()`. +- Outputs `pageSize` with a JSP expression. + +#### Dependencies +- Tag libraries: `jakarta.tags.core`, `jakarta.tags.fmt`. +- Classes: `java.util.List`, `shop.Order`, `shop.OrderFilter`. +- Included files: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf`. +- URL patterns: `/orders/search`, `orders/${order.id}/cancel`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jsp/package.ai.md new file mode 100644 index 00000000..34bfff2d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/jsp/package.ai.md @@ -0,0 +1,34 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:15:42Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> Staff can search and review customer orders, including totals and overdue status, and initiate order cancellation. + +#### Purpose +- Presents the order list and a customer-email/status search form. +- Shows each order’s number, total, overdue indicator, and cancellation link. + +#### Responsibilities +- **Order search and display:** Submits search criteria by GET and renders the supplied orders. +- **Cancellation access:** Provides a per-order link to the cancellation URL. +- **Page layout:** Includes shared header and footer fragments. + +#### Key units +- `order-list.jsp` — renders the order search form and order list; defaults `pageSize` to 25 when `orderFilter` is absent. + +#### Data flow +- Reads `orderFilter` and `orders` from request attributes; derives `pageSize` from the filter when present. +- Uses the `customerEmail` request parameter as the search input value. +- Submits `customerEmail` and `status` (`OPEN` or `SHIPPED`) to `/orders/search`; builds cancellation links from each order’s ID. + +#### Dependencies +- Jakarta Tags core (`c`) and format (`fmt`) tag libraries. +- `shop.Order`, `shop.OrderFilter`, and `java.util.List`. +- `/WEB-INF/jspf/header.jspf` and `/WEB-INF/jspf/footer.jspf`. +- URL patterns `/orders/search` and `orders/${order.id}/cancel`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..61e217ff --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,44 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:14:08Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the Shop orders backoffice application with three replicas, internal service access, and HTTP ingress at `backoffice.shop.example`. + +#### Purpose +- Runs the orders backoffice application and exposes it through a Kubernetes Service and Ingress. + +#### Type +- Kubernetes manifest; `apps/v1` Deployment, `v1` Service, `networking.k8s.io/v1` Ingress. + +#### Definitions +- Deployment `orders-backoffice`: 3 replicas; pod label and selector `app: orders-backoffice`. + - Container `backoffice`: image `registry.shop.example/orders-backoffice:2.1.0`; container port `8080`. + - Environment: `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop`; `SHOP_DB_PASSWORD` from Secret `orders-db-credentials`, key `password`. + - Readiness probe: HTTP GET `/health/ready` on port `8080`. + - Resource limits: memory `768Mi`, CPU `"1"`. +- Service `orders-backoffice`: selects `app: orders-backoffice`; port `80` targets `8080`. +- Ingress `orders-backoffice`: host `backoffice.shop.example`; path `/` with `Prefix` path type routes to Service `orders-backoffice`, port `80`. + +#### Configuration +- `replicas=3` +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD` references Secret `orders-db-credentials`, key `password`. +- `containerPort=8080` +- Readiness path: `/health/ready`; port `8080`. +- Resource limits: `memory=768Mi`, `cpu="1"`. +- Service: `port=80`, `targetPort=8080`. +- Ingress: `host=backoffice.shop.example`, `path=/`, `pathType=Prefix`, backend port `80`. + +#### Dependencies +- Image: `registry.shop.example/orders-backoffice:2.1.0` +- Secret: `orders-db-credentials` (`password`) +- Database endpoint: `orders-db:5432` (database `shop`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/k8s/package.ai.md new file mode 100644 index 00000000..0c67e2da --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/k8s/package.ai.md @@ -0,0 +1,39 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:15:45Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Runs the Shop orders backoffice and makes it reachable over HTTP while connecting it to the orders database. + +#### Purpose +- Deploys and exposes the orders backoffice application in Kubernetes. +- Configures its database connection and readiness check. + +#### Responsibilities +- Application workload: runs three replicas of the backoffice container with resource limits and an HTTP readiness probe. +- Network access: provides an internal Service and routes ingress traffic for `backoffice.shop.example`. +- Runtime configuration: supplies the database URL and obtains the database password from a Kubernetes Secret. + +#### Key units +- Deployment `orders-backoffice` — runs `registry.shop.example/orders-backoffice:2.1.0` on port `8080`. +- Service `orders-backoffice` — maps port `80` to the application’s port `8080`. +- Ingress `orders-backoffice` — routes `/` requests for `backoffice.shop.example` to the Service. + +#### Data flow +- Ingress traffic reaches the Service on port `80`, which forwards it to application pods on port `8080`. +- The application connects to `orders-db:5432` using `SHOP_DB_URL` and the `password` key from Secret `orders-db-credentials`. +- Kubernetes checks readiness through `/health/ready` on port `8080`. + +#### Dependencies +- Container image `registry.shop.example/orders-backoffice:2.1.0`. +- Secret `orders-db-credentials`, key `password`. +- Database endpoint `orders-db:5432`, database `shop`. + +#### Cross-cutting +- Deployment uses three replicas selected by the label `app: orders-backoffice`. +- Readiness probe uses HTTP; resource limits are `768Mi` memory and `1` CPU. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..0ed03db0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,75 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:14:13Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Issues invoices for completed orders, assigns payment deadlines, and calculates line totals and category-based tax rates. + +#### Purpose +- `InvoiceService` creates invoices for non-empty completed orders, persists them, and returns an issued or rejected result. +- `InvoiceLine` calculates a line amount; `List.total()` sums line amounts. + +#### Type +- `InvoiceNumber` — value class; wraps `String`; annotated `@JvmInline`. +- `InvoiceLine` — data class; fields `sku: String`, `quantity: Int`, `unitPrice: BigDecimal`. +- `InvoiceResult` — sealed interface. +- `InvoiceResult.Issued` — data class implementing `InvoiceResult`; fields `number: InvoiceNumber`, `dueDate: LocalDate`. +- `InvoiceResult.Rejected` — data class implementing `InvoiceResult`; field `reason: String`. +- `InvoiceService` — class; constructor-injected `InvoiceRepository` and `clock: () -> LocalDate` (default `LocalDate::now`); contains companion object. + +#### Input +- `InvoiceService` constructor: `repository: InvoiceRepository`; `clock: () -> LocalDate`, defaulting to `LocalDate::now`. +- `issue(order: CompletedOrder)` reads `order.lines`, `order.id`, and `order.customerId`. +- `taxRate(category: String)` checks the category against `REDUCED_TAX_CATEGORIES`. +- `InvoiceLine.total()` receives a `List`. +- `InvoiceLine` receives `sku`, `quantity`, and `unitPrice`. + +#### Output +- `issue` returns `InvoiceResult`; successful issuance saves an `Invoice` through `repository.save`. +- Issued invoices receive a due date `PAYMENT_TERM_DAYS` after `clock()`. +- `taxRate` returns `BigDecimal`: `0.07` for reduced-tax categories, otherwise `0.19`. +- `InvoiceLine.amount` and `List.total()` return `BigDecimal`. +- `defaultCurrency` is publicly mutable state; `sequence` increments when a number is generated. + +#### Core logic +- `issue` runs within `withContext(Dispatchers.IO)`. +- Rejects orders with no lines, returning a reason containing the order ID; rejection occurs before numbering or saving. +- For a non-empty order, increments the sequence to form `INV-`, calculates the due date, constructs an `Invoice`, saves it, then returns `Issued`. +- Reduced-tax categories are `"books"` and `"food"`. +- `InvoiceLine.amount` multiplies `unitPrice` by `quantity`; `total()` folds line amounts from `BigDecimal.ZERO`. + +#### Public API +- `PAYMENT_TERM_DAYS: Int` — payment term in days. +- `InvoiceNumber(value: String)` — wraps an invoice number. +- `InvoiceLine(sku: String, quantity: Int, unitPrice: BigDecimal)` — creates an invoice line. +- `amount: BigDecimal` — calculated line amount. +- `InvoiceResult.Issued(number: InvoiceNumber, dueDate: LocalDate)` — successful result. +- `InvoiceResult.Rejected(reason: String)` — rejected result. +- `InvoiceService(repository: InvoiceRepository, clock: () -> LocalDate)` — creates the service. +- `REDUCED_TAX_CATEGORIES: Set` — reduced-tax category names. +- `defaultCurrency: String` — default currency property. +- `issue(order: CompletedOrder): InvoiceResult` — issues and saves an invoice. +- `taxRate(category: String): BigDecimal` — returns category tax rate. +- `List.total(): BigDecimal` — sums line amounts. + +#### Dependencies +- `BigDecimal`, `LocalDate` +- `Dispatchers`, `withContext` +- Referenced domain types: `InvoiceRepository`, `CompletedOrder`, `Invoice` + +#### Exceptions / Errors +- Empty orders produce `InvoiceResult.Rejected`; no exception is thrown in this branch. +- `defaultCurrency` is `lateinit`; access before initialization can fail. +- Repository and clock failures are not caught. + +#### Concurrency +- `issue` switches execution to `Dispatchers.IO`. +- `sequence` is mutable and incremented without synchronization; concurrent issuance is not protected against races. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/kotlin/package.ai.md new file mode 100644 index 00000000..4cfccac9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/kotlin/package.ai.md @@ -0,0 +1,43 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:15:49Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> Converts completed orders into persisted invoices with payment deadlines, line totals, and category-based tax rates. + +#### Purpose +- Issues invoices for non-empty completed orders, returning either an issued invoice number and due date or a rejection. +- Provides invoice-line amount and total calculations, plus reduced-rate category lookup. + +#### Responsibilities +- Invoice issuance: reject empty orders; number, date, persist, and report valid invoices. +- Invoice calculations and tax rules: multiply line price by quantity, sum line amounts, and select tax rates by category. + +#### Key units +- `InvoiceService` — issues invoices through `InvoiceRepository`, using an injectable date clock. +- `InvoiceNumber` — value class wrapping an invoice number. +- `InvoiceResult` — sealed result with `Issued` and `Rejected` variants. +- `InvoiceLine` — holds SKU, quantity, and unit price; exposes the calculated `amount`. +- `List.total()` — sums line amounts. +- `PAYMENT_TERM_DAYS`, `REDUCED_TAX_CATEGORIES`, `defaultCurrency` — payment-term constant, reduced-rate categories (`books`, `food`), and mutable currency state. +- `taxRate(category)` — returns `0.07` for reduced-rate categories and `0.19` otherwise. + +#### Data flow +- `issue(order)` reads the completed order’s lines, ID, and customer ID; empty lines yield `Rejected` before numbering or persistence. +- For non-empty orders, increments the sequence to form `INV-`, sets the due date from `clock()` plus `PAYMENT_TERM_DAYS`, saves an `Invoice`, and returns `Issued`. +- Invoice-line amounts multiply `unitPrice` by `quantity`; list totals fold amounts from `BigDecimal.ZERO`. + +#### Dependencies +- Domain collaborators: `CompletedOrder`, `Invoice`, `InvoiceRepository`. +- Standard types: `BigDecimal`, `LocalDate`. +- Coroutine execution: `withContext`, `Dispatchers.IO`. + +#### Cross-cutting +- `issue` runs on `Dispatchers.IO`; mutable sequence increments are unsynchronized and may race under concurrent issuance. +- Empty-order handling uses `InvoiceResult.Rejected`; repository and clock failures are not caught. +- `defaultCurrency` is `lateinit`; accessing it before initialization can fail. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..c4f30b53 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,38 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:14:21Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Defines MyBatis customer queries and mutations for the `CUSTOMER` table, including dynamic search and bulk promotion. + +#### Type +- MyBatis mapper; root element `mapper`; no XML namespaces declared. +- Mapper namespace: `shop.customer.CustomerMapper`. + +#### Definitions +- Result map `customerResult` → `shop.customer.Customer`: `id` ← `CUSTOMER_ID`, `email` ← `EMAIL`, `loyaltyTier` ← `LOYALTY_TIER`. +- SQL fragment `customerColumns`: `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT`. +- `select` `findByEmail`: selects the shared columns from `CUSTOMER` by `EMAIL = #{email}`; result map `customerResult`. +- `select` `search`: selects the shared columns from `CUSTOMER`; optional filters for `tier` and `createdAfter`; orders by `${sortColumn}`; result map `customerResult`. +- `insert` `insert`: writes `EMAIL`, `LOYALTY_TIER`, and `CREATED_AT` (`now()`); generated keys enabled, assigned to `id`. +- `update` `promote`: sets `LOYALTY_TIER = #{tier}` for `CUSTOMER_ID` values from `ids`. +- `delete` `deleteInactive`: deletes from `CUSTOMER` where `LAST_ORDER_AT < #{cutoff}`. +- `${sortColumn}` is spliced into SQL unescaped. +- Commented-out `findAll` is not active. + +#### Configuration +- `search`: includes `LOYALTY_TIER = #{tier}` when `tier != null`; includes `CREATED_AT >= #{createdAfter}` when `createdAfter != null`. +- `insert`: `useGeneratedKeys="true"`, `keyProperty="id"`. +- `promote`: `foreach` uses `collection="ids"`, `item="id"`, parentheses delimiters, comma separator. + +#### Dependencies +- Java class `shop.customer.Customer`. +- MyBatis mapper DTD: `https://mybatis.org/dtd/mybatis-3-mapper.dtd`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/mybatis/package.ai.md new file mode 100644 index 00000000..89c9fae6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/mybatis/package.ai.md @@ -0,0 +1,38 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:15:54Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Provides customer persistence operations for looking up and filtering customers, inserting records, promoting loyalty tiers, and deleting inactive customers. + +#### Purpose +- Defines MyBatis queries and mutations for the `CUSTOMER` table. + +#### Responsibilities +- Retrieve customers by email or optional loyalty-tier and creation-date filters. +- Insert customers with generated IDs, promote selected customers, and delete customers with orders before a cutoff date. + +#### Key units +- `shop.customer.CustomerMapper` — MyBatis mapper namespace for customer operations. +- `customerResult` — maps `CUSTOMER_ID`, `EMAIL`, and `LOYALTY_TIER` to `shop.customer.Customer`. +- `customerColumns` — shared selection fragment including customer ID, email, loyalty tier, and creation timestamp. +- `findByEmail`, `search` — retrieve customers; `search` supports optional filters and sorts by `${sortColumn}`. +- `insert`, `promote`, `deleteInactive` — insert a customer, update loyalty tiers for a list of IDs, and delete customers by last-order cutoff. + +#### Data flow +- Mapper inputs supply lookup values, optional search filters, sort column, insert fields, customer IDs and tier, or an inactivity cutoff. +- Queries use `customerResult` to map rows to `shop.customer.Customer`; mutations write to `CUSTOMER`, with `insert` assigning its generated key to `id`. + +#### Dependencies +- `shop.customer.Customer` — result-map target. +- MyBatis mapper DTD — mapper configuration format. + +#### Cross-cutting +- `search` conditionally adds tier and creation-date predicates when their parameters are non-null. +- `promote` expands the `ids` collection into a parenthesized, comma-separated list. +- `${sortColumn}` is spliced into SQL unescaped. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..00b36b0f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,37 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:14:26Z +- G: +- A: 0.0.0 +- X: file +- P: 34DB4705 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> Specifies backoffice access to shop orders, including listing, retrieving, and cancelling orders. + +#### Purpose +- Read orders and change order status through the shop backoffice API. + +#### Type +- OpenAPI 3.0.3; `Shop Orders API` version `2.1.0` + +#### Operations +- `GET /orders` — `listOrders`; optional query parameters `status` (`OrderStatus`) and `limit` (integer, maximum 200); response `200`: array of `Order`. +- `GET /orders/{orderId}` — `getOrder`; required path parameter `orderId` (string); response `200`: `Order`; response `404`: no schema specified. +- `POST /orders/{orderId}/cancel` — `cancelOrder`; required path parameter `orderId` (string); response `204`: no schema specified; response `409`: no schema specified; requires `backofficeToken` with scope `orders:write`. + +#### Schemas +- `OrderStatus` — string enum: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order` — object; required: `orderId`, `status`, `total`. + - `orderId`: string. + - `status`: `OrderStatus`. + - `total`: number, format `double`. + - `couponCode`: string, deprecated. + +#### Security and servers +- Server: `https://api.shop.example/backoffice`. +- `backofficeToken`: OAuth 2.0 client credentials; token URL `https://auth.shop.example/token`; scope `orders:write`. Required by `POST /orders/{orderId}/cancel`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/openapi/package.ai.md new file mode 100644 index 00000000..d6bf14b3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/openapi/package.ai.md @@ -0,0 +1,38 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:15:59Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> Provides backoffice users with API access to list, retrieve, and cancel shop orders. + +#### Purpose +- Defines the Shop Orders API for reading orders and changing their status through cancellation. + +#### Responsibilities +- Expose order-listing and order-retrieval operations, with status and result-limit filtering for listings. +- Expose order cancellation, protected by OAuth 2.0 authorization. +- Define the order response shape and allowed order statuses. + +#### Key units +- `GET /orders` (`listOrders`) — returns an array of orders; accepts optional `status` and `limit` query parameters. +- `GET /orders/{orderId}` (`getOrder`) — retrieves an order by ID. +- `POST /orders/{orderId}/cancel` (`cancelOrder`) — requests cancellation; requires `orders:write` scope. +- `Order` — schema requiring `orderId`, `status`, and `total`; includes deprecated `couponCode`. +- `OrderStatus` — enum of `OPEN`, `PAID`, `SHIPPED`, and `CANCELLED`. + +#### Data flow +- Backoffice clients send requests to the API server; list and retrieval operations return `Order` data, while cancellation returns status-only responses. + +#### Dependencies +- API server: `https://api.shop.example/backoffice`. +- OAuth 2.0 client-credentials token service: `https://auth.shop.example/token`; cancellation requires `backofficeToken` with `orders:write` scope. + +#### Cross-cutting +- OpenAPI 3.0.3 specification, version `2.1.0`. +- Listing `limit` is an integer capped at 200; order retrieval and cancellation identify orders by string `orderId`. +- `Order.couponCode` is deprecated. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..6bef5ec5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,71 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:16:13Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> Implements the shop’s order and back-office lifecycle across checkout, fulfilment, shipping, invoicing, customer and shipment persistence, and operational integration. + +#### Purpose +- Defines application contracts, workflows, user interfaces, and deployment configuration for processing shop orders and supporting back-office operations. +- Covers the path from checkout and order intake through fulfilment, invoice issuance, staff access, and production deployment. + +#### Responsibilities +- **Order processing and fulfilment:** BPMN coordinates stock reservation, payment, approval for orders over 1000, shipping, invoicing, and out-of-stock cancellation; Camel routes incoming JMS orders to manual review or the ERP. +- **Checkout and shipping:** Facelets collects delivery and shipping selections; Groovy `ShippingRules` calculates tiered charges, free shipping, and overweight rejection. +- **Invoices and service contracts:** Kotlin issues invoices for completed orders; WSDL defines SOAP stock-availability lookup and unknown-SKU faults; OpenAPI exposes order retrieval and cancellation. +- **Back-office access:** JSP presents order search, status, totals, overdue indicators, and cancellation links; Jakarta EE descriptors configure web endpoints, EJB services, and order-event handling. +- **Data access:** MyBatis maps customer queries and mutations; JPA/Hibernate maps shipments and configures shop and reporting persistence units. +- **Release and runtime:** GitHub Actions validates and publishes versioned images; Docker builds the runtime image; Kubernetes deploys and exposes the back office. + +#### Key units +- `orderFulfilment` — BPMN process for order payment, approval, shipping, invoicing, and cancellation. +- `orderIntegration` — Camel routes for JMS intake, validation, manual review, ERP submission, auditing, and dead-letter handling. +- `ShippingRules` — calculates shipping charges from order total and parcel weight. +- `InvoiceService`, `InvoiceResult`, `InvoiceLine` — issue invoices, represent outcomes, and calculate line and invoice totals. +- `checkout.xhtml` — customer checkout form bound to `checkoutBean`. +- `order-list.jsp` — staff order search and order-list view. +- `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener` — configured EJB components for reservation, checkout, and order-placed events. +- `CustomerMapper` — MyBatis customer lookup, filtering, insertion, promotion, and deletion operations. +- `Shipment`, `ExpressShipment` — JPA mappings for shipments, parcels, and express-shipment details. +- `GET /orders`, `GET /orders/{orderId}`, `POST /orders/{orderId}/cancel` — order API operations. +- `StockPortType.GetStockLevel` — SOAP contract for stock availability by SKU. +- `release-backoffice`, `Dockerfile`, `orders-backoffice` Deployment — release workflow, container build, and Kubernetes workload. + +#### Data flow +- Checkout captures address and shipping method; shipping changes trigger total recalculation, and submission invokes `checkoutBean.placeOrder`. +- Order processing reserves stock and waits for payment; BPMN routes high-value orders for approval and sends successful fulfilment to invoicing, while stock errors cancel the order. +- Camel validates incoming JMS orders, audits them, routes high-value orders to manual review, and translates other orders for ERP submission; handled ERP outages retry before dead-letter routing. +- Completed orders enter `InvoiceService`, which rejects empty orders or numbers and persists an invoice with a payment due date. +- Customer and shipment data are mapped to database records through MyBatis and JPA; API, JSP, and SOAP contracts expose order and stock operations. +- Release checks precede image publishing and deployment; Kubernetes routes ingress traffic through the Service to application pods. + +#### Dependencies +- **Domain and application types:** `Order`, `CompletedOrder`, `Invoice`, `InvoiceRepository`, `Customer`, `Parcel`, `StockReservation`, `checkoutBean`. +- **Messaging and workflow:** Camunda BPMN, Apache Camel, JMS queues, `shop.bpm.ReserveStockDelegate`, and the `invoicing` BPMN activity. +- **Persistence:** MyBatis, Hibernate/JPA, PostgreSQL, `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`, and database Secret `orders-db-credentials`. +- **External services:** ERP API, shipping external-task topic, OAuth 2.0 token service, and SOAP stock endpoint. +- **Runtime and delivery:** Maven, Java 21, GitHub Actions, container registry, and Kubernetes. + +#### Cross-cutting +- XML-based configuration appears in Camel routes, Jakarta EE descriptors, persistence configuration, BPMN, and WSDL; OpenAPI defines HTTP contracts. +- Error paths include BPMN `OutOfStock` cancellation, Camel `ErpUnavailableException` retries and dead-letter routing, Groovy overweight rejection, and Kotlin invoice rejection. +- Runtime configuration spans integration properties, production container environment variables, JTA shop persistence, and resource-local reporting persistence. +- The Kotlin invoice sequence is unsynchronized; MyBatis search interpolates `${sortColumn}` into SQL. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..abb132f5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,46 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:14:36Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps shipment and express-shipment records to database tables, defines their order and parcel associations, and provides shipment lookup and carrier-count queries. + +#### Purpose +- Hibernate mapping for shipment persistence and related queries. +- Maps `Shipment` inheritance, shipment metadata, and parcel ownership. + +#### Type +- Hibernate mapping (`*.hbm.xml`); root element: `hibernate-mapping`. +- Declares no XML namespace; references Hibernate Mapping DTD 3.0 at `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. + +#### Definitions +- Package: `shop.shipping`. +- Entity `Shipment` → table `SHIPMENT`: + - ID `id` → column `SHIPMENT_ID`; sequence generator `SHIPMENT_SEQ`. + - Properties: `trackingCode` → `TRACKING_CODE`; `carrier` → `CARRIER`; `shippedAt` → `SHIPPED_AT` (`timestamp`). + - Many-to-one `order` → class `shop.Order`, column `ORDER_ID`. + - Set `parcels` → inverse, cascade `all-delete-orphan`; key column `SHIPMENT_ID`; one-to-many class `Parcel`. +- Joined subclass `ExpressShipment` → table `EXPRESS_SHIPMENT`; key column `SHIPMENT_ID`; property `deliveryWindow` → `DELIVERY_WINDOW`. +- Named query `Shipment.undelivered`: selects shipments where `deliveredAt` is null and `shippedAt` precedes `:cutoff`. +- Native SQL query `Shipment.countByCarrier`: selects `CARRIER` and `count(*)` from `SHIPMENT`, grouped by `CARRIER`. + +#### Configuration +- `trackingCode`: length `40`, not null. +- `carrier`: length `12`. +- `order`: not null. +- `parcels`: inverse `true`; cascade `all-delete-orphan`. +- ID sequence: `SHIPMENT_SEQ`. +- Query parameter: `:cutoff`. + +#### Dependencies +- DTD: `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. +- Classes: `shop.shipping.Shipment`, `shop.shipping.ExpressShipment`, `shop.shipping.Parcel`, `shop.Order`. +- Database tables: `SHIPMENT`, `EXPRESS_SHIPMENT`; sequence: `SHIPMENT_SEQ`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/persistence/package.ai.md new file mode 100644 index 00000000..781623ea --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/persistence/package.ai.md @@ -0,0 +1,44 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:16:03Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Persists shop shipments and configures transactional shop data access alongside a separate daily-revenue reporting unit. + +#### Purpose +- Maps shipment and express-shipment data, relationships, and lookup queries to database tables. +- Configures Hibernate-backed JPA persistence for shop transactions and resource-local revenue reporting. + +#### Responsibilities +- **Shipment mapping:** Defines `Shipment` and joined-subclass `ExpressShipment` storage, shipment-to-order and shipment-to-parcel associations, and shipment queries. +- **Persistence-unit configuration:** Declares the JTA `shop` unit for orders, order lines, and customers, and the resource-local `reporting` unit for daily revenue. + +#### Key units +- `Shipment` — maps shipment ID, tracking code, carrier, timestamp, order, and parcels to `SHIPMENT`. +- `ExpressShipment` — maps express-shipment delivery-window data to `EXPRESS_SHIPMENT` using a joined key. +- `Shipment.undelivered` — selects shipments not yet delivered and shipped before a cutoff. +- `Shipment.countByCarrier` — groups shipment counts by carrier. +- `shop` persistence unit — configures Hibernate JTA persistence for `shop.Order`, `shop.OrderLine`, and `shop.Customer`. +- `reporting` persistence unit — configures resource-local persistence for `shop.reporting.DailyRevenue`. + +#### Data flow +- JPA persistence units connect managed shop and reporting classes to their configured data sources. +- Hibernate mapping persists `Shipment` records and their `Parcel` collection; `ExpressShipment` adds joined-table data. +- Shipment queries retrieve undelivered shipments by cutoff or aggregate shipment counts by carrier. + +#### Dependencies +- Hibernate provider `org.hibernate.jpa.HibernatePersistenceProvider` and PostgreSQL dialect `org.hibernate.dialect.PostgreSQLDialect`. +- Data sources `java:/jdbc/ShopDS` and `java:/jdbc/ReportingDS`. +- Shipment mapping references `shop.Order`, `shop.shipping.Parcel`, and the `SHIPMENT`, `EXPRESS_SHIPMENT` tables with sequence `SHIPMENT_SEQ`. +- Shop persistence references `META-INF/order-queries.xml`. + +#### Cross-cutting +- Shop transactions use JTA; reporting uses `RESOURCE_LOCAL`. +- Shipment parcels use inverse one-to-many mapping with `all-delete-orphan` cascade; shipment order association is required. +- Shop persistence configures JDBC batch size `50`; reporting excludes unlisted classes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..db9d76af --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/persistence/persistence.xml.ai.md @@ -0,0 +1,37 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:14:31Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Defines JPA persistence units for shop transactions and reporting data. + +#### Purpose +- Configures Hibernate-backed persistence for shop orders, order lines, and customers. +- Defines a separate resource-local unit for daily revenue reporting. + +#### Type +- JPA `persistence.xml`; root element `persistence`. +- Namespace: default `https://jakarta.ee/xml/ns/persistence` (version `3.1`). + +#### Definitions +- Persistence unit `shop`: transaction type `JTA`; provider `org.hibernate.jpa.HibernatePersistenceProvider`; managed classes `shop.Order`, `shop.OrderLine`, `shop.Customer`; mapping file `META-INF/order-queries.xml`. +- Persistence unit `reporting`: transaction type `RESOURCE_LOCAL`; managed class `shop.reporting.DailyRevenue`; excludes unlisted classes (`true`). + +#### Configuration +- `shop`: JTA data source `java:/jdbc/ShopDS`; `hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect`; `hibernate.jdbc.batch_size=50`; `hibernate.connection.username=shop_app`; `hibernate.connection.password=***`. +- `reporting`: non-JTA data source `java:/jdbc/ReportingDS`; `exclude-unlisted-classes=true`. + +#### Dependencies +- Mapping file: `META-INF/order-queries.xml`. +- Provider class: `org.hibernate.jpa.HibernatePersistenceProvider`. +- Managed classes: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue`. +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`. +- Database dialect: `org.hibernate.dialect.PostgreSQLDialect`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..ce3c8a0e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,41 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:14:41Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Defines a SOAP service for retrieving stock availability by SKU, including an unknown-SKU fault. + +#### Type +- WSDL; root `definitions` +- Namespaces: default `http://schemas.xmlsoap.org/wsdl/`; `soap` = `http://schemas.xmlsoap.org/wsdl/soap/`; `tns` = `http://shop.example/stock`; `xs` = `http://www.w3.org/2001/XMLSchema` + +#### Definitions +- Service `StockService` + - Port `StockPort` uses binding `tns:StockSoapBinding`; address `https://erp.shop.example/soap/stock` +- Port type `StockPortType` + - Operation `GetStockLevel`: input `tns:GetStockLevelInput`, output `tns:GetStockLevelOutput`, fault `UnknownSku` (`tns:UnknownSku`) +- Binding `StockSoapBinding` + - Type `tns:StockPortType`; document style, SOAP/HTTP transport + - Operation `GetStockLevel`: SOAP action `http://shop.example/stock/GetStockLevel`; input, output and `UnknownSku` fault use literal bodies +- Schema target namespace `http://shop.example/stock` + - Element `StockLevelRequest`: contains `sku` (`xs:string`) + - Element `StockLevelResponse`: contains `available` (`xs:int`) + - Complex type `UnknownSkuFault`: contains `sku` (`xs:string`) +- Messages: `GetStockLevelInput` uses element `tns:StockLevelRequest`; `GetStockLevelOutput` uses element `tns:StockLevelResponse`; `UnknownSku` uses type `tns:UnknownSkuFault` + +#### Configuration +- SOAP endpoint: `https://erp.shop.example/soap/stock` +- SOAP action: `http://shop.example/stock/GetStockLevel` +- Binding style: `document`; transport: `http://schemas.xmlsoap.org/soap/http`; body use: `literal` + +#### Dependencies +- WSDL and SOAP namespaces; XML Schema namespace +- Service endpoint: `erp.shop.example` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/wsdl/package.ai.md new file mode 100644 index 00000000..6f27bdc6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/other/wsdl/package.ai.md @@ -0,0 +1,37 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:16:09Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Defines the stock-availability lookup contract for retrieving inventory by SKU and reporting unknown SKUs. + +#### Purpose +- Specify the SOAP interface for querying stock availability by SKU. +- Describe the request, response, and unknown-SKU fault exchanged with the stock service. + +#### Responsibilities +- Define the `GetStockLevel` operation, its SOAP binding, and the service endpoint. +- Define XML Schema payloads for SKU requests, availability responses, and unknown-SKU faults. + +#### Key units +- `StockService` / `StockPort` — expose `StockPortType` through `StockSoapBinding` at `https://erp.shop.example/soap/stock`. +- `StockPortType.GetStockLevel` — accept a `GetStockLevelInput`, return a `GetStockLevelOutput`, or raise `UnknownSku`. +- `StockLevelRequest` — carry the requested `sku` as a string. +- `StockLevelResponse` — carry `available` as an integer. +- `UnknownSkuFault` — carry the SKU associated with the fault. +- `StockSoapBinding` — define document-style SOAP over HTTP with literal input, output, and fault bodies. + +#### Data flow +- A `StockLevelRequest` containing `sku` enters `GetStockLevel`; the service returns `StockLevelResponse` with `available`, or `UnknownSku` with the relevant SKU. + +#### Dependencies +- WSDL, SOAP, and XML Schema namespaces. +- Service endpoint at `erp.shop.example`; SOAP action `http://shop.example/stock/GetStockLevel`. + +#### Cross-cutting +- Uses document-style SOAP over HTTP with literal message bodies. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..ad039328 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/package.ai.md @@ -0,0 +1,59 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:16:24Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> Supports end-to-end shop order processing, from checkout and fulfilment through invoicing and back-office review, cancellation, and operational deployment. + +#### Purpose +- Defines order workflows and customer/staff interfaces, integrating stock, payment, shipping, invoicing, and ERP processing. +- Provides secured back-office order management, including refunds on cancellation and scheduled purging of cancelled orders after 30 days. + +#### Responsibilities +- **Order lifecycle:** `orderFulfilment` coordinates stock reservation, payment, high-value approval, shipping, invoicing, and out-of-stock cancellation; Camel `orderIntegration` validates and routes incoming JMS orders to manual review or ERP. +- **Checkout and shipping:** `checkout.xhtml` collects delivery and shipping selections; `ShippingRules` calculates tiered charges, free shipping, and overweight rejection. +- **Invoicing and service contracts:** `InvoiceService` issues invoices for completed orders; SOAP and OpenAPI contracts expose stock lookup and order operations. +- **Back-office operations:** `OrderResource` and `order-list.jsp` support staff order lookup and cancellation; cancellation refunds payment, changes order status, and audits the action. +- **Persistence and runtime:** `CustomerMapper` maps customer operations through MyBatis; `Shipment` and `ExpressShipment` map shipment data through JPA. Release automation, Docker, and Kubernetes configure delivery and deployment. + +#### Key units +- `orderFulfilment` — BPMN workflow for order fulfilment, approval, invoicing, and cancellation. +- `orderIntegration` — Camel routes for JMS intake, validation, review, ERP submission, auditing, retries, and dead-letter handling. +- `OrderResource` — secured `/orders` REST operations for listing, retrieval, cancellation, and scheduled cleanup. +- `ShippingRules` — computes shipping charges from order total and parcel weight. +- `InvoiceService`, `InvoiceResult`, `InvoiceLine` — issue invoices and represent invoice outcomes and totals. +- `checkout.xhtml` — customer checkout form bound to `checkoutBean`. +- `order-list.jsp` — staff order search and status view, including overdue indicators and cancellation links. +- `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener` — configured EJB components for reservation, checkout, and order-placed events. +- `CustomerMapper` — MyBatis customer lookup, filtering, insertion, promotion, and deletion. +- `Shipment`, `ExpressShipment` — JPA mappings for shipments, parcels, and express-shipment details. +- `GET /orders`, `GET /orders/{orderId}`, `POST /orders/{orderId}/cancel` — order API operations; `StockPortType.GetStockLevel` — SOAP stock lookup by SKU. +- `PURGE_AFTER_DAYS` — 30-day cancelled-order retention threshold. +- `release-backoffice`, `Dockerfile`, `orders-backoffice` Deployment — release workflow, container build, and Kubernetes workload. + +#### Data flow +- Checkout captures delivery and shipping choices, recalculates totals when shipping changes, and submits through `checkoutBean.placeOrder`. +- Order processing reserves stock and waits for payment; BPMN routes high-value orders for approval and successful fulfilment to invoicing, while stock errors cancel orders. +- Camel validates and audits JMS orders, routes high-value orders to manual review, and submits others to ERP; ERP outages retry before dead-letter routing. +- Completed orders enter `InvoiceService`, which rejects empty orders or order numbers and persists invoices with a payment due date. +- Back-office lookup queries open orders or retrieves by ID; cancellation refunds through `PaymentGateway`, marks the order `CANCELLED`, and audits it. Scheduled cleanup runs `Order.purgeCancelled` and audits the removal count. +- Customer and shipment data flow through MyBatis and JPA mappings; release checks precede image publishing and Kubernetes deployment. + +#### Dependencies +- **Domain and application:** `Order`, `OrderStatus`, `CompletedOrder`, `Invoice`, `InvoiceRepository`, `Customer`, `Parcel`, `StockReservation`, `checkoutBean`. +- **Workflow and integration:** Camunda BPMN, Apache Camel, JMS queues, `shop.bpm.ReserveStockDelegate`, invoicing activity, ERP API, shipping external-task topic, OAuth 2.0 token service, SOAP stock endpoint. +- **Persistence:** MyBatis, Hibernate/JPA, PostgreSQL, `EntityManager`, `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`, `orders-db-credentials`; named queries `Order.open` and `Order.purgeCancelled`. +- **Platform and delivery:** Jakarta EE REST, EJB, transactions, security, persistence and injection; Maven, Java 21, GitHub Actions, container registry, Docker, Kubernetes. + +#### Cross-cutting +- XML-based configuration spans Camel routes, Jakarta EE descriptors, persistence, BPMN, and WSDL; OpenAPI defines HTTP contracts. +- Error handling includes BPMN `OutOfStock` cancellation, Camel `ErpUnavailableException` retries and dead-letter routing, overweight rejection, and invoice rejection. +- `OrderResource` restricts access to `backoffice` and `admin`; cancellation uses `REQUIRED` transaction semantics, and scheduled cleanup is non-persistent. +- Runtime configuration includes integration properties, production container environment variables, JTA shop persistence, and resource-local reporting persistence. +- The Kotlin invoice sequence is unsynchronized; MyBatis search interpolates `${sortColumn}` into SQL. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..63c5fa8d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-6-luna/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: E0E32A4E +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:16:35Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project centers on end-to-end shop order processing: customer checkout feeds fulfilment, where stock reservation and payment lead to approval, shipping, invoicing, or out-of-stock cancellation. Back-office web and API interfaces let staff review orders and cancel them with refunds, while persistence, customer management, and ERP integration support the order lifecycle. Container and deployment automation package and hand off the back office for production. + +#### Packages +- java — Backoffice staff can review orders, cancel them with payment refunds, and remove cancelled orders after a retention period. +- java/shop — Backoffice users can inspect orders, cancel them with payment refunds, and automatically remove long-cancelled orders. +- other/actions/.github — Automates validation, publication, and production deployment handoff for versioned Orders Backoffice container images. +- other/actions/.github/workflows — Validates and releases versioned Orders Backoffice container images, then hands them off for production deployment. +- other/actions — Validates, publishes, and hands off versioned Orders Backoffice container releases for production deployment. +- other/bpmn — Coordinates order fulfilment from stock reservation and payment through approval, shipping, invoicing, or out-of-stock cancellation. +- other/docker — Packages the Orders Backoffice Java application as a production container that serves HTTP traffic on port 8080. +- other/facelets — Customers provide delivery and shipping details, review an updated EUR order total, and submit checkout. +- other/groovy — Calculates order shipping charges by applying a free-shipping threshold, weight-based price tiers, and a maximum parcel-weight limit. +- other/integration — Processes incoming orders by validating them, routing high-value orders for manual review and others to the ERP, while auditing traffic and handling ERP outages. +- other/jee — Configures the shop back office’s web access and the EJB services that reserve stock, process checkout, and handle order-placed events. +- other/jsp — Staff can search and review customer orders, including totals and overdue status, and initiate order cancellation. +- other/k8s — Runs the Shop orders backoffice and makes it reachable over HTTP while connecting it to the orders database. +- other/kotlin — Converts completed orders into persisted invoices with payment deadlines, line totals, and category-based tax rates. +- other/mybatis — Provides customer persistence operations for looking up and filtering customers, inserting records, promoting loyalty tiers, and deleting inactive customers. +- other/openapi — Provides backoffice users with API access to list, retrieve, and cancel shop orders. +- other — Implements the shop’s order and back-office lifecycle across checkout, fulfilment, shipping, invoicing, customer and shipment persistence, and operational integration. +- other/persistence — Persists shop shipments and configures transactional shop data access alongside a separate daily-revenue reporting unit. +- other/wsdl — Defines the stock-availability lookup contract for retrieving inventory by SKU and reporting unknown SKUs. +- . — Supports end-to-end shop order processing, from checkout and fulfilment through invoicing and back-office review, cancellation, and operational deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..5df261d0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,48 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:17:54Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> A stateless REST service that manages back‑office order lifecycle, including listing, retrieval, cancellation with payment refund, audit logging, and nightly purge of cancelled orders. + +#### Purpose +- Expose a stateless REST API for back‑office order management. +- Handle order cancellation and nightly cleanup of cancelled orders. + +#### Responsibilities +- **Order retrieval** – list open orders, fetch by ID. +- **Order cancellation** – refund payment, update status, audit. +- **Scheduled maintenance** – nightly purge of old cancelled orders. + +#### Key units +- `OrderResource` – Stateless EJB, `@Path("/orders")`, exposes `openOrders()`, `find(id)`, `cancel(id)`, and scheduled `purgeCancelled()`. +- `PaymentGateway` – injected payment service used for refunds. +- `AuditLog` – EJB used to record audit events. +- `EntityManager` (`shop`) – JPA persistence context for `Order` entities. + +#### Data flow +1. **Open orders** – `openOrders()` queries named query `"Order.open"` via `EntityManager`, returns list of `Order`. +2. **Find order** – `find(id)` looks up `Order` by primary key; returns 200 with order or 404. +3. **Cancel order** – `cancel(id)`: + - Find `Order`. + - Call `payments.refund(order.getPaymentReference(), order.getTotal())`. + - Set status to `CANCELLED`. + - Persist change and record audit via `audit`. + - Return 204 or 404. +4. **Purge cancelled** – scheduled at 02:15 nightly, deletes `Order` entities older than `PURGE_AFTER_DAYS` using a named query, logs count removed. + +#### Dependencies +- Jakarta EE APIs: `@Stateless`, `@EJB`, `@Inject`, `@PersistenceContext`, `@Schedule`, `@RolesAllowed`, `@Path`, `@GET`, `@PathParam`, `@Produces`, `Response`, `MediaType`. +- JPA: `EntityManager`, named queries `"Order.open"`. +- Domain classes: `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog`. + +#### Cross-cutting +- Stateless EJB ensures thread safety; container‑managed transactions. +- Security via `@RolesAllowed({"backoffice","admin"})`. +- No explicit exception handling; container rolls back on failure. +- Scheduled method `purgeCancelled()` runs nightly without persistence context. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..1d6b75d7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md @@ -0,0 +1,73 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:16:38Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 50211B16 +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Provides REST endpoints for back‑office order management, including listing, retrieving, canceling, and nightly purging of cancelled orders. + +#### Purpose +- Exposes order back‑office REST API. +- Handles order cancellation and nightly purge of cancelled orders. + +#### Type +- `public class OrderResource` (Stateless, @Path("/orders"), @Produces(JSON), @RolesAllowed({"backoffice","admin"})) + - Extends `Object`. + - Annotations: `@Stateless`, `@Path`, `@Produces`, `@RolesAllowed`. + - Fields: + - `@PersistenceContext(unitName = "shop") private EntityManager em;` + - `@Inject private PaymentGateway payments;` + - `@EJB private AuditLog audit;` + - Methods: + - `public List openOrders()` + - `public Response find(long id)` + - `public Response cancel(long id)` + - `void purgeCancelled()` + +#### Input +- `openOrders`: none. +- `find`: `@PathParam("id") long id`. +- `cancel`: `@PathParam("id") long id`; uses `EntityManager.find`, `PaymentGateway.refund`, `Order.getPaymentReference`, `Order.getTotal`. +- `purgeCancelled`: none; uses named query parameter `days`. + +#### Output +- `openOrders`: list of `Order`. +- `find`: `Response` with 200 and order or 404. +- `cancel`: `Response` no‑content or 404; updates order status, records audit, refunds payment. +- `purgeCancelled`: audit record of removed count; no HTTP response. + +#### Core logic +- `openOrders`: query `"Order.open"` for all open orders. +- `find`: lookup order by id; return 404 if missing. +- `cancel`: lookup order; if missing return 404; otherwise refund via `payments.refund`, set status to `CANCELLED`, audit record, return 204. +- `purgeCancelled`: scheduled at 02:15 nightly; delete cancelled orders older than `PURGE_AFTER_DAYS`; audit record of count removed. + +#### Public API +- `openOrders() -> List`: list open orders. +- `find(long) -> Response` (returns order or 404). +- `cancel(long) -> Response` (cancels order or 404). +- `purgeCancelled()` (no public visibility; scheduled). + +#### Dependencies +- `jakarta.annotation.security.RolesAllowed` +- `jakarta.ejb.EJB`, `Schedule`, `Stateless`, `TransactionAttribute`, `TransactionAttributeType` +- `jakarta.inject.Inject` +- `jakarta.persistence.EntityManager`, `PersistenceContext` +- `jakarta.ws.rs.GET`, `POST`, `Path`, `PathParam`, `Produces` +- `jakarta.ws.rs.core.MediaType`, `Response` +- `java.util.List` +- `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog` + +#### Exceptions / Errors +- Returns `Response.Status.NOT_FOUND` when order not found. +- No explicit exception handling; relies on container for transaction rollback on failure. + +#### Concurrency +- Stateless EJB; thread‑safe by container. Transactional on `cancel`. Scheduled method non‑persistent. No explicit synchronization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/java/shop/package.ai.md new file mode 100644 index 00000000..8777e079 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/java/shop/package.ai.md @@ -0,0 +1,48 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:17:48Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Provides a stateless REST API for back‑office order management, including listing, retrieving, canceling, and nightly purging of cancelled orders. + +#### Purpose +- Expose order back‑office REST endpoints. +- Handle order cancellation and nightly purge of cancelled orders. + +#### Responsibilities +- **Order retrieval** – list open orders, fetch by ID. +- **Order cancellation** – refund payment, update status, audit. +- **Scheduled maintenance** – nightly purge of old cancelled orders. + +#### Key units +- `OrderResource` (Stateless EJB, `@Path("/orders")`) – REST resource exposing `openOrders()`, `find(id)`, `cancel(id)`, and scheduled `purgeCancelled()`. +- `PaymentGateway` – injected payment service used for refunds. +- `AuditLog` – EJB used to record audit events. +- `EntityManager` (`shop`) – JPA persistence context for `Order` entities. + +#### Data flow +1. **Open orders** – `openOrders()` queries named query `"Order.open"` via `EntityManager`, returns list of `Order`. +2. **Find order** – `find(id)` looks up `Order` by primary key; returns 200 with order or 404. +3. **Cancel order** – `cancel(id)`: + - Find `Order`. + - Call `payments.refund(order.getPaymentReference(), order.getTotal())`. + - Set status to `CANCELLED`. + - Persist change and record audit via `audit`. + - Return 204 or 404. +4. **Purge cancelled** – scheduled at 02:15 nightly, deletes `Order` entities older than `PURGE_AFTER_DAYS` using a named query, logs count removed. + +#### Dependencies +- Jakarta EE APIs: `@Stateless`, `@EJB`, `@Inject`, `@PersistenceContext`, `@Schedule`, `@RolesAllowed`, `@Path`, `@GET`, `@PathParam`, `@Produces`, `Response`, `MediaType`. +- JPA: `EntityManager`, named queries `"Order.open"`. +- Domain classes: `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog`. + +#### Cross-cutting +- Stateless EJB ensures thread safety; container‑managed transactions. +- Security via `@RolesAllowed({"backoffice","admin"})`. +- No explicit exception handling; container rolls back on failure. +- Scheduled method `purgeCancelled()` runs nightly without persistence context. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/.github/package.ai.md new file mode 100644 index 00000000..99bb01c5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/.github/package.ai.md @@ -0,0 +1,40 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:18:02Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Automates the CI/CD pipeline for the Backoffice Java service, building, testing, containerizing, and deploying it to a Kubernetes cluster. + +#### Purpose +- Continuous integration and deployment of the Backoffice service. +- Automate Docker image creation and Kubernetes rollout. + +#### Responsibilities +- **Build & Test**: Compile Java code and run unit tests across multiple Java versions. +- **Containerization**: Build and push Docker images to a private registry. +- **Deployment**: Trigger a Kubernetes deployment workflow with environment‑specific configuration. + +#### Key units +- **`release.yml` workflow** – orchestrates build, image, and deploy jobs. +- **`build` job** – runs Maven `verify` with CI profile on Java 21 and 25. +- **`image` job** – logs into `registry.shop.example`, builds image `orders-backoffice:${tag}`, pushes to registry. +- **`deploy` job** – calls external `.github/workflows/deploy-k8s.yml` for production rollout. + +#### Data flow +`push` to a tag → `build` job → `image` job → `deploy` job → Kubernetes cluster. + +#### Dependencies +- GitHub Actions: `checkout@v4`, `setup-java@v4`, `docker/login-action@v3`. +- External workflow: `.github/workflows/deploy-k8s.yml`. +- Docker registry: `registry.shop.example`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. + +#### Cross-cutting +- Matrix strategy for Java versions. +- Single environment (`production`) for image and deploy stages. +- Secret handling for registry credentials. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..c2782b96 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,40 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:17:59Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Automates the CI/CD pipeline for the Backoffice Java service, building, testing, containerizing, and deploying it to a Kubernetes cluster. + +#### Purpose +- Continuous integration and deployment of the Backoffice service. +- Automate Docker image creation and Kubernetes rollout. + +#### Responsibilities +- **Build & Test**: Compile Java code and run unit tests across multiple Java versions. +- **Containerization**: Build and push Docker images to a private registry. +- **Deployment**: Trigger a Kubernetes deployment workflow with environment‑specific configuration. + +#### Key units +- **`release.yml` workflow** – orchestrates build, image, and deploy jobs. +- **`build` job** – runs Maven `verify` with CI profile on Java 21 and 25. +- **`image` job** – logs into `registry.shop.example`, builds image `orders-backoffice:${tag}`, pushes to registry. +- **`deploy` job** – calls external `.github/workflows/deploy-k8s.yml` for production rollout. + +#### Data flow +`push` to a tag → `build` job → `image` job → `deploy` job → Kubernetes cluster. + +#### Dependencies +- GitHub Actions: `checkout@v4`, `setup-java@v4`, `docker/login-action@v3`. +- External workflow: `.github/workflows/deploy-k8s.yml`. +- Docker registry: `registry.shop.example`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. + +#### Cross-cutting +- Matrix strategy for Java versions. +- Single environment (`production`) for image and deploy stages. +- Secret handling for registry credentials. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..29615788 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,50 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:16:44Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds, tests, containerizes, and deploys the Backoffice service to production Kubernetes. + +#### Purpose +- Build and test the Backoffice Java application. +- Create and push a Docker image to the registry. +- Trigger a Kubernetes deployment. + +#### Type +- GitHub Actions workflow (`release.yml`), API v4. + +#### Definitions +- **Triggers**: `push` on tags matching `v*`; `workflow_dispatch`. +- **Jobs**: + - `build` (runs on `ubuntu-24.04`): + - Matrix `java`: `21`, `25`. + - Steps: + - `actions/checkout@v4` + - `actions/setup-java@v4` with `distribution: temurin`, `java-version: ${{ matrix.java }}` + - `Build and test` runs `mvn -B verify -Pci` + - `image` (needs `build`, runs on `ubuntu-24.04`, environment `production`): + - Steps: + - `actions/checkout@v4` + - `Log in to the registry` uses `docker/login-action@v3` with `registry: registry.shop.example`, `username: ${{ secrets.REGISTRY_USER }}`, `password: ${{ secrets.REGISTRY_TOKEN }}` + - `Push the image` runs Docker build and push for `registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v}` + - `deploy` (needs `image`): + - Uses external workflow `.github/workflows/deploy-k8s.yml` with `environment: production`; inherits secrets. + +#### Configuration +- `java-version` matrix values: `21`, `25`. +- Docker image tag: `${GITHUB_REF_NAME#v}` (tag without leading `v`). +- Registry credentials: `REGISTRY_USER`, `REGISTRY_TOKEN`. + +#### Dependencies +- Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- External workflow: `.github/workflows/deploy-k8s.yml`. +- Docker registry: `registry.shop.example`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/package.ai.md new file mode 100644 index 00000000..5226c901 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/actions/package.ai.md @@ -0,0 +1,40 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:18:04Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Automates the CI/CD pipeline for the Backoffice Java service, building, testing, containerizing, and deploying it to a Kubernetes cluster. + +#### Purpose +- Continuous integration and deployment of the Backoffice service. +- Automate Docker image creation and Kubernetes rollout. + +#### Responsibilities +- **Build & Test**: Compile Java code and run unit tests across multiple Java versions. +- **Containerization**: Build and push Docker images to a private registry. +- **Deployment**: Trigger a Kubernetes deployment workflow with environment‑specific configuration. + +#### Key units +- **`release.yml` workflow** – orchestrates build, image, and deploy jobs. +- **`build` job** – runs Maven `verify` with CI profile on Java 21 and 25. +- **`image` job** – logs into `registry.shop.example`, builds image `orders-backoffice:${tag}`, pushes to registry. +- **`deploy` job** – calls external `.github/workflows/deploy-k8s.yml` for production rollout. + +#### Data flow +`push` to a tag → `build` job → `image` job → `deploy` job → Kubernetes cluster. + +#### Dependencies +- GitHub Actions: `checkout@v4`, `setup-java@v4`, `docker/login-action@v3`. +- External workflow: `.github/workflows/deploy-k8s.yml`. +- Docker registry: `registry.shop.example`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. + +#### Cross-cutting +- Matrix strategy for Java versions. +- Single environment (`production`) for image and deploy stages. +- Secret handling for registry credentials. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..00a9a9e9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,61 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:16:47Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 7ADEA688 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1; decisions: 0; decision rules: 0 + +> Defines a BPMN process for order fulfilment, including payment handling, stock reservation, approval workflow, shipping, invoicing, and error handling. + +#### Purpose +- Models order fulfilment workflow. +- Handles stock reservation, payment wait, order approval, shipping, invoicing, and cancellation. + +#### Type +- BPMN 2.0 definition (`bpmn:definitions` root). +- Namespaces: + - `bpmn` → `http://www.omg.org/spec/BPMN/20100524/MODEL` + - `bpmndi` → `http://www.omg.org/spec/BPMN/20100524/DI` + - `dc` → `http://www.omg.org/spec/DD/20100524/DC` + - `camunda` → `http://camunda.org/schema/1.0/bpmn` + +#### Definitions +- **Messages** + - `msgPaymentReceived` (`name="PaymentReceived"`) +- **Errors** + - `errOutOfStock` (`name="OutOfStock"`, `errorCode="STOCK_EMPTY"`) +- **Process** `orderFulfilment` (`name="Order fulfilment"`, `isExecutable="true"`) + - **Start Event** `orderPlaced` (`name="Order placed"`) + - **Service Task** `reserveStock` (`name="Reserve stock"`, `camunda:class="shop.bpm.ReserveStockDelegate"`) + - **Boundary Event** `stockMissing` (attached to `reserveStock`, error `errOutOfStock`) + - **Intermediate Catch Event** `waitForPayment` (`name="Wait for payment"`, message `msgPaymentReceived`) + - **Exclusive Gateway** `amountCheck` (`name="Large order?"`) + - **Sequence Flow** `large` (`conditionExpression="${order.total > 1000}"`) → `approveOrder` + - **Sequence Flow** `small` (`conditionExpression="${order.total <= 1000}"`) → `shipOrder` + - **User Task** `approveOrder` (`name="Approve large order"`, `camunda:candidateGroups="backoffice"`) + - **Service Task** `shipOrder` (`name="Ship order"`, `camunda:type="external"`, `camunda:topic="shipping"`) + - **Call Activity** `createInvoice` (`name="Create invoice"`, `calledElement="invoicing"`) + - **End Events** + - `orderCompleted` (`name="Order completed"`) + - `orderCancelled` (`name="Order cancelled"`) +- **Diagram** `fulfilmentDiagram` with plane `plane` referencing `orderFulfilment`. Shapes for `orderPlaced`, `reserveStock`, `shipOrder` with bounds. + +#### Configuration +- `camunda:class="shop.bpm.ReserveStockDelegate"` +- `camunda:candidateGroups="backoffice"` +- `camunda:type="external"` +- `camunda:topic="shipping"` +- `calledElement="invoicing"` +- Condition expressions: `${order.total > 1000}`, `${order.total <= 1000}` + +#### Dependencies +- Java class `shop.bpm.ReserveStockDelegate` (service task). +- External topic `shipping` (service task). +- Called element `invoicing` (call activity). +- Camunda BPM engine (via `camunda` namespace). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/bpmn/package.ai.md new file mode 100644 index 00000000..2e509498 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/bpmn/package.ai.md @@ -0,0 +1,57 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:18:07Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> Provides a Camunda‑based BPMN workflow for end‑to‑end order fulfilment, from stock reservation and payment receipt to approval, shipping, invoicing, and error handling. + +#### Purpose +- Model and execute the full order fulfilment lifecycle. +- Coordinate stock, payment, approval, shipping, and invoicing steps. + +#### Responsibilities +- **Order Processing** – orchestrates reservation, payment wait, and approval. +- **Stock Management** – reserves inventory and handles out‑of‑stock errors. +- **Payment Handling** – waits for a payment‑received message. +- **Approval Workflow** – routes large orders to back‑office approval. +- **Shipping** – triggers external shipping service. +- **Invoicing** – delegates invoice creation to an external process. +- **Error & Cancellation** – manages cancellations and out‑of‑stock scenarios. + +#### Key units +- **Process** `orderFulfilment` – main executable BPMN flow. +- **Service Task** `reserveStock` – Java delegate `shop.bpm.ReserveStockDelegate`. +- **Boundary Event** `stockMissing` – error `errOutOfStock` (`STOCK_EMPTY`). +- **Intermediate Catch Event** `waitForPayment` – message `msgPaymentReceived`. +- **Exclusive Gateway** `amountCheck` – splits on `${order.total > 1000}`. +- **User Task** `approveOrder` – candidate group `backoffice`. +- **Service Task** `shipOrder` – external topic `shipping`. +- **Call Activity** `createInvoice` – calls element `invoicing`. +- **End Events** `orderCompleted`, `orderCancelled`. + +#### Data flow +1. **Order placed** → `reserveStock` (Java delegate). +2. If stock missing → `stockMissing` → `orderCancelled`. +3. On success → `waitForPayment` (message). +4. After payment → `amountCheck` → + - Large order → `approveOrder` (user task) → `shipOrder`. + - Small order → `shipOrder` directly. +5. `shipOrder` → `createInvoice` (call activity). +6. Completion → `orderCompleted`. + +#### Dependencies +- **Java**: `shop.bpm.ReserveStockDelegate` for stock reservation. +- **Camunda BPM**: BPMN engine, external task topic `shipping`, call activity `invoicing`. +- **Messages**: `msgPaymentReceived` for payment notification. +- **Errors**: `errOutOfStock` (`STOCK_EMPTY`) for inventory issues. + +#### Cross-cutting +- **Camunda annotations**: `camunda:class`, `camunda:type`, `camunda:topic`, `camunda:candidateGroups`. +- **Conditional expressions**: `${order.total > 1000}` and `${order.total <= 1000}`. +- **Error handling**: boundary event attached to `reserveStock`. +- **External integration**: external task for shipping, call activity for invoicing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..eb968b8c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/docker/Dockerfile.ai.md @@ -0,0 +1,53 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:16:56Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds a Java back‑office application, packages it with Maven, and runs it in an Alpine JRE container exposing port 8080 with a health check. + +#### Purpose +- Compile and package a Maven project into a JAR. +- Deploy the JAR in a lightweight runtime image. +- Expose the application for external access. + +#### Type +- `Dockerfile` + Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine` + +#### Definitions +- **Build stage** (`build`): + - `WORKDIR /src` + - `COPY pom.xml .` + - `RUN mvn -B dependency:go-offline` + - `COPY src ./src` + - `RUN mvn -B package -DskipTests` +- **Runtime stage**: + - `ARG APP_VERSION=2.1.0` + - `ENV JAVA_OPTS="-XX:MaxRAMPercentage=75" SHOP_PROFILE=production` + - `RUN addgroup -S shop && adduser -S backoffice -G shop` + - `COPY --from=build /src/target/orders-backoffice.jar /opt/shop/orders-backoffice.jar` + - `EXPOSE 8080` + - `USER backoffice` + - `HEALTHCHECK --interval=30s CMD wget -qO- http://localhost:8080/health/live || exit 1` + - `ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"]` + +#### Configuration +- `APP_VERSION=2.1.0` +- `JAVA_OPTS="-XX:MaxRAMPercentage=75"` +- `SHOP_PROFILE=production` +- `USER backoffice` +- `HEALTHCHECK` interval `30s` +- `EXPOSE 8080` + +#### Dependencies +- Maven 3.9 with Eclipse Temurin 21 (`maven:3.9-eclipse-temurin-21`) +- Eclipse Temurin 21 JRE Alpine (`eclipse-temurin:21-jre-alpine`) +- Project JAR: `orders-backoffice.jar` built from `pom.xml` and `src/` directory. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/docker/package.ai.md new file mode 100644 index 00000000..0ab00b56 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/docker/package.ai.md @@ -0,0 +1,40 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:18:11Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> Builds and deploys a Java back‑office service as a Docker image, compiling the Maven project and running the resulting JAR in an Alpine JRE container. + +#### Purpose +- Compile a Maven‑based Java back‑office application into a JAR. +- Package the JAR into a lightweight Docker image. +- Expose the service on port 8080 with a health‑check endpoint. + +#### Responsibilities +- **Build pipeline**: Maven dependency resolution, source compilation, and packaging. +- **Runtime configuration**: Java options, user permissions, and health‑check. +- **Container orchestration**: Exposing ports, setting entrypoint, and defining image layers. + +#### Key units +- **Dockerfile**: Two‑stage build; `build` stage compiles with Maven, `runtime` stage runs the JAR. +- **Maven project** (`pom.xml` + `src/`): Defines dependencies and build lifecycle. +- **Java application** (`orders-backoffice.jar`): The back‑office service executable. + +#### Data flow +`pom.xml` → Maven resolves dependencies → `src/` compiled → JAR produced → JAR copied to runtime image → Docker container starts JAR with `java $JAVA_OPTS -jar`. + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21` (build), `eclipse-temurin:21-jre-alpine` (runtime). +- Maven project artifacts (`pom.xml`, `src/`). +- Runtime environment variables: `APP_VERSION`, `JAVA_OPTS`, `SHOP_PROFILE`. + +#### Cross-cutting +- Two‑stage Docker build pattern. +- Environment variable configuration for Java and application profile. +- Non‑root user (`backoffice`) for running the service. +- Health‑check using `wget` on `/health/live`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..e182103f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,48 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:16:59Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> A checkout page that collects shipping address, selects shipping method, shows total, and places an order. + +#### Purpose +- Collect shipping address and method. +- Display order total. +- Submit order. + +#### Type +- Facelets page (`checkout.xhtml`). +- Uses template `/WEB-INF/templates/shop.xhtml`. +- Tag libraries: `h` = `jakarta.faces.html`, `f` = `jakarta.faces.core`, `ui` = `jakarta.faces.facelets`. + +#### Data +- `#{checkoutBean.address.street}` – input value. +- `#{checkoutBean.address.zip}` – input value, validated by regex `[0-9]{5}`. +- `#{checkoutBean.shippingMethod}` – selected value. +- `#{checkoutBean.shippingMethods}` – collection for ``. +- `#{checkoutBean.total}` – displayed total, converted to currency EUR. +- `` – includes payment hints fragment. + +#### Actions +- `` submits to `#{checkoutBean.placeOrder}` via ``. +- `` triggers on shipping method change to recalculate total. + +#### Structure +- Defines `content` section of `shop.xhtml` template. +- Includes `/WEB-INF/includes/payment-hints.xhtml` after form. + +#### Server code +- No scriptlets or expressions beyond EL. + +#### Dependencies +- Tag libraries: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- Included file: `/WEB-INF/includes/payment-hints.xhtml`. +- Bean: `checkoutBean` with properties `address`, `shippingMethod`, `shippingMethods`, `total`; methods `recalculate()`, `placeOrder()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/facelets/package.ai.md new file mode 100644 index 00000000..8a7194d5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/facelets/package.ai.md @@ -0,0 +1,50 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:18:14Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> A JSF‑based checkout page that gathers shipping details, lets the user pick a shipping method, shows the order total, and submits the order. + +#### Purpose +- Capture shipping address and method. +- Display calculated total. +- Submit order to backend. + +#### Responsibilities +- **UI rendering** – Facelets page `checkout.xhtml` extends `/WEB-INF/templates/shop.xhtml`. +- **Form handling** – `` with input fields for address and shipping method. +- **Dynamic total** – AJAX listener `checkoutBean.recalculate` updates total when shipping method changes. +- **Order submission** – `` triggers `checkoutBean.placeOrder`. + +#### Key units +- **`checkout.xhtml`** – Facelets page, template section `content`, includes payment hints. +- **`checkoutBean`** – Managed bean with: + - `address` (street, zip with `[0-9]{5}` validation) + - `shippingMethod` (selected) + - `shippingMethods` (select items) + - `total` (currency EUR) + - `recalculate()` – updates total on shipping change. + - `placeOrder()` – processes order submission. + +#### Data flow +1. User enters address → bound to `checkoutBean.address`. +2. User selects shipping method → bound to `checkoutBean.shippingMethod`. +3. AJAX listener `recalculate()` runs → updates `checkoutBean.total`. +4. Total displayed in UI. +5. User clicks “Place Order” → `checkoutBean.placeOrder()` processes order. + +#### Dependencies +- **Tag libraries**: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- **Template**: `/WEB-INF/templates/shop.xhtml`. +- **Include**: `/WEB-INF/includes/payment-hints.xhtml`. +- **Managed bean**: `checkoutBean`. + +#### Cross-cutting +- EL expressions for data binding and method calls. +- Validation via regex on ZIP field. +- Currency conversion for total display. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..cf497ac4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,69 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:17:02Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Tests shipping cost calculation and overweight handling for DHL parcels. + +#### Purpose +- Verify free‑shipping threshold logic. +- Validate tiered shipping cost by weight. +- Ensure overweight parcels trigger `ParcelTooHeavyException`. + +#### Type +- `class ShippingRulesSpec` (extends `Specification`) – test specification. +- `class ShippingRules` (annotated `@CompileStatic`) – shipping cost engine. + +#### Input +- `ShippingRulesSpec`: + - `FREE_SHIPPING_THRESHOLD` (BigDecimal, 50.00). + - `rules` (ShippingRules, carrier: 'DHL', maxParcelKg: 31.5). + - Test orders: `Order(total: BigDecimal, weightKg: BigDecimal)`. +- `ShippingRules`: + - `carrier` (String). + - `maxParcelKg` (BigDecimal). + - `costFor(Order)` receives an `Order`. + +#### Output +- `ShippingRulesSpec`: + - Assertions on returned cost or thrown exception. +- `ShippingRules`: + - Returns `BigDecimal` cost or throws `ParcelTooHeavyException`. + +#### Core logic +- `ShippingRules.costFor`: + 1. If `order.weightKg > maxParcelKg` → throw `ParcelTooHeavyException`. + 2. If `order.total >= ShippingRulesSpec.FREE_SHIPPING_THRESHOLD` → return 0. + 3. Define tiers: upTo 2 kg → 4.99, upTo 10 kg → 9.99, upTo 31.5 kg → 19.99. + 4. Find first tier where `order.weightKg <= tier.upTo` and return its `price`. + +#### Public API +- `ShippingRulesSpec`: + - `orders above the threshold ship for free() -> void` – test free shipping. + - `a parcel of #weight kg costs #expected() -> void` – parameterized cost test. + - `an overweight parcel is rejected() -> void` – test overweight exception. + - `heavyOrder(BigDecimal) -> Order` – helper (private). +- `ShippingRules`: + - `costFor(Order) -> BigDecimal` – compute shipping cost. + +#### Dependencies +- `groovy.transform.CompileStatic` +- `spock.lang.Specification` +- `spock.lang.Unroll` +- `Order` (assumed in same package) +- `ParcelTooHeavyException` (assumed in same package) + +#### Exceptions / Errors +- `ParcelTooHeavyException` thrown when `order.weightKg > maxParcelKg`. +- No other explicit exceptions. + +#### Concurrency +- No threading or synchronization constructs used. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/groovy/package.ai.md new file mode 100644 index 00000000..a75e822f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/groovy/package.ai.md @@ -0,0 +1,39 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:18:17Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> A lightweight shipping‑cost engine for DHL parcels, with unit tests verifying free‑shipping thresholds, tiered rates, and overweight rejection. + +#### Purpose +- Provide a cost calculation service for DHL parcels. +- Test the service’s free‑shipping logic, weight tiers, and exception handling. + +#### Responsibilities +- **ShippingRules**: compute shipping cost based on order total and weight, enforce maximum parcel weight. +- **ShippingRulesSpec**: validate ShippingRules behavior with Spock tests. + +#### Key units +- `ShippingRules` (`@CompileStatic`): `costFor(Order)` → `BigDecimal`; throws `ParcelTooHeavyException` if `order.weightKg > maxParcelKg`. +- `ShippingRulesSpec` (`Specification`): tests for free shipping, tiered pricing, and overweight rejection; helper `heavyOrder(BigDecimal)`. + +#### Data flow +1. Test creates `Order(total, weightKg)`. +2. `ShippingRules.costFor` checks weight against `maxParcelKg`. +3. If within limits, checks `total` against `FREE_SHIPPING_THRESHOLD` (50.00) → returns 0 if met. +4. Otherwise selects first tier where `weightKg <= tier.upTo` and returns corresponding price (4.99, 9.99, 19.99). + +#### Dependencies +- Groovy `@CompileStatic`. +- Spock `Specification`, `Unroll`. +- Domain types: `Order`, `ParcelTooHeavyException` (assumed in same package). + +#### Cross-cutting +- Static type checking via `@CompileStatic`. +- Exception handling limited to `ParcelTooHeavyException`. +- No concurrency or external services involved. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..e02c4f99 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md @@ -0,0 +1,66 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:17:12Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Configures a Camel integration context for processing incoming orders, validating them, routing to ERP or manual review, and handling exceptions. + +#### Purpose +- Defines order processing routes. +- Validates orders and translates invoices. +- Routes orders to ERP or manual review based on total. +- Handles ERP unavailability with redelivery and dead‑letter queue. + +#### Type +- Spring XML configuration. +- Root element: `beans`. +- Namespaces: + - `xmlns="http://www.springframework.org/schema/beans"` + - `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + - `xmlns="http://camel.apache.org/schema/spring"` (within `camelContext`). + +#### Definitions +- **Beans** + - `orderValidator` – class `shop.integration.OrderValidator`. + - `invoiceTranslator` – class `shop.integration.InvoiceTranslator`. +- **Camel Context** `orderIntegration` + - **Property placeholder** `properties` – location `classpath:integration.properties`. + - **Exception handling** for `shop.integration.ErpUnavailableException`: + - Redelivery: max 5, delay 2000 ms, exponential back‑off. + - Handled: `true`. + - Dead‑letter: `jms:queue:orders.deadletter`. + - **Routes** + - `incomingOrders` + - From `jms:queue:{{orders.incoming.queue}}`. + - Bean `orderValidator.validate`. + - Choice: if `${body.total} > {{orders.review.threshold}}` → `direct:manualReview`; else → `direct:toErp`. + - WireTap to `seda:orderAudit`. + - `toErp` + - From `direct:toErp`. + - Bean `invoiceTranslator`. + - Dynamic to `https://{{erp.host}}/api/orders/${header.orderId}`. + - `manualReview` + - From `direct:manualReview`. + - Split on `${body.lines}` → `jms:queue:review.lines`. + - Commented `legacyFtpImport` route (ignored). + +#### Configuration +- `orders.incoming.queue` – queue name for incoming orders. +- `orders.review.threshold` – numeric threshold for manual review. +- `erp.host` – ERP host URL. +- `orders.deadletter` – dead‑letter queue name. + +#### Dependencies +- `shop.integration.OrderValidator` +- `shop.integration.InvoiceTranslator` +- `shop.integration.ErpUnavailableException` +- External JMS queues: `orders.incoming.queue`, `orders.deadletter`, `review.lines`. +- External HTTP endpoint: `https://{{erp.host}}/api/orders/${header.orderId}`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/integration/package.ai.md new file mode 100644 index 00000000..07cef81d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/integration/package.ai.md @@ -0,0 +1,50 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:18:19Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Orchestrates order intake, validation, and routing to ERP or manual review, with robust error handling and audit logging. + +#### Purpose +- Define Camel integration routes for order processing. +- Validate orders and translate invoices. +- Route orders to ERP or manual review based on total. +- Provide redelivery and dead‑letter handling for ERP failures. + +#### Responsibilities +- **Order Intake** – consume orders from a JMS queue. +- **Validation & Translation** – apply business rules and convert to ERP format. +- **Routing Logic** – decide between ERP submission or manual review. +- **Error Management** – retry, back‑off, and dead‑letter queue for ERP outages. +- **Audit** – wire‑tap orders to an audit channel. + +#### Key units +- **Beans** + - `orderValidator` (`shop.integration.OrderValidator`) – validates order payload. + - `invoiceTranslator` (`shop.integration.InvoiceTranslator`) – converts order to ERP invoice. +- **Exception** + - `shop.integration.ErpUnavailableException` – signals ERP downtime. +- **Camel Context** `orderIntegration` + - Routes: `incomingOrders`, `toErp`, `manualReview`. + - Property placeholders: `orders.incoming.queue`, `orders.review.threshold`, `erp.host`, `orders.deadletter`. + +#### Data flow +1. **Incoming Orders** – `jms:queue:{{orders.incoming.queue}}` → `orderValidator.validate`. +2. **Decision** – if `body.total > {{orders.review.threshold}}` → `direct:manualReview`; else → `direct:toErp`. +3. **Audit** – wire‑tap to `seda:orderAudit`. +4. **ERP Path** – `direct:toErp` → `invoiceTranslator` → dynamic HTTP POST to `https://{{erp.host}}/api/orders/${header.orderId}`. +5. **Manual Review Path** – `direct:manualReview` → split `body.lines` → `jms:queue:review.lines`. + +#### Dependencies +- **Internal** – `OrderValidator`, `InvoiceTranslator`, `ErpUnavailableException`. +- **External** – JMS queues: `orders.incoming.queue`, `orders.deadletter`, `review.lines`; HTTP endpoint: `https://{{erp.host}}/api/orders/${header.orderId}`. + +#### Cross-cutting +- Property placeholders for queue names, thresholds, and ERP host. +- Centralized exception handling with redelivery policy and dead‑letter queue. +- Wire‑tap for audit logging via `seda:orderAudit`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..5ca407a6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,45 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:17:15Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Configures Jakarta EE EJB components, their environment, transactions, and interceptors for a shop application. + +#### Purpose +- Declares EJBs: stateless, stateful, and message‑driven beans. +- Sets environment entry for reservation minutes. +- Defines local reference for `CheckoutSessionBean`. +- Configures activation for `OrderPlacedListener`. +- Applies transaction attribute and interceptor binding. + +#### Type +- Jakarta EE descriptor: `ejb-jar.xml` +- Root element: `ejb-jar` +- Namespace: `https://jakarta.ee/xml/ns/jakartaee` (prefix `xmlns`) + +#### Definitions +- **EJBs** + - `StockReservationBean` – class `shop.stock.StockReservationBean`, stateless, env‑entry `reservationMinutes` = `45`. + - `CheckoutSessionBean` – class `shop.checkout.CheckoutSessionBean`, stateful, local ref `ejb/StockReservation` to `shop.stock.StockReservation`. + - `OrderPlacedListener` – class `shop.events.OrderPlacedListener`, message‑driven, activation property `destinationLookup` = `java:/jms/queue/OrderPlaced`. +- **Interceptors** + - `shop.audit.TimingInterceptor` applied globally via `` and ``. +- **Transactions** + - Method `reserve` of `StockReservationBean` uses `RequiresNew`. + +#### Configuration +- `reservationMinutes` env‑entry: `45`. +- Activation property `destinationLookup`: `java:/jms/queue/OrderPlaced`. +- Transaction attribute for `reserve`: `RequiresNew`. + +#### Dependencies +- Java classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`, `shop.stock.StockReservation`. +- JMS queue: `java:/jms/queue/OrderPlaced`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jee/package.ai.md new file mode 100644 index 00000000..3953f05b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jee/package.ai.md @@ -0,0 +1,47 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:18:23Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> A Jakarta EE back‑office module that wires EJB services, web servlets, filters, listeners, and security for a shop application. + +#### Purpose +- Exposes EJB components (stateless, stateful, message‑driven) and configures their environment, transactions, and interceptors. +- Provides a servlet for report downloads, a request‑ID filter, and a startup audit listener. +- Enforces admin‑only access to `/admin/*` and configures a JDBC data source. + +#### Responsibilities +- **EJB configuration** – declares `StockReservationBean`, `CheckoutSessionBean`, and `OrderPlacedListener`; sets env‑entry, activation, transaction attributes, and global interceptor binding. +- **Web layer** – defines `ReportDownloadServlet`, `RequestIdFilter`, and `StartupAuditListener`; sets session timeout, security constraints, and JDBC resource reference. +- **Security** – restricts `/admin/*` to role `admin` and declares the role. + +#### Key units +- `StockReservationBean` (`shop.stock.StockReservationBean`) – stateless EJB, reserves stock, uses `reservationMinutes` env‑entry, `RequiresNew` transaction. +- `CheckoutSessionBean` (`shop.checkout.CheckoutSessionBean`) – stateful EJB, local reference to `StockReservation`. +- `OrderPlacedListener` (`shop.events.OrderPlacedListener`) – message‑driven EJB listening on `java:/jms/queue/OrderPlaced`. +- `TimingInterceptor` (`shop.audit.TimingInterceptor`) – global interceptor applied to all EJB methods. +- `ReportDownloadServlet` (`shop.web.ReportDownloadServlet`) – handles `/reports/*` requests, load‑on‑startup. +- `RequestIdFilter` (`shop.web.RequestIdFilter`) – filter applied to all URLs. +- `StartupAuditListener` (`shop.web.StartupAuditListener`) – context listener for startup audit. +- `jdbc/ShopDS` – JDBC `DataSource` referenced by the web layer. + +#### Data flow +1. **Web request** → `RequestIdFilter` assigns a request ID → `ReportDownloadServlet` processes `/reports/*` → accesses `jdbc/ShopDS` for data. +2. **Order placement** → JMS queue `OrderPlaced` triggers `OrderPlacedListener` → calls `StockReservationBean.reserve()` (transaction `RequiresNew`) → `TimingInterceptor` logs timing. +3. **Checkout** → `CheckoutSessionBean` interacts with `StockReservationBean` via local reference. + +#### Dependencies +- **Internal**: EJB classes (`shop.stock.*`, `shop.checkout.*`, `shop.events.*`, `shop.audit.*`), servlet/filter/listener classes (`shop.web.*`). +- **External**: JMS queue `java:/jms/queue/OrderPlaced`, JDBC `DataSource` `jdbc/ShopDS`, Jakarta EE container for EJB, Servlet, and JMS support. + +#### Cross-cutting +- Global `TimingInterceptor` applied to all EJB methods. +- Environment entry `reservationMinutes` shared by `StockReservationBean`. +- Security constraint uses role `admin` for `/admin/*`. +- Session timeout set to 20 minutes; context parameter `shop.reportDirectory` points to `/var/shop/reports`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jee/web.xml.ai.md new file mode 100644 index 00000000..4359e30f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jee/web.xml.ai.md @@ -0,0 +1,51 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:17:18Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Configures the web application “shop-backoffice”, defining servlets, filters, listeners, session timeout, security constraints, and a JDBC resource reference. + +#### Purpose +- Sets up servlet, filter, listener, and security configuration for the application. + +#### Type +- Jakarta EE `web.xml` (Jakarta Servlet 6.0) +- Namespace: `https://jakarta.ee/xml/ns/jakartaee` + +#### Definitions +- **Servlets** + - `ReportDownloadServlet` → class `shop.web.ReportDownloadServlet`, load‑on‑startup `1` +- **Servlet Mappings** + - `ReportDownloadServlet` → URL pattern `/reports/*` +- **Filters** + - `RequestIdFilter` → class `shop.web.RequestIdFilter` +- **Filter Mappings** + - `RequestIdFilter` → URL pattern `/*` +- **Listeners** + - `shop.web.StartupAuditListener` +- **Session Config** + - Timeout `20` minutes +- **Security Constraint** + - Resource collection `backoffice` → URL pattern `/admin/*` + - Auth constraint role `admin` +- **Security Role** + - `admin` +- **Resource Reference** + - Name `jdbc/ShopDS`, type `javax.sql.DataSource` + +#### Configuration +- Context parameter `shop.reportDirectory` = `/var/shop/reports` + +#### Dependencies +- Servlet class `shop.web.ReportDownloadServlet` +- Filter class `shop.web.RequestIdFilter` +- Listener class `shop.web.StartupAuditListener` +- JDBC resource `jdbc/ShopDS` (DataSource) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..87c5cd31 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,56 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:17:21Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> Displays a searchable list of open orders, allowing filtering by customer email and status, and providing a cancel link for each order. + +#### Purpose +- Show open orders with total and overdue status. +- Enable search by customer email and status. +- Offer cancel action per order. + +#### Type +- JSP page +- Content type: `text/html;charset=UTF-8` +- Tag libraries: `c` = `jakarta.tags.core`, `fmt` = `jakarta.tags.fmt` + +#### Data +- Request attribute: `orderFilter` → `OrderFilter filter` +- Request attribute: `orders` (iterated with `c:forEach`, var `order`) + - `order.number` + - `order.total` + - `order.overdue` + - `order.id` +- Request parameters: + - `param.customerEmail` + - `param.status` + +#### Actions +- Form: `action="${pageContext.request.contextPath}/orders/search"`, method `get` + - Input `name="customerEmail"` + - Select `name="status"` with options `OPEN`, `SHIPPED` + - Submit button +- Link: `href="orders/${order.id}/cancel"` (per order) + +#### Structure +- Includes header fragment: `/WEB-INF/jspf/header.jspf` +- Includes footer fragment: `/WEB-INF/jspf/footer.jspf` + +#### Server code +- Scriptlet imports: `java.util.List`, `shop.Order`, `shop.OrderFilter` +- Scriptlet retrieves `OrderFilter` from request, determines `pageSize` (default 25) +- Scriptlet outputs `pageSize` in paragraph + +#### Dependencies +- Tag libraries: `jakarta.tags.core`, `jakarta.tags.fmt` +- Included files: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf` +- Beans/Classes: `shop.Order`, `shop.OrderFilter` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jsp/package.ai.md new file mode 100644 index 00000000..4fe11ea2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/jsp/package.ai.md @@ -0,0 +1,42 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:18:27Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> A JSP page that lists open orders, lets users filter by customer email and status, and provides a cancel link for each order. + +#### Purpose +- Render a searchable list of open orders. +- Allow filtering by customer email and status. +- Offer a cancel action per order. + +#### Responsibilities +- **Presentation**: Display order details (number, total, overdue flag) in an HTML table. +- **Filtering**: Provide a form to submit `customerEmail` and `status` parameters to `/orders/search`. +- **Action**: Generate a cancel link for each order (`orders/{id}/cancel`). + +#### Key units +- **`order-list.jsp`** – JSP page that iterates over `orders` (type `List`) and renders the table. +- **`OrderFilter`** – Bean passed as request attribute `orderFilter` to pre‑populate filter fields. +- **`Order`** – Domain model with properties `number`, `total`, `overdue`, `id`. + +#### Data flow +1. **Request** → `orderFilter` and `orders` attributes set by a servlet/controller. +2. **JSP** reads `orderFilter` to fill form fields and `orders` to populate the table. +3. **User submits** filter form → `/orders/search` servlet processes parameters, updates `orderFilter` and `orders`, forwards back to `order-list.jsp`. +4. **Cancel link** triggers `/orders/{id}/cancel` endpoint to cancel the selected order. + +#### Dependencies +- **Tag libraries**: `jakarta.tags.core` (`c`), `jakarta.tags.fmt` (`fmt`). +- **Included fragments**: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf`. +- **Java classes**: `shop.Order`, `shop.OrderFilter`. + +#### Cross-cutting +- Uses EL expressions (`${}`) for data binding. +- Relies on standard JSP scriptlet for page size calculation. +- Consistent use of `c:forEach` for iterating over orders. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..c9f55148 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,58 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:17:23Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the `orders-backoffice` application, exposing it via a Service and Ingress. + +#### Purpose +- Runs the orders back‑office microservice. +- Provides HTTP access through a Service and Ingress. + +#### Type +- Kubernetes `Deployment`, `Service`, and `Ingress` manifests (apiVersion `apps/v1`, `v1`, `networking.k8s.io/v1`). + +#### Definitions +- **Deployment** `orders-backoffice` + - 3 replicas. + - Container `backoffice`: + - Image `registry.shop.example/orders-backoffice:2.1.0`. + - Exposes port `8080`. + - Environment: + - `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop`. + - `SHOP_DB_PASSWORD` from secret `orders-db-credentials` key `password`. + - Readiness probe: HTTP GET `/health/ready` on port `8080`. + - Resource limits: `memory: 768Mi`, `cpu: "1"`. +- **Service** `orders-backoffice` + - Selects pods with label `app: orders-backoffice`. + - Exposes port `80` mapped to target port `8080`. +- **Ingress** `orders-backoffice` + - Host `backoffice.shop.example`. + - Path `/` (Prefix) routes to Service `orders-backoffice` port `80`. + +#### Configuration +- `replicas=3` +- `image=registry.shop.example/orders-backoffice:2.1.0` +- `containerPort=8080` +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD` from `orders-db-credentials.password` +- `readinessProbe.httpGet.path=/health/ready` +- `readinessProbe.httpGet.port=8080` +- `resources.limits.memory=768Mi` +- `resources.limits.cpu="1"` +- Service port `80` → target `8080` +- Ingress host `backoffice.shop.example`, path `/`, service `orders-backoffice` port `80`. + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0`. +- Secret `orders-db-credentials` (key `password`). +- Service `orders-backoffice` (defined in same file). +- Ingress controller handling `networking.k8s.io/v1` Ingress. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/k8s/package.ai.md new file mode 100644 index 00000000..87422290 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/k8s/package.ai.md @@ -0,0 +1,41 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:18:30Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Deploys and exposes the orders‑backoffice microservice in a Kubernetes cluster, handling database connectivity and health checks. + +#### Purpose +- Run the orders‑backoffice application. +- Expose it via a Service and Ingress for HTTP traffic. + +#### Responsibilities +- **Deployment**: manage pod lifecycle, replica count, container image, environment, probes, and resource limits. +- **Service**: provide stable cluster‑internal endpoint for the pods. +- **Ingress**: route external HTTP requests to the Service. + +#### Key units +- **Deployment `orders-backoffice`** – 3 replicas, container `backoffice` (image `registry.shop.example/orders-backoffice:2.1.0`, port `8080`), env `SHOP_DB_URL`, secret‑backed `SHOP_DB_PASSWORD`, readiness probe `/health/ready`, limits `memory: 768Mi`, `cpu: 1`. +- **Service `orders-backoffice`** – selects pods by `app: orders-backoffice`, exposes port `80` → target `8080`. +- **Ingress `orders-backoffice`** – host `backoffice.shop.example`, path `/`, routes to Service `orders-backoffice` port `80`. + +#### Data flow +1. **Ingress** receives HTTP requests on `backoffice.shop.example/`. +2. Routes to **Service** `orders-backoffice` on port `80`. +3. Service forwards to one of the **Deployment** pods on port `8080`. +4. Pod reads `SHOP_DB_URL` and `SHOP_DB_PASSWORD` (from secret) to connect to `orders-db`. + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0`. +- Secret `orders-db-credentials` (key `password`). +- Kubernetes API objects: `Deployment`, `Service`, `Ingress` (networking.k8s.io/v1). + +#### Cross-cutting +- Environment variables for database connectivity. +- Readiness probe ensures pod is healthy before receiving traffic. +- Resource limits enforce CPU/memory constraints. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..371b8236 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,85 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:17:26Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Generates and stores invoices for completed orders, applying tax rules and payment terms. + +#### Purpose +- Issues invoices for completed orders. +- Applies reduced tax rate to specific categories. +- Stores invoices via `InvoiceRepository`. + +#### Type +- `final class InvoiceService` (class) + - Extends `Any`. + - Implements no interfaces. + - Modifiers: none. + - Annotations: none. +- `value class InvoiceNumber` (value) + - Modifiers: `@JvmInline`. +- `data class InvoiceLine` (record) + - Modifiers: none. +- `sealed interface InvoiceResult` (interface) + - Subtypes: `data class Issued`, `data class Rejected`. +- `fun List.total()` (extension function) + +#### Input +- `InvoiceService` constructor: `repository: InvoiceRepository`, `clock: () -> LocalDate = LocalDate::now`. +- `issue(order: CompletedOrder)` parameter: `order: CompletedOrder`. +- `taxRate(category: String)` parameter: `category: String`. +- `nextNumber()` uses internal `sequence` and `PREFIX`. +- `total()` operates on `List`. + +#### Output +- `issue` returns `InvoiceResult` (`Issued` or `Rejected`). +- `taxRate` returns `BigDecimal`. +- `total` returns `BigDecimal`. +- `repository.save(invoice)` writes invoice to persistence. + +#### Core logic +- `issue`: + 1. Validate `order.lines` non‑empty; reject if empty. + 2. Generate next invoice number via `nextNumber()`. + 3. Create `Invoice` with number, customerId, lines, dueDate (`clock() + PAYMENT_TERM_DAYS`). + 4. Persist invoice with `repository.save`. + 5. Return `Issued(number, dueDate)`. +- `taxRate`: + - Return `0.07` if category in `REDUCED_TAX_CATEGORIES`; else `0.19`. +- `total`: + - Sum `line.amount` over list. + +#### Public API +- `InvoiceService.issue(order: CompletedOrder) -> InvoiceResult` – issue invoice for order. +- `InvoiceService.taxRate(category: String) -> BigDecimal` – get tax rate for category. +- `InvoiceNumber.value: String` – invoice number string. +- `InvoiceLine.sku: String` – product SKU. +- `InvoiceLine.quantity: Int` – quantity. +- `InvoiceLine.unitPrice: BigDecimal` – unit price. +- `InvoiceLine.amount: BigDecimal` – line total. +- `InvoiceResult.Issued.number: InvoiceNumber` – issued number. +- `InvoiceResult.Issued.dueDate: LocalDate` – due date. +- `InvoiceResult.Rejected.reason: String` – rejection reason. +- `List.total() -> BigDecimal` – total amount of lines. + +#### Dependencies +- `java.math.BigDecimal` +- `java.time.LocalDate` +- `kotlinx.coroutines.Dispatchers` +- `kotlinx.coroutines.withContext` +- `shop.billing.InvoiceRepository` +- `shop.billing.CompletedOrder` + +#### Exceptions / Errors +- `issue` rejects orders with no lines, returning `Rejected` with message. + +#### Concurrency +- `issue` runs in `Dispatchers.IO` context, ensuring IO‑bound work off the main thread. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/kotlin/package.ai.md new file mode 100644 index 00000000..fe3d19f9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/kotlin/package.ai.md @@ -0,0 +1,47 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:18:33Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> Generates and stores invoices for completed orders, applying tax rules and payment terms. + +#### Purpose +- Issue invoices for completed orders. +- Apply reduced tax rates to specific categories. +- Persist invoices via `InvoiceRepository`. + +#### Responsibilities +- **Invoice generation** – create invoice numbers, calculate due dates, and assemble invoice lines. +- **Tax calculation** – determine tax rate per product category. +- **Persistence** – save invoices to the repository. +- **Validation** – reject orders lacking line items. + +#### Key units +- `InvoiceService` – orchestrates invoice creation, validation, and persistence. +- `InvoiceNumber` – inline value type holding the invoice identifier string. +- `InvoiceLine` – data class representing a single line item (SKU, quantity, unit price, amount). +- `InvoiceResult` (sealed interface) – outcome of an invoice request; subtypes `Issued` (success) and `Rejected` (failure). +- `List.total()` – extension computing the sum of line amounts. + +#### Data flow +1. `InvoiceService.issue(order)` receives a `CompletedOrder`. +2. Validates that `order.lines` is non‑empty; otherwise returns `Rejected`. +3. Generates a new `InvoiceNumber` via `nextNumber()`. +4. Builds an `Invoice` object with customer ID, lines, and a due date (`clock() + PAYMENT_TERM_DAYS`). +5. Persists the invoice using `InvoiceRepository.save`. +6. Returns `Issued(number, dueDate)`. + +#### Dependencies +- **Internal**: `InvoiceRepository`, `CompletedOrder`. +- **Standard**: `java.math.BigDecimal`, `java.time.LocalDate`. +- **Coroutines**: `Dispatchers.IO`, `withContext` for IO‑bound persistence. + +#### Cross-cutting +- **Concurrency**: `issue` executes within `Dispatchers.IO` to keep IO operations off the main thread. +- **Error handling**: Rejection is represented by the `Rejected` subtype with a reason string, avoiding exceptions for normal control flow. +- **Configuration**: Uses a clock supplier (`() -> LocalDate`) and a constant payment term, enabling testability and flexibility. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..591a1b57 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,44 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:17:31Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Defines MyBatis SQL mappings for the `shop.customer.CustomerMapper` namespace, including result mapping, reusable column fragments, CRUD operations, and conditional queries for customer data. + +#### Purpose +- Maps SQL statements to Java methods for customer persistence. +- Provides reusable column list and result mapping. + +#### Type +- MyBatis mapper XML. +- Root element: `mapper`. +- Namespace: `shop.customer.CustomerMapper`. + +#### Definitions +- **ResultMap** `customerResult`: maps `CUSTOMER_ID` → `id`, `EMAIL` → `email`, `LOYALTY_TIER` → `loyaltyTier`. +- **SQL fragment** `customerColumns`: `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT`. +- **Select** `findByEmail`: retrieves a single customer by `EMAIL`. +- **Select** `search`: retrieves customers filtered by optional `tier` and `createdAfter`; orders by `${sortColumn}`. +- **Insert** `insert`: inserts a new customer, generates `id`. +- **Update** `promote`: updates `LOYALTY_TIER` for a list of `ids`. +- **Delete** `deleteInactive`: deletes customers with `LAST_ORDER_AT` before `cutoff`. + +#### Configuration +- `useGeneratedKeys="true"` on `insert`. +- `keyProperty="id"` on `insert`. +- `order by ${sortColumn}` in `search`. +- `now()` used for `CREATED_AT` in `insert`. + +#### Dependencies +- SQL tables: `CUSTOMER`. +- Columns: `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`. +- Java class: `shop.customer.Customer`. +- MyBatis DTD: `https://mybatis.org/dtd/mybatis-3-mapper.dtd`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/mybatis/package.ai.md new file mode 100644 index 00000000..02b0b2a4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/mybatis/package.ai.md @@ -0,0 +1,46 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:18:37Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Provides MyBatis SQL mappings for customer persistence, including CRUD operations, result mapping, and dynamic queries for the `shop.customer.CustomerMapper` namespace. + +#### Purpose +- Map SQL statements to Java methods for customer data access. +- Offer reusable column fragments and result mappings. + +#### Responsibilities +- **Data Access Layer**: CRUD operations and conditional queries for customers. +- **SQL Fragment Reuse**: Centralized column list for consistency. +- **Dynamic Query Building**: Conditional filtering and ordering. + +#### Key units +- **Mapper Namespace**: `shop.customer.CustomerMapper` +- **ResultMap** `customerResult`: maps `CUSTOMER_ID → id`, `EMAIL → email`, `LOYALTY_TIER → loyaltyTier`. +- **SQL Fragment** `customerColumns`: `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT`. +- **Select** `findByEmail`: fetches a single customer by email. +- **Select** `search`: retrieves customers with optional `tier` and `createdAfter` filters, ordered by `${sortColumn}`. +- **Insert** `insert`: inserts a new customer, auto-generates `id` with `useGeneratedKeys="true"`. +- **Update** `promote`: batch updates `LOYALTY_TIER` for a list of customer IDs. +- **Delete** `deleteInactive`: removes customers whose `LAST_ORDER_AT` precedes a cutoff date. + +#### Data flow +1. **Input**: Method parameters (e.g., email, tier, dates, IDs). +2. **Processing**: MyBatis constructs SQL using the defined fragments and dynamic tags. +3. **Execution**: SQL runs against the `CUSTOMER` table. +4. **Output**: Result objects mapped via `customerResult` or affected row counts. + +#### Dependencies +- **Database**: `CUSTOMER` table (`CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`). +- **Java Model**: `shop.customer.Customer`. +- **MyBatis**: DTD `https://mybatis.org/dtd/mybatis-3-mapper.dtd`. + +#### Cross-cutting +- **Dynamic SQL**: Uses ``, ``, and `` tags for optional clauses. +- **Parameter Binding**: `#{}` for safe parameters; `${}` for dynamic column names. +- **Key Generation**: `useGeneratedKeys="true"` with `keyProperty="id"` for inserts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..6c807c8b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,45 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:17:34Z +- G: +- A: 0.0.0 +- X: file +- P: 34DB4705 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> The API lets backoffice users list, retrieve, and cancel shop orders, exposing order status and total. + +#### Purpose +- List orders with optional status filter and limit. +- Retrieve a single order by ID. +- Cancel an order (requires write scope). + +#### Type +- OpenAPI 3.0.3 +- Title: `Shop Orders API` +- Version: `2.1.0` +- Server URL: `https://api.shop.example/backoffice` + +#### Operations +- `GET /orders` – `listOrders` – query `status` (`OrderStatus`), `limit` (int, max 200); 200 → array of `Order`. +- `GET /orders/{orderId}` – `getOrder` – path `orderId` (string); 200 → `Order`; 404 → not found. +- `POST /orders/{orderId}/cancel` – `cancelOrder` – path `orderId` (string); security `backofficeToken` with scope `orders:write`; 204 → cancelled; 409 → already shipped. + +#### Schemas +- `OrderStatus` – enum: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order` – object, required: `orderId`, `status`, `total`; properties: + - `orderId`: string + - `status`: `OrderStatus` + - `total`: number (double) + - `couponCode`: string (deprecated) + +#### Security and servers +- Security scheme `backofficeToken`: OAuth2 client credentials, token URL `https://auth.shop.example/token`; scope `orders:write` (change orders). +- Server: `https://api.shop.example/backoffice`. + +#### Dependencies +- `$ref` to `#/components/schemas/OrderStatus` and `#/components/schemas/Order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/openapi/package.ai.md new file mode 100644 index 00000000..3301bcfa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/openapi/package.ai.md @@ -0,0 +1,43 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:18:41Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> A back‑office API for managing shop orders, providing listing, retrieval, and cancellation endpoints with status filtering and security. + +#### Purpose +- Expose CRUD‑like operations for shop orders to back‑office users. +- Enforce OAuth2 scopes for write actions. + +#### Responsibilities +- **Order Retrieval** – list orders with optional status filter and limit; fetch a single order by ID. +- **Order Cancellation** – cancel an existing order, guarded by `orders:write` scope. +- **Security** – OAuth2 client‑credentials flow with scoped access. + +#### Key units +- **`listOrders`** (`GET /orders`) – returns an array of `Order` objects, filtered by `OrderStatus` and limited to 200. +- **`getOrder`** (`GET /orders/{orderId}`) – returns a single `Order` or 404. +- **`cancelOrder`** (`POST /orders/{orderId}/cancel`) – cancels an order, 204 on success, 409 if already shipped. +- **`OrderStatus`** – enum (`OPEN`, `PAID`, `SHIPPED`, `CANCELLED`). +- **`Order`** – schema with `orderId`, `status`, `total`; `couponCode` is deprecated. +- **`backofficeToken`** – OAuth2 client‑credentials security scheme, scope `orders:write`. + +#### Data flow +1. Client calls `listOrders` → server queries order store → returns list of `Order`. +2. Client calls `getOrder` → server fetches order by ID → returns `Order` or 404. +3. Client calls `cancelOrder` → server validates scope, checks order status → updates status to `CANCELLED` or returns 409. + +#### Dependencies +- OAuth2 token endpoint `https://auth.shop.example/token`. +- Server base URL `https://api.shop.example/backoffice`. +- Internal references to `#/components/schemas/OrderStatus` and `#/components/schemas/Order`. + +#### Cross-cutting +- All endpoints use JSON media type. +- `OrderStatus` enum centralizes status values across operations. +- Security scope `orders:write` is required only for cancellation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..1938f962 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,68 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:18:53Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> A full‑stack shop platform that builds, tests, containerises, and deploys a Java back‑office service, orchestrates order fulfilment via BPMN, Camel, and SOAP, and exposes REST and SOAP APIs for order and stock management while persisting data with Hibernate/MyBatis and generating invoices in Kotlin. + +#### Purpose +- End‑to‑end order lifecycle: intake → validation → stock reservation → payment → approval → shipping → invoicing → cancellation. +- Continuous delivery of the back‑office microservice to Kubernetes. +- Unified persistence and reporting across JDBC, Hibernate, and MyBatis. + +#### Responsibilities +- **CI/CD** – GitHub Actions build, test, image, and deploy to K8s. +- **Workflow orchestration** – Camunda BPMN (`orderFulfilment`) and Camel routes (`orderIntegration`) for order intake and ERP routing. +- **Service packaging** – Dockerfile, Maven build, and Kubernetes manifests. +- **User interfaces** – JSF checkout (`checkout.xhtml`) and JSP order list (`order-list.jsp`). +- **Business logic** – Kotlin invoice service, Groovy shipping rules, Java EJBs for stock and checkout. +- **Data access** – Hibernate entities (`Shipment`, `ExpressShipment`), MyBatis customer mapper, JDBC datasource. +- **API exposure** – OpenAPI REST for orders, WSDL SOAP for stock queries. +- **Security & audit** – OAuth2 scopes, request‑ID filter, timing interceptor, audit listeners. + +#### Key units +- **CI/CD**: `release.yml`, `build`, `image`, `deploy` jobs. +- **BPMN**: `orderFulfilment` process, `reserveStock` delegate, `shipOrder` external task, `createInvoice` call activity. +- **Camel**: `orderIntegration` context, `orderValidator`, `invoiceTranslator`, `ErpUnavailableException`. +- **Docker/K8s**: `Dockerfile`, `orders-backoffice` Deployment, Service, Ingress. +- **UI**: `checkout.xhtml`, `checkoutBean`, `order-list.jsp`, `OrderFilter`. +- **Business**: `InvoiceService`, `InvoiceNumber`, `InvoiceLine`, `InvoiceResult`; `ShippingRules`; `StockReservationBean`; `CheckoutSessionBean`; `OrderPlacedListener`; `TimingInterceptor`. +- **Persistence**: `Shipment`, `ExpressShipment`, `Shipment.undelivered`, `Shipment.countByCarrier`; `persistence.xml` units `shop` & `reporting`; MyBatis `shop.customer.CustomerMapper`. +- **APIs**: OpenAPI `listOrders`, `getOrder`, `cancelOrder`; WSDL `StockService.wsdl`, `GetStockLevel` operation. + +#### Data flow +1. **Order creation** – UI submits to REST `/orders`; Camel consumes JMS queue → validator → translator → ERP or manual review. +2. **Fulfilment** – BPMN reserves stock, waits for payment, routes large orders to back‑office approval, ships via external task, creates invoice via call activity. +3. **Persistence** – Hibernate manages `Shipment` entities; MyBatis handles customer CRUD; Kotlin service persists invoices. +4. **Deployment** – GitHub Actions builds JAR → Docker image → pushes to registry → K8s rollout; Ingress routes external traffic to pods. + +#### Dependencies +- **Build**: Maven, Docker, GitHub Actions, Kubernetes. +- **Runtime**: Java 21, Eclipse Temurin Alpine, Camunda BPM, Apache Camel, Jakarta EE container, Hibernate, MyBatis, Kotlin/JVM, Groovy, Spock. +- **External services**: ERP HTTP API, shipping external task topic, stock SOAP endpoint, OAuth2 token service, PostgreSQL, Redis (if used for caching), Docker registry. +- **Data sources**: `jdbc/ShopDS`, `jdbc/ReportingDS`, `orders-db-credentials` secret. + +#### Cross‑cutting +- **Configuration**: Environment variables (`APP_VERSION`, `JAVA_OPTS`, `SHOP_PROFILE`, `SHOP_DB_URL`, `SHOP_DB_PASSWORD`), property placeholders in Camel/K8s. +- **Security**: OAuth2 client‑credentials (`orders:write` scope), role‑based access (`admin` for `/admin/*`), request‑ID filter, timing interceptor. +- **Error handling**: Camel redelivery policy with dead‑letter queue, BPMN boundary events for stock errors, WSDL fault `UnknownSkuFault`. +- **Testing**: Spock tests for shipping rules, unit tests for EJBs, integration tests for Camel routes. +- **Observability**: Health checks (`/health/live`, `/health/ready`), audit listeners, logging via interceptors, metrics exposed by Kubernetes probes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..297b2915 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,47 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:17:41Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps the `shop.shipping.Shipment` entity and its subclasses to database tables, defines relationships, queries, and persistence behavior. + +#### Purpose +- Configures Hibernate mapping for `Shipment` and related entities. +- Provides HQL and native SQL queries for shipment retrieval and statistics. + +#### Type +- Hibernate mapping (`` root). +- Namespace: none declared. + +#### Definitions +- **Entity** `Shipment` (`table="SHIPMENT"`, `package="shop.shipping"`) + - `id` (`column="SHIPMENT_ID"`, sequence `SHIPMENT_SEQ`) + - `trackingCode` (`column="TRACKING_CODE"`, `length="40"`, `not-null="true"`) + - `carrier` (`column="CARRIER"`, `length="12"`) + - `shippedAt` (`column="SHIPPED_AT"`, `type="timestamp"`) + - `order` (`many-to-one`, `class="shop.Order"`, `column="ORDER_ID"`, `not-null="true"`) + - `parcels` (`set`, `inverse="true"`, `cascade="all-delete-orphan"`) + - key: `column="SHIPMENT_ID"` + - one-to-many: `class="Parcel"` + - **Subclass** `ExpressShipment` (`joined-subclass`, `table="EXPRESS_SHIPMENT"`) + - key: `column="SHIPMENT_ID"` + - `deliveryWindow` (`column="DELIVERY_WINDOW"`) +- **Query** `Shipment.undelivered` (HQL): `from Shipment s where s.deliveredAt is null and s.shippedAt < :cutoff` +- **SQL Query** `Shipment.countByCarrier`: `select CARRIER, count(*) from SHIPMENT group by CARRIER` + +#### Configuration +- Sequence generator: `sequence_name="SHIPMENT_SEQ"` +- Cascade: `all-delete-orphan` on `parcels` set. + +#### Dependencies +- `shop.Order` class referenced in `many-to-one`. +- `Parcel` class referenced in `one-to-many`. +- DTD: `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd` (public ID `-//Hibernate/Hibernate Mapping DTD 3.0//EN`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/persistence/package.ai.md new file mode 100644 index 00000000..2c9ea8f3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/persistence/package.ai.md @@ -0,0 +1,47 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:18:44Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Provides Hibernate‑based persistence configuration for a shop’s shipping domain and reporting units, mapping entities, queries, and transaction settings. + +#### Purpose +- Configure Hibernate mappings for `Shipment` and its subclasses. +- Define two Jakarta Persistence units (`shop` and `reporting`) with data sources, entities, and Hibernate properties. + +#### Responsibilities +- **Entity mapping** – `Shipment`, `ExpressShipment`, and related associations to `Order` and `Parcel`. +- **Query definition** – HQL and native SQL queries for shipment status and carrier statistics. +- **Persistence unit setup** – JTA and RESOURCE_LOCAL units, data source binding, and provider selection. +- **Hibernate configuration** – dialect, batch size, credentials, and mapping file inclusion. + +#### Key units +- **`Shipment` entity** – maps to `SHIPMENT` table, includes `trackingCode`, `carrier`, `shippedAt`, `deliveredAt`, and relationships to `Order` and `Parcel`. +- **`ExpressShipment` subclass** – joined‑subclass in `EXPRESS_SHIPMENT`, adds `deliveryWindow`. +- **`Shipment.undelivered` HQL query** – selects undelivered shipments before a cutoff. +- **`Shipment.countByCarrier` SQL query** – aggregates shipment counts per carrier. +- **Persistence unit `shop`** – JTA, provider `org.hibernate.jpa.HibernatePersistenceProvider`, data source `java:/jdbc/ShopDS`, entities `shop.Order`, `shop.OrderLine`, `shop.Customer`, and mapping file `META-INF/order-queries.xml`. +- **Persistence unit `reporting`** – RESOURCE_LOCAL, data source `java:/jdbc/ReportingDS`, entity `shop.reporting.DailyRevenue`. + +#### Data flow +1. **Application** requests a persistence unit (`shop` or `reporting`) via `EntityManagerFactory`. +2. **Hibernate** loads the corresponding `persistence.xml`, applies the mapping file (`Shipment.hbm.xml`) for `shop`, and registers entities. +3. **EntityManager** performs CRUD or query operations; HQL/SQL queries defined in the mapping file are executed against the configured data source. +4. **Results** are returned to the application layer for business logic or reporting. + +#### Dependencies +- **Internal**: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue`, `Parcel`. +- **External**: Hibernate JPA provider (`org.hibernate.jpa.HibernatePersistenceProvider`), PostgreSQL JDBC driver, JTA data source `java:/jdbc/ShopDS`, non‑JTA data source `java:/jdbc/ReportingDS`, mapping file `META-INF/order-queries.xml`. + +#### Cross-cutting +- **Hibernate DTD** (`http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`) used for entity mapping. +- **Batching**: `hibernate.jdbc.batch_size=50` for efficient inserts/updates. +- **Sequence generation**: `SHIPMENT_SEQ` for `Shipment.id`. +- **Cascade strategy**: `all-delete-orphan` on `Shipment.parcels` set. +- **Security**: credentials (`shop_app`/`***`) specified in persistence units. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..1d81e28f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md @@ -0,0 +1,53 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:17:37Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Configures two Jakarta Persistence units for a shop application, specifying data sources, entity classes, provider, and Hibernate properties. + +#### Purpose +- Define persistence units for JTA and RESOURCE_LOCAL transactions. +- Map entity classes and query files. +- Set Hibernate configuration properties. + +#### Type +- Jakarta Persistence XML (`persistence.xml`), root element `persistence`. +- Namespace: `https://jakarta.ee/xml/ns/persistence`. + +#### Definitions +- **Persistence Unit `shop`** + - `transaction-type="JTA"` + - `provider`: `org.hibernate.jpa.HibernatePersistenceProvider` + - `jta-data-source`: `java:/jdbc/ShopDS` + - `mapping-file`: `META-INF/order-queries.xml` + - Entity classes: `shop.Order`, `shop.OrderLine`, `shop.Customer` + - Properties: + - `hibernate.dialect`: `org.hibernate.dialect.PostgreSQLDialect` + - `hibernate.jdbc.batch_size`: `50` + - `hibernate.connection.username`: `shop_app` + - `hibernate.connection.password`: `***` +- **Persistence Unit `reporting`** + - `transaction-type="RESOURCE_LOCAL"` + - `non-jta-data-source`: `java:/jdbc/ReportingDS` + - Entity class: `shop.reporting.DailyRevenue` + - `exclude-unlisted-classes`: `true` + +#### Configuration +- `hibernate.dialect`: `org.hibernate.dialect.PostgreSQLDialect` +- `hibernate.jdbc.batch_size`: `50` +- `hibernate.connection.username`: `shop_app` +- `hibernate.connection.password`: `***` + +#### Dependencies +- Hibernate JPA provider (`org.hibernate.jpa.HibernatePersistenceProvider`) +- PostgreSQL JDBC driver (implied by dialect) +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS` +- Query mapping file: `META-INF/order-queries.xml` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..084b81d2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,56 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:17:44Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Defines a SOAP web service for querying stock levels by SKU, including request/response types and a fault for unknown SKUs. + +#### Purpose +- Exposes a `GetStockLevel` operation to retrieve available stock for a given SKU. +- Provides a fault message `UnknownSku` when the SKU is not found. + +#### Type +- WSDL 1.1 +- Root element: `definitions` +- Namespaces: + - `xmlns` → `http://schemas.xmlsoap.org/wsdl/` + - `xmlns:soap` → `http://schemas.xmlsoap.org/wsdl/soap/` + - `xmlns:tns` → `http://shop.example/stock` + - `xmlns:xs` → `http://www.w3.org/2001/XMLSchema` + +#### Definitions +- **Types** + - `StockLevelRequest` element: contains `sku` (`xs:string`) + - `StockLevelResponse` element: contains `available` (`xs:int`) + - `UnknownSkuFault` complexType: contains `sku` (`xs:string`) +- **Messages** + - `GetStockLevelInput`: part `parameters` → `tns:StockLevelRequest` + - `GetStockLevelOutput`: part `parameters` → `tns:StockLevelResponse` + - `UnknownSku`: part `fault` → `tns:UnknownSkuFault` +- **PortType** + - `StockPortType` with operation `GetStockLevel` (input, output, fault) +- **Binding** + - `StockSoapBinding` (document style, HTTP transport) + - Operation `GetStockLevel` with SOAP action `http://shop.example/stock/GetStockLevel` + - Fault `UnknownSku` mapped to SOAP fault `UnknownSku` +- **Service** + - `StockService` with port `StockPort` bound to `StockSoapBinding` + - SOAP address: `https://erp.shop.example/soap/stock` + +#### Configuration +- SOAP binding style: `document` +- Transport: `http://schemas.xmlsoap.org/soap/http` +- SOAP action: `http://shop.example/stock/GetStockLevel` +- Service endpoint: `https://erp.shop.example/soap/stock` + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema` +- Target namespace `http://shop.example/stock` used for types, messages, portType, binding, and service. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/wsdl/package.ai.md new file mode 100644 index 00000000..f979a25d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/other/wsdl/package.ai.md @@ -0,0 +1,44 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:18:49Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Provides a SOAP web service for querying stock availability by SKU, exposing a single operation and fault handling. + +#### Purpose +- Expose a `GetStockLevel` operation to retrieve available stock for a given SKU. +- Return an `UnknownSku` fault when the SKU is not found. + +#### Responsibilities +- **Service contract**: Define request/response types and fault for stock queries. +- **Transport binding**: Configure SOAP document style over HTTP. +- **Endpoint exposure**: Publish the service at a fixed HTTPS URL. + +#### Key units +- **`StockService.wsdl`** – WSDL 1.1 definition of the stock query service. +- **`StockLevelRequest`** – request element with `sku` string. +- **`StockLevelResponse`** – response element with `available` int. +- **`UnknownSkuFault`** – fault type containing the offending `sku`. +- **`StockPortType`** – port type with `GetStockLevel` operation. +- **`StockSoapBinding`** – SOAP binding mapping the operation and fault. +- **`StockService`** – service exposing the `StockPort` endpoint. + +#### Data flow +1. Client sends a SOAP message to `https://erp.shop.example/soap/stock` with a `StockLevelRequest` containing a SKU. +2. Service processes the request and returns a `StockLevelResponse` with the available quantity. +3. If the SKU is unknown, the service returns a SOAP fault mapped to `UnknownSkuFault`. + +#### Dependencies +- XML Schema (`http://www.w3.org/2001/XMLSchema`) for type definitions. +- Target namespace `http://shop.example/stock` for all WSDL elements. +- SOAP over HTTP transport (`http://schemas.xmlsoap.org/wsdl/soap/`). + +#### Cross-cutting +- Consistent use of the `http://shop.example/stock` namespace across types, messages, portType, binding, and service. +- Document-style SOAP binding with a single HTTP transport. +- Fault handling via a dedicated `UnknownSkuFault` complex type. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..efda1108 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,57 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:19:14Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> A back‑office order management system that exposes REST and SOAP APIs, orchestrates fulfillment via BPMN and Camel, and automates CI/CD to Kubernetes. + +#### Purpose +- Provide stateless REST endpoints for order lifecycle (list, retrieve, cancel, purge). +- Orchestrate end‑to‑end order processing: validation, stock reservation, payment, approval, shipping, invoicing, and cancellation. +- Deliver the back‑office service continuously to a Kubernetes cluster. + +#### Responsibilities +- **API exposure** – REST (`/orders`) and SOAP (`StockService`) for order and stock operations. +- **Order lifecycle** – listing, retrieval, cancellation with payment refund, audit logging, nightly purge of cancelled orders. +- **Workflow orchestration** – Camunda BPMN (`orderFulfilment`) and Camel routes (`orderIntegration`) for intake, validation, ERP routing, and external task handling. +- **Business logic** – Kotlin invoice generation, Groovy shipping rules, Java EJBs for stock and checkout. +- **Persistence** – Hibernate entities (`Shipment`, `ExpressShipment`), MyBatis customer mapper, JDBC datasource. +- **CI/CD & deployment** – GitHub Actions, Docker, Kubernetes manifests, health checks, and observability. + +#### Key units +- `OrderResource` – Stateless EJB exposing `openOrders()`, `find(id)`, `cancel(id)`, and scheduled `purgeCancelled()`. +- `PaymentGateway` – Service injected into `OrderResource` for refunds. +- `AuditLog` – EJB recording audit events during cancellation. +- `orderFulfilment` BPMN process – delegates `reserveStock`, external task `shipOrder`, call activity `createInvoice`. +- `orderIntegration` Camel context – routes `orderValidator`, `invoiceTranslator`, handles `ErpUnavailableException`. +- `InvoiceService` (Kotlin) – generates invoices and persists them. +- `Shipment` / `ExpressShipment` Hibernate entities – track shipping status. +- `shop.customer.CustomerMapper` (MyBatis) – CRUD for customers. +- `release.yml` – GitHub Actions workflow for build, image, and deploy jobs. + +#### Data flow +1. **Order creation** – UI → REST `/orders` → Camel queue → validator → translator → ERP or manual review. +2. **Fulfillment** – BPMN reserves stock, waits for payment, routes large orders for approval, ships via external task, creates invoice via call activity. +3. **Cancellation** – `OrderResource.cancel(id)` refunds payment, updates status, logs audit, persists change. +4. **Nightly purge** – `purgeCancelled()` deletes cancelled orders older than `PURGE_AFTER_DAYS`. +5. **Deployment** – GitHub Actions builds JAR → Docker image → pushes to registry → Kubernetes rollout; Ingress routes traffic to pods. + +#### Dependencies +- **Frameworks & runtimes** – Jakarta EE, JPA, Hibernate, MyBatis, Camunda BPM, Apache Camel, Kotlin/JVM, Groovy, Spock, Docker, Kubernetes. +- **External services** – ERP HTTP API, stock SOAP endpoint, OAuth2 token service, PostgreSQL, Redis (optional). +- **Databases** – `jdbc/ShopDS` (shop), `jdbc/ReportingDS` (reporting). +- **Security** – OAuth2 client‑credentials (`orders:write`), role‑based access (`backoffice`, `admin`). + +#### Cross‑cutting +- Stateless EJBs ensure thread safety; container‑managed transactions. +- Security via `@RolesAllowed` and OAuth2 scopes. +- Scheduled tasks (`@Schedule`) for nightly cleanup. +- Error handling: Camel redelivery policy, BPMN boundary events, SOAP fault `UnknownSkuFault`. +- Observability: health endpoints, audit listeners, metrics, logging interceptors, Kubernetes probes. +- Configuration: environment variables (`APP_VERSION`, `JAVA_OPTS`, `SHOP_PROFILE`, `SHOP_DB_URL`, `SHOP_DB_PASSWORD`), property placeholders in Camel/K8s. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..22285517 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run2/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 606DBFD0 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:19:19Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The back‑office order management system exposes REST and SOAP APIs for order and stock handling, while a stateless Java service orchestrates the order lifecycle with audit logging, payment refunds, and nightly purge of cancelled orders. Order fulfilment is driven by a Camunda BPMN workflow that reserves stock, processes payments, approves, ships, invoices, and handles errors, with a lightweight Groovy engine calculating DHL shipping costs. Persistence is handled through Hibernate and MyBatis mappings for customer and shipping data, and Kotlin code generates invoices applying tax rules. CI/CD pipelines automate building, testing, containerizing, and deploying the service to Kubernetes, with Docker images running the JAR in an Alpine JRE container. + +#### Packages +- java — A stateless REST service that manages back‑office order lifecycle, including listing, retrieval, cancellation with payment refund, audit logging, and nightly purge of cancelled orders. +- java/shop — Provides a stateless REST API for back‑office order management, including listing, retrieving, canceling, and nightly purging of cancelled orders. +- other/actions/.github — Automates the CI/CD pipeline for the Backoffice Java service, building, testing, containerizing, and deploying it to a Kubernetes cluster. +- other/actions/.github/workflows — Automates the CI/CD pipeline for the Backoffice Java service, building, testing, containerizing, and deploying it to a Kubernetes cluster. +- other/actions — Automates the CI/CD pipeline for the Backoffice Java service, building, testing, containerizing, and deploying it to a Kubernetes cluster. +- other/bpmn — Provides a Camunda‑based BPMN workflow for end‑to‑end order fulfilment, from stock reservation and payment receipt to approval, shipping, invoicing, and error handling. +- other/docker — Builds and deploys a Java back‑office service as a Docker image, compiling the Maven project and running the resulting JAR in an Alpine JRE container. +- other/facelets — A JSF‑based checkout page that gathers shipping details, lets the user pick a shipping method, shows the order total, and submits the order. +- other/groovy — A lightweight shipping‑cost engine for DHL parcels, with unit tests verifying free‑shipping thresholds, tiered rates, and overweight rejection. +- other/integration — Orchestrates order intake, validation, and routing to ERP or manual review, with robust error handling and audit logging. +- other/jee — A Jakarta EE back‑office module that wires EJB services, web servlets, filters, listeners, and security for a shop application. +- other/jsp — A JSP page that lists open orders, lets users filter by customer email and status, and provides a cancel link for each order. +- other/k8s — Deploys and exposes the orders‑backoffice microservice in a Kubernetes cluster, handling database connectivity and health checks. +- other/kotlin — Generates and stores invoices for completed orders, applying tax rules and payment terms. +- other/mybatis — Provides MyBatis SQL mappings for customer persistence, including CRUD operations, result mapping, and dynamic queries for the `shop.customer.CustomerMapper` namespace. +- other/openapi — A back‑office API for managing shop orders, providing listing, retrieval, and cancellation endpoints with status filtering and security. +- other — A full‑stack shop platform that builds, tests, containerises, and deploys a Java back‑office service, orchestrates order fulfilment via BPMN, Camel, and SOAP, and exposes REST and SOAP APIs for order and stock management while persisting data with Hibernate/MyBatis and generating invoices in Kotlin. +- other/persistence — Provides Hibernate‑based persistence configuration for a shop’s shipping domain and reporting units, mapping entities, queries, and transaction settings. +- other/wsdl — Provides a SOAP web service for querying stock availability by SKU, exposing a single operation and fault handling. +- . — A back‑office order management system that exposes REST and SOAP APIs, orchestrates fulfillment via BPMN and Camel, and automates CI/CD to Kubernetes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/meta/gpt-6-luna.json new file mode 100644 index 00000000..2145cdb2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/meta/gpt-6-luna.json @@ -0,0 +1,99 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "bpmn-facts.tsv": "6c40615d07d1f0971e6cbf6068428021551f3155a3024650b28478ada9af1066", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "004e053df906af334fbd182adb450ecd3b82dac9c45366d491695c6990fffcd3", + "java-facts.tsv": "9e91b340d71dd08fca2a0a59e34e99ba11f31e612a261ea74fc39ef08f256daf", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T08:19:22Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 96.8, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 104.5, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.2, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T08:22:47Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 27671, + "cachedPromptTokens": 27620, + "completionTokens": 9393, + "seconds": 96.1741123 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.004978, + "costUsd": 0.009342, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/meta/gpt-oss-20b.json new file mode 100644 index 00000000..79abeb61 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/meta/gpt-oss-20b.json @@ -0,0 +1,99 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "bpmn-facts.tsv": "6c40615d07d1f0971e6cbf6068428021551f3155a3024650b28478ada9af1066", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "004e053df906af334fbd182adb450ecd3b82dac9c45366d491695c6990fffcd3", + "java-facts.tsv": "9e91b340d71dd08fca2a0a59e34e99ba11f31e612a261ea74fc39ef08f256daf", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T08:22:47Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 70.5, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 86.7, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.3, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T08:25:28Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 28756, + "cachedPromptTokens": 25632, + "completionTokens": 9057, + "seconds": 69.9098746 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.00204, + "costUsd": 0.002563, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..974d9700 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,43 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:21:05Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> Backoffice order management provides secure order lookup, refund-backed cancellation with auditing, and scheduled cleanup of aged cancelled orders. + +#### Purpose +- Exposes REST operations for managing shop orders. +- Removes cancelled orders older than 30 days during scheduled cleanup. + +#### Responsibilities +- Order access: list open orders and retrieve an order by ID, returning `404 NOT_FOUND` when absent. +- Cancellation: refund the order total, set status to `CANCELLED`, and record an audit event. +- Cleanup: purge cancelled orders older than 30 days and audit the number removed. + +#### Key units +- `OrderResource` — secured `/orders` REST resource for order operations and scheduled cleanup. +- `openOrders()` — retrieves results from the `Order.open` named query. +- `find(long id)` — loads an order or returns `404 NOT_FOUND`. +- `cancel(long id)` — refunds and cancels an order, returning `204 No Content` on success. +- `purgeCancelled()` — runs the `Order.purgeCancelled` update at 02:15. + +#### Data flow +- `EntityManager` and `Order.open` supply open orders; `find(id)` loads an order by ID. +- `cancel(id)` uses the order’s payment reference and total with `PaymentGateway`, updates its status, and records `order.cancelled` through `AuditLog`. +- `purgeCancelled()` applies a 30-day cutoff and records `order.purged` with the affected-row count. + +#### Dependencies +- Domain types: `Order`, `OrderStatus`. +- Collaborators: `EntityManager`, `PaymentGateway`, `AuditLog`. +- Jakarta EE persistence, transactions, EJB scheduling, REST, and security APIs. + +#### Cross-cutting +- Access is restricted to the `backoffice` and `admin` roles. +- Cancellation uses `REQUIRED` transaction semantics. +- Cleanup runs at 02:15 with `persistent = false`. +- Refund, persistence, and audit failures are not handled in the resource. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..dc1e48d1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/java/shop/OrderResource.java.ai.md @@ -0,0 +1,53 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:19:22Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 50211B16 +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Backoffice users can list and look up orders, cancel orders with payment refunds, and purge old cancelled orders nightly. + +#### Purpose +- Provides the order backoffice REST operations and scheduled cleanup for cancelled orders. + +#### Type +- `public class OrderResource` — stateless Jakarta EE class; annotated `@Stateless`, `@Path("/orders")`, `@Produces(MediaType.APPLICATION_JSON)`, and `@RolesAllowed({"backoffice", "admin"})`. + +#### Input +- Injected `EntityManager em` for persistence unit `"shop"`, `PaymentGateway payments`, and `AuditLog audit`. +- `find(long id)` and `cancel(long id)` receive an order ID from the path. +- `purgeCancelled()` uses `PURGE_AFTER_DAYS`, set to `30`. + +#### Output +- `openOrders()` returns `List` from the `"Order.open"` named query. +- `find(long id)` and `cancel(long id)` return JAX-RS `Response` values. +- `cancel` updates the order status, requests a refund, and records an audit event. +- `purgeCancelled()` executes the `"Order.purgeCancelled"` update and records the removed-row count. + +#### Core logic +- `openOrders()` retrieves and returns the result list of `"Order.open"`. +- `find(id)` loads the order by ID; returns `404 NOT_FOUND` if absent, otherwise `200 OK` with the order. +- `cancel(id)` runs with `REQUIRED` transaction semantics; returns `404 NOT_FOUND` if absent, otherwise refunds the payment reference for the order total, sets status to `CANCELLED`, records `"order.cancelled"` with the ID, and returns `204 No Content`. +- `purgeCancelled()` runs at 02:15 with `persistent = false`; deletes cancelled orders older than 30 days and records `"order.purged"` with the affected-row count. + +#### Public API +- `openOrders() -> List` — list open orders +- `find(long id) -> Response` — look up an order +- `cancel(long id) -> Response` — refund and cancel an order + +#### Dependencies +- `Order`, `OrderStatus`, `PaymentGateway`, `AuditLog` +- Jakarta EE: `EntityManager`, `PersistenceContext`, `Inject`, `EJB`, `Stateless`, `Schedule`, `TransactionAttribute`, `TransactionAttributeType` +- Jakarta REST: `GET`, `POST`, `Path`, `PathParam`, `Produces`, `MediaType`, `Response` +- Jakarta Security: `RolesAllowed` +- `java.util.List` + +#### Exceptions / Errors +- Missing orders produce `404 NOT_FOUND` for lookup and cancellation. +- Refund, persistence, or audit failures are not handled in this class. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/java/shop/package.ai.md new file mode 100644 index 00000000..85b64948 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/java/shop/package.ai.md @@ -0,0 +1,45 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:20:59Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Backoffice order management supports order lookup, refund-backed cancellation, auditing, and scheduled removal of aged cancelled orders. + +#### Purpose +- Exposes secured REST operations for managing shop orders. +- Cleans up cancelled orders older than 30 days on a nightly schedule. + +#### Responsibilities +- Order access: list open orders and look up an order by ID, returning `404 NOT_FOUND` when absent. +- Cancellation: refund the order total through `PaymentGateway`, mark the order `CANCELLED`, and record an audit event. +- Scheduled cleanup: purge cancelled orders older than 30 days and audit the affected-row count. + +#### Key units +- `OrderResource` — stateless `/orders` REST resource for backoffice order operations and scheduled cleanup. +- `openOrders()` — returns results from the `Order.open` named query. +- `find(long id)` — returns an order or `404 NOT_FOUND`. +- `cancel(long id)` — refunds and cancels an order, returning `204 No Content` on success. +- `purgeCancelled()` — executes the `Order.purgeCancelled` update at 02:15. + +#### Data flow +- `openOrders()` retrieves `Order` results via `EntityManager` and the `Order.open` named query. +- `find(id)` loads an `Order` by ID and maps absence to `404`. +- `cancel(id)` loads the order, requests a refund using its payment reference and total, updates its status, and records `order.cancelled`. +- `purgeCancelled()` runs the purge update with a 30-day cutoff and records `order.purged` with the removed-row count. + +#### Dependencies +- Domain types: `Order`, `OrderStatus`. +- Injected collaborators: `EntityManager` for persistence, `PaymentGateway` for refunds, and `AuditLog` for events. +- Jakarta EE: EJB, persistence, transaction, and scheduling APIs. +- Jakarta REST: resource paths, HTTP methods, and `Response`; Jakarta Security: `RolesAllowed`. + +#### Cross-cutting +- Access is restricted to the `backoffice` and `admin` roles. +- Cancellation uses `REQUIRED` transaction semantics. +- Cleanup is scheduled for 02:15 with `persistent = false`. +- Missing orders produce `404 NOT_FOUND`; refund, persistence, and audit failures are not handled in this class. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/.github/package.ai.md new file mode 100644 index 00000000..37433e88 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/.github/package.ai.md @@ -0,0 +1,38 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:21:15Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Automates verification, versioned container publication, and production deployment for the Orders Backoffice application. + +#### Purpose +- Release Orders Backoffice on version-tag pushes or manual dispatch. +- Verify the application, publish its image, and hand off production deployment. + +#### Responsibilities +- Build and verify with Maven’s `ci` profile across Java 21 and 25. +- Publish `orders-backoffice` to `registry.shop.example` using the release name as the image tag. +- Invoke the reusable Kubernetes deployment workflow for production. + +#### Key units +- `release-backoffice` — GitHub Actions workflow triggered by `v*` tags or `workflow_dispatch`. +- `build` — checks out the repository and runs `mvn -B verify -Pci` across the Java version matrix. +- `image` — authenticates to the registry and builds and pushes the versioned image. +- `deploy` — calls `./.github/workflows/deploy-k8s.yml` for production. + +#### Data flow +- Release trigger or manual dispatch → Java matrix verification → image build and push → production deployment workflow. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, and `docker/login-action@v3`. +- Maven, `registry.shop.example`, and `secrets.REGISTRY_USER` / `secrets.REGISTRY_TOKEN`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Permissions grant `contents: read` and `packages: write`. +- Image publication and deployment follow successful preceding jobs; registry credentials are provided through secrets. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..4a2263ed --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,38 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:21:10Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Automates verification, container-image publication, and production Kubernetes deployment for the Orders Backoffice application. + +#### Purpose +- Release Orders Backoffice from version-tag pushes or manual dispatch. +- Verify the application, publish its versioned image, and hand off production deployment. + +#### Responsibilities +- Build and test with Maven across Java 21 and 25 using the `ci` profile. +- Build and push the `orders-backoffice` container image to `registry.shop.example`. +- Invoke the reusable Kubernetes deployment workflow for production. + +#### Key units +- `release-backoffice` — GitHub Actions workflow triggered by `v*` tags or `workflow_dispatch`. +- `build` — checks out the repository and runs `mvn -B verify -Pci` across the Java version matrix. +- `image` — logs in to the registry and publishes `registry.shop.example/orders-backoffice` tagged from the release name. +- `deploy` — calls `./.github/workflows/deploy-k8s.yml` for the production environment. + +#### Data flow +- Triggered release or manual run → Java matrix build and verification → image build and push → production deployment workflow call. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Maven with the `ci` profile; `registry.shop.example` and `secrets.REGISTRY_USER` / `secrets.REGISTRY_TOKEN`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Workflow permissions grant `contents: read` and `packages: write`. +- Image publication and deployment run after successful preceding jobs; registry credentials are supplied through secrets. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..19edd24b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,53 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:19:28Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds and publishes the Orders Backoffice container image, then deploys it to the production Kubernetes environment. + +#### Purpose +- Release workflow for building and testing the application, publishing its container image, and invoking the production deployment workflow. + +#### Type +- GitHub Actions workflow named `release-backoffice`. + +#### Definitions +- Triggers: pushes of tags matching `v*`; manual `workflow_dispatch`. +- Workflow permissions: `contents: read`, `packages: write`. +- Job `build`: + - Runner: `ubuntu-24.04`; matrix `java`: `21`, `25`. + - Steps: `actions/checkout@v4`; `actions/setup-java@v4` with `distribution: temurin` and `java-version: ${{ matrix.java }}`; runs `mvn -B verify -Pci` (`Build and test`). +- Job `image`: + - Needs: `build`; runner: `ubuntu-24.04`; environment: `production`. + - Steps: `actions/checkout@v4`; `docker/login-action@v3` logs in to `registry.shop.example`; builds and pushes `registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v}`. +- Job `deploy`: + - Needs: `image`; calls `./.github/workflows/deploy-k8s.yml` with `environment: production`; inherits secrets. + +#### Configuration +- `name`: `release-backoffice` +- `on.push.tags`: `v*` +- `workflow_dispatch`: enabled +- `permissions.contents`: `read` +- `permissions.packages`: `write` +- `build.strategy.matrix.java`: `21`, `25` +- `actions/setup-java` `distribution`: `temurin` +- `actions/setup-java` `java-version`: `${{ matrix.java }}` +- Registry login `registry`: `registry.shop.example` +- Registry login `username`: `${{ secrets.REGISTRY_USER }}` +- Registry login `password`: `${{ secrets.REGISTRY_TOKEN }}` +- Image tag expression: `${GITHUB_REF_NAME#v}` + +#### Dependencies +- Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Build tool and profile: Maven, `-Pci`. +- Registry and image: `registry.shop.example`, `registry.shop.example/orders-backoffice`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. +- Secrets: `secrets.REGISTRY_USER`, `secrets.REGISTRY_TOKEN`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/package.ai.md new file mode 100644 index 00000000..32e4a24d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/actions/package.ai.md @@ -0,0 +1,38 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:21:18Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Automates verification, container release, and production deployment of the Orders Backoffice application. + +#### Purpose +- Release the application on version-tag pushes or manual dispatch. +- Verify builds, publish a versioned container image, and hand off production deployment. + +#### Responsibilities +- Run Maven verification with the `ci` profile across Java 21 and 25. +- Build and push `orders-backoffice` to `registry.shop.example`. +- Invoke the reusable Kubernetes deployment workflow for production. + +#### Key units +- `release-backoffice` — workflow triggered by `v*` tags or `workflow_dispatch`. +- `build` — checks out the repository and runs `mvn -B verify -Pci` across the Java version matrix. +- `image` — authenticates to the registry and publishes the release-tagged image. +- `deploy` — calls `./.github/workflows/deploy-k8s.yml`. + +#### Data flow +- Release trigger or manual dispatch → Java matrix verification → image build and push → production deployment workflow. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, and `docker/login-action@v3`. +- Maven, `registry.shop.example`, and `secrets.REGISTRY_USER` / `secrets.REGISTRY_TOKEN`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Workflow permissions grant `contents: read` and `packages: write`. +- Image publication and deployment follow successful preceding jobs; registry credentials are supplied through secrets. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..cdba98d1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,47 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:19:35Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 7ADEA688 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1; decisions: 0; decision rules: 0 + +> Defines executable order fulfilment from stock reservation and payment through approval, shipping, invoicing, or cancellation when stock is unavailable. + +#### Purpose +- Orchestrates order fulfilment, including payment waiting, amount-based approval, shipping, and out-of-stock cancellation. + +#### Type +- BPMN process file; root element `bpmn:definitions`. +- Namespaces: `bpmn` = `http://www.omg.org/spec/BPMN/20100524/MODEL`; `bpmndi` = `http://www.omg.org/spec/BPMN/20100524/DI`; `dc` = `http://www.omg.org/spec/DD/20100524/DC`; `camunda` = `http://camunda.org/schema/1.0/bpmn`. + +#### Definitions +- Process `orderFulfilment` (`Order fulfilment`), executable: + - Start event `orderPlaced` (`Order placed`) → service task `reserveStock` (`Reserve stock`, class `shop.bpm.ReserveStockDelegate`). + - Boundary event `stockMissing`, attached to `reserveStock`, catches error `errOutOfStock` → end event `orderCancelled` (`Order cancelled`). + - Intermediate catch event `waitForPayment` (`Wait for payment`) catches message `msgPaymentReceived`. + - Exclusive gateway `amountCheck` (`Large order?`): flow `large` to `approveOrder` when `${order.total > 1000}`; flow `small` to `shipOrder` when `${order.total <= 1000}`. + - User task `approveOrder` (`Approve large order`), candidate group `backoffice`; flow `approvedToShip` continues to `shipOrder`. + - Service task `shipOrder` (`Ship order`), external type, topic `shipping`; continues to call activity `createInvoice` (`Create invoice`), which calls `invoicing`. + - End event `orderCompleted` (`Order completed`) follows invoicing. +- Message `msgPaymentReceived` (`PaymentReceived`). +- Error `errOutOfStock` (`OutOfStock`), error code `STOCK_EMPTY`. + +#### Configuration +- `orderFulfilment`: `isExecutable="true"`. +- Gateway conditions: `${order.total > 1000}` and `${order.total <= 1000}`. +- `reserveStock`: `camunda:class="shop.bpm.ReserveStockDelegate"`. +- `approveOrder`: `camunda:candidateGroups="backoffice"`. +- `shipOrder`: `camunda:type="external"`, `camunda:topic="shipping"`. +- `createInvoice`: `calledElement="invoicing"`. + +#### Dependencies +- Delegate class: `shop.bpm.ReserveStockDelegate`. +- Called process: `invoicing`. +- External task topic: `shipping`. +- Message: `msgPaymentReceived`; error: `errOutOfStock`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/bpmn/package.ai.md new file mode 100644 index 00000000..e5ceffed --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/bpmn/package.ai.md @@ -0,0 +1,40 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:21:22Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> Orchestrates order fulfilment from stock reservation and payment through approval, shipping, invoicing, or cancellation when stock is unavailable. + +#### Purpose +- Defines an executable BPMN process for completing or cancelling customer orders. +- Routes orders by total amount and coordinates payment, human approval, shipping, and invoicing. + +#### Responsibilities +- Stock handling: reserve stock and cancel the order when the `OutOfStock` error is caught. +- Order processing: wait for `PaymentReceived`, route large orders for back-office approval, and send orders to shipping. +- Completion: call the invoicing process and end the order as completed. + +#### Key units +- `orderFulfilment`: executable BPMN process for the order lifecycle. +- `reserveStock`: service task bound to `shop.bpm.ReserveStockDelegate`. +- `amountCheck`: exclusive gateway routing orders above or at/below 1000. +- `approveOrder`: user task assigned to candidate group `backoffice`. +- `shipOrder`: external task on topic `shipping`. +- `createInvoice`: call activity invoking process `invoicing`. +- `msgPaymentReceived` / `errOutOfStock`: payment message and stock-empty error definitions. + +#### Data flow +- Order placement triggers stock reservation; catching `errOutOfStock` at the reservation task leads to order cancellation. +- The process waits for `msgPaymentReceived`, then evaluates `order.total`: amounts above 1000 require approval, while amounts at or below 1000 proceed directly to shipping. +- Shipping proceeds to `invoicing`, then the process ends as `Order completed`. + +#### Dependencies +- Java delegate: `shop.bpm.ReserveStockDelegate`. +- Called BPMN process: `invoicing`. +- External task topic: `shipping`. +- BPMN message `PaymentReceived` and error code `STOCK_EMPTY`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..eb83d360 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/docker/Dockerfile.ai.md @@ -0,0 +1,44 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:19:42Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds the Orders Backoffice Java application and packages it into a production-oriented runtime image. + +#### Purpose +- Compiles `orders-backoffice.jar` with Maven, then runs it on a lightweight Java 21 runtime. +- Configures the container to run as a non-root user and expose application health at `/health/live`. + +#### Type +- Multi-stage Dockerfile. + +#### Definitions +- `build` stage: base image `maven:3.9-eclipse-temurin-21`; working directory `/src`. + - Copies `pom.xml` to `/src/pom.xml`. + - Runs `mvn -B dependency:go-offline`. + - Copies `src` to `/src/src`. + - Runs `mvn -B package -DskipTests`. +- Final stage: base image `eclipse-temurin:21-jre-alpine`. + - Creates group `shop` and user `backoffice`, a member of `shop`. + - Copies `/src/target/orders-backoffice.jar` from `build` to `/opt/shop/orders-backoffice.jar`. + - Exposes port `8080`; runs as `backoffice`. + - Healthcheck: every `30s`, runs `wget -qO- http://localhost:8080/health/live || exit 1`. + - Entrypoint: `sh -c "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"`. + +#### Configuration +- `APP_VERSION=2.1.0` build argument. +- `JAVA_OPTS="-XX:MaxRAMPercentage=75"`. +- `SHOP_PROFILE=production`. + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine`. +- Build inputs: `pom.xml`, `src`. +- Runtime artifact: `/src/target/orders-backoffice.jar`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/docker/package.ai.md new file mode 100644 index 00000000..e9086498 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/docker/package.ai.md @@ -0,0 +1,34 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:21:28Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> Packages the Orders Backoffice Java application as a production-oriented container that exposes its HTTP service and reports liveness. + +#### Purpose +- Builds `orders-backoffice.jar` with Maven and runs it on a Java 21 runtime. +- Provides a production container configuration for the Orders Backoffice application. + +#### Responsibilities +- **Build:** Resolves Maven dependencies and packages the application from `pom.xml` and `src`, skipping tests. +- **Runtime:** Runs the JAR on port `8080` with configured JVM options and a `/health/live` healthcheck. +- **Container security:** Creates and uses the non-root `backoffice` user in the `shop` group. + +#### Key units +- `Dockerfile` — multi-stage build that compiles the application and assembles its runtime image. + +#### Data flow +- `pom.xml` and `src` → Maven dependency resolution and packaging → `orders-backoffice.jar` → Java 21 runtime container. + +#### Dependencies +- Build images: `maven:3.9-eclipse-temurin-21` and `eclipse-temurin:21-jre-alpine`. +- Build inputs: `pom.xml`, `src`; runtime artifact: `/src/target/orders-backoffice.jar`. + +#### Cross-cutting +- Runtime configuration includes `APP_VERSION=2.1.0`, `JAVA_OPTS="-XX:MaxRAMPercentage=75"`, and `SHOP_PROFILE=production`. +- The container runs as non-root and checks liveness every 30 seconds via `http://localhost:8080/health/live`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..62f8958e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,45 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:19:47Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> Customers enter a delivery address, choose a shipping method, review the EUR order total, and place an order. + +#### Purpose +- Collect checkout address and shipping details, update the displayed total, and submit the order. + +#### Type +- Jakarta Faces Facelets page; XHTML. +- Namespaces: `h` = Jakarta Faces HTML, `f` = Jakarta Faces core, `ui` = Jakarta Faces Facelets. + +#### Data +- `checkoutBean.address.street` — street input value. +- `checkoutBean.address.zip` — ZIP input value. +- `checkoutBean.shippingMethod` — selected shipping method. +- `checkoutBean.shippingMethods` — options for the shipping menu. +- `checkoutBean.total` — displayed total. +- Iterations: none. + +#### Actions +- `checkoutForm` — Faces form; `Place order` command button invokes `checkoutBean.placeOrder`. +- Inputs: `street` (`h:inputText`, required); `zip` (`h:inputText`, regex `[0-9]{5}`). +- `shipping` (`h:selectOneMenu`) — AJAX listener `checkoutBean.recalculate`; renders `total`. +- `total` — number converter formats the value as currency with currency code `EUR`. + +#### Structure +- Uses template `/WEB-INF/templates/shop.xhtml`; defines `content`. +- Includes `/WEB-INF/includes/payment-hints.xhtml` in `content`. + +#### Dependencies +- Template: `/WEB-INF/templates/shop.xhtml`. +- Included file: `/WEB-INF/includes/payment-hints.xhtml`. +- Bean: `checkoutBean`. +- Actions: `checkoutBean.recalculate`, `checkoutBean.placeOrder`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/facelets/package.ai.md new file mode 100644 index 00000000..425e27b2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/facelets/package.ai.md @@ -0,0 +1,33 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:21:32Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> The checkout flow collects delivery details and shipping preferences, recalculates the order total, and submits the order. + +#### Purpose +- Provide a customer checkout form for address entry, shipping selection, total review, and order placement. + +#### Responsibilities +- Capture required street and ZIP details and bind them to `checkoutBean.address`. +- Present shipping options, refresh the EUR-formatted total, and invoke order placement. +- Supply checkout content through the shop template and include payment hints. + +#### Key units +- `checkout.xhtml` — Jakarta Faces Facelets checkout page with the `checkoutForm`, address inputs, shipping menu, total display, and place-order action. +- `checkoutBean` — supplies address and shipping data, total, and the `recalculate` and `placeOrder` actions. + +#### Data flow +- Customer inputs bind to `checkoutBean.address.street`, `checkoutBean.address.zip`, and `checkoutBean.shippingMethod`. +- Changing the shipping selection invokes `checkoutBean.recalculate` and re-renders `total`, formatted as EUR currency. +- Submitting the form invokes `checkoutBean.placeOrder`. + +#### Dependencies +- `/WEB-INF/templates/shop.xhtml` — provides the page template. +- `/WEB-INF/includes/payment-hints.xhtml` — included in the checkout content. +- `checkoutBean` — backing bean for form data and actions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..d01ef3fa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,60 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:19:52Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Calculates parcel shipping charges by order value and weight, providing free shipping above a threshold and rejecting parcels over the carrier’s weight limit. + +#### Purpose +- `ShippingRulesSpec` verifies free-shipping eligibility, weight-based prices, and rejection of overweight parcels. +- `ShippingRules` computes shipping cost using order total and parcel weight. + +#### Type +- `ShippingRulesSpec` — class; extends `Specification`. +- `ShippingRules` — class; `@CompileStatic`; no explicit superclass or interfaces. + +#### Input +- `ShippingRules` properties: `carrier: String`, `maxParcelKg: BigDecimal`. +- `costFor(Order order)` consumes an `Order` with `weightKg` and `total`. +- `ShippingRulesSpec` initializes rules with carrier `DHL` and `maxParcelKg: 31.5`; tests construct orders with totals and weights. + +#### Output +- `costFor(Order)` returns `BigDecimal` shipping cost. +- `costFor(Order)` throws `ParcelTooHeavyException` when the order exceeds `maxParcelKg`. +- `ShippingRulesSpec` assertions verify zero cost, tier prices `4.99`, `9.99`, `19.99`, and overweight rejection. + +#### Core logic +- `costFor` first rejects parcels whose `weightKg` exceeds `maxParcelKg`, with a message containing actual and maximum weight. +- If `order.total >= ShippingRulesSpec.FREE_SHIPPING_THRESHOLD` (`50.00`), returns `0`. +- Otherwise selects the first matching weight tier: up to 2 kg costs `4.99`; up to 10 kg costs `9.99`; up to 31.5 kg costs `19.99`. +- `ShippingRulesSpec` includes a data-driven `@Unroll` feature for the three paid tiers and separate free-shipping and overweight tests. + +#### Public API +- `ShippingRulesSpec`: + - `getRules()` / `setRules(ShippingRules)` -> rules property + - `"orders above the threshold ship for free"()` -> verifies free shipping + - `"a parcel of #weight kg costs #expected"()` -> verifies tier prices + - `"an overweight parcel is rejected"()` -> verifies overweight rejection +- `ShippingRules`: + - `getCarrier()` / `setCarrier(String)` -> carrier property + - `getMaxParcelKg()` / `setMaxParcelKg(BigDecimal)` -> parcel weight limit + - `costFor(Order)` -> calculate shipping cost + +#### Dependencies +- `groovy.transform.CompileStatic` +- `spock.lang.Specification` +- `spock.lang.Unroll` +- `Order` +- `ParcelTooHeavyException` + +#### Exceptions / Errors +- Throws `ParcelTooHeavyException` when `order.weightKg > maxParcelKg`. +- No explicit null handling for `order` or its properties. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/groovy/package.ai.md new file mode 100644 index 00000000..81d3c864 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/groovy/package.ai.md @@ -0,0 +1,33 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:21:36Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> Calculates parcel shipping charges from order value and weight, including free-shipping eligibility and rejection of parcels above the carrier’s weight limit. + +#### Purpose +- Implements shipping-cost rules and verifies them against free-shipping, weight-tier, and overweight cases. + +#### Responsibilities +- Apply a maximum parcel weight and order-value threshold before selecting a paid shipping tier. +- Test the rules with Spock examples, including data-driven checks for paid tiers. + +#### Key units +- `ShippingRules` — calculates shipping cost, with `carrier` and `maxParcelKg` properties. +- `ShippingRulesSpec` — tests free shipping at or above `50.00`, paid tiers (`4.99`, `9.99`, `19.99`), and overweight rejection. + +#### Data flow +- `costFor(Order)` checks `weightKg` against `maxParcelKg`, then checks `total` against the free-shipping threshold; otherwise it returns the first matching weight-tier price. +- Overweight orders raise `ParcelTooHeavyException`; the spec verifies the resulting behavior. + +#### Dependencies +- `Order` supplies order weight and total; `ParcelTooHeavyException` represents overweight rejection. +- `ShippingRulesSpec` uses `spock.lang.Specification` and `spock.lang.Unroll`; `ShippingRules` uses `groovy.transform.CompileStatic`. + +#### Cross-cutting +- `ShippingRules` is statically compiled; shipping rules are exercised through Spock feature methods, including an unrolled tier test. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..ef46c2eb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/integration/order-routes.xml.ai.md @@ -0,0 +1,53 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:19:59Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Routes incoming orders through validation, review-threshold decisions, ERP submission, audit tapping, and dead-letter handling with retries. + +#### Purpose +- Defines Apache Camel order-processing routes and supporting Spring beans. +- Loads integration properties from `classpath:integration.properties`. + +#### Type +- Spring beans configuration with Apache Camel routes; root element: `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` = `http://www.w3.org/2001/XMLSchema-instance`; nested Camel context uses default `http://camel.apache.org/schema/spring`. + +#### Definitions +- Beans: + - `orderValidator` — `shop.integration.OrderValidator`. + - `invoiceTranslator` — `shop.integration.InvoiceTranslator`. +- Camel context `orderIntegration`; property placeholder `properties`. +- Route `incomingOrders`: + - Consumes `jms:queue:{{orders.incoming.queue}}`. + - Calls `orderValidator.validate`. + - Sends orders with `${body.total} > {{orders.review.threshold}}` to `direct:manualReview`; otherwise to `direct:toErp`. + - Wire-taps to `seda:orderAudit`. +- Route `toErp`: + - Consumes `direct:toErp`. + - Calls `invoiceTranslator`. + - Dynamically sends to `https://{{erp.host}}/api/orders/${header.orderId}`. +- Route `manualReview`: + - Consumes `direct:manualReview`. + - Splits `${body.lines}` and sends each item to `jms:queue:review.lines`. +- Exception handling for `shop.integration.ErpUnavailableException`: + - Redelivers up to 5 times, with 2000 ms delay and exponential backoff. + - Marks the exception handled and sends to `jms:queue:orders.deadletter`. + +#### Configuration +- Property source: `classpath:integration.properties`. +- Placeholders: `{{orders.incoming.queue}}`, `{{orders.review.threshold}}`, `{{erp.host}}`. +- Redelivery: `maximumRedeliveries="5"`, `redeliveryDelay="2000"`, `useExponentialBackOff="true"`. + +#### Dependencies +- Classes: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `shop.integration.ErpUnavailableException`. +- File: `classpath:integration.properties`. +- Endpoints: JMS queues `orders.incoming.queue` (property-defined), `orders.deadletter`, `review.lines`; `direct:manualReview`, `direct:toErp`; `seda:orderAudit`; ERP HTTPS endpoint `https://{{erp.host}}/api/orders/${header.orderId}`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/integration/package.ai.md new file mode 100644 index 00000000..e2110039 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/integration/package.ai.md @@ -0,0 +1,40 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:21:40Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Processes incoming orders by validating them, routing high-value orders for manual review, and submitting other orders to the ERP with audit and failure handling. + +#### Purpose +- Defines Camel routes and Spring beans for order integration. +- Loads route configuration from `classpath:integration.properties`. + +#### Responsibilities +- Validate incoming orders, apply the review-threshold decision, and route orders to manual review or ERP submission. +- Translate ERP-bound orders, publish order audit events, and handle ERP failures with retries and dead-letter routing. + +#### Key units +- `orderIntegration` — Camel context containing the order-processing routes and property placeholder. +- `incomingOrders` — consumes the configured JMS order queue, invokes `OrderValidator`, routes by `orders.review.threshold`, and wire-taps to `seda:orderAudit`. +- `toErp` — invokes `InvoiceTranslator` and sends orders to the ERP endpoint using the `orderId` header. +- `manualReview` — splits order lines and sends them to `jms:queue:review.lines`. +- `orderValidator` (`shop.integration.OrderValidator`) — validates incoming orders. +- `invoiceTranslator` (`shop.integration.InvoiceTranslator`) — translates orders for ERP submission. + +#### Data flow +- Configured incoming JMS queue → `OrderValidator` → audit wire-tap and threshold decision. +- Orders above the threshold → `manualReview` → split lines → `review.lines`; other orders → `toErp` → `InvoiceTranslator` → ERP HTTPS endpoint. +- `shop.integration.ErpUnavailableException` → up to five redelivery attempts, then `orders.deadletter`. + +#### Dependencies +- Integration classes: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `shop.integration.ErpUnavailableException`. +- Configuration: `classpath:integration.properties`; placeholders include the incoming queue, review threshold, and ERP host. +- Endpoints: JMS incoming, review-line, and dead-letter queues; `direct:manualReview`, `direct:toErp`, `seda:orderAudit`, and the ERP HTTPS API. + +#### Cross-cutting +- Camel exception handling retries `ErpUnavailableException` up to five times with a 2000 ms delay and exponential backoff, then handles the exception by sending the message to the dead-letter queue. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..5daf037b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,37 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:20:06Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Configures shop session beans, an order-placement message listener, timing interception, and transaction behavior. + +#### Purpose +- Declares EJBs and container policies for stock reservation, checkout, and order-placement events. + +#### Type +- Jakarta EE EJB descriptor (`ejb-jar.xml`), root `ejb-jar`; namespace `https://jakarta.ee/xml/ns/jakartaee` (default). + +#### Definitions +- Session beans: + - `StockReservationBean` — Stateless; class `shop.stock.StockReservationBean`; environment entry `reservationMinutes` (`java.lang.Integer`). + - `CheckoutSessionBean` — Stateful; class `shop.checkout.CheckoutSessionBean`; local EJB reference `ejb/StockReservation` to `shop.stock.StockReservation`. +- Message-driven bean `OrderPlacedListener` — class `shop.events.OrderPlacedListener`; activation property `destinationLookup`. +- Interceptor `shop.audit.TimingInterceptor`, bound to all EJBs via `ejb-name` `*`. +- Container transaction: `StockReservationBean.reserve` uses `RequiresNew`. + +#### Configuration +- `reservationMinutes` = `45`. +- `destinationLookup` = `java:/jms/queue/OrderPlaced`. + +#### Dependencies +- Classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`. +- Local EJB interface: `shop.stock.StockReservation`. +- JMS destination: `java:/jms/queue/OrderPlaced`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jee/package.ai.md new file mode 100644 index 00000000..19032136 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jee/package.ai.md @@ -0,0 +1,47 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:21:46Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> Configures the shop’s back-office web access and enterprise services for reporting, stock reservation, checkout, and order-placement events. + +#### Purpose +- Declares Jakarta EE web and EJB components, their runtime settings, and container policies. +- Defines admin access controls and the shop data-source reference. + +#### Responsibilities +- **Back-office web application:** maps report downloads, applies a request filter, registers a startup listener, sets session policy, and protects admin URLs. +- **Shop services and events:** declares stock reservation and checkout session beans, an order-placement message listener, and timing interception. +- **Container configuration:** sets the reservation duration, JMS destination, transaction behavior, report directory, and data-source reference. + +#### Key units +- `ReportDownloadServlet` — serves requests mapped to `/reports/*`. +- `RequestIdFilter` — applies to all web request paths (`/*`). +- `StartupAuditListener` — registered as a web application listener. +- `StockReservationBean` — stateless session bean configured with a 45-minute `reservationMinutes` environment entry. +- `CheckoutSessionBean` — stateful session bean with a local reference to `shop.stock.StockReservation`. +- `OrderPlacedListener` — message-driven bean listening at `java:/jms/queue/OrderPlaced`. +- `TimingInterceptor` — interceptor bound to all EJBs. +- `jdbc/ShopDS` — web application resource reference of type `javax.sql.DataSource`. + +#### Data flow +- Web requests pass through `RequestIdFilter`; report requests are routed to `ReportDownloadServlet`. +- Checkout has a local EJB reference to stock reservation; `StockReservationBean.reserve` runs with `RequiresNew` transaction behavior. +- Order-placement messages are directed to `OrderPlacedListener` through the configured JMS destination. + +#### Dependencies +- Application classes: `shop.web.ReportDownloadServlet`, `shop.web.RequestIdFilter`, `shop.web.StartupAuditListener`, `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`. +- EJB interface: `shop.stock.StockReservation`. +- JMS destination: `java:/jms/queue/OrderPlaced`. +- Data-source type: `javax.sql.DataSource`. + +#### Cross-cutting +- Jakarta EE descriptors configure both the web application and EJB container components. +- `/admin/*` requires the `admin` role; web sessions time out after 20 minutes. +- `shop.reportDirectory` is `/var/shop/reports`; the report servlet loads on startup. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jee/web.xml.ai.md new file mode 100644 index 00000000..50713f72 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jee/web.xml.ai.md @@ -0,0 +1,42 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:20:10Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Declares the shop back-office web application’s report endpoint, request filter, startup listener, session policy, admin access restriction, and data-source reference. + +#### Purpose +- Configures the `shop-backoffice` web application and its servlet-container components. +- Restricts `/admin/*` to the `admin` role and declares the `jdbc/ShopDS` data-source reference. + +#### Type +- Jakarta EE web application descriptor; root element `web-app`, version `6.0`. +- Namespace: default `https://jakarta.ee/xml/ns/jakartaee`. + +#### Definitions +- Servlet `ReportDownloadServlet`: class `shop.web.ReportDownloadServlet`; URL pattern `/reports/*`. +- Filter `RequestIdFilter`: class `shop.web.RequestIdFilter`; URL pattern `/*`. +- Listener: `shop.web.StartupAuditListener`. +- Security constraint `backoffice`: protects `/admin/*`; requires role `admin`. +- Security role: `admin`. +- Resource reference `jdbc/ShopDS`: type `javax.sql.DataSource`. + +#### Configuration +- Display name: `shop-backoffice`. +- Context parameter `shop.reportDirectory`: `/var/shop/reports`. +- `ReportDownloadServlet` load-on-startup value: `1`. +- Session timeout: `20` minutes. + +#### Dependencies +- Servlet class: `shop.web.ReportDownloadServlet`. +- Filter class: `shop.web.RequestIdFilter`. +- Listener class: `shop.web.StartupAuditListener`. +- Referenced resource type: `javax.sql.DataSource`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..ff1c1943 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,43 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:20:15Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> The open-orders page lets staff search orders by customer email and status, review totals and overdue status, and cancel an order. + +#### Purpose +- Displays open orders and provides order search and cancellation controls. + +#### Type +- JSP page; `text/html;charset=UTF-8`. +- Tag libraries: `c` = Jakarta Tags core (`jakarta.tags.core`); `fmt` = Jakarta Tags formatting (`jakarta.tags.fmt`). + +#### Data +- Request attribute `orderFilter`: calls `getPageSize()` to determine the displayed page size. +- `${orders}`: iterated collection; variable `order` uses `number`, `total`, `overdue`, and `id`. +- `${param.customerEmail}`: populates the customer-email search field. + +#### Actions +- Search form: GET `${pageContext.request.contextPath}/orders/search`; fields `customerEmail` (text input) and `status` (select with `OPEN` and `SHIPPED` options). +- Cancel link: `orders/${order.id}/cancel`. + +#### Structure +- Includes `/WEB-INF/jspf/header.jspf` via JSP include directive. +- Includes `/WEB-INF/jspf/footer.jspf` via `jsp:include`. + +#### Server code +- Imports `java.util.List`, `shop.Order`, and `shop.OrderFilter`. +- Reads request attribute `orderFilter` as `OrderFilter`; sets `pageSize` to its page size, or `25` if the attribute is null. +- Outputs `pageSize`. + +#### Dependencies +- Included files: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf`. +- Classes: `shop.Order`, `shop.OrderFilter`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jsp/package.ai.md new file mode 100644 index 00000000..688c0668 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/jsp/package.ai.md @@ -0,0 +1,33 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:21:52Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> Provides staff with a searchable view of open orders, including order totals and overdue status, and a way to cancel orders. + +#### Purpose +- Renders the open-orders page with search and cancellation controls. +- Displays the page size from `orderFilter`, defaulting to 25 when it is absent. + +#### Responsibilities +- Search orders by customer email and status using a GET form. +- List orders with their number, total, overdue status, and ID; provide a cancellation link for each order. +- Include shared header and footer JSP fragments. + +#### Key units +- `order-list.jsp` — renders the order search form and open-order list, and reads `orderFilter` to set the displayed page size. + +#### Data flow +- Reads request attribute `orderFilter` to determine `pageSize`; outputs 25 if it is null. +- Populates the search field from `${param.customerEmail}` and submits customer email and status to `/orders/search`. +- Iterates `${orders}` to render order details and cancellation links at `orders/${order.id}/cancel`. + +#### Dependencies +- `shop.Order` and `shop.OrderFilter`. +- Jakarta Tags core and formatting libraries. +- `/WEB-INF/jspf/header.jspf` and `/WEB-INF/jspf/footer.jspf`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..85c4e826 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,48 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:20:20Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the Orders back-office application with three replicas, internal service access, and HTTP ingress at `backoffice.shop.example`. + +#### Purpose +- Runs the Orders back-office web application on Kubernetes. +- Exposes the application internally and routes external HTTP traffic to it. + +#### Type +- Kubernetes manifest; `apps/v1` Deployment, `v1` Service, `networking.k8s.io/v1` Ingress. + +#### Definitions +- `orders-backoffice` — Deployment: + - Replicas: `3`; selector and pod label: `app: orders-backoffice`. + - Container `backoffice`: image `registry.shop.example/orders-backoffice:2.1.0`; container port `8080`. + - Environment: `SHOP_DB_URL` set directly; `SHOP_DB_PASSWORD` sourced from Secret `orders-db-credentials`, key `password`. + - Readiness probe: HTTP GET `/health/ready` on port `8080`. + - Resource limits: memory `768Mi`, CPU `"1"`. +- `orders-backoffice` — Service: + - Selects pods with `app: orders-backoffice`; port `80` targets container port `8080`. +- `orders-backoffice` — Ingress: + - Host `backoffice.shop.example`; path `/` with `Prefix` path type; routes to Service `orders-backoffice` port `80`. + +#### Configuration +- `replicas: 3` +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD` references `orders-db-credentials`, key `password`. +- `containerPort: 8080` +- Readiness path: `/health/ready` +- Resource limits: `memory: 768Mi`, `cpu: "1"` +- Service port mapping: `80` → `8080` +- Ingress host: `backoffice.shop.example`; path `/`; `pathType: Prefix` + +#### Dependencies +- Image: `registry.shop.example/orders-backoffice:2.1.0` +- Secret: `orders-db-credentials`, key `password` +- Database endpoint: `orders-db:5432` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/k8s/package.ai.md new file mode 100644 index 00000000..566de010 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/k8s/package.ai.md @@ -0,0 +1,36 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:21:56Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Runs the Orders back-office application and makes it available internally and through HTTP at `backoffice.shop.example`. + +#### Purpose +- Deploys the Orders back-office web application on Kubernetes. +- Provides Service-based access and external Ingress routing. + +#### Responsibilities +- Defines the `orders-backoffice` Deployment with three replicas, database environment settings, a readiness probe, and resource limits. +- Exposes the pods through a Service on port `80` and an Ingress routing `/` to that Service. + +#### Key units +- `orders-backoffice` Deployment — runs image `registry.shop.example/orders-backoffice:2.1.0` on container port `8080`. +- `orders-backoffice` Service — maps port `80` to container port `8080`. +- `orders-backoffice` Ingress — routes requests for `backoffice.shop.example` with `/` prefix to the Service. + +#### Data flow +- Ingress sends HTTP traffic for `backoffice.shop.example/` to the `orders-backoffice` Service, which forwards it to matching pods on port `8080`. +- The application receives `SHOP_DB_URL` for `orders-db:5432` and `SHOP_DB_PASSWORD` from Secret `orders-db-credentials`, key `password`. + +#### Dependencies +- Container image: `registry.shop.example/orders-backoffice:2.1.0`. +- Kubernetes Secret: `orders-db-credentials`; database endpoint: `orders-db:5432`. + +#### Cross-cutting +- Deployment uses three replicas and label/selector `app: orders-backoffice`. +- Readiness uses HTTP GET `/health/ready` on port `8080`; resource limits are `768Mi` memory and `1` CPU. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..7a6c8130 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,75 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:20:26Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Completed orders are turned into numbered invoices with payment deadlines and category-based tax rates. + +#### Purpose +- `InvoiceService` issues invoices for non-empty completed orders, saves them, and returns an issuance or rejection result. +- `InvoiceLine` calculates line amounts; `List.total()` sums them. + +#### Type +- `PAYMENT_TERM_DAYS` — top-level `const val` of type `Int`, value `14`. +- `InvoiceNumber` — `value class`, annotated `@JvmInline`; wraps a `String`. +- `InvoiceLine` — `data class`; constructor properties `sku: String`, `quantity: Int`, `unitPrice: BigDecimal`; computed `amount: BigDecimal`. +- `InvoiceResult` — `sealed interface`; nested `Issued` data class (`number: InvoiceNumber`, `dueDate: LocalDate`) and `Rejected` data class (`reason: String`). +- `InvoiceService` — class; constructor-injected `InvoiceRepository` and clock function, defaulting to `LocalDate::now`. +- `InvoiceService.Companion` — companion object; exposes reduced-tax categories. +- Top-level extension function: `List.total()`. + +#### Input +- `InvoiceService` constructor: `repository: InvoiceRepository`, `clock: () -> LocalDate`. +- `issue(order: CompletedOrder)` reads the order’s `lines`, `id`, and `customerId`. +- `taxRate(category: String)` receives a category name. +- `total()` consumes a list of `InvoiceLine` values. + +#### Output +- `issue()` returns `InvoiceResult`; successful issuance saves an `Invoice` and returns its number and due date. +- `taxRate()` returns `BigDecimal`: `0.07` for reduced-tax categories, otherwise `0.19`. +- `InvoiceLine.amount` and `total()` return `BigDecimal`. +- `defaultCurrency: String` is publicly readable and writable; it is declared `lateinit`. + +#### Core logic +- `issue()` runs in `Dispatchers.IO`. +- Rejects orders with no lines, including the order ID in the reason; this path does not generate a number or save an invoice. +- For a non-empty order, increments the service sequence to generate an `INV-N` number. +- Computes the due date as `clock() + PAYMENT_TERM_DAYS`, builds an `Invoice` from the number, customer ID, and order lines, then calls `repository.save()`. +- Returns `InvoiceResult.Issued` with the invoice number and due date. +- `taxRate()` checks membership in `REDUCED_TAX_CATEGORIES`, which contains `"books"` and `"food"`. +- `InvoiceLine.amount` multiplies unit price by quantity; `total()` folds line amounts from `BigDecimal.ZERO`. + +#### Public API +- `PAYMENT_TERM_DAYS: Int` — payment term in days. +- `InvoiceNumber.value: String` — wrapped invoice number. +- `InvoiceLine(sku: String, quantity: Int, unitPrice: BigDecimal)` — invoice line data. +- `InvoiceLine.amount: BigDecimal` — calculated line amount. +- `InvoiceResult.Issued(number: InvoiceNumber, dueDate: LocalDate)` — successful issuance result. +- `InvoiceResult.Rejected(reason: String)` — rejection result. +- `InvoiceService(repository: InvoiceRepository, clock: () -> LocalDate)` — create invoice service. +- `InvoiceService.REDUCED_TAX_CATEGORIES: Set` — reduced-rate categories. +- `defaultCurrency: String` — get/set default currency. +- `issue(order: CompletedOrder) -> InvoiceResult` — issue and save invoice. +- `taxRate(category: String) -> BigDecimal` — select category tax rate. +- `List.total() -> BigDecimal` — sum line amounts. + +#### Dependencies +- `BigDecimal`, `LocalDate` +- `Dispatchers`, `withContext` +- `InvoiceRepository`, `CompletedOrder`, `Invoice` + +#### Exceptions / Errors +- Empty orders return `InvoiceResult.Rejected`; no exception is explicitly thrown or caught. +- Reading `defaultCurrency` before initialization can raise `UninitializedPropertyAccessException`. + +#### Concurrency +- `issue()` uses the `Dispatchers.IO` coroutine dispatcher. +- The mutable `sequence` is unsynchronized; concurrent calls have no explicit thread-safety protection. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/kotlin/package.ai.md new file mode 100644 index 00000000..e4be9a1a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/kotlin/package.ai.md @@ -0,0 +1,42 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:22:00Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> Converts completed orders into numbered invoices, calculates line totals and category-based tax rates, and records invoices with payment deadlines. + +#### Purpose +- Issue invoices for non-empty completed orders and report issuance or rejection. +- Provide invoice-line amount and total calculations plus category tax-rate selection. + +#### Responsibilities +- Invoice issuance: validate order lines, allocate an invoice number, set a payment deadline, save the invoice, and return a result. +- Invoice calculations and policy: calculate line and order totals, and select reduced or standard tax rates. + +#### Key units +- `InvoiceService` — coordinates invoice issuance through `InvoiceRepository`, with an injectable date clock. +- `InvoiceNumber` — value-class wrapper for invoice identifiers. +- `InvoiceResult` — sealed result with `Issued` (number and due date) and `Rejected` (reason) variants. +- `InvoiceLine` — holds SKU, quantity, and unit price; computes its amount. +- `List.total()` — sums line amounts. +- `PAYMENT_TERM_DAYS` — defines the 14-day payment term. +- `InvoiceService.REDUCED_TAX_CATEGORIES` — identifies `"books"` and `"food"` for the reduced rate. + +#### Data flow +- `issue(order)` rejects an order with no lines; otherwise it generates an `INV-N` number, calculates the due date from the clock and payment term, builds an `Invoice`, saves it, and returns `InvoiceResult.Issued`. +- `InvoiceLine.amount` multiplies unit price by quantity; `total()` folds amounts from `BigDecimal.ZERO`. +- `taxRate(category)` returns `0.07` for reduced-tax categories and `0.19` otherwise. + +#### Dependencies +- Internal domain and persistence types: `CompletedOrder`, `Invoice`, and `InvoiceRepository`. +- Kotlin coroutine APIs: `Dispatchers.IO` and `withContext`. +- Java numeric and date types: `BigDecimal` and `LocalDate`. + +#### Cross-cutting +- `issue()` runs on `Dispatchers.IO`; the mutable invoice-number sequence has no explicit concurrency protection. +- `defaultCurrency` is a writable `lateinit` property; reading it before initialization can raise `UninitializedPropertyAccessException`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..f0e120b4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,46 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:20:33Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Defines MyBatis customer data access for retrieving, searching, inserting, promoting, and deleting customer records. + +#### Purpose +- Maps customer SQL operations to `shop.customer.CustomerMapper`. +- Maps query results to `shop.customer.Customer`. + +#### Type +- MyBatis mapper; root element `mapper`. +- Declares no XML namespaces; uses the MyBatis Mapper 3.0 DTD. + +#### Definitions +- Namespace: `shop.customer.CustomerMapper`. +- Result map `customerResult` → `shop.customer.Customer`: `id` from `CUSTOMER_ID`, `email` from `EMAIL`, `loyaltyTier` from `LOYALTY_TIER`. +- SQL fragment `customerColumns`: `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT`. +- Select `findByEmail`: selects `customerColumns` from `CUSTOMER` where `EMAIL = #{email}`; result map `customerResult`. +- Select `search`: selects `customerColumns` from `CUSTOMER`; conditionally filters by `tier` and `createdAfter`; orders by `${sortColumn}`; result map `customerResult`. +- Insert `insert`: inserts `EMAIL`, `LOYALTY_TIER`, `CREATED_AT` into `CUSTOMER`; uses generated keys for `id`. +- Update `promote`: sets `LOYALTY_TIER` to `#{tier}` for `CUSTOMER_ID` values in `ids`. +- Delete `deleteInactive`: deletes from `CUSTOMER` where `LAST_ORDER_AT < #{cutoff}`. +- `${sortColumn}` is spliced into SQL unescaped. +- Commented-out `findAll` is not active. + +#### Configuration +- `insert`: `useGeneratedKeys="true"`; `keyProperty="id"`. +- `search`: `tier != null` adds a loyalty-tier condition; `createdAfter != null` adds a creation-time lower bound. +- `promote`: `ids` supplies the `IN` list; `tier` supplies the new loyalty tier. +- `search` ordering uses `${sortColumn}`. + +#### Dependencies +- Mapper namespace/package: `shop.customer.CustomerMapper`. +- Result class: `shop.customer.Customer`. +- Database table: `CUSTOMER`; columns include `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`. +- MyBatis Mapper 3.0 DTD: `https://mybatis.org/dtd/mybatis-3-mapper.dtd`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/mybatis/package.ai.md new file mode 100644 index 00000000..cedee57d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/mybatis/package.ai.md @@ -0,0 +1,37 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:22:04Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Provides database access for customer records, including lookup, filtered search, loyalty-tier updates, insertion, and inactive-customer deletion. + +#### Purpose +- Maps customer operations to SQL for the `CUSTOMER` table. +- Converts query results to `shop.customer.Customer`. + +#### Responsibilities +- Retrieve customers by email or search with optional loyalty-tier and creation-time filters. +- Insert customers with generated IDs, promote customers to a specified loyalty tier, and delete customers based on last-order cutoff. + +#### Key units +- `shop.customer.CustomerMapper` — MyBatis mapper namespace for customer data operations. +- `customerResult` — maps `CUSTOMER_ID`, `EMAIL`, and `LOYALTY_TIER` to `Customer` properties. +- `customerColumns` — shared SQL fragment selecting customer ID, email, loyalty tier, and creation time. +- `findByEmail`, `search`, `insert`, `promote`, `deleteInactive` — customer lookup, search, insert, tier update, and deletion statements. + +#### Data flow +- Mapper inputs provide email, optional search filters and sort column, insert values, customer IDs and tier for promotion, or a deletion cutoff. +- SQL statements operate on `CUSTOMER`; select results use `customerResult`, and inserts return generated keys to `id`. + +#### Dependencies +- `shop.customer.Customer` result class and `shop.customer.CustomerMapper` namespace. +- `CUSTOMER` table, including `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, and `LAST_ORDER_AT`. +- MyBatis Mapper 3.0 DTD. + +#### Cross-cutting +- `search` uses dynamic SQL for optional filters and orders by `${sortColumn}`, which is spliced into SQL unescaped. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..9e9fed3f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,36 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:20:40Z +- G: +- A: 0.0.0 +- X: file +- P: 34DB4705 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> Shop backoffice clients list and retrieve customer orders, inspect their status and total, and cancel orders that have not shipped. + +#### Purpose +- Specifies read and cancellation operations for shop backoffice orders. + +#### Type +- OpenAPI 3.0.3; API `Shop Orders API`, version `2.1.0`. + +#### Operations +- `GET /orders` — `listOrders`; query parameters `status` (`OrderStatus`) and `limit` (integer, maximum 200); response `200`: array of `Order`. +- `GET /orders/{orderId}` — `getOrder`; required path parameter `orderId` (string); response `200`: `Order`; response `404`: no schema specified. +- `POST /orders/{orderId}/cancel` — `cancelOrder`; required path parameter `orderId` (string); response `204`: no schema specified; response `409`: no schema specified. + +#### Schemas +- `OrderStatus` — string enum: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order` — object; required fields: `orderId`, `status`, `total`; fields: `orderId` (string), `status` (`OrderStatus`), `total` (number, format `double`), `couponCode` (string, deprecated). + +#### Security and servers +- Server: `https://api.shop.example/backoffice`. +- `backofficeToken` — OAuth 2.0 client credentials; token URL `https://auth.shop.example/token`; scope `orders:write`; required by `POST /orders/{orderId}/cancel`. + +#### Dependencies +- None external. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/openapi/package.ai.md new file mode 100644 index 00000000..9b50db81 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/openapi/package.ai.md @@ -0,0 +1,34 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:22:10Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> Defines how shop backoffice clients list and retrieve customer orders and request cancellation of orders that have not shipped. + +#### Purpose +- Specifies the Shop Orders API contract for reading order data and cancelling orders. + +#### Responsibilities +- Order access: list orders by optional status and limit, or retrieve an order by ID. +- Order cancellation: expose a cancellation operation for a specified order. + +#### Key units +- `Shop Orders API` — OpenAPI 3.0.3 contract, version `2.1.0`. +- `listOrders` — `GET /orders`, returning an array of `Order`. +- `getOrder` — `GET /orders/{orderId}`, returning an `Order` or a `404`. +- `cancelOrder` — `POST /orders/{orderId}/cancel`, returning `204` or `409`. +- `OrderStatus` — enum of `OPEN`, `PAID`, `SHIPPED`, and `CANCELLED`. +- `Order` — object with required `orderId`, `status`, and `total`; optional deprecated `couponCode`. +- `backofficeToken` — OAuth 2.0 client-credentials security scheme with `orders:write` scope, required for cancellation. + +#### Data flow +- Clients call the API at `https://api.shop.example/backoffice`; list and retrieve operations return order data, while cancellation accepts an order ID and returns a status response. + +#### Cross-cutting +- `Order` responses share the `OrderStatus` enum; `couponCode` is deprecated. +- Cancellation requires OAuth 2.0 client credentials; the contract specifies `409` as a possible cancellation response. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..8d4eac3c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,69 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:22:23Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> Defines the shop’s order, checkout, fulfilment, invoicing, customer, shipment, and stock workflows, together with the interfaces and deployment configuration that support them. + +#### Purpose +- Support customer checkout and order processing through fulfilment, shipping, invoicing, and back-office operations. +- Specify and package the shop’s application integrations, persistence mappings, service contracts, and deployment assets. + +#### Responsibilities +- **Order lifecycle and checkout:** Facelets checkout captures delivery and shipping choices; BPMN coordinates stock reservation, payment, approval, shipping, invoicing, and cancellation; the OpenAPI contract exposes order listing, retrieval, and cancellation. +- **Back-office operations and integration:** JSP renders searchable open orders and cancellation links; Camel routes validate incoming orders, audit them, route high-value orders for review, and submit other orders to ERP. +- **Commercial rules and billing:** Groovy `ShippingRules` calculates parcel charges and rejects overweight orders; Kotlin `InvoiceService` issues invoices, calculates totals, and selects tax rates. +- **Customer and shipment data:** MyBatis maps customer lookup, search, insertion, promotion, and deletion to `CUSTOMER`; Hibernate maps shipments and express shipments and configures shop and reporting persistence units. +- **Runtime and delivery:** Jakarta EE descriptors configure web and EJB components; Docker builds the application image; Kubernetes manifests deploy and expose it; GitHub Actions verifies, publishes, and deploys releases. +- **Stock service contract:** WSDL defines SOAP stock-level lookup and the unknown-SKU fault. + +#### Key units +- `orderFulfilment` — BPMN process coordinating reservation, payment, approval, shipping, and invoicing. +- `checkout.xhtml` / `checkoutBean` — checkout form and backing-bean data and actions. +- `ShippingRules` / `ShippingRulesSpec` — parcel pricing rules and Spock coverage. +- `InvoiceService`, `InvoiceLine`, `InvoiceNumber`, `InvoiceResult` — invoice issuance, calculations, identifiers, and outcomes. +- `orderIntegration`, `OrderValidator`, `InvoiceTranslator` — Camel order routing, validation, and ERP translation. +- `shop.customer.CustomerMapper` — MyBatis operations against `CUSTOMER`. +- `Shipment`, `ExpressShipment`, `shop`, `reporting` — shipment mappings and JTA/resource-local persistence units. +- `Shop Orders API` — OpenAPI contract for order list, retrieval, and cancellation. +- `StockPortType.GetStockLevel` — SOAP stock lookup operation with `UnknownSku` fault. +- `ReportDownloadServlet`, `RequestIdFilter`, `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener` — configured Jakarta EE web and EJB components. +- `release-backoffice`, `Dockerfile`, `orders-backoffice` Deployment/Service/Ingress — release workflow, container build, and Kubernetes runtime exposure. + +#### Data flow +- Checkout inputs bind to `checkoutBean`; shipping changes recalculate the displayed total, and form submission invokes order placement. +- In fulfilment, stock reservation may cancel an order on `STOCK_EMPTY`; otherwise the process waits for payment, routes totals above 1000 for approval, then ships and calls `invoicing`. +- Incoming JMS orders pass through validation and audit routing; high-value orders go to manual review, while other orders are translated and sent to ERP, with failures retried and dead-lettered. +- Completed orders enter `InvoiceService`, which rejects empty orders or generates and saves an invoice with a payment deadline. +- Customer and shipment operations map between application types and database tables through MyBatis and Hibernate. +- Release triggers lead to Maven verification, container publication, and Kubernetes deployment; Kubernetes Ingress routes back-office HTTP traffic through a Service to application pods. + +#### Dependencies +- **Application/domain types:** `Order`, `CompletedOrder`, `Invoice`, `InvoiceRepository`, `Customer`, `Parcel`, and shop checkout, stock, integration, web, and event classes. +- **Messaging and process interfaces:** JMS queues, Camel routes and endpoints, BPMN message `PaymentReceived`, external task topic `shipping`, and called process `invoicing`. +- **Databases and persistence:** `CUSTOMER`, `SHIPMENT`, `EXPRESS_SHIPMENT`, `SHIPMENT_SEQ`; `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`, and `META-INF/order-queries.xml`. +- **External contracts and services:** ERP HTTPS API, SOAP stock endpoint, OAuth 2.0 client-credentials security for cancellation, and `registry.shop.example`. +- **Runtime tooling:** Maven, Java 21, Jakarta EE, Hibernate, MyBatis, Camel, Spock, Kotlin coroutines, Docker, Kubernetes, and GitHub Actions. + +#### Cross-cutting +- Configuration spans integration property placeholders, Jakarta EE descriptors, persistence-unit settings, container environment variables, and Kubernetes Secret-backed database credentials. +- Operational controls include admin-role protection, request filtering, health/readiness probes, non-root container execution, resource limits, and deployment replicas. +- Failure handling is explicit in stock-out cancellation, overweight shipping rejection, invoice rejection for empty orders, and ERP retry/dead-letter routing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..56ec7379 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,45 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:20:49Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps shipment and express-shipment persistence to database tables, including order and parcel relationships and shipment lookup queries. + +#### Purpose +- Defines Hibernate mappings for shipment records, express-shipment extensions, and queries for undelivered shipments and carrier counts. + +#### Type +- Hibernate mapping XML; root element `hibernate-mapping`; no XML namespaces declared. +- References Hibernate Mapping DTD 3.0. + +#### Definitions +- Package: `shop.shipping`. +- Entity `Shipment` maps to table `SHIPMENT`: + - ID `id` → column `SHIPMENT_ID`; sequence generator uses `SHIPMENT_SEQ`. + - Properties: `trackingCode` → `TRACKING_CODE`; `carrier` → `CARRIER`; `shippedAt` → `SHIPPED_AT` (`timestamp`). + - Many-to-one `order` → class `shop.Order`, column `ORDER_ID`. + - Set `parcels` → one-to-many class `Parcel`, keyed by `SHIPMENT_ID`; inverse with `all-delete-orphan` cascade. +- Joined subclass `ExpressShipment` maps to `EXPRESS_SHIPMENT`, keyed by `SHIPMENT_ID`; property `deliveryWindow` → `DELIVERY_WINDOW`. +- Named query `Shipment.undelivered`: selects shipments where `deliveredAt` is null and `shippedAt` is before `:cutoff`. +- SQL query `Shipment.countByCarrier`: selects `CARRIER` and `count(*)` from `SHIPMENT`, grouped by `CARRIER`. + +#### Configuration +- `trackingCode`: column `TRACKING_CODE`, length `40`, not null. +- `carrier`: column `CARRIER`, length `12`. +- `order`: column `ORDER_ID`, not null. +- `parcels`: `inverse="true"`; `cascade="all-delete-orphan"`. +- `Shipment.undelivered`: parameter `:cutoff`. + +#### Dependencies +- Class references: `shop.Order`, `Parcel`; package-relative mapped classes `Shipment`, `ExpressShipment`. +- Database tables and columns: `SHIPMENT`, `EXPRESS_SHIPMENT`, `SHIPMENT_ID`, `TRACKING_CODE`, `CARRIER`, `SHIPPED_AT`, `ORDER_ID`, `DELIVERY_WINDOW`. +- Sequence: `SHIPMENT_SEQ`. +- DTD: `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/persistence/package.ai.md new file mode 100644 index 00000000..ce7200ec --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/persistence/package.ai.md @@ -0,0 +1,42 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:22:14Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Persists shipment and order-related data through Hibernate mappings and configures JTA shop and resource-local reporting persistence units. + +#### Purpose +- Maps shipments, express-shipment extensions, and their order and parcel relationships to database tables. +- Configures persistence providers, data sources, managed classes, and Hibernate properties for shop operations and reporting. + +#### Responsibilities +- **Shipment persistence:** Maps `Shipment` and `ExpressShipment`, their fields and associations, and shipment lookup and carrier-count queries. +- **Persistence-unit setup:** Defines the JTA `shop` unit and resource-local `reporting` unit, including their data sources, managed classes, and mapping file. + +#### Key units +- `Shipment` — maps shipment identifiers, tracking, carrier, timestamp, order, and parcels to `SHIPMENT`. +- `ExpressShipment` — joined subclass mapped to `EXPRESS_SHIPMENT`, with a `deliveryWindow` property. +- `Shipment.undelivered` — selects shipments with no delivery timestamp and a shipment time before `:cutoff`. +- `Shipment.countByCarrier` — groups shipment counts by `CARRIER`. +- `shop` persistence unit — configures Hibernate JPA with JTA and manages order-related classes. +- `reporting` persistence unit — configures resource-local persistence for `shop.reporting.DailyRevenue`. + +#### Data flow +- Hibernate maps shipment records to `SHIPMENT` and express-shipment extensions to `EXPRESS_SHIPMENT`; `Shipment` associates with `shop.Order` and owns an inverse, delete-orphan-cascaded parcel set. +- The `shop` persistence unit uses `java:/jdbc/ShopDS` and `META-INF/order-queries.xml`; the `reporting` unit uses `java:/jdbc/ReportingDS`. + +#### Dependencies +- Entity classes: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue`, and `Parcel`. +- Database objects: `SHIPMENT`, `EXPRESS_SHIPMENT`, and sequence `SHIPMENT_SEQ`. +- Hibernate provider: `org.hibernate.jpa.HibernatePersistenceProvider`; dialect: `org.hibernate.dialect.PostgreSQLDialect`. +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`; mapping file: `META-INF/order-queries.xml`. + +#### Cross-cutting +- Hibernate configuration sets JDBC batch size to `50`; credentials are configured in persistence properties. +- Shipment-to-parcel mapping uses inverse ownership and `all-delete-orphan` cascade; shipment-to-order is a required many-to-one association. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..39fb0bef --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/persistence/persistence.xml.ai.md @@ -0,0 +1,38 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:20:45Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Defines the `shop` JTA persistence unit and a separate resource-local persistence unit for reporting. + +#### Purpose +- Configures Hibernate persistence for shop orders and customers using a JTA data source. +- Defines a reporting persistence unit using a non-JTA data source. + +#### Type +- JPA `persistence.xml`; root element: `persistence`. +- Namespace: default `https://jakarta.ee/xml/ns/persistence`. + +#### Definitions +- Persistence unit `shop`: transaction type `JTA`; provider `org.hibernate.jpa.HibernatePersistenceProvider`; data source `java:/jdbc/ShopDS`; mapping file `META-INF/order-queries.xml`; managed classes `shop.Order`, `shop.OrderLine`, `shop.Customer`. +- Persistence unit `reporting`: transaction type `RESOURCE_LOCAL`; non-JTA data source `java:/jdbc/ReportingDS`; managed class `shop.reporting.DailyRevenue`; `exclude-unlisted-classes=true`. + +#### Configuration +- `hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect` +- `hibernate.jdbc.batch_size=50` +- `hibernate.connection.username=shop_app` +- `hibernate.connection.password=***` + +#### Dependencies +- Mapping file: `META-INF/order-queries.xml` +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS` +- Provider class: `org.hibernate.jpa.HibernatePersistenceProvider` +- Entity classes: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..8aaa7422 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,43 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:20:54Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Defines a SOAP service for retrieving a product’s available stock by SKU, with an `UnknownSku` fault. + +#### Purpose +- Describes the `GetStockLevel` operation and its request, response, and fault contract. +- Publishes the SOAP endpoint used by stock clients. + +#### Type +- WSDL; root element `definitions`. +- Namespaces: default `http://schemas.xmlsoap.org/wsdl/`; `soap` = `http://schemas.xmlsoap.org/wsdl/soap/`; `tns` = `http://shop.example/stock`; `xs` = `http://www.w3.org/2001/XMLSchema`. + +#### Definitions +- Service `StockService`; port `StockPort` uses binding `tns:StockSoapBinding`. +- Port type `StockPortType`: operation `GetStockLevel` takes `tns:GetStockLevelInput`, returns `tns:GetStockLevelOutput`, and declares fault `UnknownSku` (`tns:UnknownSku`). +- Messages: + - `GetStockLevelInput`: `parameters` references `tns:StockLevelRequest`. + - `GetStockLevelOutput`: `parameters` references `tns:StockLevelResponse`. + - `UnknownSku`: `fault` uses type `tns:UnknownSkuFault`. +- Schema types in `http://shop.example/stock`: + - `StockLevelRequest`: `sku` (`xs:string`). + - `StockLevelResponse`: `available` (`xs:int`). + - `UnknownSkuFault`: `sku` (`xs:string`). +- Binding `StockSoapBinding` for `tns:StockPortType`: document style, SOAP/HTTP transport, literal input/output bodies, literal `UnknownSku` fault. + +#### Configuration +- SOAP address: `https://erp.shop.example/soap/stock`. +- SOAP action for `GetStockLevel`: `http://shop.example/stock/GetStockLevel`. + +#### Dependencies +- XML Schema built-in types: `xs:string`, `xs:int`. +- SOAP/HTTP transport: `http://schemas.xmlsoap.org/soap/http`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/wsdl/package.ai.md new file mode 100644 index 00000000..05924421 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/other/wsdl/package.ai.md @@ -0,0 +1,31 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:22:19Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Defines the contract clients use to query a product’s available stock by SKU and handle unknown-SKU faults. + +#### Purpose +- Describes the `GetStockLevel` SOAP request, response, and `UnknownSku` fault. +- Publishes the stock service endpoint and SOAP binding. + +#### Responsibilities +- Specify stock lookup messages and schema types: `StockLevelRequest`, `StockLevelResponse`, and `UnknownSkuFault`. +- Expose the operation through a document/literal SOAP-over-HTTP service. + +#### Key units +- `StockService` / `StockPort` — service and endpoint at `https://erp.shop.example/soap/stock`. +- `StockPortType.GetStockLevel` — accepts a SKU and returns availability, with an `UnknownSku` fault. +- `StockSoapBinding` — binds the operation to SOAP/HTTP with literal bodies and fault. + +#### Data flow +- Client sends `StockLevelRequest.sku`; `GetStockLevel` returns `StockLevelResponse.available` or an `UnknownSkuFault` containing the SKU. + +#### Dependencies +- XML Schema built-in types `xs:string` and `xs:int`. +- SOAP/HTTP transport; `GetStockLevel` SOAP action is `http://shop.example/stock/GetStockLevel`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..015e3850 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/package.ai.md @@ -0,0 +1,59 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:22:34Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> Supports the shop’s order lifecycle from checkout and fulfilment through cancellation, invoicing, back-office management, and deployment. + +#### Purpose +- Coordinate customer order processing, commercial rules, stock and payment interactions, shipping, invoicing, and back-office operations. +- Provide the persistence mappings, service contracts, runtime configuration, and delivery assets needed to run the shop application. + +#### Responsibilities +- **Checkout and order lifecycle:** `checkout.xhtml` and `checkoutBean` collect delivery and shipping choices; `orderFulfilment` coordinates stock reservation, payment, approval, shipping, invoicing, and stock-out cancellation. +- **Back-office orders:** `OrderResource` exposes secured order lookup and cancellation, refunds and audits cancellations, and purges cancelled orders older than 30 days; JSP supports searching open orders and cancellation links. +- **Order integration:** Camel `orderIntegration` validates and audits incoming JMS orders, routes high-value orders for review, and submits others to ERP with retry and dead-letter handling. +- **Commercial services:** `ShippingRules` calculates parcel charges and rejects overweight orders; Kotlin `InvoiceService` validates completed orders, calculates totals and tax, and issues invoices. +- **Customer and shipment persistence:** MyBatis `CustomerMapper` operates on `CUSTOMER`; Hibernate maps `Shipment` and `ExpressShipment` and configures shop and reporting persistence units. +- **Contracts and runtime delivery:** OpenAPI describes order operations; WSDL specifies SOAP stock lookup. Jakarta EE descriptors, Docker, Kubernetes, and GitHub Actions configure and deploy the application. + +#### Key units +- `orderFulfilment` — BPMN process coordinating reservation, payment, approval, shipping, and invoicing. +- `checkout.xhtml` / `checkoutBean` — checkout form and its backing data and actions. +- `OrderResource` — role-restricted `/orders` operations for listing, retrieval, refund-backed cancellation, and scheduled cleanup. +- `ShippingRules` / `ShippingRulesSpec` — parcel pricing and its Spock tests. +- `InvoiceService`, `InvoiceLine`, `InvoiceNumber`, `InvoiceResult` — invoice issuance, calculations, identifiers, and outcomes. +- `orderIntegration`, `OrderValidator`, `InvoiceTranslator` — Camel routing, order validation, and ERP translation. +- `shop.customer.CustomerMapper` — MyBatis customer operations against `CUSTOMER`. +- `Shipment`, `ExpressShipment`, `shop`, `reporting` — shipment mappings and persistence-unit configuration. +- `Shop Orders API` — OpenAPI contract for order listing, retrieval, and cancellation. +- `StockPortType.GetStockLevel` — SOAP stock lookup operation with an `UnknownSku` fault. +- `ReportDownloadServlet`, `RequestIdFilter`, `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener` — configured Jakarta EE web and EJB components. +- `release-backoffice`, `Dockerfile`, `orders-backoffice` Deployment/Service/Ingress — release workflow, container build, and Kubernetes exposure. + +#### Data flow +- Checkout inputs bind to `checkoutBean`; shipping changes recalculate the displayed total, and submission invokes order placement. +- `orderFulfilment` reserves stock, cancels on `STOCK_EMPTY`, waits for payment, routes totals above 1000 for approval, then ships and calls `invoicing`. +- Incoming JMS orders pass through Camel validation and audit; high-value orders go to manual review, while others are translated and sent to ERP. +- Completed orders reach `InvoiceService`, which rejects empty orders or creates and saves an invoice with a payment deadline. +- `OrderResource` retrieves orders through `EntityManager` and `Order.open`; cancellation refunds through `PaymentGateway`, updates status, and records `order.cancelled` through `AuditLog`. Scheduled cleanup applies a 30-day cutoff and audits the affected-row count. +- Customer and shipment operations map application types to database tables; release workflows verify, publish a container image, and deploy it to Kubernetes. + +#### Dependencies +- **Domain and application types:** `Order`, `OrderStatus`, `CompletedOrder`, `Invoice`, `InvoiceRepository`, `Customer`, `Parcel`, and shop checkout, stock, integration, web, and event classes. +- **Collaborators and messaging:** `EntityManager`, `PaymentGateway`, `AuditLog`, JMS queues, Camel endpoints, BPMN message `PaymentReceived`, external task topic `shipping`, and called process `invoicing`. +- **Persistence:** `CUSTOMER`, `SHIPMENT`, `EXPRESS_SHIPMENT`, `SHIPMENT_SEQ`, `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`, and `META-INF/order-queries.xml`. +- **External services and tools:** ERP HTTPS API, SOAP stock endpoint, OAuth 2.0 client-credentials security, Maven, Java 21, Jakarta EE, Hibernate, MyBatis, Camel, Spock, Kotlin coroutines, Docker, Kubernetes, and GitHub Actions. + +#### Cross-cutting +- Back-office order operations require the `backoffice` or `admin` role; cancellation uses `REQUIRED` transaction semantics. +- Cleanup runs at 02:15 with `persistent = false`; resource-level refund, persistence, and audit failures are not handled. +- Configuration spans Jakarta EE descriptors, persistence units, integration property placeholders, container environment variables, and Kubernetes Secret-backed database credentials. +- Operational controls include request filtering, health and readiness probes, non-root container execution, resource limits, and deployment replicas. +- Explicit failure paths include stock-out cancellation, overweight-shipping rejection, empty-invoice rejection, and ERP retry/dead-letter routing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..65fc1fb8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-6-luna/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 2E28F989 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:22:44Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project centers on the shop order lifecycle: checkout submits orders, fulfilment coordinates stock reservation, payment, approval, shipping, invoicing, and cancellation, while integration routes orders for review or ERP submission. Back-office services and interfaces support order lookup and cancellation, alongside customer, shipment, stock, and invoice data access and persistence. Workflow definitions, service contracts, container packaging, and Kubernetes and CI/CD configuration support deployment of the Orders Backoffice application. + +#### Packages +- java — Backoffice order management provides secure order lookup, refund-backed cancellation with auditing, and scheduled cleanup of aged cancelled orders. +- java/shop — Backoffice order management supports order lookup, refund-backed cancellation, auditing, and scheduled removal of aged cancelled orders. +- other/actions/.github — Automates verification, versioned container publication, and production deployment for the Orders Backoffice application. +- other/actions/.github/workflows — Automates verification, container-image publication, and production Kubernetes deployment for the Orders Backoffice application. +- other/actions — Automates verification, container release, and production deployment of the Orders Backoffice application. +- other/bpmn — Orchestrates order fulfilment from stock reservation and payment through approval, shipping, invoicing, or cancellation when stock is unavailable. +- other/docker — Packages the Orders Backoffice Java application as a production-oriented container that exposes its HTTP service and reports liveness. +- other/facelets — The checkout flow collects delivery details and shipping preferences, recalculates the order total, and submits the order. +- other/groovy — Calculates parcel shipping charges from order value and weight, including free-shipping eligibility and rejection of parcels above the carrier’s weight limit. +- other/integration — Processes incoming orders by validating them, routing high-value orders for manual review, and submitting other orders to the ERP with audit and failure handling. +- other/jee — Configures the shop’s back-office web access and enterprise services for reporting, stock reservation, checkout, and order-placement events. +- other/jsp — Provides staff with a searchable view of open orders, including order totals and overdue status, and a way to cancel orders. +- other/k8s — Runs the Orders back-office application and makes it available internally and through HTTP at `backoffice.shop.example`. +- other/kotlin — Converts completed orders into numbered invoices, calculates line totals and category-based tax rates, and records invoices with payment deadlines. +- other/mybatis — Provides database access for customer records, including lookup, filtered search, loyalty-tier updates, insertion, and inactive-customer deletion. +- other/openapi — Defines how shop backoffice clients list and retrieve customer orders and request cancellation of orders that have not shipped. +- other — Defines the shop’s order, checkout, fulfilment, invoicing, customer, shipment, and stock workflows, together with the interfaces and deployment configuration that support them. +- other/persistence — Persists shipment and order-related data through Hibernate mappings and configures JTA shop and resource-local reporting persistence units. +- other/wsdl — Defines the contract clients use to query a product’s available stock by SKU and handle unknown-SKU faults. +- . — Supports the shop’s order lifecycle from checkout and fulfilment through cancellation, invoicing, back-office management, and deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..d33e3bd8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,44 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:24:00Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> A Jakarta EE back‑office service that manages customer orders, handling listing, retrieval, cancellation with refunds, and nightly cleanup of obsolete cancellations. + +#### Purpose +- Expose RESTful endpoints for order management. +- Process order cancellations with payment refunds and audit logging. +- Schedule nightly purge of cancelled orders. + +#### Responsibilities +- **Order retrieval** – list open orders, fetch by ID. +- **Order cancellation** – refund payment, update status, audit. +- **Scheduled maintenance** – nightly purge of old cancelled orders. + +#### Key units +- `OrderResource` – JAX‑RS resource at `/orders`; methods: `openOrders()`, `find(id)`, `cancel(id)`, `purgeCancelled()`. +- `PaymentGateway` – injected service for processing refunds. +- `AuditLog` – injected logger for audit events. +- `EntityManager em` – JPA persistence context for `Order` entity queries. + +#### Data flow +1. **Request** → `OrderResource` endpoint → `EntityManager` queries `Order` (named queries `Order.open`, `Order.purgeCancelled`). +2. **Cancellation**: `cancel(id)` → fetch `Order` → `payments.refund(reference, total)` → set status `CANCELLED` → `audit.record("order.cancelled")` → commit transaction. +3. **Purge**: scheduled `purgeCancelled()` → execute `Order.purgeCancelled` with `days` param → `audit.record("order.purged", count)`. + +#### Dependencies +- Jakarta EE: `@Stateless`, `@Schedule`, `@RolesAllowed`, `@Transactional`, `@Inject`, `@PersistenceContext`. +- JAX‑RS: `@Path`, `@GET`, `@POST`, `@Produces`, `Response`. +- JPA: `EntityManager`, named queries on `Order`. +- Domain: `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog`. + +#### Cross-cutting +- Stateless session bean ensures thread safety. +- Container‑managed transactions; rollback on failure. +- Role‑based security (`backoffice`, `admin`) on all endpoints. +- Audit logging for cancellation and purge actions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..1f52df89 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md @@ -0,0 +1,74 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:22:48Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 50211B16 +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Provides REST endpoints for back‑office order management, including listing open orders, retrieving a specific order, canceling orders, and nightly purging of old cancellations. + +#### Purpose +- Exposes CRUD‑like operations for orders via JAX‑RS. +- Handles cancellation logic and audit logging. +- Schedules nightly purge of cancelled orders. + +#### Type +- `public class OrderResource` + - `@Stateless`, `@Path("/orders")`, `@Produces(MediaType.APPLICATION_JSON)`, `@RolesAllowed({"backoffice","admin"})` + - Extends `Object`. + - Declares fields: `EntityManager em`, `PaymentGateway payments`, `AuditLog audit`. + - Declares methods: `openOrders()`, `find(long)`, `cancel(long)`, `purgeCancelled()`. + +#### Input +- `openOrders()` – no parameters. +- `find(long id)` – path parameter `id`. +- `cancel(long id)` – path parameter `id`. +- `purgeCancelled()` – no parameters, invoked by EJB scheduler. + +#### Output +- `openOrders()` – `List` of open orders. +- `find(long)` – `Response` with 200 and order or 404. +- `cancel(long)` – `Response` 204 or 404; triggers payment refund, status update, audit record. +- `purgeCancelled()` – no return; updates DB and records audit. + +#### Core logic +- `openOrders()` queries named query `Order.open`. +- `find(id)` retrieves order by primary key; returns 404 if null. +- `cancel(id)` + 1. Find order. + 2. If null → 404. + 3. Refund via `payments.refund(reference, total)`. + 4. Set status to `CANCELLED`. + 5. Record audit `"order.cancelled"`. + 6. Return 204. +- `purgeCancelled()` + 1. Execute named query `Order.purgeCancelled` with `days` parameter. + 2. Record audit `"order.purged"` with count of removed rows. + +#### Public API +- `openOrders() -> List` – list open orders. +- `find(long) -> Response` – get order by id. +- `cancel(long) -> Response` – cancel order. + +#### Dependencies +- `jakarta.annotation.security.RolesAllowed` +- `jakarta.ejb.EJB`, `Schedule`, `Stateless`, `TransactionAttribute`, `TransactionAttributeType` +- `jakarta.inject.Inject` +- `jakarta.persistence.EntityManager`, `PersistenceContext` +- `jakarta.ws.rs.GET`, `POST`, `Path`, `PathParam`, `Produces`, `Response` +- `jakarta.ws.rs.core.MediaType` +- `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog` + +#### Exceptions / Errors +- Returns `Response.Status.NOT_FOUND` when order not found. +- No explicit exception handling; relies on container transaction rollback on failure. + +#### Concurrency +- Stateless session bean; thread‑safe by container. +- `purgeCancelled()` runs in a scheduled, non‑persistent context. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/java/shop/package.ai.md new file mode 100644 index 00000000..367cb527 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/java/shop/package.ai.md @@ -0,0 +1,44 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:23:58Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Provides RESTful back‑office services for managing customer orders, including listing, retrieval, cancellation, and nightly cleanup of obsolete cancellations. + +#### Purpose +- Expose order‑management endpoints via JAX‑RS. +- Handle order cancellation with payment refund and audit logging. +- Schedule nightly purge of cancelled orders. + +#### Responsibilities +- **Order retrieval** – list open orders, fetch by ID. +- **Order cancellation** – process refunds, update status, audit. +- **Scheduled maintenance** – purge old cancelled orders nightly. + +#### Key units +- `OrderResource` – stateless JAX‑RS resource at `/orders`; methods: `openOrders()`, `find(id)`, `cancel(id)`, `purgeCancelled()`. +- `PaymentGateway` – injected service for processing refunds. +- `AuditLog` – injected logger for audit events. +- `EntityManager em` – JPA persistence context for `Order` entity queries. + +#### Data flow +1. **Request** → `OrderResource` endpoint (GET/POST) → `EntityManager` queries `Order` (named queries `Order.open`, `Order.purgeCancelled`). +2. **Cancellation**: `cancel(id)` → fetch `Order` → `payments.refund(reference, total)` → set status `CANCELLED` → `audit.record("order.cancelled")` → commit transaction. +3. **Purge**: scheduled `purgeCancelled()` → execute `Order.purgeCancelled` with `days` param → `audit.record("order.purged", count)`. + +#### Dependencies +- Jakarta EE: `@Stateless`, `@Schedule`, `@RolesAllowed`, `@Transactional`, `@Inject`, `@PersistenceContext`. +- JAX‑RS: `@Path`, `@GET`, `@POST`, `@Produces`, `Response`. +- JPA: `EntityManager`, named queries on `Order`. +- Domain: `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog`. + +#### Cross-cutting +- Stateless session bean ensures thread safety. +- Container‑managed transactions; rollback on failure. +- Role‑based security (`backoffice`, `admin`) on all endpoints. +- Audit logging for cancellation and purge actions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/.github/package.ai.md new file mode 100644 index 00000000..a6ff9854 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/.github/package.ai.md @@ -0,0 +1,39 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:24:07Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Automates the CI/CD pipeline for a Java Backoffice service, from build and test through Docker image creation to Kubernetes deployment. + +#### Purpose +- Continuous integration and delivery for the Backoffice service. + +#### Responsibilities +- **Build & Test**: Compile Java code and run unit tests across multiple Java versions. +- **Containerization**: Build Docker images and push them to a private registry. +- **Deployment**: Trigger a Kubernetes deployment workflow after image push. + +#### Key units +- **`release.yml`** – orchestrates build, image, and deploy jobs. +- **`build` job** – Maven (`mvn -B verify -Pci`) on `ubuntu-24.04` with Java 21/25 matrix. +- **`image` job** – Builds Docker image, tags with release version, pushes to `registry.shop.example`. +- **`deploy` job** – Calls reusable workflow `deploy-k8s.yml` for production deployment. + +#### Data flow +`push` to a tag → `build` → `image` → `deploy` → Kubernetes cluster. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Docker registry: `registry.shop.example` (credentials from `REGISTRY_USER`/`REGISTRY_TOKEN`). +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Java version matrix strategy. +- Secret handling for registry credentials. +- Environment‑specific configuration (`production`). +- Permission block to restrict actions to required scopes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..69641e35 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,39 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:24:04Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Automates building, testing, containerizing, and deploying a Java Backoffice service to a production Kubernetes cluster via GitHub Actions. + +#### Purpose +- Continuous integration and delivery pipeline for the Backoffice service. + +#### Responsibilities +- **Build & Test**: Compile Java code and run unit tests across multiple Java versions. +- **Containerization**: Build Docker images and push them to a private registry. +- **Deployment**: Trigger a Kubernetes deployment workflow after image push. + +#### Key units +- **`release.yml`** – GitHub Actions workflow orchestrating build, image, and deploy jobs. +- **`build` job** – Runs Maven (`mvn -B verify -Pci`) on `ubuntu-24.04` with Java 21 and 25 matrices. +- **`image` job** – Builds Docker image, tags with release version, and pushes to `registry.shop.example`. +- **`deploy` job** – Calls reusable workflow `deploy-k8s.yml` to deploy to the `production` environment. + +#### Data flow +`push` to a tag → `build` → `image` → `deploy` → Kubernetes cluster. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Docker registry: `registry.shop.example` (credentials from `REGISTRY_USER` and `REGISTRY_TOKEN` secrets). +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Matrix strategy for Java versions. +- Secret handling for registry credentials. +- Environment‑specific configuration (`production`). +- Permission block to restrict actions to required scopes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..a50fbf9c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,41 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:22:51Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds, tests, containerizes, and deploys the Backoffice service to production Kubernetes. + +#### Purpose +- Build and test Java application. +- Create and push Docker image. +- Trigger Kubernetes deployment. + +#### Type +- GitHub Actions workflow (`release.yml`), API v4. + +#### Definitions +- **Triggers**: `push` on tags matching `v*`; `workflow_dispatch`. +- **Jobs**: + - `build`: runs on `ubuntu-24.04`, matrix `java: [21, 25]`. + - Steps: `actions/checkout@v4`, `actions/setup-java@v4` (distribution `temurin`, `java-version` from matrix), `Build and test` (`mvn -B verify -Pci`). + - `image`: depends on `build`, runs on `ubuntu-24.04`, environment `production`. + - Steps: `actions/checkout@v4`, `docker/login-action@v3` (registry `registry.shop.example`, credentials from secrets), `Push the image` (`docker build` and `docker push` with tag `${GITHUB_REF_NAME#v}`). + - `deploy`: depends on `image`, uses reusable workflow `./.github/workflows/deploy-k8s.yml` with `environment: production`, inherits secrets. + +#### Configuration +- `java-version`: `${{ matrix.java }}`. +- Docker image tag: `${GITHUB_REF_NAME#v}`. +- Registry credentials: `REGISTRY_USER`, `REGISTRY_TOKEN` from secrets. + +#### Dependencies +- Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Docker registry: `registry.shop.example`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/package.ai.md new file mode 100644 index 00000000..98d80261 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/actions/package.ai.md @@ -0,0 +1,39 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:24:10Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Automates the CI/CD pipeline for a Java Backoffice service, from build and test through Docker image creation to Kubernetes deployment. + +#### Purpose +- Continuous integration and delivery for the Backoffice service. + +#### Responsibilities +- **Build & Test**: Compile Java code and run unit tests across multiple Java versions. +- **Containerization**: Build Docker images and push them to a private registry. +- **Deployment**: Trigger a Kubernetes deployment workflow after image push. + +#### Key units +- **`release.yml`** – orchestrates build, image, and deploy jobs. +- **`build` job** – Maven (`mvn -B verify -Pci`) on `ubuntu-24.04` with Java 21/25 matrix. +- **`image` job** – Builds Docker image, tags with release version, pushes to `registry.shop.example`. +- **`deploy` job** – Calls reusable workflow `deploy-k8s.yml` for production deployment. + +#### Data flow +`push` to a tag → `build` → `image` → `deploy` → Kubernetes cluster. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Docker registry: `registry.shop.example` (credentials from `REGISTRY_USER`/`REGISTRY_TOKEN`). +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Java version matrix strategy. +- Secret handling for registry credentials. +- Environment‑specific configuration (`production`). +- Permission block to restrict actions to required scopes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..00cdc673 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,74 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:22:53Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 7ADEA688 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1; decisions: 0; decision rules: 0 + +> Defines a BPMN process for order fulfilment, including stock reservation, payment wait, amount check, approval, shipping, invoicing, and cancellation paths. + +#### Purpose +- Models the order fulfilment workflow. +- Handles stock reservation, payment, large‑order approval, shipping, invoicing, and cancellation. + +#### Type +- BPMN 2.0 XML (`bpmn:definitions` root). +- Namespaces: + - `bpmn` → `http://www.omg.org/spec/BPMN/20100524/MODEL` + - `bpmndi` → `http://www.omg.org/spec/BPMN/20100524/DI` + - `dc` → `http://www.omg.org/spec/DD/20100524/DC` + - `camunda` → `http://camunda.org/schema/1.0/bpmn` + +#### Definitions +- **Messages** + - `msgPaymentReceived` (`name="PaymentReceived"`) +- **Errors** + - `errOutOfStock` (`name="OutOfStock"`, `errorCode="STOCK_EMPTY"`) +- **Process** `orderFulfilment` (`name="Order fulfilment"`, `isExecutable="true"`) + - **Events** + - `orderPlaced` (start) + - `waitForPayment` (intermediate catch, message event) + - `orderCompleted` (end) + - `orderCancelled` (end) + - **Tasks** + - `reserveStock` (service, `camunda:class="shop.bpm.ReserveStockDelegate"`) + - `approveOrder` (user, `camunda:candidateGroups="backoffice"`) + - `shipOrder` (service, `camunda:type="external"`, `camunda:topic="shipping"`) + - `createInvoice` (call, `calledElement="invoicing"`) + - **Gateways** + - `amountCheck` (exclusive, `name="Large order?"`) + - **Boundary Event** + - `stockMissing` (attached to `reserveStock`, error event `errOutOfStock`) + - **Sequence Flows** + - `toReserve` (`orderPlaced → reserveStock`) + - `toWaitPayment` (`reserveStock → waitForPayment`) + - `toAmountCheck` (`waitForPayment → amountCheck`) + - `large` (`amountCheck → approveOrder`, condition `${order.total > 1000}`) + - `small` (`amountCheck → shipOrder`, condition `${order.total <= 1000}`) + - `approvedToShip` (`approveOrder → shipOrder`) + - `toInvoice` (`shipOrder → createInvoice`) + - `toEnd` (`createInvoice → orderCompleted`) + - `toCancelled` (`stockMissing → orderCancelled`) + +#### Configuration +- `camunda:class="shop.bpm.ReserveStockDelegate"` +- `camunda:candidateGroups="backoffice"` +- `camunda:type="external"` +- `camunda:topic="shipping"` +- Condition expressions: `${order.total > 1000}`, `${order.total <= 1000}` + +#### Dependencies +- External service: `shop.bpm.ReserveStockDelegate` (Java class). +- External topic: `shipping` (Camunda external task). +- Called element: `invoicing` (sub‑process or external service). +- Message event definition references `msgPaymentReceived`. +- Error event definition references `errOutOfStock`. + +#### Diagram +- BPMN diagram `fulfilmentDiagram` with plane `plane` containing shapes for `orderPlaced`, `reserveStock`, and `shipOrder` with specified bounds. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/bpmn/package.ai.md new file mode 100644 index 00000000..fdae3ff6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/bpmn/package.ai.md @@ -0,0 +1,54 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:24:12Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> Provides a BPMN‑based workflow for handling order fulfilment, from stock reservation through payment, approval, shipping, invoicing, and cancellation. + +#### Purpose +- Model the end‑to‑end order fulfilment process. +- Coordinate stock, payment, approval, shipping, and invoicing steps. + +#### Responsibilities +- **Order lifecycle management**: start, payment wait, approval, shipping, invoicing, cancellation. +- **Stock handling**: reserve stock and react to out‑of‑stock errors. +- **Payment coordination**: wait for external payment message. +- **Large‑order approval**: gate for orders over €1,000. +- **External task integration**: ship order via external topic. +- **Sub‑process invocation**: call invoicing service. + +#### Key units +- **Process** `orderFulfilment` – orchestrates all tasks and events. +- **Service task** `reserveStock` – Java delegate `shop.bpm.ReserveStockDelegate`. +- **User task** `approveOrder` – backoffice approval. +- **External task** `shipOrder` – topic `shipping`. +- **Call activity** `createInvoice` – invokes `invoicing` element. +- **Message** `msgPaymentReceived` – triggers payment wait. +- **Error** `errOutOfStock` – handles stock shortages. +- **Gateway** `amountCheck` – routes based on `${order.total > 1000}`. + +#### Data flow +1. **Start**: `orderPlaced` event → `reserveStock`. +2. **Stock reservation**: on success → `waitForPayment`; on error (`errOutOfStock`) → `orderCancelled`. +3. **Payment wait**: receives `msgPaymentReceived` → `amountCheck`. +4. **Amount check**: if large → `approveOrder`; if small → `shipOrder`. +5. **Approval**: after `approveOrder` → `shipOrder`. +6. **Shipping**: external task completes → `createInvoice`. +7. **Invoicing**: call activity completes → `orderCompleted`. + +#### Dependencies +- **Java delegate**: `shop.bpm.ReserveStockDelegate`. +- **External task topic**: `shipping`. +- **Called element**: `invoicing` (sub‑process or external service). +- **Message event**: `msgPaymentReceived`. +- **Error event**: `errOutOfStock`. + +#### Cross-cutting +- Camunda BPMN 2.0 XML with `camunda` namespace for service, user, external, and call tasks. +- Conditional expressions `${order.total > 1000}` and `${order.total <= 1000}` for gateway routing. +- Error handling via boundary event attached to `reserveStock`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..30c298bd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/docker/Dockerfile.ai.md @@ -0,0 +1,56 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:22:59Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds a Java back‑office service, compiles it with Maven, and runs the resulting JAR in an Alpine JRE container with health checks. + +#### Purpose +- Compile and package a Maven project into a JAR. +- Deploy the JAR in a lightweight Java runtime. +- Expose the service on port 8080 with health monitoring. + +#### Type +- `Dockerfile` + Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine` + +#### Definitions +- **Build stage** (`build`): + - `WORKDIR /src` + - `COPY pom.xml .` + - `RUN mvn -B dependency:go-offline` + - `COPY src ./src` + - `RUN mvn -B package -DskipTests` +- **Runtime stage**: + - `ARG APP_VERSION=2.1.0` + - `ENV JAVA_OPTS="-XX:MaxRAMPercentage=75" SHOP_PROFILE=production` + - `RUN addgroup -S shop && adduser -S backoffice -G shop` + - `COPY --from=build /src/target/orders-backoffice.jar /opt/shop/orders-backoffice.jar` + - `EXPOSE 8080` + - `USER backoffice` + - `HEALTHCHECK --interval=30s CMD wget -qO- http://localhost:8080/health/live || exit 1` + - `ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"]` + +#### Configuration +- `APP_VERSION=2.1.0` +- `JAVA_OPTS="-XX:MaxRAMPercentage=75"` +- `SHOP_PROFILE=production` +- `EXPOSE 8080` +- Health check URL: `http://localhost:8080/health/live` + +#### Dependencies +- `maven:3.9-eclipse-temurin-21` (build image) +- `eclipse-temurin:21-jre-alpine` (runtime image) +- Maven project `pom.xml` and source `src/` +- JAR `orders-backoffice.jar` produced by Maven +- `wget` (used in health check) +- User `backoffice` in group `shop` +- Port `8080` exposed for the application. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/docker/package.ai.md new file mode 100644 index 00000000..e61808d5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/docker/package.ai.md @@ -0,0 +1,43 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:24:16Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> Builds and deploys a Java back‑office service as a Docker image, compiling the Maven project into a JAR and running it in an Alpine JRE container with health monitoring. + +#### Purpose +- Compile a Maven‑based Java back‑office application into a runnable JAR. +- Package the JAR into a lightweight Docker image for production deployment. +- Provide health checks and expose the service on port 8080. + +#### Responsibilities +- **Build pipeline**: Maven dependency resolution, source compilation, and JAR packaging. +- **Containerization**: Multi‑stage Docker build, user isolation, environment configuration, and health‑check setup. +- **Runtime configuration**: JVM options, profile selection, and entrypoint execution. + +#### Key units +- **Dockerfile** – orchestrates the two‑stage build, sets environment variables (`JAVA_OPTS`, `SHOP_PROFILE`), exposes port 8080, defines healthcheck, and runs the JAR. +- **orders-backoffice.jar** – the compiled application artifact produced by Maven. +- **Maven project** (`pom.xml`, `src/`) – source and build definition for the back‑office service. + +#### Data flow +1. **Build stage**: `pom.xml` → Maven resolves dependencies → compiles `src/` → produces `orders-backoffice.jar`. +2. **Runtime stage**: `orders-backoffice.jar` is copied into `/opt/shop/`, environment variables are set, and the JAR is executed with `java $JAVA_OPTS -jar ...`. +3. Healthcheck periodically requests `http://localhost:8080/health/live` to verify service liveness. + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21` (build) and `eclipse-temurin:21-jre-alpine` (runtime). +- Maven project files (`pom.xml`, `src/`). +- `wget` utility for the healthcheck. +- User `backoffice` in group `shop` for non‑root execution. + +#### Cross-cutting +- Multi‑stage Docker build pattern for separating build and runtime environments. +- Consistent use of environment variables (`APP_VERSION`, `JAVA_OPTS`, `SHOP_PROFILE`) for configuration. +- Healthcheck integration using `wget` to expose a liveness endpoint. +- User/group isolation (`backoffice`/`shop`) for security. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..c5eadfcb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,48 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:23:12Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> A checkout page that collects shipping address, selects shipping method, shows total, and places an order. + +#### Purpose +- Collect shipping address and method. +- Display order total. +- Submit order. + +#### Type +- Facelets page (`checkout.xhtml`). +- Uses template `/WEB-INF/templates/shop.xhtml`. +- Tag libraries: `h` = `jakarta.faces.html`, `f` = `jakarta.faces.core`, `ui` = `jakarta.faces.facelets`. + +#### Data +- `#{checkoutBean.address.street}` (required). +- `#{checkoutBean.address.zip}` (validated by regex `[0-9]{5}`). +- `#{checkoutBean.shippingMethod}`. +- `#{checkoutBean.shippingMethods}` (select items). +- `#{checkoutBean.total}` (converted to currency EUR). +- Includes `/WEB-INF/includes/payment-hints.xhtml`. + +#### Actions +- Form `checkoutForm` submits to `#{checkoutBean.placeOrder}` via `h:commandButton`. +- Ajax on `shipping` menu: listener `#{checkoutBean.recalculate}`, renders component `total`. + +#### Structure +- Defines `content` region of template. +- Includes payment hints fragment. + +#### Server code +- No scriptlets or expressions beyond EL. + +#### Dependencies +- Tag libraries: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- Template: `/WEB-INF/templates/shop.xhtml`. +- Include: `/WEB-INF/includes/payment-hints.xhtml`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/facelets/package.ai.md new file mode 100644 index 00000000..98c2c150 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/facelets/package.ai.md @@ -0,0 +1,45 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:24:19Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> A JSF checkout page that gathers shipping details, lets the user pick a shipping method, shows the order total, and submits the order. + +#### Purpose +- Capture shipping address and method. +- Display calculated order total. +- Submit the order to the server. + +#### Responsibilities +- **User input collection** – shipping address fields, shipping method selector. +- **Order calculation** – recalculate total when shipping changes. +- **Order submission** – invoke `checkoutBean.placeOrder`. +- **UI composition** – embed payment hints and use a common shop layout. + +#### Key units +- **`checkout.xhtml`** – Facelets page, main UI. +- **`checkoutBean`** – backing bean (not shown) providing `address`, `shippingMethod`, `shippingMethods`, `total`, `recalculate()`, `placeOrder()`. +- **`/WEB-INF/templates/shop.xhtml`** – master template providing the page skeleton. +- **`/WEB-INF/includes/payment-hints.xhtml`** – reusable fragment with payment guidance. + +#### Data flow +1. User enters `address.street`, `address.zip` (validated by `[0-9]{5}`) and selects `shippingMethod`. +2. Changing `shippingMethod` triggers `checkoutBean.recalculate()` via Ajax, updating the `total` component. +3. Clicking the submit button calls `checkoutBean.placeOrder()`, sending the collected data to the server. + +#### Dependencies +- **Tag libraries**: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- **Template**: `/WEB-INF/templates/shop.xhtml`. +- **Include**: `/WEB-INF/includes/payment-hints.xhtml`. +- **Backing bean**: `checkoutBean` (assumed to be a CDI/JSF managed bean). + +#### Cross-cutting +- **EL expressions** used throughout for data binding and method calls. +- **Ajax** employed for dynamic total recalculation. +- **Validation** applied to ZIP code via regex. +- **Currency formatting** applied to `total` (EUR). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..f2ac0edd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,67 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:23:14Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Tests shipping cost calculation, free‑shipping threshold, and overweight rejection for DHL parcels. + +#### Purpose +- Verify `ShippingRules.costFor` behavior for various weights and totals. +- Ensure free shipping applies above threshold. +- Confirm overweight parcels throw `ParcelTooHeavyException`. + +#### Type +- `class ShippingRulesSpec` (extends `Specification`) + - Modifiers: none + - Imports: `groovy.transform.CompileStatic`, `spock.lang.Specification`, `spock.lang.Unroll` +- `class ShippingRules` (annotated `@CompileStatic`) + - Modifiers: none + - Fields: `String carrier`, `BigDecimal maxParcelKg` + - Method: `BigDecimal costFor(Order order)` + +#### Input +- `ShippingRulesSpec` constructor: none. +- `ShippingRulesSpec` fields: `static final BigDecimal FREE_SHIPPING_THRESHOLD = 50.00`, `def rules = new ShippingRules(carrier: 'DHL', maxParcelKg: 31.5)` +- `ShippingRules.costFor` parameters: `Order order` (properties `total: BigDecimal`, `weightKg: BigDecimal`). +- `ShippingRulesSpec` test methods create `Order` instances with `total` and `weightKg`. + +#### Output +- `ShippingRules.costFor` returns `BigDecimal` cost or `0` for free shipping. +- Throws `ParcelTooHeavyException` when `order.weightKg > maxParcelKg`. +- Test methods assert returned cost or exception. + +#### Core logic +- In `costFor`: + 1. If `order.weightKg > maxParcelKg` → throw `ParcelTooHeavyException`. + 2. If `order.total >= ShippingRulesSpec.FREE_SHIPPING_THRESHOLD` → return `0`. + 3. Define tiers: `[[upTo: 2, price: 4.99], [upTo: 10, price: 9.99], [upTo: 31.5, price: 19.99]]`. + 4. Find first tier where `order.weightKg <= tier.upTo` and return `tier.price` as `BigDecimal`. + +#### Public API +- `ShippingRulesSpec."orders above the threshold ship for free"() -> void` – test free shipping. +- `ShippingRulesSpec."a parcel of #weight kg costs #expected"() -> void` – parameterized cost test. +- `ShippingRulesSpec."an overweight parcel is rejected"() -> void` – test overweight exception. +- `ShippingRulesSpec.heavyOrder(BigDecimal kg) -> Order` – helper. +- `ShippingRules.costFor(Order order) -> BigDecimal` – shipping cost calculation. + +#### Dependencies +- `groovy.transform.CompileStatic` +- `spock.lang.Specification` +- `spock.lang.Unroll` +- `Order` (assumed defined elsewhere) +- `ParcelTooHeavyException` (assumed defined elsewhere) + +#### Exceptions / Errors +- `ParcelTooHeavyException` thrown when parcel weight exceeds `maxParcelKg`. +- No other explicit exceptions. + +#### Concurrency +- No concurrency constructs; all operations are single‑threaded. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/groovy/package.ai.md new file mode 100644 index 00000000..e7ac95d5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/groovy/package.ai.md @@ -0,0 +1,38 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T08:24:30Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> Provides shipping cost calculation logic and tests for DHL parcel shipping rules. + +#### Purpose +- Verify shipping cost calculation, free‑shipping threshold, and overweight rejection for DHL parcels. + +#### Responsibilities +- Compute shipping cost based on parcel weight and order total. +- Enforce free shipping for orders above a threshold. +- Reject parcels exceeding the maximum allowed weight. + +#### Key units +- **ShippingRules** – calculates `BigDecimal costFor(Order order)`; throws `ParcelTooHeavyException`. +- **ShippingRulesSpec** – Spock specification testing `ShippingRules`. +- **Order** – domain object with `total` and `weightKg`. +- **ParcelTooHeavyException** – exception for overweight parcels. + +#### Data flow +`Order` → `ShippingRules.costFor` → `BigDecimal cost` or `ParcelTooHeavyException`. + +#### Dependencies +- `groovy.transform.CompileStatic` +- `spock.lang.Specification`, `spock.lang.Unroll` +- External types: `Order`, `ParcelTooHeavyException` + +#### Cross-cutting +- Static type checking (`@CompileStatic`). +- Spock parameterized tests (`@Unroll`). +- Exception handling for overweight parcels. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..8809313f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md @@ -0,0 +1,65 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:23:25Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Configures a Spring‑Camel integration flow for processing incoming orders, validating them, routing to ERP or manual review, and handling exceptions. + +#### Purpose +- Defines order processing routes. +- Validates orders and translates invoices. +- Routes orders to ERP or manual review based on total. +- Handles ERP unavailability with redelivery and dead‑letter queue. + +#### Type +- Spring XML configuration (`` root). +- Declares Spring namespace `http://www.springframework.org/schema/beans` and Camel namespace `http://camel.apache.org/schema/spring`. +- Includes Camel schema location. + +#### Definitions +- **Beans** + - `orderValidator` → `shop.integration.OrderValidator` + - `invoiceTranslator` → `shop.integration.InvoiceTranslator` +- **Camel Context** `orderIntegration` + - **Property placeholder** `properties` → `classpath:integration.properties` + - **Exception handling** for `shop.integration.ErpUnavailableException` + - Redelivery: max 5, delay 2000 ms, exponential back‑off. + - Handled flag set to `true`. + - Dead‑letter queue: `jms:queue:orders.deadletter` + - **Routes** + - `incomingOrders` + - From `jms:queue:{{orders.incoming.queue}}` + - Bean `orderValidator.validate` + - Choice: if `${body.total} > {{orders.review.threshold}}` → `direct:manualReview`; else → `direct:toErp` + - Wire‑tap to `seda:orderAudit` + - `toErp` + - From `direct:toErp` + - Bean `invoiceTranslator` + - Dynamic to `https://{{erp.host}}/api/orders/${header.orderId}` + - `manualReview` + - From `direct:manualReview` + - Split on `${body.lines}` → `jms:queue:review.lines` + - (Commented out `legacyFtpImport` route) + +#### Configuration +- `orders.incoming.queue` (property placeholder) +- `orders.review.threshold` (property placeholder) +- `erp.host` (property placeholder) +- `orders.deadletter` queue URI +- Redelivery policy: `maximumRedeliveries="5"`, `redeliveryDelay="2000"`, `useExponentialBackOff="true"` + +#### Dependencies +- `shop.integration.OrderValidator` +- `shop.integration.InvoiceTranslator` +- `shop.integration.ErpUnavailableException` +- External JMS queues: `orders.incoming.queue`, `orders.deadletter`, `review.lines` +- External ERP endpoint: `https://{{erp.host}}/api/orders/${header.orderId}` +- Camel Spring schema `https://camel.apache.org/schema/spring/camel-spring.xsd` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/integration/package.ai.md new file mode 100644 index 00000000..a37b16be --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/integration/package.ai.md @@ -0,0 +1,49 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:24:39Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Orchestrates inbound order processing, validation, routing to ERP or manual review, and error handling within a Spring‑Camel integration flow. + +#### Purpose +- Define Camel routes for order ingestion and processing. +- Validate orders and translate invoices. +- Route orders to ERP or manual review based on total amount. +- Provide redelivery and dead‑letter handling for ERP failures. + +#### Responsibilities +- **Order Validation** – `orderValidator.validate` bean checks order integrity. +- **Invoice Translation** – `invoiceTranslator` converts order data for ERP consumption. +- **Routing Logic** – Camel routes decide between ERP submission or manual review. +- **Audit & Splitting** – Wire‑tap to `seda:orderAudit`; split order lines for review queue. +- **Error Management** – Redelivery policy and dead‑letter queue for `ErpUnavailableException`. + +#### Key units +- `orderValidator` (`shop.integration.OrderValidator`) – validates incoming orders. +- `invoiceTranslator` (`shop.integration.InvoiceTranslator`) – prepares ERP payload. +- `ErpUnavailableException` (`shop.integration.ErpUnavailableException`) – signals ERP outages. +- Camel context `orderIntegration` – hosts all routes and exception handling. +- Routes: `incomingOrders`, `toErp`, `manualReview` – core processing paths. + +#### Data flow +1. **Incoming**: `jms:queue:{{orders.incoming.queue}}` → `orderValidator.validate`. +2. **Decision**: If `body.total > {{orders.review.threshold}}` → `direct:manualReview`; else → `direct:toErp`. +3. **Audit**: Wire‑tap to `seda:orderAudit`. +4. **ERP Path**: `invoiceTranslator` → dynamic HTTPS call to `https://{{erp.host}}/api/orders/${header.orderId}`. +5. **Manual Review Path**: Split `body.lines` → `jms:queue:review.lines`. +6. **Failure**: On `ErpUnavailableException`, retry up to 5 times with exponential back‑off; then route to `jms:queue:orders.deadletter`. + +#### Dependencies +- **Spring Beans**: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`. +- **External Systems**: JMS queues (`orders.incoming.queue`, `orders.deadletter`, `review.lines`), ERP HTTPS endpoint (`https://{{erp.host}}/api/orders/...`). +- **Spring‑Camel Schema**: `https://camel.apache.org/schema/spring/camel-spring.xsd`. + +#### Cross-cutting +- Property placeholders (`orders.incoming.queue`, `orders.review.threshold`, `erp.host`) centralize configuration. +- Unified exception handling for ERP outages with redelivery and dead‑letter strategy. +- Wire‑tap pattern for audit logging without affecting main flow. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..7135168e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,44 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:23:29Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Configures Jakarta EE enterprise beans, their environment entries, references, activation settings, and transaction/interceptor behavior. + +#### Purpose +- Declares EJB components and their deployment descriptors. +- Specifies transaction attributes and interceptor bindings. + +#### Type +- Jakarta EE descriptor (`ejb-jar.xml`), root element `ejb-jar`, namespace `https://jakarta.ee/xml/ns/jakartaee` version `4.0`. + +#### Definitions +- **Session Beans** + - `StockReservationBean` (`shop.stock.StockReservationBean`, Stateless) + - Env entry `reservationMinutes` (`java.lang.Integer`, value `45`). + - `CheckoutSessionBean` (`shop.checkout.CheckoutSessionBean`, Stateful) + - Local reference `ejb/StockReservation` to `shop.stock.StockReservation`. +- **Message‑Driven Bean** + - `OrderPlacedListener` (`shop.events.OrderPlacedListener`) + - Activation property `destinationLookup` → `java:/jms/queue/OrderPlaced`. +- **Interceptors** + - `shop.audit.TimingInterceptor` applied globally via `` and ``. +- **Container Transaction** + - Method `StockReservationBean.reserve` uses `RequiresNew`. + +#### Configuration +- `reservationMinutes` = `45`. +- `destinationLookup` = `java:/jms/queue/OrderPlaced`. +- Transaction attribute for `StockReservationBean.reserve` = `RequiresNew`. +- Global interceptor binding to `shop.audit.TimingInterceptor`. + +#### Dependencies +- Java classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`, `shop.stock.StockReservation`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jee/package.ai.md new file mode 100644 index 00000000..60845850 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jee/package.ai.md @@ -0,0 +1,50 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:24:43Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> Provides Jakarta EE configuration for a shop back‑office application, wiring enterprise beans, web components, security, and data‑source resources. + +#### Purpose +- Declares enterprise beans, web servlets, filters, listeners, and security constraints for the shop back‑office. + +#### Responsibilities +- **EJB deployment**: session beans, message‑driven beans, interceptors, and transaction settings. +- **Web configuration**: servlet, filter, listener, session timeout, and JDBC resource reference. +- **Security**: role‑based access control for admin URLs. + +#### Key units +- `StockReservationBean` (`shop.stock.StockReservationBean`) – stateless, reserves stock, uses `RequiresNew` transaction. +- `CheckoutSessionBean` (`shop.checkout.CheckoutSessionBean`) – stateful, references `StockReservation`. +- `OrderPlacedListener` (`shop.events.OrderPlacedListener`) – listens on `java:/jms/queue/OrderPlaced`. +- `TimingInterceptor` (`shop.audit.TimingInterceptor`) – global timing interceptor. +- `ReportDownloadServlet` (`shop.web.ReportDownloadServlet`) – handles `/reports/*`. +- `RequestIdFilter` (`shop.web.RequestIdFilter`) – applies to all requests. +- `StartupAuditListener` (`shop.web.StartupAuditListener`) – application‑startup listener. +- `jdbc/ShopDS` – JDBC DataSource resource reference. + +#### Data flow +1. **Order placement** → `OrderPlacedListener` receives JMS message. +2. Listener triggers business logic that may call `StockReservationBean.reserve`. +3. `CheckoutSessionBean` coordinates checkout, invoking `StockReservation`. +4. Web layer: `ReportDownloadServlet` serves report files from `/var/shop/reports`. +5. `RequestIdFilter` injects request identifiers into all requests. +6. `StartupAuditListener` performs audit actions on application startup. + +#### Dependencies +- **Internal**: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`, `shop.web.ReportDownloadServlet`, `shop.web.RequestIdFilter`, `shop.web.StartupAuditListener`. +- **External**: Jakarta EE container (EJB, servlet, JMS), JDBC DataSource `jdbc/ShopDS`. + +#### Cross-cutting +- Global interceptor `TimingInterceptor` applied to all EJB methods. +- Transaction attribute `RequiresNew` on `StockReservationBean.reserve`. +- Environment entry `reservationMinutes` (45) for stock reservation timeout. +- Security constraint restricts `/admin/*` to role `admin`. +- Session timeout set to 20 minutes. +- Context parameter `shop.reportDirectory` supplies report path. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jee/web.xml.ai.md new file mode 100644 index 00000000..df812a62 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jee/web.xml.ai.md @@ -0,0 +1,46 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:23:32Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Configures the Jakarta EE web application “shop-backoffice”, defining servlets, filters, listeners, session timeout, security constraints, and a JDBC resource reference. + +#### Purpose +- Sets up servlet, filter, listener, and security configuration for the web app. + +#### Type +- Jakarta EE `web.xml` descriptor, root element ``; namespace `https://jakarta.ee/xml/ns/jakartaee` version `6.0`. + +#### Definitions +- **Context parameter**: `shop.reportDirectory` → `/var/shop/reports` +- **Servlet**: `ReportDownloadServlet` → class `shop.web.ReportDownloadServlet`, load‑on‑startup `1` +- **Servlet mapping**: `ReportDownloadServlet` → `/reports/*` +- **Filter**: `RequestIdFilter` → class `shop.web.RequestIdFilter` +- **Filter mapping**: `RequestIdFilter` → `/*` +- **Listener**: `shop.web.StartupAuditListener` +- **Session config**: timeout `20` minutes +- **Security constraint**: resource collection `backoffice` → `/admin/*`; auth constraint role `admin` +- **Security role**: `admin` +- **Resource reference**: `jdbc/ShopDS` of type `javax.sql.DataSource` + +#### Configuration +- `shop.reportDirectory` = `/var/shop/reports` +- `load-on-startup` for `ReportDownloadServlet` = `1` +- `session-timeout` = `20` +- `url-pattern` for `RequestIdFilter` = `/*` +- `url-pattern` for `ReportDownloadServlet` = `/reports/*` +- `url-pattern` for security constraint = `/admin/*` + +#### Dependencies +- Servlet class `shop.web.ReportDownloadServlet` +- Filter class `shop.web.RequestIdFilter` +- Listener class `shop.web.StartupAuditListener` +- JDBC resource `jdbc/ShopDS` (DataSource) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..10eb9439 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,71 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:23:35Z +- G: +- A: 0.0.0 +- X: file +- P: F6DC35F6 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> Displays a searchable list of open orders, allowing filtering by customer email and status, and providing a cancel link for each order. + +#### Purpose +- Show open orders with total and overdue status. +- Enable search by customer email and status. +- Offer cancel action per order. + +#### Type +- JSP page +- Content type: `text/html;charset=UTF-8` +- Tag libraries: + - `c` = `jakarta.tags.core` + - `fmt` = `jakarta.tags.fmt` + +#### Data +- Request attribute: `orderFilter` → `OrderFilter` (used for `pageSize`) +- Request attribute: `orders` → `List` (iterated with `var="order"`) +- Request parameter: `customerEmail` (used in search form) +- Request parameter: `status` (used in search form) +- Order properties accessed: + - `${order.number}` + - `${order.total}` + - `${order.overdue}` + - `${order.id}` + +#### Actions +- Search form: + - `action`: `${pageContext.request.contextPath}/orders/search` + - `method`: `get` + - Fields: + - `customerEmail` (text) + - `status` (select with values `OPEN`, `SHIPPED`) +- Cancel link per order: + - URL: `orders/${order.id}/cancel` + +#### Structure +- Includes: + - `/WEB-INF/jspf/header.jspf` + - `/WEB-INF/jspf/footer.jspf` + +#### Server code +- Scriptlet: + - Retrieves `OrderFilter` from request attribute `orderFilter`. + - Determines `pageSize` (default 25 if filter is null). +- Expression: + - `<%= pageSize %>` outputs the page size. + +#### Dependencies +- Java classes: + - `java.util.List` + - `shop.Order` + - `shop.OrderFilter` +- Tag libraries: + - `jakarta.tags.core` + - `jakarta.tags.fmt` +- Included JSP fragments: + - `/WEB-INF/jspf/header.jspf` + - `/WEB-INF/jspf/footer.jspf` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jsp/package.ai.md new file mode 100644 index 00000000..ca7f195b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/jsp/package.ai.md @@ -0,0 +1,41 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T08:24:45Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> A JSP page that lists open orders, supports filtering by customer email and status, and lets users cancel individual orders. + +#### Purpose +- Render a searchable table of open orders. +- Provide pagination via `OrderFilter`. +- Offer per‑order cancellation links. + +#### Responsibilities +- **Display**: Iterate over `List` and show order number, total, overdue flag, and cancel link. +- **Search**: Render a form that submits to `/orders/search` with `customerEmail` and `status` parameters. +- **Pagination**: Use `OrderFilter` from the request to determine page size (default 25). + +#### Key units +- **JSP page**: `order-list.jsp` – main view rendering orders. +- **Tag libraries**: `c` (`jakarta.tags.core`), `fmt` (`jakarta.tags.fmt`). +- **Included fragments**: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf`. + +#### Data flow +1. Controller populates request attributes `orderFilter` (optional) and `orders` (list of `Order`). +2. JSP reads `orderFilter` to set `pageSize`; iterates over `orders` to display each order. +3. User submits search form → controller filters orders and returns updated list. + +#### Dependencies +- **Java classes**: `shop.Order`, `shop.OrderFilter`, `java.util.List`. +- **Tag libraries**: `jakarta.tags.core`, `jakarta.tags.fmt`. +- **JSP fragments**: header and footer JSP files. + +#### Cross-cutting +- Uses EL expressions for order properties (`${order.number}`, `${order.total}`, `${order.overdue}`, `${order.id}`). +- Standard JSP scriptlet for retrieving `OrderFilter` and computing `pageSize`. +- Form uses GET method for idempotent search. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..a5631110 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,58 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:23:38Z +- G: +- A: 0.0.0 +- X: file +- P: 7217E4BA +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the `orders-backoffice` application, exposing it via a Service and Ingress. + +#### Purpose +- Runs the back‑office service for orders. +- Exposes the service on HTTP port 80. + +#### Type +- Kubernetes `Deployment` (apiVersion `apps/v1`) +- Kubernetes `Service` (apiVersion `v1`) +- Kubernetes `Ingress` (apiVersion `networking.k8s.io/v1`) + +#### Definitions +- **Deployment** `orders-backoffice` + - 3 replicas + - Container `backoffice` + - Image `registry.shop.example/orders-backoffice:2.1.0` + - Port `8080` + - Env: + - `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` + - `SHOP_DB_PASSWORD` from secret `orders-db-credentials` key `password` + - Readiness probe: HTTP GET `/health/ready` on port `8080` + - Resources limits: `memory: 768Mi`, `cpu: "1"` +- **Service** `orders-backoffice` + - Selector `app: orders-backoffice` + - Port `80` → target port `8080` +- **Ingress** `orders-backoffice` + - Host `backoffice.shop.example` + - Path `/` (Prefix) → service `orders-backoffice` port `80` + +#### Configuration +- `replicas=3` +- `image=registry.shop.example/orders-backoffice:2.1.0` +- `containerPort=8080` +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD` from secret `orders-db-credentials.password` +- `readinessProbe.path=/health/ready` +- `resources.limits.memory=768Mi` +- `resources.limits.cpu="1"` +- Service `port=80`, `targetPort=8080` +- Ingress host `backoffice.shop.example`, path `/` + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0` +- Secret `orders-db-credentials` (key `password`) +- Service `orders-backoffice` (used by Ingress) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/k8s/package.ai.md new file mode 100644 index 00000000..b22257f8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/k8s/package.ai.md @@ -0,0 +1,41 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:24:48Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Deploys and exposes the orders‑backoffice microservice in a Kubernetes cluster. + +#### Purpose +- Run the orders‑backoffice application. +- Expose it via HTTP on port 80. + +#### Responsibilities +- **Deployment**: manage pod lifecycle, replica count, container image, environment, probes, and resource limits. +- **Service**: provide stable cluster‑internal endpoint for the pods. +- **Ingress**: route external traffic to the service. + +#### Key units +- **Deployment `orders-backoffice`** – 3 replicas, container `backoffice` (image `registry.shop.example/orders-backoffice:2.1.0`, port 8080), env `SHOP_DB_URL` and `SHOP_DB_PASSWORD` from secret, readiness probe `/health/ready`, limits `memory:768Mi`, `cpu:1`. +- **Service `orders-backoffice`** – selector `app: orders-backoffice`, port 80 → target 8080. +- **Ingress `orders-backoffice`** – host `backoffice.shop.example`, path `/` → service `orders-backoffice` port 80. + +#### Data flow +1. **Ingress** receives external HTTP requests on `backoffice.shop.example/`. +2. Routes to **Service** `orders-backoffice` on port 80. +3. Service forwards to one of the **Deployment** pods on port 8080. +4. Pod serves requests, exposing readiness at `/health/ready`. + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0`. +- Secret `orders-db-credentials` (key `password`) for DB credentials. +- PostgreSQL database at `orders-db:5432`. + +#### Cross-cutting +- Environment variables for DB connectivity. +- Readiness probe ensures traffic only reaches healthy pods. +- Resource limits enforce CPU/memory constraints. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..d357da18 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,92 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:23:42Z +- G: +- A: 0.0.0 +- X: file +- P: 1879E12B +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Issues invoices for completed orders, assigning numbers, calculating due dates, and storing them. + +#### Purpose +- Generates and persists invoices for completed orders. +- Calculates due dates based on a payment term. +- Provides tax rate lookup for product categories. + +#### Type +- `final class InvoiceService` (class) + - Extends `Any`. + - Implements no interfaces. + - Modifiers: none. + - Annotations: none. +- `value class InvoiceNumber` (value) + - Modifiers: `@JvmInline`. + - Extends `Any`. +- `data class InvoiceLine` (data) + - Modifiers: none. + - Extends `Any`. +- `sealed interface InvoiceResult` (interface) + - Modifiers: none. + - Extends `Any`. + - Nested types: + - `data class Issued` (data) – implements `InvoiceResult`. + - `data class Rejected` (data) – implements `InvoiceResult`. + +#### Input +- `InvoiceService` constructor: `repository: InvoiceRepository`, `clock: () -> LocalDate = LocalDate::now`. +- `issue(order: CompletedOrder)` parameter: `order: CompletedOrder`. +- `taxRate(category: String)` parameter: `category: String`. +- `nextNumber()` uses internal `sequence` and `PREFIX`. +- `List.total()` operates on a list of `InvoiceLine`. + +#### Output +- `issue(order)` returns `InvoiceResult.Issued` with `InvoiceNumber` and `dueDate` or `InvoiceResult.Rejected` with reason. +- `taxRate` returns `BigDecimal` tax rate. +- `nextNumber` returns `InvoiceNumber`. +- `List.total()` returns `BigDecimal` total amount. + +#### Core logic +- `issue(order)` + 1. Reject if `order.lines` empty. + 2. Generate next invoice number via `nextNumber()`. + 3. Create `Invoice` with number, customerId, lines, dueDate (`clock().plusDays(PAYMENT_TERM_DAYS)`). + 4. Persist invoice via `repository.save(invoice)`. + 5. Return `InvoiceResult.Issued(number, invoice.dueDate)`. +- `taxRate(category)` returns 0.07 for reduced categories, else 0.19. +- `nextNumber()` increments `sequence` and formats `"INV-${sequence}"`. +- `InvoiceLine.amount` multiplies `unitPrice` by `quantity`. +- `List.total()` sums `amount` of each line. + +#### Public API +- `InvoiceService.issue(order: CompletedOrder) -> InvoiceResult` – issue invoice for order. +- `InvoiceService.taxRate(category: String) -> BigDecimal` – get tax rate. +- `InvoiceNumber.value: String` – underlying string. +- `InvoiceLine.sku: String` – product SKU. +- `InvoiceLine.quantity: Int` – quantity. +- `InvoiceLine.unitPrice: BigDecimal` – unit price. +- `InvoiceLine.amount: BigDecimal` – line total. +- `InvoiceResult.Issued.number: InvoiceNumber` – invoice number. +- `InvoiceResult.Issued.dueDate: LocalDate` – due date. +- `InvoiceResult.Rejected.reason: String` – rejection reason. +- `List.total() -> BigDecimal` – total amount of lines. + +#### Dependencies +- `java.math.BigDecimal` +- `java.time.LocalDate` +- `kotlinx.coroutines.Dispatchers` +- `kotlinx.coroutines.withContext` +- `shop.billing.InvoiceRepository` +- `shop.billing.CompletedOrder` +- `shop.billing.Invoice` (used in `issue`) + +#### Exceptions / Errors +- `issue` returns `InvoiceResult.Rejected` if order has no lines; no exceptions thrown. + +#### Concurrency +- `issue` runs in `Dispatchers.IO` context, ensuring IO-bound work off the main thread. +- No explicit synchronization; `sequence` is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/kotlin/package.ai.md new file mode 100644 index 00000000..e8f66315 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/kotlin/package.ai.md @@ -0,0 +1,48 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T08:24:51Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> A service that creates, numbers, and persists invoices for completed orders, calculating due dates and tax rates. + +#### Purpose +- Issue invoices for completed orders. +- Persist invoices via a repository. +- Compute due dates and tax rates. + +#### Responsibilities +- **Invoice generation** – create `Invoice` objects with sequential numbers and due dates. +- **Persistence** – delegate saving to `InvoiceRepository`. +- **Tax lookup** – provide tax rates per product category. +- **Line calculations** – compute line totals and invoice totals. + +#### Key units +- `InvoiceService` – orchestrates invoice creation and persistence. +- `InvoiceNumber` – inline value type for invoice identifiers. +- `InvoiceLine` – data class holding SKU, quantity, unit price, and computed amount. +- `InvoiceResult` (sealed) – outcome of issuing an invoice (`Issued` or `Rejected`). +- `InvoiceRepository` – external persistence interface. +- `CompletedOrder` – input domain model representing a finished order. + +#### Data flow +1. `issue(order: CompletedOrder)` receives an order. +2. Validates order lines; rejects if empty. +3. Calls `nextNumber()` to get a new `InvoiceNumber`. +4. Builds an `Invoice` with customer ID, lines, number, and due date (`clock().plusDays(PAYMENT_TERM_DAYS)`). +5. Persists the invoice via `repository.save(invoice)` inside `Dispatchers.IO`. +6. Returns `InvoiceResult.Issued` with number and due date, or `Rejected` with a reason. + +#### Dependencies +- **Internal**: `InvoiceRepository`, `CompletedOrder`, `Invoice`. +- **External**: `java.math.BigDecimal`, `java.time.LocalDate`, `kotlinx.coroutines.Dispatchers`, `kotlinx.coroutines.withContext`. + +#### Cross-cutting +- Uses a simple in‑memory `sequence` counter for numbering; not thread‑safe. +- All IO operations are dispatched to `Dispatchers.IO`. +- Tax rates are hard‑coded: 0.07 for reduced categories, 0.19 otherwise. +- Extension `List.total()` aggregates line amounts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..3de03f43 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,58 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:23:46Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Maps customer domain objects to SQL statements for CRUD and search operations. + +#### Purpose +- Provides MyBatis SQL mappings for `shop.customer.Customer` entities. +- Supports find, search, insert, update, and delete operations. + +#### Type +- MyBatis mapper XML +- Root element: `mapper` +- Namespace: `shop.customer.CustomerMapper` + +#### Definitions +- **ResultMap** `customerResult`: + - `id` → `CUSTOMER_ID` + - `email` → `EMAIL` + - `loyaltyTier` → `LOYALTY_TIER` +- **SQL fragment** `customerColumns`: `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT` +- **Select** `findByEmail`: + - Uses `customerColumns` + - Filters by `EMAIL = #{email}` +- **Select** `search`: + - Uses `customerColumns` + - Conditional `WHERE` clauses: + - `LOYALTY_TIER = #{tier}` if `tier` not null + - `CREATED_AT >= #{createdAfter}` if `createdAfter` not null + - Order by `${sortColumn}` +- **Insert** `insert`: + - Columns: `EMAIL, LOYALTY_TIER, CREATED_AT` + - Uses `now()` for `CREATED_AT` + - Generates key into `id` +- **Update** `promote`: + - Sets `LOYALTY_TIER = #{tier}` + - Targets `CUSTOMER_ID` in list `ids` via `` +- **Delete** `deleteInactive`: + - Deletes where `LAST_ORDER_AT < #{cutoff}` + +#### Configuration +- `useGeneratedKeys="true"` in `insert` +- `keyProperty="id"` in `insert` +- `open="(" separator="," close="")` in `` of `promote` + +#### Dependencies +- MyBatis DTD: `https://mybatis.org/dtd/mybatis-3-mapper.dtd` +- Domain class: `shop.customer.Customer` (entity) +- SQL tables: `CUSTOMER` (columns: `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/mybatis/package.ai.md new file mode 100644 index 00000000..c0c4d938 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/mybatis/package.ai.md @@ -0,0 +1,41 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:24:54Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Maps customer domain objects to SQL statements for CRUD and search operations. + +#### Purpose +- Provides MyBatis SQL mappings for `shop.customer.Customer` entities. +- Supports find, search, insert, update, and delete operations. + +#### Responsibilities +- **Data persistence**: CRUD operations for customer records. +- **Query building**: Dynamic search queries with optional filters and sorting. +- **Batch updates**: Promote multiple customers in a single statement. + +#### Key units +- `CustomerMapper` (namespace `shop.customer.CustomerMapper`): orchestrates all SQL operations. +- `customerResult` (ResultMap): maps `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER` to `shop.customer.Customer`. +- `customerColumns` (SQL fragment): reusable column list `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT`. + +#### Data flow +1. **Input**: method parameters (`email`, `tier`, `createdAfter`, `sortColumn`, `ids`, `cutoff`). +2. **Processing**: MyBatis constructs SQL using fragments, dynamic tags, and `` for batch lists. +3. **Output**: Result sets mapped to `Customer` objects or affected row counts. + +#### Dependencies +- **MyBatis**: DTD `https://mybatis.org/dtd/mybatis-3-mapper.dtd`, `useGeneratedKeys="true"`. +- **Domain**: `shop.customer.Customer` entity. +- **Database**: `CUSTOMER` table (`CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`). + +#### Cross-cutting +- Dynamic SQL tags (``, ``) for optional conditions. +- Parameter placeholders (`#{}`) and substitution (`${}`) for runtime values. +- Generated key handling (`keyProperty="id"`). +- Reusable SQL fragments for consistent column selection. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..cd16b135 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,45 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:23:49Z +- G: +- A: 0.0.0 +- X: file +- P: 34DB4705 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> The Shop Orders API lets back‑office users list, view, and cancel customer orders, exposing order status, totals, and optional coupon codes. + +#### Purpose +- List orders with optional status filter and limit. +- Retrieve a single order by ID. +- Cancel an order (requires write scope). + +#### Type +- OpenAPI 3.0.3 +- Title: `Shop Orders API` +- Version: `2.1.0` +- Server: `https://api.shop.example/backoffice` + +#### Operations +- `GET /orders` – `listOrders` – query `status` (`OrderStatus`), `limit` (int, max 200); 200 → array of `Order`. +- `GET /orders/{orderId}` – `getOrder` – path `orderId` (string); 200 → `Order`; 404 → not found. +- `POST /orders/{orderId}/cancel` – `cancelOrder` – path `orderId` (string); security `backofficeToken` with scope `orders:write`; 204 → cancelled; 409 → already shipped. + +#### Schemas +- `OrderStatus` – enum: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order` – object, required: `orderId`, `status`, `total`; properties: + - `orderId`: string + - `status`: `OrderStatus` + - `total`: number (double) + - `couponCode`: string (deprecated) + +#### Security and servers +- Security scheme `backofficeToken`: OAuth2 client‑credentials, token URL `https://auth.shop.example/token`, scope `orders:write`. +- Server URL: `https://api.shop.example/backoffice`. + +#### Dependencies +- None. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/openapi/package.ai.md new file mode 100644 index 00000000..72734f59 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/openapi/package.ai.md @@ -0,0 +1,41 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T08:25:03Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> The Shop Orders API provides back‑office endpoints for listing, retrieving, and canceling customer orders, exposing order status, totals, and optional coupon codes. + +#### Purpose +- Expose CRUD‑like operations for shop orders to back‑office users. +- Enforce OAuth2 client‑credentials with `orders:write` scope for destructive actions. + +#### Responsibilities +- **Order Retrieval** – list orders with optional status filter and limit; fetch a single order by ID. +- **Order Cancellation** – cancel an order, ensuring it is not already shipped. +- **Security** – protect cancel operation with OAuth2 scopes; expose public read endpoints. + +#### Key units +- **`listOrders`** (`GET /orders`) – returns an array of `Order` objects, filtered by `status` and limited by `limit`. +- **`getOrder`** (`GET /orders/{orderId}`) – returns a single `Order` or 404. +- **`cancelOrder`** (`POST /orders/{orderId}/cancel`) – cancels an order, returns 204 or 409 if already shipped. +- **`Order` schema** – defines `orderId`, `status`, `total`, and deprecated `couponCode`. +- **`OrderStatus` enum** – `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- **`backofficeToken` security scheme** – OAuth2 client‑credentials with `orders:write` scope. + +#### Data flow +1. Client calls `listOrders` or `getOrder` → server queries order store → returns `Order` data. +2. Client calls `cancelOrder` → server validates OAuth2 scope → checks order status → updates status to `CANCELLED` if eligible → returns 204 or 409. + +#### Dependencies +- OAuth2 token endpoint `https://auth.shop.example/token` for `backofficeToken`. +- No external data sources referenced in the specification. + +#### Cross-cutting +- All endpoints use JSON media type. +- `couponCode` field is marked deprecated but still part of the `Order` schema. +- Security is applied only to the cancel operation; read operations are public. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..50212cfb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,80 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:25:13Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> A modular shop‑backoffice system that builds, tests, containers, deploys, and exposes services for order processing, inventory, invoicing, and reporting. + +#### Purpose +- End‑to‑end order fulfilment and back‑office operations. +- Continuous delivery of a Java microservice to Kubernetes. +- Integration with ERP, JMS, and SOAP stock services. + +#### Responsibilities +- **CI/CD** – GitHub Actions build, test, Docker image, and K8s deployment. +- **Workflow orchestration** – Camunda BPMN for order lifecycle. +- **Containerization** – Multi‑stage Dockerfile for a lightweight JRE image. +- **Web UI** – JSF checkout page and JSP order list. +- **Business logic** – Groovy shipping rules, Kotlin invoice service, Java EJBs for stock and checkout. +- **Data access** – MyBatis customer mapper, Hibernate JPA for shipments. +- **Integration** – Spring‑Camel routes for order ingestion, JMS, ERP HTTP, and dead‑letter handling. +- **API exposure** – OpenAPI spec for order CRUD and cancellation. +- **SOAP service** – WSDL for stock level queries with fault handling. +- **Kubernetes deployment** – Deployment, Service, Ingress, health probes, secrets. + +#### Key units +- **CI/CD**: `release.yml`, `deploy-k8s.yml`. +- **BPMN**: `orderFulfilment` process, `reserveStock` delegate, `shipOrder` external task, `createInvoice` call activity. +- **Docker**: `Dockerfile`, `orders-backoffice.jar`. +- **JSF**: `checkout.xhtml`, `checkoutBean`. +- **JSP**: `order-list.jsp`. +- **Groovy**: `ShippingRules`, `ShippingRulesSpec`. +- **Kotlin**: `InvoiceService`, `InvoiceRepository`, `InvoiceNumber`. +- **EJB**: `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener`. +- **Spring‑Camel**: `orderIntegration` context, `orderValidator`, `invoiceTranslator`, `ErpUnavailableException`. +- **MyBatis**: `CustomerMapper`, `customerResult`, `customerColumns`. +- **Hibernate**: `Shipment.hbm.xml`, `ExpressShipment`, named queries `Shipment.undelivered`, `Shipment.countByCarrier`. +- **OpenAPI**: `listOrders`, `getOrder`, `cancelOrder`, `Order` schema, `OrderStatus` enum. +- **WSDL**: `StockService.wsdl`, `StockPortType`, `GetStockLevel` operation, `UnknownSkuFault`. + +#### Data flow +1. **Order placement** → JMS `OrderPlaced` → `OrderPlacedListener` → `StockReservationBean.reserve`. +2. **BPMN** starts on `orderPlaced` event → reserves stock → waits for payment → approval gate → shipping → invoicing → completion. +3. **Integration flow** receives orders via JMS → validates → routes to ERP or manual review → audit via `seda:orderAudit`. +4. **Invoice service** creates and persists invoices for completed orders. +5. **API** exposes order data; cancellation updates status if not shipped. +6. **SOAP** provides stock levels to external systems. +7. **CI/CD** builds JAR, Docker image, pushes to registry, deploys to K8s; pods expose service via Ingress. + +#### Dependencies +- **Build**: Maven, Java 21/25, Docker, GitHub Actions. +- **Runtime**: Eclipse Temurin JRE Alpine, PostgreSQL, Kafka/JMS, ERP HTTPS endpoint, SOAP stock service. +- **Frameworks**: Camunda BPMN, Spring‑Camel, Jakarta EE (EJB, Servlet), MyBatis, Hibernate, OpenAPI, WSDL/SOAP. +- **Secrets**: Docker registry credentials, DB passwords, OAuth2 token endpoint. +- **Configuration**: Property placeholders for queues, thresholds, ERP host, DB URLs, report directory. + +#### Cross‑cutting +- Environment variables (`JAVA_OPTS`, `SHOP_PROFILE`, `APP_VERSION`) across Docker, BPMN, and services. +- Security: OAuth2 client‑credentials for cancel endpoint; role‑based access for `/admin/*`. +- Error handling: BPMN boundary events, Camel exception policy, SOAP faults. +- Concurrency: EJB transactions (`RequiresNew`), Camel redelivery with exponential back‑off, Docker healthchecks. +- Logging/metrics: Global `TimingInterceptor`, health endpoints, readiness probes. +- Validation: ZIP regex, order line checks, shipping weight limits, invoice line totals. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..3154a9f1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,51 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:23:53Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps the `shop.shipping.Shipment` entity and its subclasses to database tables, defines relationships, queries, and persistence behavior. + +#### Purpose +- Configures Hibernate mapping for `Shipment` and `ExpressShipment`. +- Declares queries for undelivered shipments and carrier counts. + +#### Type +- Hibernate mapping (`hibernate-mapping` root). +- Namespace: none declared. +- Root element: `hibernate-mapping` with `package="shop.shipping"`. + +#### Definitions +- **Entity `Shipment`** + - Table: `SHIPMENT` + - ID: `id` → column `SHIPMENT_ID`, generated by sequence `SHIPMENT_SEQ`. + - Properties: + - `trackingCode` → `TRACKING_CODE`, length `40`, not-null. + - `carrier` → `CARRIER`, length `12`. + - `shippedAt` → `SHIPPED_AT`, type `timestamp`. + - Relationships: + - `order`: many-to-one to `shop.Order`, column `ORDER_ID`, not-null. + - `parcels`: set, inverse, cascade `all-delete-orphan`, key column `SHIPMENT_ID`, one-to-many to `Parcel`. +- **Subclass `ExpressShipment`** + - Table: `EXPRESS_SHIPMENT` + - Key column: `SHIPMENT_ID`. + - Property: `deliveryWindow` → `DELIVERY_WINDOW`. +- **Queries** + - `Shipment.undelivered`: HQL `from Shipment s where s.deliveredAt is null and s.shippedAt < :cutoff`. + - `Shipment.countByCarrier`: SQL `select CARRIER, count(*) from SHIPMENT group by CARRIER`. + +#### Configuration +- Sequence generator: `sequence_name="SHIPMENT_SEQ"`. +- Cascade: `all-delete-orphan` on `parcels`. +- Query parameters: `:cutoff` in `Shipment.undelivered`. + +#### Dependencies +- External DTD: `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. +- Referenced classes: `shop.Order`, `Parcel`, `ExpressShipment`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/persistence/package.ai.md new file mode 100644 index 00000000..200be8d0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/persistence/package.ai.md @@ -0,0 +1,45 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T08:25:06Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Provides Hibernate/JPA configuration for the shop shipping domain, mapping entities to PostgreSQL tables and defining persistence units for transactional and reporting data access. + +#### Purpose +- Configure Hibernate mappings for `Shipment` and its subclass `ExpressShipment`. +- Define JPA persistence units for shop and reporting data sources. + +#### Responsibilities +- **Entity mapping**: `Shipment.hbm.xml` maps `shop.shipping.Shipment` and `ExpressShipment` to tables, sets relationships, and declares queries. +- **Persistence unit definition**: `persistence.xml` declares two units (`shop` and `reporting`) with data source, provider, and properties. + +#### Key units +- **`Shipment` entity** – table `SHIPMENT`, fields `id`, `trackingCode`, `carrier`, `shippedAt`; many‑to‑one `order`, one‑to‑many `parcels`. +- **`ExpressShipment` subclass** – table `EXPRESS_SHIPMENT`, field `deliveryWindow`. +- **Named queries** – `Shipment.undelivered` (HQL), `Shipment.countByCarrier` (SQL). +- **Persistence unit `shop`** – JTA, Hibernate provider, PostgreSQL dialect, batch size 50, mapped classes `Order`, `OrderLine`, `Customer`. +- **Persistence unit `reporting`** – RESOURCE_LOCAL, excludes unlisted classes, maps `DailyRevenue`. + +#### Data flow +1. Application obtains an `EntityManager` from the `shop` unit. +2. `Shipment` instances are persisted via Hibernate, using the sequence `SHIPMENT_SEQ`. +3. Queries `Shipment.undelivered` and `Shipment.countByCarrier` are executed against the `SHIPMENT` table. +4. Reporting data is accessed through the `reporting` unit, reading `DailyRevenue` from the reporting data source. + +#### Dependencies +- Hibernate JPA provider `org.hibernate.jpa.HibernatePersistenceProvider`. +- PostgreSQL dialect `org.hibernate.dialect.PostgreSQLDialect`. +- Data sources `java:/jdbc/ShopDS` (JTA) and `java:/jdbc/ReportingDS` (RESOURCE_LOCAL). +- Mapping file `META-INF/order-queries.xml` referenced by the `shop` unit. + +#### Cross-cutting +- Sequence generator `SHIPMENT_SEQ` for `Shipment.id`. +- Cascade `all-delete-orphan` on `Shipment.parcels`. +- Shared Hibernate properties: dialect, batch size, connection credentials. +- Named queries defined in the mapping file for reuse across the application. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..158a9350 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md @@ -0,0 +1,59 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T08:23:51Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Configures two Jakarta Persistence units: `shop` for JTA‑managed Hibernate with PostgreSQL, and `reporting` for RESOURCE_LOCAL access to a reporting data source. + +#### Purpose +- Define persistence units for JPA entities. +- Configure Hibernate provider and data sources. + +#### Type +- Jakarta Persistence XML (`persistence.xml`). +- Root element: `persistence`. +- Namespace: `https://jakarta.ee/xml/ns/persistence`. + +#### Definitions +- **Persistence Unit `shop`** + - `transaction-type="JTA"`. + - `provider`: `org.hibernate.jpa.HibernatePersistenceProvider`. + - `jta-data-source`: `java:/jdbc/ShopDS`. + - `mapping-file`: `META-INF/order-queries.xml`. + - Entity classes: + - `shop.Order` + - `shop.OrderLine` + - `shop.Customer` + - Properties: + - `hibernate.dialect`: `org.hibernate.dialect.PostgreSQLDialect` + - `hibernate.jdbc.batch_size`: `50` + - `hibernate.connection.username`: `shop_app` + - `hibernate.connection.password`: `***` +- **Persistence Unit `reporting`** + - `transaction-type="RESOURCE_LOCAL"`. + - `non-jta-data-source`: `java:/jdbc/ReportingDS`. + - Entity class: + - `shop.reporting.DailyRevenue` + - `exclude-unlisted-classes`: `true` + +#### Configuration +- `hibernate.dialect`: `org.hibernate.dialect.PostgreSQLDialect` +- `hibernate.jdbc.batch_size`: `50` +- `hibernate.connection.username`: `shop_app` +- `hibernate.connection.password`: `***` + +#### Dependencies +- Hibernate JPA provider: `org.hibernate.jpa.HibernatePersistenceProvider`. +- PostgreSQL dialect class: `org.hibernate.dialect.PostgreSQLDialect`. +- Data sources: + - `java:/jdbc/ShopDS` + - `java:/jdbc/ReportingDS` +- Mapping file: `META-INF/order-queries.xml`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..86e2e3e0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,51 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:23:55Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Defines a SOAP web service for querying stock levels by SKU, including request/response types and an unknown‑SKU fault. + +#### Purpose +- Exposes a `GetStockLevel` operation to retrieve available stock for a given SKU. +- Provides fault handling for unknown SKUs. + +#### Type +- **WSDL** + Root element: `definitions` + Namespaces: + - `xmlns` → `http://schemas.xmlsoap.org/wsdl/` + - `xmlns:soap` → `http://schemas.xmlsoap.org/wsdl/soap/` + - `xmlns:tns` → `http://shop.example/stock` + - `xmlns:xs` → `http://www.w3.org/2001/XMLSchema` + +#### Definitions +- **Schema** (`xs:schema` targetNamespace=`http://shop.example/stock`): + - Element `StockLevelRequest` → complexType with `sku` (`xs:string`). + - Element `StockLevelResponse` → complexType with `available` (`xs:int`). + - ComplexType `UnknownSkuFault` → sequence with `sku` (`xs:string`). +- **Messages**: + - `GetStockLevelInput` → part `parameters` element `tns:StockLevelRequest`. + - `GetStockLevelOutput` → part `parameters` element `tns:StockLevelResponse`. + - `UnknownSku` → part `fault` type `tns:UnknownSkuFault`. +- **PortType** `StockPortType`: + - Operation `GetStockLevel` with input `tns:GetStockLevelInput`, output `tns:GetStockLevelOutput`, fault `UnknownSku` (`tns:UnknownSku`). +- **Binding** `StockSoapBinding` (type `tns:StockPortType`): + - SOAP binding style `document`, transport `http://schemas.xmlsoap.org/soap/http`. + - Operation `GetStockLevel` with SOAP action `http://shop.example/stock/GetStockLevel`; literal body for input/output; fault `UnknownSku` with literal body. +- **Service** `StockService`: + - Port `StockPort` binding `tns:StockSoapBinding` with SOAP address `https://erp.shop.example/soap/stock`. + +#### Configuration +- SOAP action: `http://shop.example/stock/GetStockLevel` +- Service endpoint: `https://erp.shop.example/soap/stock` + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema` for type definitions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/wsdl/package.ai.md new file mode 100644 index 00000000..47142039 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/other/wsdl/package.ai.md @@ -0,0 +1,41 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T08:25:10Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Provides a SOAP web service for querying stock availability by SKU, with fault handling for unknown SKUs. + +#### Purpose +- Exposes a `GetStockLevel` operation to retrieve available stock for a given SKU. +- Supplies an `UnknownSku` fault for invalid SKUs. + +#### Responsibilities +- **Service definition**: WSDL file declares the SOAP service, port, binding, and endpoint. +- **Message contracts**: Defines request/response and fault messages. +- **Schema types**: Declares XML schema types for request, response, and fault payloads. + +#### Key units +- **StockService.wsdl** – WSDL document defining the service. +- **StockPortType** – Port type with `GetStockLevel` operation. +- **StockSoapBinding** – SOAP binding (document style, HTTP transport). +- **StockService** – Service exposing `StockPort` at `https://erp.shop.example/soap/stock`. +- **StockLevelRequest / StockLevelResponse** – Complex types for request/response. +- **UnknownSkuFault** – Complex type for fault payload. + +#### Data flow +1. Client sends `StockLevelRequest` (SKU) to `StockService` endpoint. +2. Service processes request and returns `StockLevelResponse` (available quantity). +3. If SKU is unknown, service returns `UnknownSkuFault` via SOAP fault. + +#### Dependencies +- XML Schema (`http://www.w3.org/2001/XMLSchema`) for type definitions. +- SOAP 1.1 (`http://schemas.xmlsoap.org/wsdl/soap/`) for transport and binding. + +#### Cross-cutting +- All messages use `document` style with literal body. +- Fault handling follows standard SOAP fault structure with custom `UnknownSkuFault` payload. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..7513a1a0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,67 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:25:19Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> A Jakarta EE back‑office system that orchestrates order lifecycle, from placement through stock reservation, invoicing, and cancellation, while providing CI/CD pipelines, BPMN workflows, and multi‑platform integrations. + +#### Purpose +- Expose RESTful order APIs and manage cancellations with refunds and audit logging. +- Automate nightly cleanup of obsolete cancelled orders. +- Deliver a fully integrated, containerized microservice with CI/CD, BPMN orchestration, and external system integrations. + +#### Responsibilities +- **Order API** – list, retrieve, cancel, and purge orders via JAX‑RS. +- **Payment & Refund** – process refunds through an injected `PaymentGateway`. +- **Audit & Logging** – record cancellation and purge events with `AuditLog`. +- **Scheduled Maintenance** – nightly purge of cancelled orders. +- **CI/CD & Deployment** – build, test, containerize, and deploy to Kubernetes. +- **Workflow Orchestration** – Camunda BPMN for order lifecycle, stock reservation, shipping, and invoicing. +- **Integration** – JMS, ERP HTTP, SOAP stock service, Spring‑Camel routes, MyBatis/Hibernate data access. +- **UI & API Exposure** – JSF checkout, JSP order list, OpenAPI spec for CRUD operations. + +#### Key units +- `OrderResource` – REST resource at `/orders`; methods: `openOrders()`, `find(id)`, `cancel(id)`, `purgeCancelled()`. +- `PaymentGateway` – service for processing refunds. +- `AuditLog` – audit event logger. +- `Order` entity – JPA model with named queries `Order.open`, `Order.purgeCancelled`. +- `OrderPlacedListener` – EJB listening to JMS `OrderPlaced` events. +- `StockReservationBean` – EJB handling stock reservation. +- `InvoiceService` – Kotlin service persisting invoices. +- `orderFulfilment` BPMN process – orchestrates reservation, payment, shipping, invoicing. +- `orderIntegration` Spring‑Camel context – routes orders from JMS to ERP or manual review. +- `ShippingRules` (Groovy) – shipping cost logic. +- `StockService.wsdl` – SOAP contract for stock level queries. + +#### Data flow +1. **Order placement** → JMS `OrderPlaced` → `OrderPlacedListener` → `StockReservationBean.reserve`. +2. **BPMN** starts on `orderPlaced` event → reserves stock → waits for payment → approval gate → shipping → invoicing → completion. +3. **API**: `OrderResource` handles list, get, cancel, purge requests, querying `EntityManager` for `Order`. +4. **Cancellation**: `cancel(id)` fetches `Order`, calls `PaymentGateway.refund`, updates status to `CANCELLED`, logs audit, commits. +5. **Purge**: scheduled `purgeCancelled()` runs nightly, executing `Order.purgeCancelled` query, logs count. +6. **Integration**: Spring‑Camel validates orders, routes to ERP or manual queue, audits via `seda:orderAudit`. +7. **UI**: JSF checkout page submits orders; JSP lists orders. +8. **CI/CD**: GitHub Actions builds JAR, Docker image, pushes to registry, deploys to Kubernetes; pods expose service via Ingress. + +#### Dependencies +- Jakarta EE (EJB, JAX‑RS, CDI, JPA, Transactions). +- Camunda BPMN, Spring‑Camel, MyBatis, Hibernate. +- OpenAPI, WSDL/SOAP for external contracts. +- PostgreSQL, Kafka/JMS, ERP HTTPS endpoint, SOAP stock service. +- Docker, Maven, GitHub Actions, Kubernetes. +- OAuth2 client‑credentials, role‑based security (`backoffice`, `admin`). + +#### Cross-cutting +- Stateless session beans and container‑managed transactions ensure thread safety. +- Role‑based security annotations on all endpoints. +- Global audit logging for cancellations and purges. +- Environment variables (`JAVA_OPTS`, `SHOP_PROFILE`, `APP_VERSION`) drive configuration across Docker, BPMN, and services. +- Error handling via BPMN boundary events, Camel exception policy, SOAP faults. +- Concurrency: EJB `RequiresNew` transactions, Camel redelivery with exponential back‑off, Docker health checks. +- Logging/metrics: `TimingInterceptor`, readiness probes, global loggers. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..a8c4aae7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/enterprise/run3/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 9D9A76F5 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T08:25:25Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The Jakarta EE back‑office system orchestrates the entire order lifecycle, from placement and stock reservation to invoicing and cancellation, exposing a RESTful Shop Orders API and a SOAP service for stock queries. A BPMN workflow drives fulfillment, while Spring‑Camel integration routes inbound orders to ERP or manual review and handles errors. The modular architecture includes MyBatis‑based persistence, Hibernate/JPA mapping, and a Kotlin invoicing service, all built, containerized, and deployed to Kubernetes via GitHub Actions pipelines. The front‑end comprises JSF checkout pages and JSP order listings, with shipping cost logic implemented in Groovy. + +#### Packages +- java — A Jakarta EE back‑office service that manages customer orders, handling listing, retrieval, cancellation with refunds, and nightly cleanup of obsolete cancellations. +- java/shop — Provides RESTful back‑office services for managing customer orders, including listing, retrieval, cancellation, and nightly cleanup of obsolete cancellations. +- other/actions/.github — Automates the CI/CD pipeline for a Java Backoffice service, from build and test through Docker image creation to Kubernetes deployment. +- other/actions/.github/workflows — Automates building, testing, containerizing, and deploying a Java Backoffice service to a production Kubernetes cluster via GitHub Actions. +- other/actions — Automates the CI/CD pipeline for a Java Backoffice service, from build and test through Docker image creation to Kubernetes deployment. +- other/bpmn — Provides a BPMN‑based workflow for handling order fulfilment, from stock reservation through payment, approval, shipping, invoicing, and cancellation. +- other/docker — Builds and deploys a Java back‑office service as a Docker image, compiling the Maven project into a JAR and running it in an Alpine JRE container with health monitoring. +- other/facelets — A JSF checkout page that gathers shipping details, lets the user pick a shipping method, shows the order total, and submits the order. +- other/groovy — Provides shipping cost calculation logic and tests for DHL parcel shipping rules. +- other/integration — Orchestrates inbound order processing, validation, routing to ERP or manual review, and error handling within a Spring‑Camel integration flow. +- other/jee — Provides Jakarta EE configuration for a shop back‑office application, wiring enterprise beans, web components, security, and data‑source resources. +- other/jsp — A JSP page that lists open orders, supports filtering by customer email and status, and lets users cancel individual orders. +- other/k8s — Deploys and exposes the orders‑backoffice microservice in a Kubernetes cluster. +- other/kotlin — A service that creates, numbers, and persists invoices for completed orders, calculating due dates and tax rates. +- other/mybatis — Maps customer domain objects to SQL statements for CRUD and search operations. +- other/openapi — The Shop Orders API provides back‑office endpoints for listing, retrieving, and canceling customer orders, exposing order status, totals, and optional coupon codes. +- other — A modular shop‑backoffice system that builds, tests, containers, deploys, and exposes services for order processing, inventory, invoicing, and reporting. +- other/persistence — Provides Hibernate/JPA configuration for the shop shipping domain, mapping entities to PostgreSQL tables and defining persistence units for transactional and reporting data access. +- other/wsdl — Provides a SOAP web service for querying stock availability by SKU, with fault handling for unknown SKUs. +- . — A Jakarta EE back‑office system that orchestrates order lifecycle, from placement through stock reservation, invoicing, and cancellation, while providing CI/CD pipelines, BPMN workflows, and multi‑platform integrations. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/meta/gpt-6-luna.json new file mode 100644 index 00000000..93eea718 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/meta/gpt-6-luna.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:57:29Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 75.4, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 38.5, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.5, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T07:59:26Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 15441, + "cachedPromptTokens": 3960, + "completionTokens": 6899, + "seconds": 74.7830757 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.004637, + "costUsd": 0.00789, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/meta/gpt-oss-20b.json new file mode 100644 index 00000000..172976bc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/meta/gpt-oss-20b.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T07:59:26Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 36.3, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 30.7, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.2, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T08:00:35Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16004, + "cachedPromptTokens": 1824, + "completionTokens": 5077, + "seconds": 35.7025182 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.00114, + "costUsd": 0.001145, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..7c58df37 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,56 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:59:07Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> Supports billing and payment operations, release and worker administration, access-log analysis, and XML-based shipment and account-statement processing. + +#### Purpose +- Groups operational tools for deployments, worker health, payment exports, and web-log reporting with billing, reminder, shipment, and statement configuration. +- Defines build, scheduling, validation, and presentation behavior for related services and business documents. + +#### Responsibilities +- **Access-log analysis (`perl/`):** Parses and aggregates requests by normalized host and HTTP status, tracks slow requests, applies aliases and exclusions, and emits text or JSON reports. +- **Service operations (`shell/`):** Rolls tagged releases across staging or production hosts, manages and checks `queue-worker`, and exports settled payments to compressed CSV with a control file. +- **Billing and reminders (`xml/`):** Configures the invoice-service Maven build and Flyway migrations, and wires weekday overdue-reminder processing through database and SMTP components. +- **Business-document processing (`xml/`):** Defines shipment-notice validation rules and transforms account statements into formatted HTML. + +#### Key units +- `LogDigest` — parses access-log lines and summarizes host, status, and slow-request counts. +- `log_digest.pl` — loads aliases, filters logs, and produces ranked text or canonical JSON reports. +- `deploy_host`, `wait_healthy`, `load_hosts` — deploy and verify a release on selected hosts. +- `start_worker`, `stop_worker`, `is_running`, `heartbeat_age` — manage and inspect queue-worker process and heartbeat state. +- `run_export`, `write_control` — export settled-payment rows and record business day and row count. +- `invoice-service` — Maven project `org.example.billing:invoice-service:2.7.0`, with Java 17 compilation, Flyway migrations, and optional PDFBox support. +- `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler` — configure and schedule weekday overdue reminders with a 14-day grace period. +- `shipmentNotice`, `ShipmentNoticeType`, `CarrierCode`, `WeightGrams`, `ParcelType`, `AddressType` — define shipment-notice structure and constraints. +- `/st:statement`, `st:booking`, `statementHeader`, `statementTotal` — render statement details, booking rows, totals, and large-amount styling. + +#### Data flow +- Access-log lines are host-filtered and alias-normalized by the CLI, then parsed and aggregated by `LogDigest` for ranked text or JSON output. +- Deployment options select a host list and build archive; each host receives the release, restarts `orderd`, and is checked through its `/health` endpoint. +- Worker commands use PID and heartbeat files to determine process state and report command-specific status. +- The payment export queries Oracle `settled_payment` for a business day, writes CSV and row-count metadata, then compresses the CSV. +- Spring configuration loads reminder properties, wires database and SMTP dependencies, and schedules `OverdueReminderJob.sendDueReminders` on weekdays at 07:00. +- Shipment XML is validated against `urn:example:shipment:1`; statement XML in `urn:example:statement` is transformed to HTML with formatted booking amounts and totals. + +#### Dependencies +- Perl reporting uses `POSIX`, `List::Util`, `Carp`, `Exporter`, `Getopt::Long`, `JSON::PP`, and `LogDigest`; aliases come from `$ENV{LOG_DIGEST_CONFIG}` or `/etc/log-digest.conf`. +- Deployment uses `lib/common.sh`, host-list files, `rsync`, `ssh`, `curl`, and remote `sudo systemctl`; worker tools target `/usr/local/bin/queue-worker`. +- Payment export uses Oracle `sqlplus` (`/ AS SYSDBA`), `settled_payment`, and `gzip`; default SID is `PAYPRD`. +- Invoice build inherits from `org.example.billing:billing-parent:2.7.0` and uses Jackson Databind, Flyway, PostgreSQL, JUnit Jupiter, and Testcontainers PostgreSQL. +- Reminder wiring references `reminder.properties`, HikariCP, and `org.example.reminder` repository, gateway, and job classes. +- Shipment validation uses XML Schema built-in types; statement rendering uses XSLT functions and the statement namespace. + +#### Cross-cutting +- Configuration is supplied through command-line options, environment variables, Maven properties, Spring placeholders, and XSLT parameters. +- Log analysis enforces a 50,000-line maximum, validates levels, ignores invalid lines, and marks requests slower than 1,500 ms. +- Deployment halts on failed health checks; payment export retries up to three times; scripts signal failures with exit codes. +- Reminder scheduling uses a two-thread pool and closes its data source on shutdown; statement rendering defaults to `EUR`, a 1000 highlight threshold, and `#,##0.00` formatting. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..c342c647 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,69 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:57:30Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Summarizes access-log requests into per-host and per-status counts, including slow-request totals and busiest-host statistics. + +#### Purpose +- Parses web-server access-log lines and accumulates request statistics. +- Provides host normalization and count-ranking helpers. + +#### Type +- Module; package `LogDigest`. +- Exports `parse_line` and `top_n` via `@EXPORT_OK`. +- Object-oriented: `new` blesses a statistics object; `add` and `summarize` operate on it. + +#### Input +- `new` accepts a `level` key in `%args`; defaults to `DEFAULT_LEVEL` (`WARN`). +- `add` accepts one access-log line. +- `parse_line` accepts one access-log line. +- `top_n` accepts a count hash reference and a requested count. +- No command-line options, `@ARGV` usage, environment reads, or file reads. + +#### Output +- `parse_line` returns a hash reference with `host`, `time`, `method`, `path`, `status`, and `millis`, or an undefined value for a nonmatching line. +- `add` returns `1` for a parsed line, `0` for an unparsed line. +- `summarize` returns a hash reference with UTC `generated` timestamp (`YYYY-MM-DDTHH:MM:SSZ`), request `total`, distinct-host count `hosts`, maximum per-host count `busiest`, `slow` request count, and a copied `statuses` count hash. +- `top_n` returns host/count keys ordered by descending count, then ascending key. +- No printed output or files written. + +#### Core logic +- `new` validates the requested log level and initializes host/status counts, slow-request count, and line count. +- `parse_line` matches a combined-log-style line with a three-digit status and integer duration; returns normalized host and parsed fields. +- `add` increments the line limit counter, ignores malformed lines, then updates host and status counts and increments `slow` when duration exceeds `SLOW_REQUEST_MS`. +- `summarize` computes total requests from host counts, distinct hosts, busiest-host count, current UTC timestamp, and status counts. +- `top_n` sorts count keys by descending value with lexical tie-breaking, then returns up to `n` keys. +- `_normalize_host` lowercases the host and removes one trailing dot. + +#### Subs +- `new(%args) -> object` — validate level and initialize counters. +- `parse_line($line) -> hashref|undef` — parse and normalize one log line. +- `add($line) -> 1|0` — count a valid request. +- `summarize() -> hashref` — assemble aggregate statistics. +- `top_n($counts, $n) -> list` — rank count keys and return top entries. +- `_normalize_host($host) -> host` — lowercase and trim trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50_000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `$VERSION = '1.4'` +- `@EXPORT_OK = qw(parse_line top_n)` +- `%LEVEL_RANK = (DEBUG => 0, INFO => 1, WARN => 2, ERROR => 3)` + +#### Dependencies +- `POSIX`: imports `strftime`. +- `List::Util`: imports `max`, `sum`. +- `Carp`: imports `croak`. +- `parent`: `Exporter`. +- Pragmas: `strict`, `warnings`. + +#### Exceptions / Errors +- `new` croaks with `unknown level '$level'` for levels absent from `%LEVEL_RANK`. +- `add` croaks after the line count exceeds `MAX_LINES`, with `more than 50000 lines`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..587992eb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/perl/log_digest.pl.ai.md @@ -0,0 +1,68 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:57:42Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Summarizes access-log requests by host and status, with host aliases, exclusions, and text or JSON reporting. + +#### Purpose +- Command-line script for reading access logs and reporting request, host, and slow-request counts. +- Supports host alias configuration, host exclusions, and top-host output. + +#### Type +- Script; no package declaration, exports, or object construction in this file. +- Uses `LogDigest` objects via `LogDigest->new`. + +#### Input +- `--top` / `--n` sets `$top`; integer; default `10`. +- `--level` sets `$level`; string; default `WARN`. +- `--json` / `--no-json` sets `$as_json`; default false. +- `--exclude-host` sets `@exclude_hosts`; repeatable. +- `--help` / `-h` prints usage and exits successfully. +- Remaining `@ARGV` entries are access-log file paths. +- `$ENV{LOG_DIGEST_CONFIG}` selects the alias configuration file; default `/etc/log-digest.conf`. +- Reads the alias configuration file and each specified access-log file. + +#### Output +- JSON mode: canonical JSON encoding of `$summary`, followed by a newline. +- Text mode: `N requests from H hosts, S slow`, followed by lines from `top_n($digest->{hosts}, $top)`. +- Returns exit status `0` after successful processing; help exits `0`. + +#### Core logic +- Parses options; dies if `$top < 1`. +- Reads host aliases from the configured file; missing or unreadable config yields no aliases. +- Builds an exclusion lookup from `@exclude_hosts`. +- Creates a `LogDigest` object with the selected `$level`. +- For each log line, extracts the first space-delimited field as host; skips it if its aliased (or original) host is excluded, otherwise adds the line to the digest. +- Summarizes the digest and prints JSON or text output, including top hosts in text mode. + +#### Subs +- `usage() -> string` — formats command usage text. +- `read_aliases($path) -> hash` — reads host aliases from configuration. +- `main() -> 0` — processes logs and prints summary. + +#### Constants and configuration +- `$config_file` — `$ENV{LOG_DIGEST_CONFIG}` or `/etc/log-digest.conf`. +- `$top` — `10`. +- `$level` — `WARN`. +- `$as_json` — `0`. +- `@exclude_hosts` — empty initially. + +#### Dependencies +- `strict` — enables strict checks. +- `warnings` — enables warnings. +- `FindBin` — imports `$Bin`. +- `Getopt::Long` — imports `GetOptions`. +- `JSON::PP` — canonical JSON encoding. +- `LogDigest` — imports `top_n`; uses `new`, `add`, and `summarize`. + +#### Exceptions / Errors +- `die "--top must be positive\n"` when `$top < 1`. +- `die usage()` if option parsing fails. +- `die "cannot read $file: $!\n"` when an access-log file cannot be opened. +- Alias configuration open failure is ignored; `read_aliases` returns an empty hash. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/perl/package.ai.md new file mode 100644 index 00000000..e24b8f98 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/perl/package.ai.md @@ -0,0 +1,46 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:58:45Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Converts web-server access logs into host, status, and slow-request statistics, with configurable host aliases, exclusions, and text or JSON reporting. + +#### Purpose +- Parse access-log requests and aggregate counts by normalized host and HTTP status. +- Provide a command-line workflow for filtering logs and reporting aggregate and busiest-host statistics. + +#### Responsibilities +- **Parsing and aggregation:** `LogDigest` parses combined-log-style lines, counts valid requests by host and status, and tracks slow requests. +- **Host handling and ranking:** Normalize hostnames and rank count keys by descending count with lexical tie-breaking. +- **CLI reporting:** `log_digest.pl` reads alias configuration and log files, applies host exclusions, and prints text or canonical JSON summaries. + +#### Key units +- `LogDigest` — maintains request statistics and provides `new`, `add`, and `summarize`. +- `parse_line` — parses one access-log line into host, time, method, path, status, and duration fields, or returns undefined for a nonmatch. +- `top_n` — returns up to the requested number of count keys in ranked order. +- `_normalize_host` — lowercases hostnames and removes one trailing dot. +- `read_aliases` — loads host aliases from the configured file; returns no aliases if it cannot be opened. +- `main` — processes CLI options and log files, then emits the selected report. +- `usage` — formats command-line usage text. + +#### Data flow +- `log_digest.pl` parses options, loads aliases, and builds the exclusion set. +- For each log line, it takes the first space-delimited field as the host, applies its alias if present, and skips the line if that host is excluded. +- Remaining lines are passed to `LogDigest->add`, which parses valid requests and updates host, status, and slow-request counts. +- `summarize` produces aggregate statistics; the CLI prints canonical JSON or a text summary with ranked hosts from `top_n`. + +#### Dependencies +- `LogDigest` uses `POSIX` for UTC timestamp formatting, `List::Util` for `max` and `sum`, `Carp` for `croak`, and `Exporter` for optional exports. +- `log_digest.pl` uses `Getopt::Long` for options, `JSON::PP` for JSON output, `FindBin`, and `LogDigest`. +- Alias configuration comes from `$ENV{LOG_DIGEST_CONFIG}` or defaults to `/etc/log-digest.conf`. + +#### Cross-cutting +- `LogDigest` defaults to level `WARN`, validates levels against `DEBUG`, `INFO`, `WARN`, and `ERROR`, and rejects input beyond `MAX_LINES` (50,000). +- Requests are counted as slow when duration exceeds `SLOW_REQUEST_MS` (1,500 ms). +- Invalid log lines are ignored by `add`; invalid levels and line-limit overflow raise errors. The CLI rejects nonpositive `--top` values and dies on unreadable access-log files. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..e6fac8f1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,80 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:57:51Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Deploys a tagged release to each staging or production host in sequence, restarts `orderd`, and stops if a host fails its health check. + +#### Purpose +- Rolls out `build/$TAG.tar.gz` to every host listed for the selected environment. +- Run directly as a deployment command; it also sources `lib/common.sh`. + +#### Type +- Bash (`#!/usr/bin/env bash`); strict mode: `set -euo pipefail`. + +#### Input +- `-e ` sets `ENVIRONMENT`; parsed with `getopts`. +- `-t ` sets `TAG`; parsed with `getopts`. +- `-n` sets `DRY_RUN=1`; logs intended deployments without deploying. +- `-p ` logs that parallel deployments are unsupported and ignores the value. +- `-h` prints usage and exits successfully. +- Environment variables: `DEPLOY_USER` defaults to `deploy`; `SSH_KEY` defaults to `$HOME/.ssh/deploy_ed25519`; reads `HOME` for that default. +- Reads `$SCRIPT_DIR/lib/common.sh`, the selected host file (`hosts.staging` or `hosts.production`), and `build/$TAG.tar.gz`; checks that `SSH_KEY` is readable. + +#### Output +- Logs timestamped messages to standard error. +- Transfers the release archive to each host’s `/tmp/`; remotely extracts it under `$RELEASE_ROOT/$TAG`, updates `$RELEASE_ROOT/current`, and restarts the service. +- Sends health-check requests to `http://$host:8080/health`. +- Removes `/tmp/deploy_release.$$.lock` on exit; the script does not create this lock file. +- Exits `0` on success or help; exits `1` for deployment/prerequisite errors; exits `2` if `-e` or `-t` is missing. + +#### Core logic +- Parses options, then requires both `ENVIRONMENT` and `TAG`. +- Checks for `rsync`, `ssh`, and `curl`, and verifies the SSH key is readable. +- Selects the environment’s host file, loads non-comment lines into `HOSTS`, and fails if none are loaded. +- Iterates through hosts sequentially: + - In dry-run mode, logs the intended deployment and skips remote actions. + - Otherwise, transfers the archive with `rsync`, then uses `ssh` to create the release directory, extract the archive, update the `current` symlink, and restart the service with `sudo systemctl`. + - Polls the host’s health endpoint every two seconds; stops the rollout if health checks exceed the timeout. + - Logs successful deployment to each host. + +#### Functions +- `log`: Print timestamped messages to standard error. +- `die`: Log an error and exit. +- `usage`: Print the usage comment. +- `check_prereqs`: Verify tools and SSH key. +- `load_hosts`: Load hosts for the environment. +- `deploy_host`: Deploy and check one host. +- `wait_healthy`: Poll a host’s health endpoint. +- `cleanup`: Remove the lock-file path. + +#### Constants and configuration +- `SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"`. +- `DEPLOY_USER="${DEPLOY_USER:-deploy}"`. +- `SSH_KEY="${SSH_KEY:-$HOME/.ssh/deploy_ed25519}"`. +- `RELEASE_ROOT="/opt/releases"`. +- `SERVICE_NAME="orderd"`. +- `HEALTH_TIMEOUT=30`. +- `ENVIRONMENT=""`. +- `TAG=""`. +- `DRY_RUN=0`. +- `HOSTS=()`. +- `HOST_FILES=([staging]="hosts.staging" [production]="hosts.production"`). + +#### Dependencies +- Sourced file: `$SCRIPT_DIR/lib/common.sh`. +- External commands: `basename` is not used; `bash`, `cd`, `command`, `curl`, `date`, `grep`, `ln`, `mapfile`, `mkdir`, `pwd`, `rm`, `rsync`, `sed`, `shift`, `sleep`, `ssh`, `sudo`, `systemctl`, `tar`. +- Host-list files: `$SCRIPT_DIR/hosts.staging`, `$SCRIPT_DIR/hosts.production`. +- Remote service: `orderd`; health endpoint: `http://$host:8080/health`. + +#### Errors and exit codes +- Exit `1` if a required tool is missing, the SSH key is unreadable, the host file has no hosts, an environment is unknown, an option is invalid or missing a value, or a host fails its health check. +- Exit `2` if `ENVIRONMENT` or `TAG` is unset after option parsing. +- Exit `0` after successful completion or `-h`. +- `EXIT` trap runs `cleanup` and removes `/tmp/deploy_release.$$.lock`. +- Health checks retry every two seconds, up to `HEALTH_TIMEOUT=30`; there is no separate command timeout. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..859d645f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,62 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:58:03Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Manages the queue worker lifecycle and checks whether its heartbeat is fresh. + +#### Purpose +- Starts, stops, restarts, and reports status or heartbeat health for the queue worker. +- Directly invoked with a command argument; not a sourced library. + +#### Type +- POSIX `sh`; no strict-mode settings (`set -e`, `set -u`, or `pipefail`). + +#### Input +- `$1`: lifecycle or probe command: `start`, `stop`, `restart`, `status`, or `health`. +- Environment variables: `PID_FILE` defaults to `/run/queue-worker.pid`; `HEARTBEAT_FILE` defaults to `/var/lib/queue-worker/heartbeat`. +- Reads the PID file and heartbeat file metadata; starts `/usr/local/bin/queue-worker`. + +#### Output +- Starts the worker with output redirected to `/dev/null`; writes its PID to `PID_FILE`. +- Removes `PID_FILE` after a successful stop signal. +- Prints `already running`, `running`, `stopped`, `CRITICAL: not running`, `WARNING: heartbeat ...s old`, `OK`, or usage text. +- Exit statuses: `0` for successful commands and healthy status; `1` for stale heartbeat; `2` when health check finds the worker stopped; `3` when status finds it stopped; `64` for an invalid command. + +#### Core logic +- `start`: if the PID identifies a running process, print `already running`; otherwise launch the worker through `nohup` with `--heartbeat HEARTBEAT_FILE` and save its background PID. +- `stop`: if running, signal the PID and remove the PID file on successful signal; otherwise do nothing. +- `restart`: stop, then start. +- `status`: print `running` if the PID identifies a running process; otherwise print `stopped` and exit `3`. +- `health`: exit `2` with a critical message if stopped; otherwise calculate heartbeat age and warn/exit `1` if over 120 seconds, or print `OK`. +- Any other command prints usage to standard error and exits `64`. + +#### Functions +- `is_running`: checks PID file and process existence. +- `heartbeat_age`: calculates heartbeat file age in seconds. +- `start_worker`: launches worker unless already running. +- `stop_worker`: signals worker and removes PID file. + +#### Constants and configuration +- `PID_FILE="${PID_FILE:-/run/queue-worker.pid}"` +- `HEARTBEAT_FILE="${HEARTBEAT_FILE:-/var/lib/queue-worker/heartbeat}"` +- `MAX_HEARTBEAT_AGE=120` +- `WORKER_BIN=/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `cat`, `date`, `stat`, `echo`, `kill`, `nohup`, `rm`. +- Worker executable: `/usr/local/bin/queue-worker`, invoked with `--heartbeat` and the heartbeat file path. +- Files: `/run/queue-worker.pid`; `/var/lib/queue-worker/heartbeat`. + +#### Errors and exit codes +- `0`: successful command; health check reports `OK` when heartbeat age is at most 120 seconds. +- `1`: health check reports heartbeat older than 120 seconds. +- `2`: health check finds no running worker. +- `3`: `status` finds no running worker. +- `64`: unrecognized command. +- No traps, retries, or timeouts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..e7f69a48 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,70 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:58:11Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Exports settled payments for one business day from Oracle into a gzipped CSV with a row-count control file. + +#### Purpose +- Creates a daily settled-payment export and companion row-count file. +- Runs directly as a nightly job; not a sourced library. + +#### Type +- `ksh93` (`#!/bin/ksh93`); no strict-mode settings (`set -e`, `set -u`, or `pipefail`). + +#### Input +- `-d` sets `business_day` to the requested `YYYYMMDD`; parsed with `getopts`. +- `-o` sets `export_dir`; parsed with `getopts`. +- Reads `ORACLE_SID`, defaulting to `ORACLE_SID_DEFAULT` (`PAYPRD`). +- Reads no input files. + +#### Output +- Creates `export_dir` if needed. +- Writes `payments_$business_day.csv`, then compresses it to `.csv.gz`; writes the row count and business day to the corresponding `.ctl` file. +- Logs timestamped status messages to stderr. +- Exits `0` on successful export; exits `2` for invalid options, `3` when a required tool is missing, `4` after retries are exhausted, or `1` if `fail` is called without an explicit status. + +#### Core logic +- Defaults `business_day` to `date +%Y%m%d` and `export_dir` to `/data/export/payments`; sets the Oracle environment. +- Parses `-d` and `-o`, then checks that `sqlplus` and `gzip` are available. +- Creates the export directory if it does not exist; targets `payments_$business_day.csv`. +- Tries the export up to three times: connects through `sqlplus` as SYSDBA and selects payment ID, account number, amount, and currency from `settled_payment` for the requested business day. +- On success, counts CSV lines, writes the `.ctl` file, compresses the CSV with `gzip -f`, logs success, and exits `0`. +- On failure, logs the attempt and sleeps 60 seconds; after exhausting retries, exits `4`. + +#### Functions +- `log` — timestamped stderr logging. +- `fail` — logs failure and exits. +- `require_tools` — checks required commands. +- `run_export` — runs the Oracle payment query into the CSV. +- `write_control` — writes row count and business day. + +#### Constants and configuration +- `ORACLE_SID_DEFAULT=PAYPRD` +- `EXPORT_DIR_DEFAULT=/data/export/payments` +- `MAX_RETRIES=3` +- `attempt=0` +- `business_day=$(date +%Y%m%d)` +- `export_dir=$EXPORT_DIR_DEFAULT` +- `ORACLE_SID=${ORACLE_SID:-$ORACLE_SID_DEFAULT}` +- `NLS_LANG=AMERICAN_AMERICA.AL32UTF8` +- `csv=$export_dir/payments_$business_day.csv` + +#### Dependencies +- External commands: `date`, `sqlplus`, `gzip`, `wc`, `sleep`. +- Shell commands/builtins: `whence`, `mkdir`, `print`. +- Oracle connection: `/ AS SYSDBA`. +- Table read: `settled_payment` (`payment_id`, `account_no`, `amount`, `currency`, `business_day`). + +#### Errors and exit codes +- `2` — unrecognized option; prints usage. +- `3` — `sqlplus` or `gzip` is unavailable. +- `1` — export directory creation fails. +- Export retries up to `MAX_RETRIES=3`, sleeping 60 seconds after each failed attempt; `4` if all attempts fail. +- `0` — export, control-file write, and compression succeed. +- No traps. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/package.ai.md new file mode 100644 index 00000000..5615dbd2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/shell/package.ai.md @@ -0,0 +1,46 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:58:52Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates release rollout, queue-worker health management, and nightly settled-payment exports for operational services. + +#### Purpose +- Provides shell entry points for sequential application deployment and service health checks. +- Produces daily Oracle payment extracts with compressed CSV output and row-count controls. + +#### Responsibilities +- **Release deployment:** `deploy_release.sh` selects staging or production hosts, transfers a tagged build, updates the release symlink, restarts `orderd`, and halts rollout on failed health checks; supports dry-run mode. +- **Worker lifecycle and monitoring:** `healthcheck.sh` starts, stops, restarts, and reports status for `queue-worker`; its health probe checks process presence and heartbeat freshness. +- **Payment export:** `nightly_extract.ksh` queries settled payments for a business day, retries failed exports, and writes a gzipped CSV with a companion control file. + +#### Key units +- `deploy_host` — deploys one release archive to a host and verifies its health. +- `wait_healthy` — polls a host’s `/health` endpoint up to the configured timeout. +- `load_hosts` — reads the selected staging or production host list. +- `start_worker` / `stop_worker` — launch or signal the worker and maintain its PID file. +- `is_running` / `heartbeat_age` — determine worker process state and heartbeat age. +- `run_export` — runs the Oracle query for settled payments on the requested business day. +- `write_control` — records the export row count and business day in the control file. + +#### Data flow +- Deployment: environment and tag options → host list and `build/$TAG.tar.gz` → per-host transfer and remote extraction → `orderd` restart → HTTP health verification. +- Worker health: PID and heartbeat files → process and age checks → status message and command-specific exit code. +- Payment export: business day and export directory → Oracle `settled_payment` query → CSV row count and `.ctl` file → gzip-compressed CSV. + +#### Dependencies +- Deployment uses `lib/common.sh`, staging/production host files, and `rsync`, `ssh`, `curl`, and remote `sudo systemctl`; target service is `orderd`. +- Worker management uses `/usr/local/bin/queue-worker`, its PID file, heartbeat file, and standard process/file utilities. +- Payment export uses Oracle `sqlplus` with `/ AS SYSDBA`, `settled_payment`, and `gzip`; defaults to `ORACLE_SID=PAYPRD`. + +#### Cross-cutting +- Each script is a directly invoked operational command; `deploy_release.sh` additionally sources `lib/common.sh`. +- Configuration is supplied through command-line options and environment variables, with defaults for deployment identity, worker files, Oracle SID, and export directory. +- Failure is signaled through script-specific exit codes; deployment stops on a host health-check failure, while payment export retries up to three times. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..73b100e6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,48 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:58:22Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Configures the `invoice-service` JAR build, database migrations, test runtime, and optional native PDF support for invoice creation and archiving. + +#### Purpose +- Builds the invoice service and configures Flyway migrations and Maven tests. +- Provides an optional `native-pdf` profile with PDFBox. + +#### Type +- Maven POM; root element `project`. +- Namespaces: default `http://maven.apache.org/POM/4.0.0`; prefix `xsi` — `http://www.w3.org/2001/XMLSchema-instance`. + +#### Definitions +- Coordinates: `org.example.billing:invoice-service:2.7.0` (groupId and version inherited); packaging `jar`; name `Invoice service`. +- Parent: `org.example.billing:billing-parent:2.7.0`. +- Dependencies: + - `com.fasterxml.jackson.core:jackson-databind` — compile; version `${jackson.version}`. + - `org.flywaydb:flyway-core` — compile; version `${flyway.version}`. + - `org.postgresql:postgresql` — runtime. + - `org.junit.jupiter:junit-jupiter` — test. + - `org.testcontainers:postgresql` — test. +- Plugins: + - `flyway-maven-plugin` — version `${flyway.version}`; migration location `filesystem:src/main/resources/db/migration`. + - `maven-surefire-plugin` — sets system property `invoice.archive.dir` to `${invoice.archive.dir}`. +- Properties: `maven.compiler.release=17`; `jackson.version=2.19.2`; `flyway.version=11.4.0`; `invoice.archive.dir=${project.build.directory}/archive`. +- Profile: `native-pdf`. + +#### Configuration +- `maven.compiler.release`: `17`. +- `jackson.version`: `2.19.2`. +- `flyway.version`: `11.4.0`. +- `invoice.archive.dir`: `${project.build.directory}/archive`. +- Flyway migration location: `filesystem:src/main/resources/db/migration`. +- Surefire system property `invoice.archive.dir`: `${invoice.archive.dir}`. +- `native-pdf` profile dependency: `org.apache.pdfbox:pdfbox`, version `3.0.5`. + +#### Dependencies +- Parent POM: `org.example.billing:billing-parent:2.7.0`. +- Migration files: `src/main/resources/db/migration`. +- External systems/libraries: PostgreSQL, Jackson Databind, Flyway, JUnit Jupiter, Testcontainers PostgreSQL, PDFBox. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/package.ai.md new file mode 100644 index 00000000..27d82552 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/package.ai.md @@ -0,0 +1,53 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:58:59Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Defines billing and reminder runtime configuration alongside shipment-message validation and account-statement rendering. + +#### Purpose +- Provides XML build and Spring scheduling configuration for invoice and overdue-reminder services. +- Defines the warehouse shipment notice contract and transforms account statements into HTML. + +#### Responsibilities +- **Build and migrations:** `invoice-service-pom.xml` configures the `invoice-service` JAR, Flyway migrations, test runtime, and optional PDFBox support. +- **Reminder scheduling:** `scheduler-context.xml` wires database access, SMTP delivery, and weekday execution of overdue reminders. +- **Shipment validation:** `shipment.xsd` constrains shipment notice structure, carriers, parcel weights, and recipient addresses. +- **Statement presentation:** `statement-to-html.xsl` renders statement details and booking totals, highlighting large amounts. + +#### Key units +- `invoice-service` — Maven project `org.example.billing:invoice-service:2.7.0`, with Java 17 compilation and a `native-pdf` profile. +- `reminderDataSource` — pooled `HikariDataSource` configured from reminder database properties. +- `reminderRepository` — `JdbcReminderRepository` backed by `reminderDataSource`. +- `mailGateway` — `SmtpMailGateway` configured for the SMTP host and port 587. +- `overdueReminderJob` — `OverdueReminderJob` using the repository and mail gateway, with a 14-day grace period. +- `reminderScheduler` — Spring task scheduler that runs `sendDueReminders` at 07:00 Monday through Friday. +- `shipmentNotice` / `ShipmentNoticeType` — shipment document containing order, dispatch, carrier, recipient, and one or more parcels. +- `CarrierCode`, `WeightGrams`, `ParcelType`, `AddressType` — schema types constraining shipment carrier, weight, parcel, and address data. +- `/st:statement` and `st:booking` templates — XSLT rules that render the statement page and booking rows. +- `statementHeader` and `statementTotal` — named XSLT templates for account details and booking totals. + +#### Data flow +- Spring loads `reminder.properties`, configures the reminder data source and mail gateway, and invokes `OverdueReminderJob.sendDueReminders` on the weekday schedule. +- Shipment notices are validated against `urn:example:shipment:1`, including required notice and parcel attributes and a maximum parcel weight of 31,500 grams. +- Statement XML in `urn:example:statement` is transformed into HTML with account details, formatted booking amounts, a total, and `large` styling for amounts above the configured threshold. +- Maven builds the invoice service and directs Flyway to migration files under `src/main/resources/db/migration`. + +#### Dependencies +- `invoice-service-pom.xml` inherits from `org.example.billing:billing-parent:2.7.0`; uses Jackson Databind, Flyway, PostgreSQL, JUnit Jupiter, and Testcontainers PostgreSQL; optionally uses PDFBox. +- `scheduler-context.xml` references `reminder.properties`, HikariCP, and `org.example.reminder` repository, gateway, and job classes; scans `org.example.reminder.web`. +- `shipment.xsd` uses XML Schema built-in types and its `urn:example:shipment:1` types. +- `statement-to-html.xsl` consumes the `urn:example:statement` vocabulary and uses XSLT `format-number()`, `sum()`, and `number()`. + +#### Cross-cutting +- External configuration uses Maven properties, Spring property placeholders, and XSLT parameters. +- The reminder data source has an explicit `close` destroy method; reminder scheduling uses a two-thread scheduler pool. +- Statement formatting defaults to currency symbol `EUR`, highlight threshold `1000`, and amount format `#,##0.00`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..a06a9b33 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,43 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:58:28Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Configures a weekday morning reminder job backed by a pooled database connection and SMTP mail gateway. + +#### Purpose +- Wires the reminder repository, mail gateway, overdue reminder job, and scheduled execution. +- Loads reminder settings from `reminder.properties` and scans the reminder web package. + +#### Type +- Spring application context; root `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` `http://www.w3.org/2001/XMLSchema-instance`; `context` `http://www.springframework.org/schema/context`; `task` `http://www.springframework.org/schema/task`. + +#### Definitions +- Beans: + - `reminderDataSource` — `com.zaxxer.hikari.HikariDataSource`; `destroy-method="close"`. + - `reminderRepository` — `org.example.reminder.JdbcReminderRepository`; constructor references `reminderDataSource`. + - `mailGateway` — `org.example.reminder.SmtpMailGateway`. + - `overdueReminderJob` — `org.example.reminder.OverdueReminderJob`; constructor references `reminderRepository` and `mailGateway`. +- Scheduler `reminderScheduler`. +- Scheduled task: `overdueReminderJob.sendDueReminders`, using `reminderScheduler`. + +#### Configuration +- Property file: `classpath:reminder.properties`. +- Component scan: `org.example.reminder.web`. +- `reminderDataSource`: `jdbcUrl=${reminder.db.url}`, `username=${reminder.db.user}`, `maximumPoolSize=8`. +- `mailGateway`: `host=${reminder.smtp.host}`, `port=587`. +- `overdueReminderJob`: `graceDays=14`. +- `reminderScheduler`: `pool-size=2`. +- Schedule: `cron="0 0 7 * * MON-FRI"`. + +#### Dependencies +- Referenced property file: `reminder.properties`. +- Property placeholders: `${reminder.db.url}`, `${reminder.db.user}`, `${reminder.smtp.host}`. +- Classes: `com.zaxxer.hikari.HikariDataSource`, `org.example.reminder.JdbcReminderRepository`, `org.example.reminder.SmtpMailGateway`, `org.example.reminder.OverdueReminderJob`. +- Scanned package: `org.example.reminder.web`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..f8984afe --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/shipment.xsd.ai.md @@ -0,0 +1,38 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:58:34Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Defines the warehouse shipment notice format, including recipient details, carrier codes, parcel tracking, and weight limits. + +#### Purpose +- Validates shipment notices sent when parcels leave the warehouse. +- Constrains carrier values, parcel weights, required fields, and recipient address data. + +#### Type +- XML Schema; root element `schema`. +- Namespaces: `xs` → `http://www.w3.org/2001/XMLSchema`; `shp` → `urn:example:shipment:1`. +- Target namespace: `urn:example:shipment:1`. + +#### Definitions +- Top-level element `shipmentNotice`: type `shp:ShipmentNoticeType`. +- Simple type `CarrierCode`: `xs:string` enumeration `DHL`, `UPS`, `GLS`, `POST`. +- Simple type `WeightGrams`: `xs:positiveInteger`, maximum inclusive `31500`. +- Complex type `ParcelType`: ordered elements `trackingNumber` (`xs:string`), `weight` (`shp:WeightGrams`); required attribute `sequence` (`xs:positiveInteger`). +- Complex type `AddressType`: ordered elements `name`, `street`, `postalCode`, `city` (`xs:string`), and optional `country` (`xs:string`, default `DE`). +- Complex type `ShipmentNoticeType`: ordered elements `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one-or-more `parcel` (`shp:ParcelType`); required attribute `noticeId` (`xs:ID`). + +#### Configuration +- `elementFormDefault`: `qualified`. +- `AddressType.country`: `minOccurs=0`, default `DE`. +- `ShipmentNoticeType.parcel`: `maxOccurs=unbounded`. +- `ParcelType.sequence` and `ShipmentNoticeType.noticeId`: required. + +#### Dependencies +- XML Schema built-in types: `xs:string`, `xs:positiveInteger`, `xs:dateTime`, `xs:ID`. +- Internal schema types: `shp:ShipmentNoticeType`, `shp:CarrierCode`, `shp:WeightGrams`, `shp:AddressType`, `shp:ParcelType`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..250b8611 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,38 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:58:40Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Transforms a monthly account statement into an HTML page with account details, booking rows, and a total. + +#### Purpose +- Render statement data as an HTML account statement. +- Mark bookings above a configurable amount threshold with the `large` class. + +#### Type +- XSLT 1.0 stylesheet; root element `xsl:stylesheet`. +- Namespaces: `xsl` — `http://www.w3.org/1999/XSL/Transform`; `st` — `urn:example:statement`. + +#### Definitions +- Output method: `html`, encoding `UTF-8`, indentation enabled. +- Templates: + - Match `/st:statement`: outputs page title using `@period`, calls `statementHeader`, renders `st:booking` rows in a table, and calls `statementTotal`. + - Named `statementHeader`: outputs `st:accountNumber` and `@period`. + - Match `st:booking`: outputs value date, purpose, and formatted amount with currency symbol; adds class `large` when `number(st:amount) > $highlightAbove`. + - Named `statementTotal`: outputs the formatted sum of booking amounts. +- Parameters: `currencySymbol` defaults to `EUR`; `highlightAbove` defaults to `1000`. +- Key `bookingsByDay`: matches `st:booking`, indexed by `st:valueDate`. + +#### Configuration +- `currencySymbol`: `EUR`. +- `highlightAbove`: `1000`. +- Amount format: `#,##0.00`. + +#### Dependencies +- Input statement vocabulary in namespace `urn:example:statement`: `statement`, `accountNumber`, `booking`, `valueDate`, `purpose`, and `amount`. +- XSLT functions: `format-number()`, `sum()`, `number()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..1a39d830 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/package.ai.md @@ -0,0 +1,52 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:59:15Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> Provides operational and business-document tooling for payment and billing workflows, service deployment, worker health, access-log reporting, and shipment and statement processing. + +#### Purpose +- Groups tools and configuration for release operations, worker management, settled-payment exports, and access-log analysis. +- Supports invoice and overdue-reminder services plus shipment validation and account-statement rendering. + +#### Responsibilities +- **Operational reporting:** Parse, filter, normalize, and aggregate web access logs; produce ranked text or JSON reports, including slow-request counts. +- **Service and payment operations:** Deploy tagged releases to selected hosts and verify health; inspect and manage `queue-worker`; export settled payments with control metadata. +- **Billing and reminders:** Configure the `invoice-service` build and migrations; wire weekday overdue-reminder processing to database and SMTP components. +- **Business documents:** Validate shipment notices against XML constraints and transform account statements into formatted HTML. + +#### Key units +- `LogDigest`, `log_digest.pl` — aggregate access-log records and produce filtered, ranked reports. +- `deploy_host`, `wait_healthy`, `load_hosts` — deploy releases to selected hosts and check service health. +- `start_worker`, `stop_worker`, `is_running`, `heartbeat_age` — manage and inspect queue-worker process and heartbeat state. +- `run_export`, `write_control` — export settled-payment rows and record business day and row count. +- `invoice-service` — Maven project `org.example.billing:invoice-service:2.7.0`, with Java 17, Flyway migrations, and optional PDFBox support. +- `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler` — configure and schedule weekday overdue reminders. +- `shipmentNotice`, `ShipmentNoticeType`, `CarrierCode`, `WeightGrams`, `ParcelType`, `AddressType` — define shipment-notice structure and constraints. +- `/st:statement`, `st:booking`, `statementHeader`, `statementTotal` — render statement details, booking rows, totals, and large-amount styling. + +#### Data flow +- Access logs are host-filtered and alias-normalized before `LogDigest` aggregates them for text or JSON output. +- Deployment options select hosts and a build archive; each host receives the release, restarts `orderd`, and is checked through `/health`. +- Worker commands use PID and heartbeat files to determine process state and report status. +- Payment export queries Oracle `settled_payment` for a business day, writes CSV and row-count metadata, then compresses the CSV. +- Spring configuration wires reminder properties, database and SMTP dependencies, and schedules `OverdueReminderJob.sendDueReminders` on weekdays at 07:00. +- Shipment XML is validated in `urn:example:shipment:1`; statement XML in `urn:example:statement` is transformed to formatted HTML. + +#### Dependencies +- Log reporting uses Perl modules including `POSIX`, `List::Util`, `Getopt::Long`, and `JSON::PP`; aliases come from `$ENV{LOG_DIGEST_CONFIG}` or `/etc/log-digest.conf`. +- Deployment uses `lib/common.sh`, host lists, `rsync`, `ssh`, `curl`, and remote `sudo systemctl`; worker tools target `/usr/local/bin/queue-worker`. +- Payment export uses Oracle `sqlplus`, `settled_payment`, and `gzip`; the default SID is `PAYPRD`. +- `invoice-service` inherits from `org.example.billing:billing-parent:2.7.0` and uses Jackson Databind, Flyway, PostgreSQL, JUnit Jupiter, and Testcontainers PostgreSQL. +- Reminder wiring references `reminder.properties`, HikariCP, and `org.example.reminder` repository, gateway, and job classes; XML processing uses XML Schema built-in types and XSLT functions. + +#### Cross-cutting +- Configuration comes from command-line options, environment variables, Maven properties, Spring placeholders, and XSLT parameters. +- Log analysis caps input at 50,000 lines, validates levels, ignores invalid lines, and marks requests slower than 1,500 ms. +- Deployment stops on failed health checks; payment export retries up to three times; scripts report failures with exit codes. +- Reminder scheduling uses a two-thread pool and closes its data source on shutdown; statement rendering defaults to `EUR`, a 1000 highlight threshold, and `#,##0.00` formatting. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..e3407f02 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-6-luna/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 5AD2BAE5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:59:24Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project combines payment and billing workflows with operational tooling for release deployment and queue-worker health. It also provides access-log analysis and XML-based shipment validation and account-statement processing, with runtime configuration for billing and reminders. + +#### Packages +- other — Supports billing and payment operations, release and worker administration, access-log analysis, and XML-based shipment and account-statement processing. +- other/perl — Converts web-server access logs into host, status, and slow-request statistics, with configurable host aliases, exclusions, and text or JSON reporting. +- other/shell — Automates release rollout, queue-worker health management, and nightly settled-payment exports for operational services. +- other/xml — Defines billing and reminder runtime configuration alongside shipment-message validation and account-statement rendering. +- . — Provides operational and business-document tooling for payment and billing workflows, service deployment, worker health, access-log reporting, and shipment and statement processing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..51baeca7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,61 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:00:21Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A toolkit that aggregates web‑server logs, deploys application releases, and supports invoicing workflows through build, scheduling, and XML processing. + +#### Purpose +- Log aggregation and reporting for web servers. +- Automated deployment and process management for a queue worker. +- Build, scheduling, and XML‑based invoicing and reminder services. + +#### Responsibilities +- **Log Processing** – parse access logs, aggregate host and status statistics, identify slow requests, and output summaries or JSON. +- **Deployment & Process Control** – orchestrate tarball deployment, service restarts, health checks, and manage a long‑running queue worker. +- **Invoicing Infrastructure** – Maven build, scheduled reminder jobs, XML schema validation, and XSLT rendering of statements. + +#### Key units +- **Perl** + - `LogDigest` (class): `add`, `summarize`, `top_n`, `parse_line`. + - `log_digest.pl` (script): `usage`, `read_aliases`, `main`. +- **Shell** + - `deploy_release.sh` – host‑by‑host deployment, health verification, service restart. + - `healthcheck.sh` – PID/heartbeat management for queue worker. + - `nightly_extract.ksh` – Oracle export to CSV/CTL, gzip, retry logic. +- **XML** + - `invoice-service-pom.xml` – Maven project, Flyway, PDF profile. + - `scheduler-context.xml` – Spring beans for overdue‑reminder job. + - `shipment.xsd` – XML Schema for shipment notices. + - `statement-to-html.xsl` – XSLT for statement HTML rendering. + +#### Data flow +1. **Log Toolkit** – CLI supplies log files → `log_digest.pl` reads config → `LogDigest` aggregates → summary/JSON output. +2. **Deployment** – `deploy_release.sh` rsyncs tarball → SSH extraction → symlink update → service restart → health check. +3. **Worker** – `healthcheck.sh` starts `/usr/local/bin/queue-worker`, writes PID/heartbeat → healthcheck monitors age. +4. **Export** – `nightly_extract.ksh` runs Oracle query → CSV/CTL → gzip → archive. +5. **Invoicing** – Maven builds JAR → Spring loads `scheduler-context.xml` → `overdueReminderJob` queries DB → emails sent. +6. **XML** – Shipment notices validated against `shipment.xsd`; monthly statements transformed by `statement-to-html.xsl` into HTML. + +#### Dependencies +- **Perl**: `POSIX`, `List::Util`, `Carp`, `Exporter`, `FindBin`, `Getopt::Long`, `JSON::PP`. +- **Shell**: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `nohup`, `kill`, `sqlplus`, `gzip`. +- **XML**: Maven (`jackson-databind`, `flyway-core`, `postgresql`, `pdfbox`), Spring (`context`, `task`), HikariCP, XSLT processor. +- **External**: Oracle database (`/ AS SYSDBA`), host lists (`hosts.staging`, `hosts.production`). + +#### Cross-cutting +- Configuration via environment variables and external files (`/etc/log-digest.conf`, `reminder.properties`). +- Consistent error handling: `set -euo pipefail` in shell, `croak` in Perl. +- Logging helper (`log`) used across scripts. +- Retry logic with exponential back‑off in `nightly_extract.ksh`. +- Host normalization (lowercase, strip trailing dots) in `LogDigest`. +- Scheduler cron: `0 0 7 * * MON-FRI`; pool size 2. +- XML schema defaults: country `DE`, carrier enumeration. +- XSLT parameters (`currencySymbol`, `highlightAbove`) allow runtime overrides. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..d9312ee0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,69 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:59:27Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Provides a log‑digesting object for web‑server access logs. +- Counts per‑host, per‑status, and slow requests. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: `new`, `add`, `summarize`. + +#### Input +- `new(level => $level)` – `$level` must be one of `DEBUG`, `INFO`, `WARN`, `ERROR`; defaults to `WARN`. +- `add($line)` – expects a log line matching the regex in `parse_line`. +- `parse_line($line)` – parses a single log line. +- `top_n($counts, $n)` – returns top `$n` keys from a hash of counts. + +#### Output +- `add` returns `1` on successful parse, `0` if line ignored, dies on too many lines. +- `summarize` returns hashref: + - `generated` – UTC timestamp. + - `total` – total lines processed. + - `hosts` – number of distinct hosts. + - `busiest` – max count for any host. + - `slow` – number of requests > 1500 ms. + - `statuses` – hashref of status counts. +- `top_n` returns list of keys sorted by count descending, then lexicographically. + +#### Core logic +- `new`: validate level, initialize counters. +- `parse_line`: regex extracts host, time, method, path, status, millis; normalizes host. +- `add`: enforce `MAX_LINES`; parse line; increment host and status counters; count slow requests. +- `summarize`: compute totals, busiest host, and assemble summary hash. +- `top_n`: sort counts descending, return top `$n`. +- `_normalize_host`: lowercase, strip trailing dot. + +#### Subs +- `new(%args) -> object` – create digest with level. +- `parse_line($line) -> hashref` – parse log line. +- `add($line) -> 1/0` – add entry, update counters. +- `summarize() -> hashref` – produce summary. +- `top_n($counts, $n) -> list` – top keys by count. +- `_normalize_host($host) -> host` – lowercase, strip dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `%LEVEL_RANK = (DEBUG => 0, INFO => 1, WARN => 2, ERROR => 3)` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `croak` if unknown level in `new`. +- `croak` if more than `MAX_LINES` added in `add`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..566ce08e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,73 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:59:31Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Generates a summary of web‑server access logs, listing the busiest hosts and status‑code counts, optionally in JSON. + +#### Purpose +- Script to analyze access logs. +- Outputs busiest hosts and request statistics. + +#### Type +- Script. +- No package; procedural. + +#### Input +- Command‑line options: + - `--top|n=i` → `$top` (default 10) + - `--level=s` → `$level` (default 'WARN') + - `--json!` → `$as_json` (default 0) + - `--exclude-host=s` → `@exclude_hosts` + - `--help|h` → prints usage +- Positional arguments: `FILE...` (log files) +- Environment variable: `LOG_DIGEST_CONFIG` → `$config_file` (default `/etc/log-digest.conf`) +- Reads alias file: `$config_file` +- Reads each log file line by line. + +#### Output +- If `$as_json`: JSON string of `$summary` followed by newline. +- Else: plain text: + - One line: `" requests from hosts, slow"` + - Followed by `$top` lines from `top_n($digest->{hosts}, $top)` +- Exit status 0 on success; non‑zero on errors. + +#### Core logic +- Load host aliases from config file. +- Build exclusion set from `@exclude_hosts`. +- Create `LogDigest` object with `level`. +- For each input file: + - Read each line. + - Extract host (first token). + - Skip if host (or its alias) is excluded. + - Pass line to `$digest->add`. +- After all files, call `$digest->summarize`. +- Output summary in chosen format. + +#### Subs +- `usage() -> string` – returns usage text. +- `read_aliases(path) -> hash` – parses `key = value` pairs, ignores comments/blank lines. +- `main() -> int` – orchestrates processing, returns exit code. + +#### Constants and configuration +- `$config_file = $ENV{LOG_DIGEST_CONFIG} // '/etc/log-digest.conf'` +- `$top = 10` +- `$level = 'WARN'` +- `$as_json = 0` +- `@exclude_hosts = ()` + +#### Dependencies +- `FindBin` – `$Bin` +- `Getopt::Long` – `GetOptions` +- `JSON::PP` – `->new->canonical->encode` +- `LogDigest` – `new`, `add`, `summarize`, `top_n` + +#### Exceptions / Errors +- `die usage()` on bad options. +- `die "--top must be positive\n"` if `$top < 1`. +- `die "cannot read $file: $!\n"` if a log file cannot be opened. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..a91dc10f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,43 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:00:03Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> A Perl toolkit that parses web‑server access logs, aggregates per‑host and per‑status statistics, and reports the busiest hosts and slow requests, optionally as JSON. + +#### Purpose +- Aggregate and summarize web‑server access logs. +- Identify busiest hosts and slow requests. +- Provide a command‑line utility for quick reporting. + +#### Responsibilities +- **Log parsing & aggregation** – `LogDigest` module parses individual log lines, normalizes hosts, counts requests, tracks slow requests, and tallies status codes. +- **Reporting** – `log_digest.pl` script consumes `LogDigest`, applies host exclusions and aliases, and outputs a concise summary or JSON. + +#### Key units +- **`LogDigest`** – OO class; methods: `new`, `add`, `summarize`, `top_n`; exports `parse_line`. +- **`log_digest.pl`** – procedural script; functions: `usage`, `read_aliases`, `main`. + +#### Data flow +1. **Input** – log files supplied on the command line. +2. **Alias & exclusion** – `log_digest.pl` reads `/etc/log-digest.conf` (or env override) for host aliases and builds an exclusion set. +3. **Processing** – each line is passed to `LogDigest->add`; the module updates host, status, and slow‑request counters. +4. **Summarization** – after all files, `summarize` produces totals, busiest host, and status counts. +5. **Output** – script prints a plain‑text line and top‑N hosts, or JSON if `--json` is set. + +#### Dependencies +- **Perl core** – `POSIX`, `List::Util`, `Carp`, `Exporter`, `FindBin`, `Getopt::Long`. +- **CPAN** – `JSON::PP`. +- **Internal** – `LogDigest` module used by the script. + +#### Cross-cutting +- **Host normalization** – lowercasing and stripping trailing dots (`_normalize_host`). +- **Error handling** – `croak` for invalid levels or exceeding `MAX_LINES`; script dies on file read errors. +- **Configuration** – host alias file (`/etc/log-digest.conf`), command‑line options (`--top`, `--level`, `--json`, `--exclude-host`). +- **Constants** – `MAX_LINES=50000`, `SLOW_REQUEST_MS=1500`, log levels mapping. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..9e454185 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,84 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:59:36Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploys a specified release tarball to all hosts in a chosen environment. +- Restarts the `orderd` service on each host. +- Stops deployment if a host fails its health check. +- Can run in dry‑run mode. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`) +- Strict mode: `set -euo pipefail` + +#### Input +- Options parsed with `getopts`: + - `-e ` → `ENVIRONMENT` + - `-t ` → `TAG` + - `-n` → `DRY_RUN=1` + - `-p ` → ignored, logged + - `-h` → prints usage +- Environment variables: + - `DEPLOY_USER` (default `deploy`) + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`) +- Files read: + - `hosts.staging` or `hosts.production` in `$SCRIPT_DIR` + - `build/.tar.gz` (source tarball) + +#### Output +- Copies `build/.tar.gz` to `/tmp/` on each host via `rsync`. +- Extracts tarball to `$RELEASE_ROOT/$TAG` on host. +- Creates symlink `$RELEASE_ROOT/current` pointing to the new release. +- Restarts `orderd` service via `systemctl`. +- Checks health at `http://:8080/health`; aborts if timeout. +- Logs actions to stderr. +- Exit status 0 on success, 1 on error. + +#### Core logic +- Parse options; validate `ENVIRONMENT` and `TAG`. +- Verify required tools (`rsync`, `ssh`, `curl`) and SSH key. +- Load host list from environment‑specific file. +- For each host: + - If dry‑run: log intended action. + - Else: + - `rsync` tarball to host. + - SSH into host, extract tarball, update symlink, restart service. + - Wait for health endpoint, abort on timeout. + - Log successful deployment. + +#### Functions +- `log` – prints timestamped message to stderr. +- `die` – logs error and exits. +- `usage` – prints usage from script comment. +- `check_prereqs` – ensures required tools and SSH key exist. +- `load_hosts` – reads host list file into `HOSTS` array. +- `deploy_host` – deploys release to a single host. +- `wait_healthy` – polls health endpoint until success or timeout. +- `cleanup` – removes temporary lock file on exit. + +#### Constants and configuration +- `SCRIPT_DIR` – directory of script. +- `DEPLOY_USER` – `deploy` +- `SSH_KEY` – `$HOME/.ssh/deploy_ed25519` +- `RELEASE_ROOT` – `/opt/releases` +- `SERVICE_NAME` – `orderd` +- `HEALTH_TIMEOUT` – `30` +- `HOST_FILES` – associative array mapping environments to host list files. + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `mkdir`, `ln`. +- Host list files: `hosts.staging`, `hosts.production`. +- Source tarball: `build/.tar.gz`. + +#### Errors and exit codes +- `die` exits with status 1 for missing tools, unreadable SSH key, empty host list, health timeout, or unknown options. +- `usage` prints help and exits with status 0 or 2 when required arguments are missing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..d88187e5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,67 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:59:42Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> A POSIX init-style wrapper that manages a queue worker, providing start, stop, status, restart, and health checks based on a PID file and heartbeat file age. + +#### Purpose +- Controls a queue worker process. +- Exposes init-style commands: `start`, `stop`, `restart`, `status`, `health`. + +#### Type +- POSIX sh (`#!/bin/sh`). +- No strict mode flags used. + +#### Input +- `$1`: command (`start|stop|restart|status|health`). +- Environment variables: + - `PID_FILE` (default `/run/queue-worker.pid`). + - `HEARTBEAT_FILE` (default `/var/lib/queue-worker/heartbeat`). +- No additional options or arguments. + +#### Output +- Writes PID to `$PID_FILE` on start. +- Removes `$PID_FILE` on stop. +- Prints status messages (`running`, `stopped`, `OK`, `WARNING`, `CRITICAL`). +- Exits with codes: `0` success, `1` warning, `2` critical, `3` stopped, `64` usage error. + +#### Core logic +- `is_running`: checks if PID file exists and process is alive. +- `heartbeat_age`: computes seconds since last heartbeat file modification. +- `start_worker`: starts worker with `nohup`, records PID. +- `stop_worker`: kills process and removes PID file. +- Command dispatch via `case` on `$1`: + - `start`: invoke `start_worker`. + - `stop`: invoke `stop_worker`. + - `restart`: stop then start. + - `status`: report running/stopped, exit 3 if stopped. + - `health`: verify running and heartbeat age ≤ `MAX_HEARTBEAT_AGE` (120s); warn if older. + - default: usage message, exit 64. + +#### Functions +- `is_running`: checks process existence. +- `heartbeat_age`: calculates heartbeat age. +- `start_worker`: launches worker, records PID. +- `stop_worker`: terminates worker, cleans PID file. + +#### Constants and configuration +- `PID_FILE`=`/run/queue-worker.pid` +- `HEARTBEAT_FILE`=`/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE`=`120` +- `WORKER_BIN`=`/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `kill`, `nohup`, `date`, `stat`, `cat`. +- Worker binary: `/usr/local/bin/queue-worker` (expects `--heartbeat` option). + +#### Errors and exit codes +- `exit 2`: worker not running during health check. +- `exit 1`: heartbeat older than `MAX_HEARTBEAT_AGE`. +- `exit 3`: status reports stopped. +- `exit 64`: invalid command usage. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..7eced805 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,70 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:59:45Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, creates a control file, and gzips the result. + +#### Purpose +- Performs nightly export of settled payments. +- Runs as a standalone script. + +#### Type +- `ksh93` shell. +- Uses `set -e`? none; uses `typeset -i` and `until` loop. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → sets `business_day`. + - `-o

` → sets `export_dir`. +- Environment variables: + - `ORACLE_SID` (default `PAYPRD`). + - `NLS_LANG` set to `AMERICAN_AMERICA.AL32UTF8`. +- No positional arguments. + +#### Output +- Creates `$export_dir/payments_$business_day.csv`. +- Generates control file `$export_dir/payments_$business_day.ctl` with row count. +- Gzips the CSV to `$export_dir/payments_$business_day.csv.gz`. +- Prints log messages to stderr. +- Exit status: `0` on success, `1` on failure, `3` if required tool missing, `4` if retries exhausted. + +#### Core logic +- Parse options; set defaults. +- Ensure export directory exists. +- Attempt export up to `MAX_RETRIES` times: + - Run `run_export` to spool SQL query output to CSV. + - If successful, write control file, gzip CSV, log success, exit. + - On failure, log, sleep 60, retry. +- On exhausting retries, call `fail`. + +#### Functions +- `log` – prints timestamped message to stderr. +- `fail` – logs failure and exits with code. +- `require_tools` – checks for `sqlplus` and `gzip`. +- `run_export` – runs SQL query via `sqlplus` and writes to file. +- `write_control` – counts rows in CSV and writes control file. + +#### Constants and configuration +- ``ORACLE_SID_DEFAULT=PAYPRD`` +- ``EXPORT_DIR_DEFAULT=/data/export/payments`` +- ``MAX_RETRIES=3`` +- ``attempt=0`` +- ``business_day=$(date +%Y%m%d)`` +- ``export_dir=$EXPORT_DIR_DEFAULT`` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle database connection via `/ AS SYSDBA`. +- SQL query selects from `settled_payment` table. + +#### Errors and exit codes +- `fail` with code `3` if `sqlplus` or `gzip` missing. +- `fail` with code `4` after exceeding `MAX_RETRIES`. +- `fail` with code `2` on usage error. +- `exit 0` on successful export. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..f589e69a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,45 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:00:10Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> A collection of shell utilities that deploy releases, manage a queue worker, and export nightly payment data. + +#### Purpose +- Deploy application releases to multiple hosts. +- Control a long‑running queue worker process. +- Export settled payments from Oracle to CSV. + +#### Responsibilities +- **Deployment**: transfer tarballs, update symlinks, restart services, health‑check hosts. +- **Process Management**: start/stop/restart a worker, track PID, monitor heartbeat. +- **Data Extraction**: run Oracle queries, generate CSV/CTL, gzip output, retry on failure. + +#### Key units +- `deploy_release.sh` – orchestrates host‑by‑host deployment, health verification, and service restart. +- `healthcheck.sh` – init‑style wrapper for a queue worker, handling PID/heartbeat files and status reporting. +- `nightly_extract.ksh` – nightly Oracle export script, producing CSV, control file, and gzipped archive. + +#### Data flow +1. **Deploy**: `deploy_release.sh` reads an environment‑specific host list, rsyncs a tarball, SSH‑executes extraction, updates `$RELEASE_ROOT/current`, restarts `orderd`, and polls `/health`. +2. **Worker**: `healthcheck.sh` starts `/usr/local/bin/queue-worker` with `nohup`, writes its PID, and writes a heartbeat file; health checks compare heartbeat age to `MAX_HEARTBEAT_AGE`. +3. **Export**: `nightly_extract.ksh` runs a SQL query via `sqlplus`, writes results to a CSV, counts rows for a control file, gzips the CSV, and retries on transient failures. + +#### Dependencies +- External utilities: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `nohup`, `kill`, `sqlplus`, `gzip`. +- Host list files: `hosts.staging`, `hosts.production`. +- Oracle connection: `/ AS SYSDBA` with `ORACLE_SID`. +- Worker binary: `/usr/local/bin/queue-worker`. + +#### Cross‑cutting +- Strict error handling in `deploy_release.sh` (`set -euo pipefail`). +- Common logging function `log` in all scripts. +- Use of environment variables for configuration (e.g., `DEPLOY_USER`, `PID_FILE`, `ORACLE_SID`). +- Retry logic in `nightly_extract.ksh` with exponential back‑off via `sleep 60`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..5dd332a3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,57 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:59:49Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Configures the Maven build for the Invoice Service, including dependencies, compiler settings, Flyway migration, and a PDF generation profile. + +#### Purpose +- Defines build configuration for the Invoice Service. +- Specifies dependencies, compiler release, and Flyway migration settings. +- Provides a profile for native PDF generation. + +#### Type +- Maven POM + Root element: `project` + Namespaces: + - `xmlns="http://maven.apache.org/POM/4.0.0"` + - `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release=17` + - `jackson.version=2.19.2` + - `flyway.version=11.4.0` + - `invoice.archive.dir=${project.build.directory}/archive` +- **Dependencies** (5 total): + - `com.fasterxml.jackson.core:jackson-databind` (`${jackson.version}`) + - `org.flywaydb:flyway-core` (`${flyway.version}`) + - `org.postgresql:postgresql` (runtime) + - `org.junit.jupiter:junit-jupiter` (test) + - `org.testcontainers:postgresql` (test) +- **Build Plugins** (2): + - `org.flywaydb:flyway-maven-plugin` (`${flyway.version}`) + - Configuration: `locations` → `filesystem:src/main/resources/db/migration` + - `org.apache.maven.plugins:maven-surefire-plugin` + - Configuration: `systemPropertyVariables` → `invoice.archive.dir=${invoice.archive.dir}` +- **Profile** `native-pdf`: + - Adds dependency `org.apache.pdfbox:pdfbox:3.0.5` + +#### Configuration +- `maven.compiler.release=17` +- `jackson.version=2.19.2` +- `flyway.version=11.4.0` +- `invoice.archive.dir=${project.build.directory}/archive` +- Flyway location: `filesystem:src/main/resources/db/migration` +- Surefire system property: `invoice.archive.dir=${invoice.archive.dir}` + +#### Dependencies +- External libraries: `jackson-databind`, `flyway-core`, `postgresql`, `junit-jupiter`, `testcontainers:postgresql`, `pdfbox` +- Parent project: `org.example.billing:billing-parent:2.7.0` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..0c1c8131 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,49 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:00:17Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides build, configuration, and data‑formatting support for an invoicing and reminder system, including Maven setup, Spring scheduling, XML schema for shipments, and XSLT for statement rendering. + +#### Purpose +- Build and dependency management for the Invoice Service. +- Configure a scheduled reminder job for overdue invoices. +- Define XML contracts for shipment notices. +- Transform monthly statement XML into HTML. + +#### Responsibilities +- **Build & Deployment** – Maven POM with compiler, Flyway, and PDF generation profile. +- **Scheduling & Email** – Spring context wiring for a daily overdue‑reminder job. +- **Data Validation** – XML Schema for shipment notices. +- **Presentation** – XSLT stylesheet converting statement XML to HTML. + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, Flyway migration, PDF profile. +- `scheduler-context.xml` – Spring bean definitions: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, and scheduled trigger. +- `shipment.xsd` – XML Schema (`shipmentNotice` element) with `ParcelType`, `AddressType`, and carrier enumeration. +- `statement-to-html.xsl` – XSLT stylesheet with parameters `currencySymbol`, `highlightAbove`; templates for header, bookings, and total. + +#### Data flow +1. **Build**: Maven compiles Java, runs Flyway migrations, packages JAR, optionally generates PDFs. +2. **Runtime**: Spring context loads `scheduler-context.xml`; `overdueReminderJob` queries `reminderRepository` (via HikariDataSource), sends emails via `mailGateway`. +3. **External Data**: Shipment notices validated against `shipment.xsd`; monthly statements transformed by `statement-to-html.xsl` into HTML pages. + +#### Dependencies +- Maven: `jackson-databind`, `flyway-core`, `postgresql`, `pdfbox`, testing libs. +- Spring: `context`, `task`; HikariCP for data source. +- XSLT: relies on input XML in `urn:example:statement` namespace. + +#### Cross-cutting +- Central configuration via property placeholders (`reminder.properties`). +- Consistent use of `jdbcUrl`, `username`, and `maximumPoolSize` for data sources. +- Scheduler uses cron expression `0 0 7 * * MON-FRI` and a pool size of 2. +- XML schema defines default country `DE` and enumerated carrier codes. +- XSLT parameters allow currency symbol and highlight threshold to be overridden. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..59ace409 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,46 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:59:53Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Configures a Spring context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled trigger. + +#### Purpose +- Wire reminder scheduler components. +- Schedule `OverdueReminderJob.sendDueReminders` daily at 7 AM Monday‑Friday. + +#### Type +- Spring bean configuration (`` root). +- Namespaces: `http://www.springframework.org/schema/beans` (default), `http://www.springframework.org/schema/context`, `http://www.springframework.org/schema/task`. + +#### Definitions +- **Property placeholder**: `reminder.properties`. +- **Component scan**: `org.example.reminder.web`. +- **Beans**: + - `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`): `jdbcUrl` `${reminder.db.url}`, `username` `${reminder.db.user}`, `maximumPoolSize` `8`. + - `reminderRepository` (`org.example.reminder.JdbcReminderRepository`): constructor `reminderDataSource`. + - `mailGateway` (`org.example.reminder.SmtpMailGateway`): `host` `${reminder.smtp.host}`, `port` `587`. + - `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`): constructor `reminderRepository`, `mailGateway`; property `graceDays` `14`. +- **Scheduler**: `reminderScheduler` (`task:scheduler`) with `pool-size` `2`. +- **Scheduled task**: `overdueReminderJob.sendDueReminders` cron `0 0 7 * * MON-FRI`. + +#### Configuration +- `reminder.db.url` – JDBC URL. +- `reminder.db.user` – DB username. +- `reminder.smtp.host` – SMTP host. +- `reminder.smtp.port` – SMTP port `587`. +- `overdueReminderJob.graceDays` – `14`. +- Scheduler pool size – `2`. +- Cron expression – `0 0 7 * * MON-FRI`. + +#### Dependencies +- `com.zaxxer.hikari.HikariDataSource`. +- `org.example.reminder.JdbcReminderRepository`. +- `org.example.reminder.SmtpMailGateway`. +- `org.example.reminder.OverdueReminderJob`. +- Spring `context`, `task` modules. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..01e87c00 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,37 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T07:59:57Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Validates shipment notice documents. +- Specifies parcel, carrier, and recipient details. + +#### Type +- XML Schema (``) +- Root element: `shipmentNotice` +- Namespace: `urn:example:shipment:1` (prefix `shp`) + +#### Definitions +- **SimpleTypes** + - `CarrierCode`: enumeration of `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: positive integer ≤ 31500. +- **ComplexTypes** + - `ParcelType`: sequence of `trackingNumber` (`xs:string`) and `weight` (`shp:WeightGrams`); required attribute `sequence` (`xs:positiveInteger`). + - `AddressType`: sequence of `name`, `street`, `postalCode`, `city`, optional `country` (`xs:string`, default `DE`). + - `ShipmentNoticeType`: sequence of `orderReference`, `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one or more `parcel` (`shp:ParcelType`); required attribute `noticeId` (`xs:ID`). +- **Element** + - `shipmentNotice`: type `shp:ShipmentNoticeType`. + +#### Configuration +- `AddressType.country` default value: `DE`. + +#### Dependencies +- None. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..1de5889b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,42 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:00:00Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Transforms a monthly account statement XML into an HTML page with header, table rows for each booking, and a total. + +#### Purpose +- Renders a monthly account statement as an HTML page. +- Highlights bookings exceeding a threshold. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespaces: `xmlns:xsl="http://www.w3.org/1999/XSL/Transform"`, `xmlns:st="urn:example:statement"`. + +#### Definitions +- **Parameters** + - `currencySymbol` (default `'EUR'`). + - `highlightAbove` (default `1000`). +- **Key** + - `bookingsByDay`: matches `st:booking`, indexed by `st:valueDate`. +- **Templates** + - `match="/st:statement"`: outputs `` with header, table, and total. + - `name="statementHeader"`: outputs `

` with account number and `

` with period. + - `match="st:booking"`: outputs `` with optional `class="large"` if `st:amount > $highlightAbove`; cells for date, purpose, amount with currency symbol. + - `name="statementTotal"`: outputs `

` with total amount of all bookings. + +#### Configuration +- `xsl:output` method: `html`, encoding: `UTF-8`, indent: `yes`. +- `currencySymbol` parameter: `'EUR'`. +- `highlightAbove` parameter: `1000`. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: + - `st:statement` (attributes: `period`, child `st:accountNumber`). + - `st:booking` (children: `st:valueDate`, `st:purpose`, `st:amount`). +- No external schemas or files referenced. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..ff46b295 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,59 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:00:28Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A unified toolkit for web‑server log analysis, automated deployment, and invoicing workflows, integrating Perl, shell, and XML components. + +#### Purpose +- Aggregate and report web‑server logs. +- Automate application release deployment and queue‑worker lifecycle. +- Build, schedule, and render invoicing and shipment XML documents. + +#### Responsibilities +- **Log Processing** – parse, aggregate, and summarize access logs; expose JSON and host‑status metrics. +- **Deployment & Process Control** – orchestrate tarball deployment, service restarts, health checks, and long‑running worker management. +- **Invoicing & XML** – Maven build, scheduled reminder jobs, XML schema validation, and XSLT rendering of statements and shipment notices. + +#### Key units +- **Perl** + - `LogDigest` (class): `add`, `summarize`, `top_n`, `parse_line`. + - `log_digest.pl` (CLI): `usage`, `read_aliases`, `main`. +- **Shell** + - `deploy_release.sh` – host‑by‑host deployment, health verification, service restart. + - `healthcheck.sh` – PID/heartbeat monitoring for queue worker. + - `nightly_extract.ksh` – Oracle export to CSV/CTL, gzip, retry logic. +- **XML** + - `invoice-service-pom.xml` – Maven project with Flyway, PDF profile. + - `scheduler-context.xml` – Spring beans for overdue‑reminder job. + - `shipment.xsd` – XML Schema for shipment notices. + - `statement-to-html.xsl` – XSLT for statement HTML rendering. + +#### Data flow +1. **Log Toolkit** – CLI → `log_digest.pl` → `LogDigest` aggregates → summary/JSON output. +2. **Deployment** – `deploy_release.sh` rsyncs tarball → SSH extraction → symlink update → service restart → health check. +3. **Worker** – `healthcheck.sh` starts `/usr/local/bin/queue-worker`, writes PID/heartbeat → healthcheck monitors age. +4. **Export** – `nightly_extract.ksh` runs Oracle query → CSV/CTL → gzip → archive. +5. **Invoicing** – Maven builds JAR → Spring loads `scheduler-context.xml` → `overdueReminderJob` queries DB → emails sent. +6. **XML** – Shipment notices validated against `shipment.xsd`; monthly statements transformed by `statement-to-html.xsl` into HTML. + +#### Dependencies +- **Perl**: `POSIX`, `List::Util`, `Carp`, `Exporter`, `FindBin`, `Getopt::Long`, `JSON::PP`. +- **Shell**: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `nohup`, `kill`, `sqlplus`, `gzip`. +- **XML**: Maven (`jackson-databind`, `flyway-core`, `postgresql`, `pdfbox`), Spring (`context`, `task`), HikariCP, XSLT processor. +- **External**: Oracle database (`/ AS SYSDBA`), host lists (`hosts.staging`, `hosts.production`). + +#### Cross-cutting +- Configuration via environment variables and external files (`/etc/log-digest.conf`, `reminder.properties`). +- Consistent error handling: `set -euo pipefail` in shell, `croak` in Perl. +- Shared logging helper (`log`) across scripts. +- Retry logic with exponential back‑off in `nightly_extract.ksh`. +- Host normalization (lowercase, strip trailing dots) in `LogDigest`. +- Scheduler cron: `0 0 7 * * MON-FRI`; pool size 2. +- XML schema defaults: country `DE`, carrier enumeration. +- XSLT parameters (`currencySymbol`, `highlightAbove`) allow runtime overrides. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..5e239503 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run1/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: A66CB7DA +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:00:34Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard project is a unified toolkit that combines web‑server log analysis, automated deployment, and invoicing workflows. It aggregates logs and builds releases via shell utilities, while a Perl module parses access logs to produce host‑ and status‑based statistics and JSON reports. XML support supplies build, configuration, and data‑formatting for invoicing and reminder systems, including Maven, Spring scheduling, shipment schemas, and XSLT rendering. Together, these components provide a cohesive pipeline from log collection to deployment and billing. + +#### Packages +- other — A toolkit that aggregates web‑server logs, deploys application releases, and supports invoicing workflows through build, scheduling, and XML processing. +- other/perl — A Perl toolkit that parses web‑server access logs, aggregates per‑host and per‑status statistics, and reports the busiest hosts and slow requests, optionally as JSON. +- other/shell — A collection of shell utilities that deploy releases, manage a queue worker, and export nightly payment data. +- other/xml — Provides build, configuration, and data‑formatting support for an invoicing and reminder system, including Maven setup, Spring scheduling, XML schema for shipments, and XSLT for statement rendering. +- . — A unified toolkit for web‑server log analysis, automated deployment, and invoicing workflows, integrating Perl, shell, and XML components. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/meta/gpt-6-luna.json new file mode 100644 index 00000000..9156db2f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/meta/gpt-6-luna.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T08:00:36Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 73.4, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 37.5, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.7, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T08:02:30Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 15441, + "cachedPromptTokens": 15414, + "completionTokens": 6888, + "seconds": 72.8148444 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.003601, + "costUsd": 0.005919, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/meta/gpt-oss-20b.json new file mode 100644 index 00000000..8081cc85 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/meta/gpt-oss-20b.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T08:02:30Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 38.7, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 27.8, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.3, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T08:03:39Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16017, + "cachedPromptTokens": 8992, + "completionTokens": 5083, + "seconds": 38.1033168 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.001141, + "costUsd": 0.001646, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..34bc3599 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,53 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:02:12Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> Supports order and billing operations through access-log reporting, release and worker management, payment exports, reminder scheduling, shipment validation, and statement rendering. + +#### Purpose +- Groups operational scripts, log-analysis tools, and XML build, scheduling, data-contract, and presentation artifacts for order and billing services. +- Covers both runtime operations and business-data processing, from deployment and payment extraction to reminders and customer statements. + +#### Responsibilities +- **Access-log analytics (`perl/`):** Parse and aggregate requests by host and status; filter hosts and report ranked statistics as text or JSON. +- **Service operations (`shell/`):** Deploy tagged `orderd` releases, manage queue-worker lifecycle and health, and export settled payments to compressed CSV with a control file. +- **Billing and customer artifacts (`xml/`):** Configure invoice-service builds and migrations, schedule overdue reminders, define shipment XML validation, and transform statements into HTML. + +#### Key units +- `LogDigest` — parses access-log entries and summarizes normalized host, status, and slow-request counts. +- `log_digest.pl::main` — applies CLI options, aliases, and exclusions before emitting ranked text or JSON reports. +- `deploy_host` / `wait_healthy` — install a release on a host, restart `orderd`, and poll its health endpoint. +- `start_worker` / `stop_worker` / `is_running` / `heartbeat_age` — manage queue-worker processes and assess heartbeat freshness. +- `run_export` / `write_control` — query settled payments and record export row count and business day. +- `overdueReminderJob` / `reminderScheduler` — wire reminder delivery and schedule weekday runs. +- `shipmentNotice` / `ShipmentNoticeType` — define the shipment notice contract and its required data. +- `statement-to-html.xsl` templates — render statement metadata, booking rows, and totals, including threshold-based highlighting. +- `invoice-service` Maven project — configures the Java 17 service build, dependencies, tests, and Flyway migrations. + +#### Data flow +- Access-log files pass through CLI filtering and host alias handling, then `LogDigest` parsing and aggregation, producing ranked text or canonical JSON. +- Release artifacts are copied and installed host by host; each `orderd` restart is followed by health polling before deployment proceeds. +- Worker commands use PID and heartbeat files to perform lifecycle actions and report status. +- The payment export selects a business day, queries Oracle `settled_payment`, writes CSV and a control file, then gzips the CSV; failed exports are retried. +- Reminder configuration loads properties and wires the datasource, repository, SMTP gateway, and scheduled job. +- Shipment XML is validated against `shipment.xsd`; statement XML in `urn:example:statement` is transformed to HTML. + +#### Dependencies +- Perl analytics uses `Getopt::Long`, `JSON::PP`, `POSIX`, `List::Util`, `Carp`, and `Exporter`; the CLI reads access logs and optional alias configuration. +- Deployment depends on `lib/common.sh`, environment host lists, release archives, and `rsync`, `ssh`, and `curl`; worker management uses the queue-worker executable and PID/heartbeat paths. +- Payment exports use Oracle `sqlplus`, `settled_payment`, and `gzip`, `wc`, and `mkdir`. +- XML artifacts depend on the billing Maven parent and Java libraries including Jackson, Flyway, PostgreSQL, JUnit, and Testcontainers; reminder wiring uses HikariCP and `org.example.reminder` components. +- Shipment schema uses XML Schema types; statement transformation consumes the statement namespace. + +#### Cross-cutting +- Configuration is externalized where applicable: log aliases, deployment and worker settings, Oracle SID, reminder database and SMTP properties, and invoice archive directory. +- Operational scripts report failures with nonzero exit statuses; deployment stops on an unhealthy host and payment export retries up to three times. +- Domain constraints include a 1,500 ms slow-request threshold, 120-second worker heartbeat limit, 31,500-gram shipment parcel maximum, and statement highlighting above 1000. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..9c31bc3c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,68 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:00:37Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Aggregates access-log entries into normalized per-host and per-status counts, including slow-request totals and busiest-host statistics. + +#### Purpose +- Processes web-server access-log lines and produces aggregate traffic summaries. +- Provides helpers to parse entries and rank count keys. + +#### Type +- Module: `LogDigest`; procedural functions and blessed-object API via `new`. +- `@EXPORT_OK`: `parse_line`, `top_n`; no default exports. + +#### Input +- `new(level => ...)`: optional `level` argument; defaults to `DEFAULT_LEVEL`. +- `add($line)`: accepts an access-log line matching the module’s fixed pattern. +- `parse_line($line)`: accepts one access-log line. +- `top_n($counts, $n)`: accepts a count hash reference and requested number of keys. +- No command-line options, `%ENV` reads, or file reads. + +#### Output +- `parse_line` returns a hash reference with `host`, `time`, `method`, `path`, `status`, and `millis`; returns false for non-matching lines. +- `add` returns `1` for a parsed entry and `0` for a non-matching line; updates object counts. +- `summarize` returns a hash reference with UTC `generated` timestamp, `total`, distinct `hosts`, `busiest` host count, `slow` request count, and copied `statuses` counts. +- `top_n` returns keys sorted by descending count, then ascending key. +- Prints nothing; writes no files. + +#### Core logic +- `new` validates the requested log level and initializes host/status counts, slow-request count, and line count. +- `parse_line` extracts host, timestamp, method, path, status, and response time using a fixed access-log regular expression; lowercases the host and removes one trailing dot. +- `add` increments the line count, rejects input beyond `MAX_LINES`, skips malformed lines, and updates host and status counts. +- Counts a request as slow when its response time exceeds `SLOW_REQUEST_MS`. +- `summarize` computes total requests, distinct hosts, and maximum requests for one host; adds the UTC generation time and status-count copy. +- `top_n` orders keys by count descending with lexical tie-breaking. + +#### Subs +- `new($class, %args) -> object` — validate level; initialize counters. +- `parse_line($line) -> hashref or false` — parse one access-log entry. +- `add($self, $line) -> 1 or 0` — count a valid entry. +- `summarize($self) -> hashref` — produce aggregate statistics. +- `top_n($counts, $n) -> list` — rank count keys. +- `_normalize_host($host) -> string` — lowercase and trim trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50_000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `$VERSION = '1.4'` +- `@EXPORT_OK = qw(parse_line top_n)` +- `%LEVEL_RANK = (DEBUG => 0, INFO => 1, WARN => 2, ERROR => 3)` + +#### Dependencies +- `strict`, `warnings` — enable strictness and warnings. +- `POSIX`: imports `strftime`. +- `List::Util`: imports `max`, `sum`. +- `Carp`: imports `croak`. +- `parent`: inherits from `Exporter`. + +#### Exceptions / Errors +- `new` croaks with `unknown level '$level'` for an unrecognized level. +- `add` croaks with `more than 50000 lines` after the line limit is exceeded. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..ae148d73 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/perl/log_digest.pl.ai.md @@ -0,0 +1,68 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:00:48Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Summarizes access-log requests by host and status, applying configured host aliases and exclusions, then prints busiest hosts and request counts as text or JSON. + +#### Purpose +- Command-line tool for digesting access-log files. +- Reads host aliases from configuration and reports aggregate request statistics. + +#### Type +- Script; no package declaration. +- Procedural; calls `LogDigest->new`. +- No exports. + +#### Input +- Options: `--top` / `--n` → `$top`; `--level` → `$level`; `--json` / `--nojson` → `$as_json`; repeated `--exclude-host` → `@exclude_hosts`; `--help` / `--h` → print usage and exit. +- `@ARGV`: access-log file paths; each log line is passed to the digest after host filtering. +- `%ENV`: `LOG_DIGEST_CONFIG` sets `$config_file`; default `/etc/log-digest.conf`. +- Reads the config file for host aliases; unreadable or absent config yields no aliases. +- Reads each `@ARGV` file line by line. + +#### Output +- JSON mode: canonical JSON summary plus newline. +- Text mode: request/host/slow counts, then lines from `top_n($digest->{hosts}, $top)`. +- `main` returns `0`; script exits with that status. +- Usage is printed for help or invalid options; help exits `0`. + +#### Core logic +- Parse options and reject `$top < 1` with `--top must be positive`. +- Load aliases as `from=to` mappings, skipping blank and comment lines. +- Build an exclusion lookup from `@exclude_hosts`. +- Construct a digest with `LogDigest->new(level => $level)`. +- For each log line, extract its first space-delimited field as host; skip it if the aliased host (or original host when no alias exists) is excluded. +- Add remaining lines to the digest and summarize it. +- Emit canonical JSON or formatted text with `top_n` host results. + +#### Subs +- `usage()` → usage text; documents options and config path. +- `read_aliases($path)` → alias hash; reads `from=to` mappings. +- `main()` → `0`; reads logs and prints digest. + +#### Constants and configuration +- `$config_file` → `$ENV{LOG_DIGEST_CONFIG}` or `/etc/log-digest.conf`. +- `$top` → `10`. +- `$level` → `'WARN'`. +- `$as_json` → `0`. +- `@exclude_hosts` → empty initially. + +#### Dependencies +- `strict`, `warnings` — enable strictness and warnings. +- `FindBin` — imports `$Bin`. +- `lib` — adds `$Bin` to module search path. +- `Getopt::Long` — imports `GetOptions`. +- `JSON::PP` — canonical JSON encoding. +- `LogDigest` — imports `top_n`; uses `new`, `add`, and `summarize`. + +#### Exceptions / Errors +- Dies with usage text if `GetOptions` fails. +- Dies with `--top must be positive` if `$top < 1`. +- Dies with `cannot read $file: $!` when an input log cannot be opened. +- Config-file open failure is silently treated as an empty alias map. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/perl/package.ai.md new file mode 100644 index 00000000..f054cbae --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/perl/package.ai.md @@ -0,0 +1,45 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:01:50Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Converts access-log traffic into normalized host and status statistics, with filtering and text or JSON reporting. + +#### Purpose +- Parse web-server access logs and aggregate request, host, status, and slow-request counts. +- Provide a command-line report with configurable host aliases, exclusions, ranking, and output format. + +#### Responsibilities +- **Parsing and aggregation:** Match access-log entries, normalize hosts, enforce a line limit, and accumulate counts and summary statistics. +- **Ranking:** Order count keys by descending count with lexical tie-breaking. +- **CLI reporting:** Parse options and log files, load host aliases, filter excluded hosts, and print text or canonical JSON summaries. + +#### Key units +- `LogDigest`: Perl module exposing an object API for collecting entries and producing aggregate summaries. +- `LogDigest::parse_line`: Extract host, timestamp, method, path, status, and response time from a log line. +- `LogDigest::add`: Add a valid entry to host and status counts and track slow requests. +- `LogDigest::summarize`: Return generated time, request and host totals, busiest-host count, slow-request count, and status counts. +- `LogDigest::top_n`: Rank keys from a count hash. +- `log_digest.pl::read_aliases`: Read `from=to` host mappings from configuration. +- `log_digest.pl::main`: Filter and digest input logs, then emit the selected report format. + +#### Data flow +- `log_digest.pl` parses CLI options and loads aliases from `LOG_DIGEST_CONFIG` or `/etc/log-digest.conf`. +- For each input line, the script checks the first field against the exclusion list after alias mapping; remaining lines go to `LogDigest->add`. +- `LogDigest` parses and normalizes entries, updates counts, and returns a summary; the script prints canonical JSON or text with ranked hosts. + +#### Dependencies +- `LogDigest` uses `POSIX` for UTC timestamps, `List::Util` for aggregate operations, `Carp` for errors, and `Exporter` for optional exports. +- `log_digest.pl` uses `Getopt::Long`, `JSON::PP`, `FindBin`, and `LogDigest`. +- Configuration and inputs: `LOG_DIGEST_CONFIG` alias file and access-log files supplied through `@ARGV`. + +#### Cross-cutting +- `LogDigest` defaults to `WARN`, accepts `DEBUG`, `INFO`, `WARN`, or `ERROR`, rejects unknown levels, and limits processing to `MAX_LINES` (50,000). +- Hosts are lowercased and have one trailing dot removed; requests over `SLOW_REQUEST_MS` (1,500 ms) count as slow. +- The CLI defaults to the top 10 hosts and text output; config-file read failures produce an empty alias map. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..190258a8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,82 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:00:57Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Deploys a tagged release to each staging or production host, restarts `orderd`, and stops if a host fails its health check. + +#### Purpose +- Roll out `build/.tar.gz` to environment hosts one at a time. +- Run directly; sources `lib/common.sh`. + +#### Type +- Bash; strict mode: `set -euo pipefail`. + +#### Input +- `-e ` sets `ENVIRONMENT`; parsed by `getopts`. +- `-t ` sets `TAG`. +- `-n` sets `DRY_RUN=1`; logs planned deployments without deploying. +- `-p ` logs that parallel deploys are unsupported and ignores the value. +- `-h` prints usage and exits. +- Environment variables: `DEPLOY_USER` defaults to `deploy`; `SSH_KEY` defaults to `$HOME/.ssh/deploy_ed25519`; `HOME` supplies the default SSH-key location. +- Reads `lib/common.sh`, the selected `hosts.staging` or `hosts.production` file, and `build/.tar.gz`. +- Checks that the SSH key is readable. + +#### Output +- Logs timestamps and deployment messages to stderr; `-h` prints usage to stdout. +- On remote hosts: copies the release tarball to `/tmp/`, extracts it under `/opt/releases/`, updates `/opt/releases/current`, and restarts `orderd` with `sudo systemctl`. +- Sends health checks to `http://:8080/health`. +- Removes `/tmp/deploy_release.$$.lock` on exit; the script does not create this lock file. + +#### Core logic +- Parse options; require nonempty `ENVIRONMENT` and `TAG`. +- Check for `rsync`, `ssh`, and `curl`, and verify the SSH key is readable. +- Read the selected host file, skipping lines beginning with `#`; fail if no hosts are loaded. +- For each host in order: + - In dry-run mode, log the planned deployment and return. + - Copy `build/.tar.gz` to the host’s `/tmp/` using `rsync` over SSH. + - Remotely create the release directory, extract the tarball, update the `current` symlink, and restart `orderd`. + - Poll the host’s health endpoint every two seconds; log successful deployment before proceeding to the next host. + +#### Functions +- `log`: Print timestamped messages to stderr. +- `die`: Log an error and exit with status 1. +- `usage`: Print the usage comment. +- `check_prereqs`: Check required commands and SSH key. +- `load_hosts`: Read the selected environment’s host list. +- `deploy_host`: Copy, install, and restart a release on one host. +- `wait_healthy`: Poll a host’s health endpoint until healthy. +- `cleanup`: Remove the PID-specific lock path. + +#### Constants and configuration +- `SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"`. +- `DEPLOY_USER="${DEPLOY_USER:-deploy}"`. +- `SSH_KEY="${SSH_KEY:-$HOME/.ssh/deploy_ed25519}"`. +- `RELEASE_ROOT="/opt/releases"` (exported). +- `SERVICE_NAME="orderd"`. +- `HEALTH_TIMEOUT=30`. +- `ENVIRONMENT=""`. +- `TAG=""`. +- `DRY_RUN=0`. +- `HOSTS=()`. +- `HOST_FILES=([staging]="hosts.staging" [production]="hosts.production")`. + +#### Dependencies +- Sourced file: `$SCRIPT_DIR/lib/common.sh`. +- External commands: `date`, `sed`, `command`, `grep`, `rsync`, `ssh`, `curl`, `sleep`, `rm`, `mkdir`, `tar`, `sudo`, `systemctl`. +- Host-list files: `$SCRIPT_DIR/hosts.staging`, `$SCRIPT_DIR/hosts.production`. +- Release artifact: `build/$TAG.tar.gz`. +- Remote service: `orderd`; remote health endpoint: `http://$host:8080/health`. + +#### Errors and exit codes +- Exit 1 via `die` for missing tools, unreadable SSH key, unknown environment, empty host list, or health-check timeout. +- Exit 2 if `ENVIRONMENT` or `TAG` is missing. +- Exit 0 for `-h`; successful completion otherwise returns 0. +- Unknown options and options missing values call `die`. +- Health checks retry every two seconds, up to `HEALTH_TIMEOUT` (30 seconds); stops deployment at the first failed host. +- `EXIT` trap runs `cleanup`, removing `/tmp/deploy_release.$$.lock`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..32a4f73f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,62 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:01:10Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Manages the queue worker lifecycle and checks whether its heartbeat is recent enough. + +#### Purpose +- Starts, stops, restarts, and reports status for the queue worker; `health` checks that it is running and its heartbeat is fresh. +- Run directly as an init-style command wrapper. + +#### Type +- POSIX `sh` (`#!/bin/sh`); no strict-mode settings. + +#### Input +- First positional argument selects `start`, `stop`, `restart`, `status`, or `health`. +- Environment: `PID_FILE` defaults to `/run/queue-worker.pid`; `HEARTBEAT_FILE` defaults to `/var/lib/queue-worker/heartbeat`. +- Reads the PID file to check or signal the worker; reads the heartbeat file’s modification time during `health`. + +#### Output +- Starts `/usr/local/bin/queue-worker` with `--heartbeat "$HEARTBEAT_FILE"`; records its PID in `PID_FILE`. +- Stops the worker and removes `PID_FILE` after a successful `kill`. +- Prints `already running`, `running`, `stopped`, `CRITICAL: not running`, `WARNING: heartbeat ...s old`, `OK`, or usage text. +- Exit statuses: `0` for successful commands, running status, or healthy worker; `1` for stale heartbeat; `2` when health check finds the worker stopped; `3` for stopped status; `64` for an unsupported command. + +#### Core logic +- `start`: if the PID file identifies a live process, prints `already running`; otherwise launches the worker with `nohup` and writes its PID. +- `stop`: returns successfully if not running; otherwise signals the PID and removes the PID file if `kill` succeeds. +- `restart`: runs stop, then start. +- `status`: prints `running` if live; otherwise prints `stopped` and exits `3`. +- `health`: exits `2` with a critical message if stopped; otherwise computes heartbeat age, exits `1` with a warning if age exceeds 120 seconds, or prints `OK`. +- Unsupported command: prints usage to standard error and exits `64`. + +#### Functions +- `is_running`: checks PID file and process liveness. +- `heartbeat_age`: calculates seconds since heartbeat modification. +- `start_worker`: launches worker and records PID. +- `stop_worker`: signals worker and removes PID file. + +#### Constants and configuration +- `PID_FILE="${PID_FILE:-/run/queue-worker.pid}"` +- `HEARTBEAT_FILE="${HEARTBEAT_FILE:-/var/lib/queue-worker/heartbeat}"` +- `MAX_HEARTBEAT_AGE=120` +- `WORKER_BIN=/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `cat`, `date`, `stat`, `echo`, `kill`, `nohup`, `rm`. +- Worker executable: `/usr/local/bin/queue-worker`. +- Files: `/run/queue-worker.pid`; `/var/lib/queue-worker/heartbeat`. + +#### Errors and exit codes +- `0`: successful command; worker running for `status`; heartbeat within limit for `health`. +- `1`: heartbeat age exceeds `MAX_HEARTBEAT_AGE`. +- `2`: `health` finds no running worker. +- `3`: `status` finds no running worker. +- `64`: unsupported command. +- No traps, retries, or timeouts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..0edb2800 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,72 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:01:20Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Exports settled payments for one business day from Oracle into a gzipped CSV with a row-count control file. + +#### Purpose +- Produces a daily payment export and adjacent control file for the selected business day. +- Runs directly as a nightly export command; it is not a sourced library. + +#### Type +- `ksh93` (`#!/bin/ksh93`); no `set -e`, `set -u`, or `pipefail`. + +#### Input +- `-d YYYYMMDD` sets `business_day`; parsed by `getopts`. +- `-o dir` sets `export_dir`; parsed by `getopts`. +- `ORACLE_SID` environment variable; defaults to `PAYPRD`. +- Reads the Oracle `settled_payment` table. Defaults the business day using `date +%Y%m%d`. +- Reads `OPTARG` and `OPTIND` through `getopts`; no input files are read. + +#### Output +- Creates `export_dir` if missing. +- Writes `payments_.csv`, then gzips it with `gzip -f` and removes the uncompressed CSV on successful gzip. +- Writes `payments_.ctl` containing `rows= business_day=`. +- Logs timestamped status messages to standard error. +- Explicit exit statuses: `0` after export, `2` for invalid options, `3` for a missing required tool, `4` after retries are exhausted; `fail` otherwise defaults to `1`. + +#### Core logic +- Parses optional business-day and output-directory arguments. +- Sets Oracle environment: preserves `ORACLE_SID` if provided, otherwise uses `PAYPRD`; sets `NLS_LANG=AMERICAN_AMERICA.AL32UTF8`. +- Checks that `sqlplus` and `gzip` are available. +- Ensures the output directory exists and sets the CSV path. +- Tries the export up to three times: runs a SQL query for payments matching `business_day`, writes the control file from the CSV line count, gzips the CSV, logs success, and exits. +- On export failure, logs the attempt and sleeps 60 seconds before retrying; after all attempts, exits with status `4`. + +#### Functions +- `log` — writes timestamped messages to standard error. +- `fail` — logs failure and exits with a supplied or default status. +- `require_tools` — checks for required commands. +- `run_export` — queries Oracle and writes CSV output. +- `write_control` — writes the row count and business day. + +#### Constants and configuration +- `ORACLE_SID_DEFAULT=PAYPRD` +- `EXPORT_DIR_DEFAULT=/data/export/payments` +- `MAX_RETRIES=3` +- `attempt=0` +- `business_day=$(date +%Y%m%d)` +- `export_dir=$EXPORT_DIR_DEFAULT` +- `ORACLE_SID=${ORACLE_SID:-$ORACLE_SID_DEFAULT}` +- `NLS_LANG=AMERICAN_AMERICA.AL32UTF8` +- `csv=$export_dir/payments_$business_day.csv` + +#### Dependencies +- External commands: `date`, `sqlplus`, `gzip`, `wc`, `mkdir`, `sleep`. +- Uses `whence` to check command availability and `print` for logging and control-file output. +- Oracle connection: `CONNECT / AS SYSDBA`; query reads `settled_payment` columns `payment_id`, `account_no`, `amount`, `currency`, filtered by `business_day`. +- No sourced files. + +#### Errors and exit codes +- Exit `2`: unrecognized option; prints usage through `fail`. +- Exit `3`: `sqlplus` or `gzip` is unavailable. +- Exit `4`: all three export attempts fail. +- Exit `1` by default for other calls to `fail`, including output-directory creation failure. +- Retries failed `run_export` calls three times, sleeping 60 seconds between failed attempts. +- No traps. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/package.ai.md new file mode 100644 index 00000000..5cba7d97 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/shell/package.ai.md @@ -0,0 +1,46 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:01:57Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates order-service releases, queue-worker health and lifecycle checks, and daily settled-payment exports. + +#### Purpose +- Provides operational shell commands for deploying tagged releases, managing worker availability, and extracting payment data. +- Supports staging/production rollout, heartbeat-based health reporting, and Oracle-backed daily CSV delivery. + +#### Responsibilities +- **Release deployment — `deploy_release.sh`:** Selects staging or production hosts, installs a tagged build, restarts `orderd`, and verifies each host before continuing. +- **Worker operations — `healthcheck.sh`:** Starts, stops, restarts, and reports queue-worker status; checks heartbeat freshness for health. +- **Payment exports — `nightly_extract.ksh`:** Exports settled payments for a business day to gzipped CSV and writes a row-count control file; retries failed exports. + +#### Key units +- `deploy_host` — transfers and installs a release on one host, restarts `orderd`, and waits for health. +- `wait_healthy` — polls `http://:8080/health` with a 30-second limit. +- `start_worker` / `stop_worker` — launch the queue worker and manage its PID file. +- `is_running` / `heartbeat_age` — determine worker liveness and heartbeat age. +- `run_export` — queries Oracle for settled payments matching the business day. +- `write_control` — writes the export row count and business day to the `.ctl` file. +- `settled_payment` — Oracle source table; exported columns are `payment_id`, `account_no`, `amount`, and `currency`. + +#### Data flow +- `deploy_release.sh`: parses environment and tag → loads host list and `build/.tar.gz` → copies, extracts, switches the `current` symlink, and restarts `orderd` host by host → polls each health endpoint. +- `healthcheck.sh`: reads PID and heartbeat files → performs the requested lifecycle or status action → reports worker state and, for `health`, checks heartbeat age against 120 seconds. +- `nightly_extract.ksh`: selects a business day and output directory → queries Oracle → writes CSV and row-count control file → gzips the CSV; retries failed exports up to three times. + +#### Dependencies +- **Deployment:** `lib/common.sh`, `hosts.staging` or `hosts.production`, `build/.tar.gz`, and external `rsync`, `ssh`, and `curl`; remote host service `orderd`. +- **Worker operations:** `/usr/local/bin/queue-worker`, `/run/queue-worker.pid`, and `/var/lib/queue-worker/heartbeat`. +- **Payment export:** Oracle via `sqlplus` (`CONNECT / AS SYSDBA`), `settled_payment`, and external `gzip`, `wc`, and `mkdir`. + +#### Cross-cutting +- Scripts are directly executable shell commands: Bash for deployment, POSIX `sh` for worker management, and `ksh93` for payment export. +- Configurable environment values include deployment user and SSH key, worker PID/heartbeat paths, and Oracle SID; defaults are provided per script. +- Each command reports failures through nonzero exit statuses; deployment stops at the first unhealthy host, while payment export retries up to three times. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..995e0f22 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,46 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:01:30Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Builds the invoice service JAR, configuring database migrations, test dependencies and an optional PDFBox profile. + +#### Purpose +- Defines the `invoice-service` Maven module for creating, numbering and archiving customer invoices. +- Configures Flyway migrations and passes the archive directory to tests. + +#### Type +- Maven POM; root element `project`. +- Namespaces: default `http://maven.apache.org/POM/4.0.0`; `xsi` `http://www.w3.org/2001/XMLSchema-instance`. + +#### Definitions +- Coordinates: `org.example.billing:invoice-service:2.7.0` (group and version inherited); packaging `jar`. +- Parent: `org.example.billing:billing-parent:2.7.0`. +- Dependencies: + - `com.fasterxml.jackson.core:jackson-databind` — compile, version `${jackson.version}`. + - `org.flywaydb:flyway-core` — compile, version `${flyway.version}`. + - `org.postgresql:postgresql` — runtime. + - `org.junit.jupiter:junit-jupiter` — test. + - `org.testcontainers:postgresql` — test. +- Plugins: + - `flyway-maven-plugin` — version `${flyway.version}`; migration location `filesystem:src/main/resources/db/migration`. + - `maven-surefire-plugin` — sets system property `invoice.archive.dir` to `${invoice.archive.dir}`. +- Properties: `maven.compiler.release=17`; `jackson.version=2.19.2`; `flyway.version=11.4.0`; `invoice.archive.dir=${project.build.directory}/archive`. +- Profile: `native-pdf` — adds `org.apache.pdfbox:pdfbox`, version `3.0.5` (compile scope). + +#### Configuration +- `maven.compiler.release`: `17`. +- `jackson.version`: `2.19.2`. +- `flyway.version`: `11.4.0`. +- `invoice.archive.dir`: `${project.build.directory}/archive`. +- Flyway `locations`: `filesystem:src/main/resources/db/migration`. +- Surefire system property `invoice.archive.dir`: `${invoice.archive.dir}`. + +#### Dependencies +- Parent POM: `org.example.billing:billing-parent:2.7.0`. +- Migration files: `src/main/resources/db/migration`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/package.ai.md new file mode 100644 index 00000000..1a173826 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/package.ai.md @@ -0,0 +1,49 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:02:04Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides XML-based build, scheduling, data-contract, and presentation configuration for billing, reminders, shipments, and account statements. + +#### Purpose +- Defines supporting artifacts for invoice-service builds, overdue-reminder delivery, shipment notice validation, and statement-to-HTML rendering. +- Establishes build dependencies and runtime settings alongside XML data and presentation contracts. + +#### Responsibilities +- **Build and migrations:** `invoice-service-pom.xml` configures the `invoice-service` JAR, Flyway migrations, test settings, and optional PDFBox support. +- **Reminder scheduling and wiring:** `scheduler-context.xml` connects the reminder repository, SMTP gateway, and job, scheduled for weekday mornings. +- **Shipment data contract:** `shipment.xsd` specifies shipment notices, recipients, carriers, parcels, and weight constraints. +- **Statement presentation:** `statement-to-html.xsl` transforms statement XML into HTML with formatted totals and threshold-based booking highlighting. + +#### Key units +- `invoice-service` Maven project — builds `org.example.billing:invoice-service:2.7.0` with Java 17 configuration. +- `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob` — Spring beans collaborating to send overdue reminders. +- `reminderScheduler` — runs `overdueReminderJob.sendDueReminders` at `0 0 7 * * MON-FRI`. +- `shipmentNotice` / `ShipmentNoticeType` — shipment contract requiring order, date, carrier, recipient, and one or more parcels. +- `CarrierCode`, `WeightGrams`, `ParcelType`, `AddressType` — shipment schema types for carrier enumeration, parcel details, and recipient data. +- `statementHeader`, `statementTotal`, booking template — XSLT rendering units for statement metadata, booking rows, and summed amounts. + +#### Data flow +- The Spring context loads `reminder.properties`, configures the datasource and SMTP gateway, then schedules the overdue-reminder job to use the repository and gateway. +- Statement XML in `urn:example:statement` is transformed into HTML containing account and period details, booking rows, and a total; bookings above `highlightAbove` are marked `large`. +- Shipment XML is validated against `shipment.xsd`, including required identifiers, enumerated carriers, and parcel weight limits. +- Maven builds the invoice-service JAR and directs Flyway to migration files under `src/main/resources/db/migration`. + +#### Dependencies +- `invoice-service-pom.xml`: parent `org.example.billing:billing-parent:2.7.0`; Jackson Databind, Flyway, PostgreSQL, JUnit Jupiter, Testcontainers PostgreSQL; optional PDFBox profile. +- `scheduler-context.xml`: HikariCP and `org.example.reminder` repository, SMTP gateway, and job classes; `org.example.reminder.web` component scan; database and SMTP settings supplied through `reminder.properties`. +- `shipment.xsd`: XML Schema built-in types and target namespace `urn:example:shipment:1`. +- `statement-to-html.xsl`: input namespace `urn:example:statement`. + +#### Cross-cutting +- XML configuration uses externalized properties for reminder database and SMTP settings; invoice archive output is configured through `invoice.archive.dir`. +- Shipment constraints include carrier codes `DHL`, `UPS`, `GLS`, `POST`, a maximum parcel weight of 31,500 grams, and default country `DE`. +- Statement output defaults to `EUR`, formats amounts as `#,##0.00`, and highlights amounts above `1000`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..b8a35fb7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,43 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:01:36Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Configures weekday morning delivery of overdue reminders through a Spring-wired database repository and SMTP gateway. + +#### Purpose +- Wires the reminder database, repository, mail gateway, and overdue reminder job. +- Schedules `sendDueReminders` to run on weekdays at 07:00. + +#### Type +- Spring application context; root element `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` `http://www.w3.org/2001/XMLSchema-instance`; `context` `http://www.springframework.org/schema/context`; `task` `http://www.springframework.org/schema/task`. + +#### Definitions +- Beans: + - `reminderDataSource`: `com.zaxxer.hikari.HikariDataSource`; destroy method `close`. + - `reminderRepository`: `org.example.reminder.JdbcReminderRepository`; constructor references `reminderDataSource`. + - `mailGateway`: `org.example.reminder.SmtpMailGateway`. + - `overdueReminderJob`: `org.example.reminder.OverdueReminderJob`; constructor references `reminderRepository` and `mailGateway`. +- Component scan: `org.example.reminder.web`. +- Scheduler: `reminderScheduler`. +- Scheduled task: `overdueReminderJob.sendDueReminders`, using `reminderScheduler`, cron `0 0 7 * * MON-FRI`. + +#### Configuration +- Property placeholder location: `classpath:reminder.properties`. +- `reminderDataSource`: `jdbcUrl=${reminder.db.url}`; `username=${reminder.db.user}`; `maximumPoolSize=8`. +- `mailGateway`: `host=${reminder.smtp.host}`; `port=587`. +- `overdueReminderJob`: `graceDays=14`. +- `reminderScheduler`: `pool-size=2`. +- Scheduled task cron: `0 0 7 * * MON-FRI`. + +#### Dependencies +- Properties file: `classpath:reminder.properties`. +- Classes: `com.zaxxer.hikari.HikariDataSource`, `org.example.reminder.JdbcReminderRepository`, `org.example.reminder.SmtpMailGateway`, `org.example.reminder.OverdueReminderJob`. +- Scanned package: `org.example.reminder.web`. +- External systems: database at `${reminder.db.url}`; SMTP host `${reminder.smtp.host}` on port `587`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..555942d4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/shipment.xsd.ai.md @@ -0,0 +1,32 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:01:41Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Defines the warehouse shipment notice contract, including recipient details, carrier codes, parcel tracking, and weight limits. + +#### Type +- XML Schema; root `xs:schema`. +- Namespaces: `xs` = `http://www.w3.org/2001/XMLSchema`; `shp` = `urn:example:shipment:1`. +- Target namespace: `urn:example:shipment:1`. + +#### Definitions +- Top-level element `shipmentNotice`: type `shp:ShipmentNoticeType`. +- Simple type `CarrierCode`: string enumeration `DHL`, `UPS`, `GLS`, `POST`. +- Simple type `WeightGrams`: positive integer, maximum inclusive `31500`. +- Complex type `ParcelType`: ordered `trackingNumber` (`xs:string`), `weight` (`shp:WeightGrams`); required `sequence` attribute (`xs:positiveInteger`). +- Complex type `AddressType`: ordered `name`, `street`, `postalCode`, `city`, `country` (all `xs:string`); `country` is optional. +- Complex type `ShipmentNoticeType`: ordered `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), one or more `parcel` (`shp:ParcelType`); required `noticeId` attribute (`xs:ID`). + +#### Configuration +- `AddressType.country`: default `DE`. +- `WeightGrams`: maximum inclusive value `31500`. +- `ShipmentNoticeType.parcel`: `maxOccurs="unbounded"`. + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema`; built-in types include `xs:string`, `xs:positiveInteger`, `xs:dateTime`, and `xs:ID`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..4ee56253 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,37 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:01:46Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Renders a monthly account statement as an HTML page with booking rows, conditional highlighting, and a total. + +#### Purpose +- Transforms a statement document into an HTML account summary. +- Highlights bookings whose amount exceeds a configurable threshold. + +#### Type +- XSLT 1.0 stylesheet; root element `xsl:stylesheet`. +- Namespaces: `xsl` — `http://www.w3.org/1999/XSL/Transform`; `st` — `urn:example:statement`. + +#### Definitions +- Output method: `html`; encoding `UTF-8`; `indent="yes"`. +- Parameters: `currencySymbol` defaults to `EUR`; `highlightAbove` defaults to `1000`. +- Key `bookingsByDay`: matches `st:booking`, indexed by `st:valueDate`. +- Templates: + - Match `/st:statement`: renders statement title and header, applies booking templates, and renders total. + - Named `statementHeader`: renders account number and period. + - Match `st:booking`: renders a row with value date, purpose, and formatted amount; adds class `large` when the amount exceeds `$highlightAbove`. + - Named `statementTotal`: renders the sum of booking amounts. + +#### Configuration +- `currencySymbol`: `EUR`. +- `highlightAbove`: `1000`. +- Amount format: `#,##0.00`. + +#### Dependencies +- Input statement namespace: `urn:example:statement`; expected data includes `st:accountNumber`, `st:booking`, `st:valueDate`, `st:purpose`, `st:amount`, and statement attribute `period`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..ab19b0aa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/package.ai.md @@ -0,0 +1,49 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:02:20Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> Supports order and billing operations by analyzing access traffic, managing releases and workers, exporting payments, and processing customer-facing billing artifacts. + +#### Purpose +- Provides operational tooling and billing-service artifacts for order deployment, payment processing, reminders, shipment validation, and statements. + +#### Responsibilities +- **Traffic analysis:** Parse access logs, apply host aliases and exclusions, and report ranked request statistics. +- **Service operations:** Deploy tagged `orderd` releases with health checks; manage queue-worker lifecycle and health. +- **Payment export:** Extract settled payments to compressed CSV and produce an export control file. +- **Billing artifacts:** Configure the invoice-service build and migrations; schedule overdue reminders, validate shipment notices, and render statements as HTML. + +#### Key units +- `LogDigest` / `log_digest.pl::main` — parse, aggregate, filter, and report access-log statistics in text or JSON. +- `deploy_host` / `wait_healthy` — install a release, restart `orderd`, and poll host health. +- `start_worker` / `stop_worker` / `is_running` / `heartbeat_age` — manage queue-worker processes and check heartbeat freshness. +- `run_export` / `write_control` — export settled payments and record row count and business day. +- `overdueReminderJob` / `reminderScheduler` — deliver overdue reminders and schedule weekday runs. +- `shipmentNotice` / `ShipmentNoticeType` — define required shipment-notice data. +- `statement-to-html.xsl` templates — render statement metadata, booking rows, and totals with threshold-based highlighting. +- `invoice-service` Maven project — configure the Java 17 build, dependencies, tests, and Flyway migrations. + +#### Data flow +- Access logs pass through CLI filtering and alias handling into `LogDigest`, producing ranked text or canonical JSON. +- Release artifacts are installed host by host; deployment waits for `orderd` health before proceeding. +- Worker commands use PID and heartbeat files for lifecycle operations and status checks. +- The payment export selects a business day, queries Oracle `settled_payment`, writes CSV and control data, then compresses the CSV. +- Reminder properties wire the datasource, repository, SMTP gateway, and scheduled job; shipment XML is validated against `shipment.xsd`, while statement XML is transformed to HTML. + +#### Dependencies +- Perl analytics uses `Getopt::Long`, `JSON::PP`, `POSIX`, `List::Util`, `Carp`, and `Exporter`. +- Deployment uses `lib/common.sh`, host lists, release archives, `rsync`, `ssh`, and `curl`; worker management uses the queue-worker executable and PID/heartbeat paths. +- Payment export depends on Oracle `sqlplus`, `settled_payment`, and system utilities including `gzip`, `wc`, and `mkdir`. +- Billing artifacts use the Maven parent and Java dependencies including Jackson, Flyway, PostgreSQL, JUnit, and Testcontainers; reminder wiring uses HikariCP and `org.example.reminder` components. +- XML artifacts use XML Schema types and the `urn:example:statement` namespace. + +#### Cross-cutting +- External configuration covers log aliases, deployment and worker settings, Oracle SID, reminder database and SMTP properties, and invoice archive directory. +- Operational scripts signal failures with nonzero exit statuses; deployment stops on unhealthy hosts, and payment export retries up to three times. +- Domain thresholds include a 1,500 ms slow-request limit, 120-second worker heartbeat limit, 31,500-gram parcel maximum, and statement highlighting above 1000. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..9b617ceb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-6-luna/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: D61E9C1F +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:02:28Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project centers on order and billing operations, with access-log analysis, release and queue-worker management, and settled-payment exports. Perl tools normalize and report traffic statistics, shell scripts handle release, worker, and export tasks, and XML configuration supports builds, scheduling, data contracts, and customer-facing billing artifacts such as reminders, shipments, and account statements. + +#### Packages +- other — Supports order and billing operations through access-log reporting, release and worker management, payment exports, reminder scheduling, shipment validation, and statement rendering. +- other/perl — Converts access-log traffic into normalized host and status statistics, with filtering and text or JSON reporting. +- other/shell — Automates order-service releases, queue-worker health and lifecycle checks, and daily settled-payment exports. +- other/xml — Provides XML-based build, scheduling, data-contract, and presentation configuration for billing, reminders, shipments, and account statements. +- . — Supports order and billing operations by analyzing access traffic, managing releases and workers, exporting payments, and processing customer-facing billing artifacts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..f5a503c3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,59 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:25Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A multi‑language toolkit that parses web logs, automates deployment and monitoring of a payment service, and builds an invoice‑processing Java service with XML contracts and scheduled reminders. + +#### Purpose +- Aggregate and report web‑server access‑log metrics. +- Deploy, monitor, and extract nightly data for a payment processing system. +- Build, configure, and run an invoice‑processing service with XML data exchange and reminder scheduling. + +#### Responsibilities +- **Log Analysis (Perl)** – parse access logs, aggregate host/status statistics, identify slow requests, output summaries or JSON. +- **Deployment & Monitoring (Shell)** – distribute release tarballs, restart services, health‑check queue workers, export settled payments from Oracle. +- **Build & Runtime (XML/Java)** – Maven build with Flyway migrations, optional PDF generation, Spring scheduler for overdue reminders, XML schemas for shipment notices and statements, XSLT for HTML reports. + +#### Key units +- **Perl** + - `LogDigest` (OO module): `new`, `add`, `summarize`, `top_n`; constants `MAX_LINES`, `SLOW_REQUEST_MS`. + - `log_digest.pl`: CLI entry point, option parsing, alias handling, output formatting. +- **Shell** + - `deploy_release.sh`: host‑by‑host tarball deployment, symlink update, service restart, health polling. + - `healthcheck.sh`: PID/heartbeat manager for `/usr/local/bin/queue-worker`. + - `nightly_extract.ksh`: Oracle `sqlplus` export, CSV/GZ creation, control file generation. +- **XML/Java** + - `invoice-service-pom.xml`: Maven project, Flyway, PDFBox profile. + - `scheduler-context.xml`: Spring beans (`reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler`). + - `shipment.xsd`: `shipmentNotice` schema with `ParcelType`, `AddressType`. + - `statement-to-html.xsl`: XSLT for `st:statement` → styled HTML. + +#### Data flow +1. **Log Analysis** – `log_digest.pl` reads files → `LogDigest::add` → `summarize` → output. +2. **Deployment** – `deploy_release.sh` rsyncs → SSH → extraction → symlink → restart → health check. +3. **Healthcheck** – `healthcheck.sh` writes PID, monitors heartbeat, reports status. +4. **Extraction** – `nightly_extract.ksh` runs SQL, spools CSV, counts rows, writes control file, gzips. +5. **Invoice Service** – Maven builds JAR → Flyway migrates DB → Spring loads `scheduler-context.xml` → `overdueReminderJob` queries DB, formats emails, sends via `SmtpMailGateway`. +6. **XML Exchange** – External systems send `shipmentNotice` XML validated against `shipment.xsd`; accounting systems produce `st:statement` XML transformed by `statement-to-html.xsl` into HTML reports. + +#### Dependencies +- **Perl** – `Getopt::Long`, `JSON::PP`, `POSIX`, `List::Util`, `Carp`, `Exporter`. +- **Shell** – `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `sqlplus`, `gzip`; host lists (`hosts.staging`, `hosts.production`); common shell library (`lib/common.sh`). +- **Java** – HikariCP, PostgreSQL JDBC, Flyway, Jackson Databind, JUnit/Testcontainers, PDFBox (profile), Spring `task`/`context`. +- **XML** – Standard XML Schema namespace; XSLT processor. + +#### Cross‑cutting +- Consistent error handling (`Carp::croak`, `die` with exit codes). +- Configuration via environment variables or property placeholders (`LOG_DIGEST_CONFIG`, `DEPLOY_USER`, `HEARTBEAT_FILE`, `reminder.*`). +- Logging with timestamps across scripts. +- Retry and timeout logic in deployment and extraction. +- Canonical JSON output for deterministic ordering. +- XML schemas enforce strict contracts; XSLT parameters allow runtime customization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..a8977b83 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,68 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:02:31Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Provides per‑host and per‑status statistics from log lines. +- Tracks number of slow requests. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: constructor `new`, methods `add`, `summarize`. + +#### Input +- `new(level => $level)` – `$level` must be one of `DEBUG`, `INFO`, `WARN`, `ERROR`; defaults to `WARN`. +- `add($line)` – expects a log line matching the regex in `parse_line`. +- `parse_line($line)` – parses a single log line. +- `top_n($counts, $n)` – receives a hashref of counts and integer `n`. + +#### Output +- `new` returns blessed object. +- `add` returns `1` on successful parse, `0` if line ignored, dies on line limit. +- `summarize` returns hashref: + - `generated` timestamp UTC ISO‑8601. + - `total` total lines processed. + - `hosts` number of distinct hosts. + - `busiest` max requests per host. + - `slow` count of requests > `SLOW_REQUEST_MS`. + - `statuses` hashref of status counts. +- `top_n` returns list of top `n` keys sorted by count descending, then key ascending. + +#### Core logic +- `new`: validate level, initialize counters. +- `parse_line`: regex extracts host, time, method, path, status, millis; normalizes host. +- `add`: enforce `MAX_LINES`; parse line; increment host and status counters; increment slow counter if millis > `SLOW_REQUEST_MS`. +- `summarize`: compute totals, busiest host, generate UTC timestamp. +- `top_n`: sort counts by value descending, key ascending; slice top `n`. + +#### Subs +- `new(%args) -> object` – create digest with level. +- `parse_line($line) -> hashref` – parse log line. +- `add($line) -> 1|0` – add line to digest. +- `summarize() -> hashref` – return summary. +- `top_n($counts, $n) -> list` – top `n` keys. +- `_normalize_host($host) -> host` – lowercase, strip trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `new` dies with `croak` if unknown level. +- `add` dies with `croak` if line count exceeds `MAX_LINES`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..4a62303c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,78 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:02:36Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Reads web server access logs, filters hosts, and reports request counts and slow responses, optionally as JSON. + +#### Purpose +- Script to analyze access logs. +- Outputs busiest hosts and status‑code tallies. + +#### Type +- Script. +- Uses package `LogDigest` (imported `top_n`). + +#### Input +- Command‑line options: + - `--top|n=i` → `$top` (default 10). + - `--level=s` → `$level` (default 'WARN'). + - `--json!` → `$as_json` (default 0). + - `--exclude-host=s` → `@exclude_hosts` (multiple allowed). + - `--help|h` → prints usage. +- Positional arguments: list of log files (`@ARGV`). +- Environment variable: `LOG_DIGEST_CONFIG` (default `/etc/log-digest.conf`). +- Alias file format: `host=alias` per line, comments start with `#`. + +#### Output +- If `$as_json`: JSON string of `$summary` hash, newline terminated. +- Else: plain text: + - Summary line: `"%d requests from %d hosts, %d slow"`. + - List of top hosts: one per line from `top_n($digest->{hosts}, $top)`. + +#### Core logic +- Load host aliases from config file. +- Build exclusion set from `@exclude_hosts`. +- Create `LogDigest` object with `level`. +- For each input file: + - Read line by line. + - Extract host (first token). + - Skip if host (or its alias) is excluded. + - Pass line to `$digest->add`. +- After processing all files: + - Get `$summary = $digest->summarize`. + - Output JSON or formatted text. + +#### Subs +- `usage() -> string` + Returns usage message. +- `read_aliases($path) -> hash` + Parses alias file into `%aliases`. +- `main() -> 0` + Orchestrates parsing, digesting, and output. + +#### Constants and configuration +- `$config_file = $ENV{LOG_DIGEST_CONFIG} // '/etc/log-digest.conf'`. +- `$top = 10`. +- `$level = 'WARN'`. +- `$as_json = 0`. +- `@exclude_hosts = ()`. + +#### Dependencies +- `FindBin` (`$Bin`). +- `Getopt::Long` (`GetOptions`). +- `JSON::PP` (`JSON::PP->new->canonical->encode`). +- `LogDigest` (`LogDigest->new`, `->add`, `->summarize`, `top_n`). + +#### Exceptions / Errors +- `die usage()` on bad options. +- `die "--top must be positive\n"` if `$top < 1`. +- `die "cannot read $file: $!\n"` if file open fails. +- `die` on missing config file read (handled by returning empty hash). + +--- diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..9729f7c2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,40 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:10Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> A Perl toolkit that parses web‑server access logs, aggregates per‑host and per‑status statistics, and reports the busiest hosts and slow requests, optionally as JSON. + +#### Purpose +- Aggregate access‑log metrics (host counts, status tallies, slow request counts). +- Provide a command‑line utility to output summaries and top hosts. + +#### Responsibilities +- **Log parsing & aggregation** – `LogDigest` module handles line parsing, counting, and summarization. +- **Command‑line interface** – `log_digest.pl` script orchestrates file reading, host filtering, alias resolution, and output formatting. + +#### Key units +- **`LogDigest`** – OO module; `new`, `add`, `summarize`, `top_n`; constants `MAX_LINES`, `SLOW_REQUEST_MS`. +- **`log_digest.pl`** – script; uses `Getopt::Long`, `JSON::PP`, `LogDigest`; functions `usage`, `read_aliases`, `main`. + +#### Data flow +1. `log_digest.pl` parses options and loads host aliases. +2. For each input log file, it reads lines, skips excluded hosts, and feeds each line to a `LogDigest` instance via `add`. +3. After all files, `summarize` produces a hash of totals, host counts, slow request count, and status tallies. +4. The script outputs either plain text or JSON, including the top N hosts via `top_n`. + +#### Dependencies +- **Internal**: `LogDigest` module, `log_digest.pl` script. +- **External**: `POSIX`, `List::Util`, `Carp`, `Exporter` (module); `FindBin`, `Getopt::Long`, `JSON::PP` (script). + +#### Cross-cutting +- Host normalization (`_normalize_host`) ensures consistent counting. +- Error handling via `Carp::croak` for invalid levels or line limits. +- Configuration via environment variable `LOG_DIGEST_CONFIG` and optional host alias file. +- JSON output uses canonical encoding for deterministic ordering. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..a5d91986 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,83 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:02:41Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploys a specified release tarball to all hosts in an environment. +- Runs as a standalone script. + +#### Type +- `bash` +- `set -euo pipefail` + +#### Input +- Options parsed by `getopts`: + - `-e ` → `ENVIRONMENT` + - `-t ` → `TAG` + - `-n` → `DRY_RUN=1` + - `-p ` → ignored, logged + - `-h` → prints usage +- Environment variables: + - `DEPLOY_USER` (default `deploy`) + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`) +- Files read: + - `"$SCRIPT_DIR/lib/common.sh"` + - `"$SCRIPT_DIR/${HOST_FILES[$ENVIRONMENT]}"` (hosts list) + +#### Output +- Logs to stderr. +- Copies `build/$TAG.tar.gz` to each host via `rsync`. +- Extracts tarball on host, updates symlink `current`, restarts `orderd` service. +- Verifies health endpoint `http://$host:8080/health`. +- Exits with status 1 on failure, 0 on success. + +#### Core logic +- Parse options, validate `ENVIRONMENT` and `TAG`. +- `check_prereqs`: ensure `rsync`, `ssh`, `curl` exist and SSH key readable. +- `load_hosts`: read host list file into `HOSTS`. +- For each host: + - `deploy_host`: rsync tarball, SSH into host to extract, symlink, restart service. + - `wait_healthy`: poll health endpoint until success or timeout. + - Log deployment. + +#### Functions +- `log`: prints timestamped message to stderr. +- `die`: logs error and exits. +- `usage`: prints usage from script comment. +- `check_prereqs`: verifies required tools and SSH key. +- `load_hosts`: loads host list into `HOSTS`. +- `deploy_host`: deploys tarball to a host. +- `wait_healthy`: waits for health endpoint. +- `cleanup`: removes temporary lock file (unused). + +#### Constants and configuration +- `SCRIPT_DIR`=`$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)` +- `DEPLOY_USER`=`${DEPLOY_USER:-deploy}` +- `SSH_KEY`=`${SSH_KEY:-$HOME/.ssh/deploy_ed25519}` +- `RELEASE_ROOT`=`/opt/releases` +- `SERVICE_NAME`=`orderd` +- `HEALTH_TIMEOUT`=`30` +- `ENVIRONMENT`=`""` +- `TAG`=`""` +- `DRY_RUN`=`0` +- `HOSTS`=`()` +- `HOST_FILES`=`([staging]="hosts.staging" [production]="hosts.production")` + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl`. +- External file: `"$SCRIPT_DIR/lib/common.sh"`. +- Host list files: `hosts.staging`, `hosts.production`. + +#### Errors and exit codes +- `die` exits with status 1 on missing tools, unreadable SSH key, unknown environment, empty host list, or health timeout. +- `usage` prints help and exits with status 0. +- Missing required options triggers exit status 2. +- `wait_healthy` exits with status 1 if health check fails after `HEALTH_TIMEOUT` seconds. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..f36f1132 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,62 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:02:47Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> A POSIX init‑style wrapper that manages a queue worker, providing start, stop, status, and health checks based on a PID file and heartbeat file age. + +#### Purpose +- Controls a queue worker process. +- Exposes `start`, `stop`, `restart`, `status`, and `health` commands. + +#### Type +- POSIX sh (`#!/bin/sh`). +- No strict mode flags. + +#### Input +- `$1`: command (`start`, `stop`, `restart`, `status`, `health`). +- `PID_FILE`: environment variable or default `/run/queue-worker.pid`. +- `HEARTBEAT_FILE`: environment variable or default `/var/lib/queue-worker/heartbeat`. +- `MAX_HEARTBEAT_AGE`: default `120` seconds. +- `WORKER_BIN`: `/usr/local/bin/queue-worker`. + +#### Output +- Writes PID to `$PID_FILE` when starting. +- Removes `$PID_FILE` when stopping. +- Prints status messages (`running`, `stopped`, `OK`, `WARNING`, `CRITICAL`). +- Exit codes: `0` success, `1` warning, `2` critical, `3` stopped, `64` usage error. + +#### Core logic +- `is_running`: checks if PID file exists and process is alive. +- `heartbeat_age`: calculates seconds since last heartbeat file modification. +- `start_worker`: starts worker in background with `nohup`, writes PID. +- `stop_worker`: kills process and removes PID file. +- Command dispatch via `case` on `$1`. + +#### Functions +- `is_running`: test if worker process is alive. +- `heartbeat_age`: compute heartbeat file age. +- `start_worker`: launch worker, record PID. +- `stop_worker`: terminate worker, clean PID file. + +#### Constants and configuration +- `PID_FILE=/run/queue-worker.pid` +- `HEARTBEAT_FILE=/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE=120` +- `WORKER_BIN=/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `kill`, `nohup`, `date`, `stat`. +- Worker binary: `/usr/local/bin/queue-worker` with `--heartbeat` option. + +#### Errors and exit codes +- `exit 2`: health check fails because worker not running. +- `exit 1`: heartbeat older than `MAX_HEARTBEAT_AGE`. +- `exit 3`: status reports stopped. +- `exit 64`: invalid command usage. +- No traps or cleanup beyond PID file removal. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..b8779e19 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,76 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:02:51Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, gzips it, and creates a control file with row count. + +#### Purpose +- Run nightly to export settled payments. +- Executed directly; not sourced. + +#### Type +- `ksh93` (shebang `#!/bin/ksh93`). +- Uses `set -e`? none; uses `typeset` and `whence`. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → sets `business_day`. + - `-o

` → sets `export_dir`. +- Environment variables: + - `ORACLE_SID` (default `PAYPRD`). + - `NLS_LANG` set to `AMERICAN_AMERICA.AL32UTF8`. +- No other external input files. + +#### Output +- Creates `payments_.csv` in `$export_dir`. +- Gzips the CSV to `payments_.csv.gz`. +- Writes control file `payments_.ctl` with `rows=` and `business_day=`. +- Prints log messages to stderr. +- Exits with status 0 on success, 1–4 on various failures. + +#### Core logic +- Parse options; set defaults. +- Ensure `$export_dir` exists. +- Build `csv` path. +- Retry loop (max 3 attempts): + - Run `run_export` to spool SQL query output to `$csv`. + - If successful: + - `write_control` counts rows and writes control file. + - `gzip -f "$csv"`. + - Log success and exit. + - On failure: log, sleep 60, retry. +- On exhausting retries: call `fail` with exit code 4. + +#### Functions +- `log` – prints timestamped message to stderr. +- `fail` – logs failure and exits with code. +- `require_tools` – checks for `sqlplus` and `gzip`. +- `run_export` – runs SQL query via `sqlplus` and writes to file. +- `write_control` – counts rows in CSV and writes control file. + +#### Constants and configuration +- ``ORACLE_SID_DEFAULT=PAYPRD`` +- ``EXPORT_DIR_DEFAULT=/data/export/payments`` +- ``MAX_RETRIES=3`` +- ``attempt=0`` +- ``business_day=$(date +%Y%m%d)`` +- ``export_dir=$EXPORT_DIR_DEFAULT`` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle database connection via `sqlplus / AS SYSDBA`. +- SQL query accesses table `settled_payment`. + +#### Errors and exit codes +- `fail` exit codes: + - 1: generic failure (e.g., missing tool). + - 2: usage error. + - 3: missing required tool. + - 4: exceeded retry limit. +- Traps: none defined. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..09a64ad3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,46 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:16Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates deployment, health monitoring, and nightly data extraction for a payment processing service. + +#### Purpose +- Deploy release tarballs to multiple hosts, restart services, and verify health. +- Control a queue‑worker process with start/stop/status/health commands. +- Export settled payments from Oracle to CSV, gzip, and generate control files. + +#### Responsibilities +- **Deployment**: `deploy_release.sh` handles distribution, extraction, symlink updates, service restarts, and health checks across environments. +- **Process Management**: `healthcheck.sh` provides a POSIX init‑style interface for a queue worker, tracking PID, heartbeat, and status. +- **Data Extraction**: `nightly_extract.ksh` runs nightly to pull settled payments, produce CSV/GZ, and create control metadata. + +#### Key units +- `deploy_release.sh` – orchestrates host‑by‑host deployment, uses `rsync`, `ssh`, `curl`. +- `healthcheck.sh` – PID/heartbeat manager for `/usr/local/bin/queue-worker`. +- `nightly_extract.ksh` – Oracle export script, relies on `sqlplus` and `gzip`. + +#### Data flow +1. **Deployment**: script parses `-e`/`-t`, loads host list, rsyncs tarball → SSH → extract → symlink `current` → restart `orderd` → poll `http://host:8080/health`. +2. **Healthcheck**: `start` writes PID, `stop` kills process, `status` checks PID and heartbeat age, `health` reports OK/WARNING/CRITICAL. +3. **Extraction**: parse `-d`/`-o`, run SQL via `sqlplus`, spool to CSV, count rows, write control file, gzip CSV. + +#### Dependencies +- External utilities: `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `sqlplus`, `gzip`. +- External files: `hosts.staging`, `hosts.production`, `"$SCRIPT_DIR/lib/common.sh"`. +- Oracle DB via `sqlplus / AS SYSDBA`. +- Queue worker binary `/usr/local/bin/queue-worker`. + +#### Cross-cutting +- Logging with timestamps (`log` functions). +- Strict error handling: `die`/`fail` exit with codes 1–4. +- Configuration via environment variables and defaults (`DEPLOY_USER`, `SSH_KEY`, `HEARTBEAT_FILE`, `MAX_HEARTBEAT_AGE`, `ORACLE_SID`). +- Retry logic in nightly extraction (max 3 attempts). +- Health checks use timeouts (`HEALTH_TIMEOUT`, `MAX_HEARTBEAT_AGE`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..16138e0d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,60 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:02:56Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Configures the Maven build for the Invoice Service, including dependencies, compiler settings, Flyway migrations, and a PDF generation profile. + +#### Purpose +- Builds the `invoice-service` JAR. +- Manages database migrations with Flyway. +- Provides a native PDF generation profile. + +#### Type +- Maven POM + Root element: `project` + Namespaces: + - `xmlns="http://maven.apache.org/POM/4.0.0"` + - `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release` = `17` + - `jackson.version` = `2.19.2` + - `flyway.version` = `11.4.0` + - `invoice.archive.dir` = `${project.build.directory}/archive` +- **Dependencies**: + - `com.fasterxml.jackson.core:jackson-databind:${jackson.version}` + - `org.flywaydb:flyway-core:${flyway.version}` + - `org.postgresql:postgresql` (runtime) + - `org.junit.jupiter:junit-jupiter` (test) + - `org.testcontainers:postgresql` (test) +- **Plugins**: + - `org.flywaydb:flyway-maven-plugin:${flyway.version}` + - `locations`: `filesystem:src/main/resources/db/migration` + - `org.apache.maven.plugins:maven-surefire-plugin` + - `systemPropertyVariables`: `invoice.archive.dir=${invoice.archive.dir}` +- **Profile** `native-pdf`: + - Adds dependency `org.apache.pdfbox:pdfbox:3.0.5` + +#### Configuration +- `maven.compiler.release` = `17` +- `invoice.archive.dir` = `${project.build.directory}/archive` +- Flyway location: `filesystem:src/main/resources/db/migration` +- Surefire system property: `invoice.archive.dir=${invoice.archive.dir}` + +#### Dependencies +- Parent: `org.example.billing:billing-parent:2.7.0` +- Jackson Databind (`2.19.2`) +- Flyway Core (`11.4.0`) +- PostgreSQL JDBC (runtime) +- JUnit Jupiter (test) +- Testcontainers PostgreSQL (test) +- PDFBox (`3.0.5`) (profile `native-pdf`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..f332c069 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,49 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:19Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides build, configuration, and data‑exchange support for an invoice‑processing service, including Maven build setup, a reminder scheduler, shipment XML schema, and statement‑to‑HTML transformation. + +#### Purpose +- Build and package the `invoice-service` JAR with database migrations and optional PDF generation. +- Configure a Spring‑based reminder scheduler that sends overdue notifications via email. +- Define XML contracts for shipment notices and monthly account statements. +- Transform statement XML into styled HTML for reporting. + +#### Responsibilities +- **Build & Deployment** – Maven POM with Flyway migrations, compiler settings, and PDF profile. +- **Scheduling & Notifications** – Spring context for a daily reminder job using HikariCP, JDBC repository, and SMTP gateway. +- **Data Exchange** – XML Schema for shipment notices; XSLT for rendering account statements. +- **Configuration Management** – Property placeholders for database, SMTP, and job parameters. + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, Flyway plugin, PDFBox profile. +- `scheduler-context.xml` – Spring beans: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`; `reminderScheduler` with cron trigger. +- `shipment.xsd` – `shipmentNotice` schema with `ParcelType`, `AddressType`, `ShipmentNoticeType`. +- `statement-to-html.xsl` – XSLT stylesheet transforming `st:statement` XML to HTML, highlighting large amounts. + +#### Data flow +1. **Build**: Maven compiles source, runs Flyway migrations, packages JAR; optional PDFBox dependency added in `native-pdf` profile. +2. **Runtime**: Spring context loads `scheduler-context.xml`; `reminderScheduler` triggers `overdueReminderJob.sendDueReminders` every weekday at 7 AM. +3. **Job Execution**: `OverdueReminderJob` queries `JdbcReminderRepository` (via `reminderDataSource`), formats emails with `SmtpMailGateway`, and sends reminders. +4. **External Interaction**: Warehouse systems send `shipmentNotice` XML validated against `shipment.xsd`; accounting systems generate `st:statement` XML transformed by `statement-to-html.xsl` into HTML reports. + +#### Dependencies +- **Internal**: `org.example.reminder` classes (`JdbcReminderRepository`, `SmtpMailGateway`, `OverdueReminderJob`). +- **External**: HikariCP, PostgreSQL JDBC, Flyway, Jackson Databind, JUnit/Testcontainers, PDFBox (profile), Spring `task`/`context`. +- **Schema**: Standard XML Schema namespace; no external schema imports. + +#### Cross-cutting +- Property placeholders (`reminder.*`) centralize configuration. +- Spring task scheduling and cron expressions standardize job timing. +- XML schemas enforce strict data contracts for shipment and statement documents. +- XSLT parameters (`currencySymbol`, `highlightAbove`) allow runtime customization of report rendering. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..48338a28 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,45 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:00Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Configures a Spring application context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled trigger. + +#### Purpose +- Sets up a reminder scheduler with database access and email notifications. +- Declares a scheduled task to send due reminders every weekday at 7 AM. + +#### Type +- Spring application context (`` root). +- Namespaces: `http://www.springframework.org/schema/beans` (default), `http://www.springframework.org/schema/context`, `http://www.springframework.org/schema/task`. + +#### Definitions +- **Property placeholder**: `reminder.properties` (classpath). +- **Component scan**: `org.example.reminder.web`. +- **Beans**: + - `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`): `jdbcUrl`=`${reminder.db.url}`, `username`=`${reminder.db.user}`, `maximumPoolSize`=`8`. + - `reminderRepository` (`org.example.reminder.JdbcReminderRepository`): constructor arg `reminderDataSource`. + - `mailGateway` (`org.example.reminder.SmtpMailGateway`): `host`=`${reminder.smtp.host}`, `port`=`587`. + - `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`): constructor args `reminderRepository`, `mailGateway`; property `graceDays`=`14`. +- **Scheduler**: `reminderScheduler` (`task:scheduler`) with `pool-size`=`2`. +- **Scheduled task**: `overdueReminderJob.sendDueReminders` invoked by cron `0 0 7 * * MON-FRI` via `reminderScheduler`. + +#### Configuration +- `reminder.db.url` – database JDBC URL. +- `reminder.db.user` – database username. +- `reminder.smtp.host` – SMTP host. +- `reminder.smtp.port` – SMTP port (fixed 587). +- `overdueReminderJob.graceDays` – 14 days. +- Scheduler pool size – 2 threads. + +#### Dependencies +- `com.zaxxer.hikari.HikariDataSource` (HikariCP). +- `org.example.reminder.JdbcReminderRepository`. +- `org.example.reminder.SmtpMailGateway`. +- `org.example.reminder.OverdueReminderJob`. +- Spring `task` and `context` modules. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..6a8e54cc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,40 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:04Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Specifies the structure of a shipment notice XML document. +- Validates parcel details, carrier, recipient address, and shipment metadata. + +#### Type +- XML Schema (``) +- Root element: `shipmentNotice` +- Namespace: `urn:example:shipment:1` (prefix `shp`) + +#### Definitions +- **Simple types** + - `CarrierCode`: enumeration of `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: positive integer ≤ 31500. +- **Complex types** + - `ParcelType` + - Elements: `trackingNumber` (`xs:string`), `weight` (`shp:WeightGrams`). + - Attribute: `sequence` (`xs:positiveInteger`, required). + - `AddressType` + - Elements: `name`, `street`, `postalCode`, `city` (`xs:string`), `country` (`xs:string`, optional, default `DE`). + - `ShipmentNoticeType` + - Elements: `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), `parcel` (`shp:ParcelType`, unbounded). + - Attribute: `noticeId` (`xs:ID`, required). + +#### Configuration +- `country` element in `AddressType` defaults to `DE` when omitted. + +#### Dependencies +- None beyond standard XML Schema (`http://www.w3.org/2001/XMLSchema`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..dda3e1f8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,42 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:06Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Transforms a monthly account statement XML into an HTML page with header, rows per booking, and a total. + +#### Purpose +- Render a monthly account statement as an HTML page. +- Highlight bookings exceeding a threshold. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespace: `xmlns:xsl="http://www.w3.org/1999/XSL/Transform"`, `xmlns:st="urn:example:statement"`. + +#### Definitions +- **Parameters** + - `currencySymbol` (default `'EUR'`). + - `highlightAbove` (default `1000`). +- **Key** + - `bookingsByDay`: matches `st:booking`, indexed by `st:valueDate`. +- **Templates** + - `match="/st:statement"`: builds the overall HTML structure. + - `name="statementHeader"`: outputs account number and period. + - `match="st:booking"`: outputs a table row; adds `class="large"` if `st:amount` > `$highlightAbove`. + - `name="statementTotal"`: outputs the sum of all `st:booking/st:amount`. + +#### Configuration +- `xsl:output` method `html`, encoding `UTF-8`, indent `yes`. +- `currencySymbol` parameter value `'EUR'`. +- `highlightAbove` parameter value `1000`. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: + - `st:statement` (root, attributes `period`, child `st:accountNumber`). + - `st:booking` (children `st:valueDate`, `st:purpose`, `st:amount`). +- No external schemas or stylesheets referenced. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..16bb9e49 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,57 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:31Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A toolkit that parses web logs, automates deployment and monitoring of a payment system, and builds an invoice‑processing service with XML contracts and scheduled reminders. + +#### Purpose +- Aggregate web‑server access‑log metrics. +- Deploy, monitor, and nightly‑extract data for a payment service. +- Build, configure, and run an invoice‑processing Java service with XML exchange and reminder scheduling. + +#### Responsibilities +- **Log Analysis (Perl)** – parse access logs, aggregate statistics, detect slow requests, output summaries or JSON. +- **Deployment & Monitoring (Shell)** – distribute releases, restart services, health‑check queue workers, export settled payments from Oracle. +- **Build & Runtime (XML/Java)** – Maven build with Flyway migrations, optional PDF generation, Spring scheduler for overdue reminders, XML schemas for shipment notices and statements, XSLT for HTML reports. + +#### Key units +- **Perl** + - `LogDigest` (OO module): `new`, `add`, `summarize`, `top_n`; constants `MAX_LINES`, `SLOW_REQUEST_MS`. + - `log_digest.pl`: CLI entry point, option parsing, alias handling, output formatting. +- **Shell** + - `deploy_release.sh`: host‑by‑host tarball deployment, symlink update, service restart, health polling. + - `healthcheck.sh`: PID/heartbeat manager for `/usr/local/bin/queue-worker`. + - `nightly_extract.ksh`: Oracle `sqlplus` export, CSV/GZ creation, control file generation. +- **XML/Java** + - `invoice-service-pom.xml`: Maven project, Flyway, PDFBox profile. + - `scheduler-context.xml`: Spring beans (`reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler`). + - `shipment.xsd`: `shipmentNotice` schema with `ParcelType`, `AddressType`. + - `statement-to-html.xsl`: XSLT for `st:statement` → styled HTML. + +#### Data flow +1. **Log Analysis** – `log_digest.pl` reads log files → `LogDigest::add` → `summarize` → output. +2. **Deployment** – `deploy_release.sh` rsyncs → SSH → extraction → symlink → restart → health check. +3. **Healthcheck** – `healthcheck.sh` writes PID, monitors heartbeat, reports status. +4. **Extraction** – `nightly_extract.ksh` runs SQL, spools CSV, counts rows, writes control file, gzips. +5. **Invoice Service** – Maven builds JAR → Flyway migrates DB → Spring loads `scheduler-context.xml` → `overdueReminderJob` queries DB, formats emails, sends via `SmtpMailGateway`. +6. **XML Exchange** – External systems send `shipmentNotice` XML validated against `shipment.xsd`; accounting systems produce `st:statement` XML transformed by `statement-to-html.xsl` into HTML reports. + +#### Dependencies +- **Perl** – `Getopt::Long`, `JSON::PP`, `POSIX`, `List::Util`, `Carp`, `Exporter`. +- **Shell** – `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `sqlplus`, `gzip`; host lists (`hosts.staging`, `hosts.production`); common shell library (`lib/common.sh`). +- **Java** – HikariCP, PostgreSQL JDBC, Flyway, Jackson Databind, JUnit/Testcontainers, PDFBox (profile), Spring `task`/`context`. +- **XML** – Standard XML Schema namespace; XSLT processor. + +#### Cross‑cutting +- Consistent error handling (`Carp::croak`, `die` with exit codes). +- Configuration via environment variables or property placeholders (`LOG_DIGEST_CONFIG`, `DEPLOY_USER`, `HEARTBEAT_FILE`, `reminder.*`). +- Logging with timestamps across scripts. +- Retry and timeout logic in deployment and extraction. +- Canonical JSON output for deterministic ordering. +- XML schemas enforce strict contracts; XSLT parameters allow runtime customization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..3055d139 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run2/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: BEC5B5FD +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:37Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project centers on a payment‑processing ecosystem that combines web‑log parsing, automated deployment and health monitoring, and an invoice‑processing service. Log‑analysis utilities (in Perl and shell) aggregate per‑host and per‑status statistics, expose the busiest hosts and slow requests, and can output JSON for downstream consumption. Deployment and monitoring scripts orchestrate the payment system’s lifecycle, while a dedicated XML toolkit supplies build, configuration, and data‑exchange support for the invoice service, including Maven integration, reminder scheduling, shipment schema handling, and statement‑to‑HTML transformation. Together these subsystems provide a cohesive, multi‑language framework for managing payments, monitoring performance, and automating invoice workflows. + +#### Packages +- other — A multi‑language toolkit that parses web logs, automates deployment and monitoring of a payment service, and builds an invoice‑processing Java service with XML contracts and scheduled reminders. +- other/perl — A Perl toolkit that parses web‑server access logs, aggregates per‑host and per‑status statistics, and reports the busiest hosts and slow requests, optionally as JSON. +- other/shell — Automates deployment, health monitoring, and nightly data extraction for a payment processing service. +- other/xml — Provides build, configuration, and data‑exchange support for an invoice‑processing service, including Maven build setup, a reminder scheduler, shipment XML schema, and statement‑to‑HTML transformation. +- . — A toolkit that parses web logs, automates deployment and monitoring of a payment system, and builds an invoice‑processing service with XML contracts and scheduled reminders. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/meta/gpt-6-luna.json new file mode 100644 index 00000000..59f6275b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/meta/gpt-6-luna.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T08:03:40Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 71.0, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 36.6, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.6, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T08:05:31Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 15441, + "cachedPromptTokens": 15414, + "completionTokens": 6991, + "seconds": 70.3689087 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.003652, + "costUsd": 0.005845, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/meta/gpt-oss-20b.json new file mode 100644 index 00000000..89460099 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/meta/gpt-oss-20b.json @@ -0,0 +1,79 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-java", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "04a644b6b333747926f2d4a38e7274a9a7bf9ce358fa4900903a9dd54e1ccf17", + "file-body-fallback.md": "39695225b45f5b6e809a2768ce1723251f5d336e10a5bea035c96a8455e25f6e", + "file-body-java.md": "276887a4efee16e5b61a7f53c92fa4ba6679675cfde10662692c033bf4cc9c69", + "file-body-oop.md": "004ab790b65b1310ff4e193abc2c9cf071a06e8f462beb3595693fca23e5c545", + "file-body-ops.md": "8a2479306472cc706891d128769e88c751675d9f0a8750eab6442dcbbbe4e8d4", + "file-body-perl.md": "a68622087183a46c316f5e4623caa002268f806c20ccbf934ba0e41afed3a2c3", + "file-body-shell.md": "7367ebfd912042ad1ed0b0fb756f6c37eacba58450b5fd0148898c84b592ac7c", + "file-body-sql.md": "ffba311d967210a2faf4d43d162c6cba09b6876e8afbaec7ef35cd3b22784140", + "file-body-view.md": "a6c5d86108e79b81b3671c2c7f960a9289f9d7a903312cea8779852caf35273c", + "file-body-xml.md": "f47baaa5989aca7b9dabe575e7026d05aa8b107d2d880a1327582d5a7b68d158", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T08:05:32Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 33.2, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 34.9, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.0, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T08:06:42Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16017, + "cachedPromptTokens": 15920, + "completionTokens": 4943, + "seconds": 32.6577859 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.001123, + "costUsd": 0.001543, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..b9f4b0e8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,55 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:12Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> Supports billing and order operations through access-log analytics, service deployment and worker management, payment exports, reminder scheduling, shipment validation, and statement rendering. + +#### Purpose +- Provides operational tools for monitoring and releasing services, exporting settlement data, and summarizing web-server traffic. +- Defines billing-related build and reminder configuration, shipment XML constraints, and account-statement presentation. + +#### Responsibilities +- **Log analytics (`perl/`):** Parses access logs, aggregates host and status counts, tracks slow requests, and reports summaries as text or canonical JSON. +- **Service operations (`shell/`):** Deploys tagged `orderd` releases with health checks and manages queue-worker lifecycle and heartbeat status. +- **Settlement exports (`shell/`):** Queries Oracle `settled_payment` for a business day and writes gzipped CSV plus a row-count control file, retrying failures. +- **Billing and reminders (`xml/`):** Configures the `invoice-service` Maven build and Spring overdue-reminder scheduling. +- **Shipment and statement XML (`xml/`):** Constrains shipment notices with `shipment.xsd` and transforms statement XML into HTML with `statement-to-html.xsl`. + +#### Key units +- `LogDigest` — parses and aggregates requests by normalized host and status, including slow-request counts. +- `log_digest.pl::main` — reads CLI options and log files, applies host exclusions, and emits text or JSON summaries. +- `deploy_host`, `load_hosts`, `wait_healthy` — select deployment hosts, install a release, restart `orderd`, and poll its `/health` endpoint. +- `is_running`, `heartbeat_age`, `start_worker`, `stop_worker` — check and manage the queue worker using its PID and heartbeat files. +- `run_export`, `write_control` — produce the Oracle payment CSV and its business-day and row-count control file. +- `invoice-service` Maven project — packages the service with Flyway migrations and optional `native-pdf` support. +- `overdueReminderJob` — runs `OverdueReminderJob.sendDueReminders` on weekday mornings with a 14-day grace period. +- `shipmentNotice` / `ShipmentNoticeType` — define shipment payload structure and required notice and parcel data. +- `CarrierCode` / `WeightGrams` — constrain shipment carrier values and parcel weights. +- `/st:statement`, `statementHeader`, `statementTotal`, `bookingsByDay` — render statement HTML, headers, totals, and booking groupings. + +#### Data flow +- Access-log files → CLI filtering and alias resolution → `LogDigest` parsing and aggregation → text or canonical JSON summary. +- Deployment options and tag → host-list and prerequisite checks → archive transfer and installation → service restart → per-host health polling. +- Worker operation argument → PID/process or lifecycle action; health checks also compare heartbeat age against a 120-second limit. +- Business day and export directory → Oracle query → CSV and row-count control file → gzip; failed exports are retried up to three times. +- Spring reminder configuration → database and mail gateway → weekday job; shipment XML is validated against the schema, while statement XML is transformed to HTML. + +#### Dependencies +- **Perl:** `Getopt::Long`, `JSON::PP`, `FindBin`, `POSIX`, `List::Util`, `Carp`, and `Exporter`; configuration from `$ENV{LOG_DIGEST_CONFIG}` or `/etc/log-digest.conf`. +- **Shell:** `lib/common.sh`, environment host lists, `rsync`, `ssh`, `curl`, remote `orderd` commands, queue-worker files and utilities, Oracle `sqlplus`, `settled_payment`, and `gzip`. +- **XML:** Maven parent `org.example.billing:billing-parent:2.7.0`, Jackson, Flyway, PostgreSQL, JUnit Jupiter, Testcontainers, optional PDFBox; Spring reminder repository, SMTP gateway, job classes, and `reminder.properties`. +- **XML formats:** Shipment types in `urn:example:shipment:1`; statement vocabulary in `urn:example:statement`. + +#### Cross-cutting +- Runtime behavior is configurable through CLI options, environment/config files, Maven properties, reminder properties, and stylesheet parameters. +- Log processing defaults to `WARN`, caps input at 50,000 lines, and marks requests over 1,500 ms as slow. +- Operational failure handling varies by task: deployment halts on failed health checks, worker health returns distinct status codes, and exports retry before reporting exhausted retries. +- Reminder execution uses a two-thread scheduler with a 07:00 Monday–Friday cron schedule. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..f5479a48 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,66 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:41Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Condenses web-server access-log entries into per-host, per-status, and slow-request counts. + +#### Purpose +- Accumulates access-log statistics and produces a timestamped summary. +- Parses individual log lines and ranks count keys. + +#### Type +- Module; package `LogDigest`; procedural API with object constructor `new`. +- `@EXPORT_OK`: `parse_line`, `top_n`; no default exports. + +#### Input +- `new(level => ...)`: optional `level` argument; defaults to `DEFAULT_LEVEL`. +- `add($line)`: access-log line string; increments the line limit before parsing. +- `parse_line($line)`: access-log line string. +- `top_n($counts, $n)`: hash reference of counts and requested result count. +- No command-line options, environment variables, or file/handle reads. + +#### Output +- `parse_line`: hash reference with normalized `host`, `time`, `method`, `path`, `status`, and `millis`; returns false for an unmatched line. +- `add`: `1` for a parsed entry, `0` for an unmatched line. +- `summarize`: hash reference containing UTC `generated` timestamp, `total`, distinct `hosts`, maximum per-host count `busiest`, `slow` count, and copied `statuses` counts. +- `top_n`: list of keys sorted by descending count, then ascending key. +- No printed output or files written. + +#### Core logic +- `new` validates the requested log level and initializes host/status counts, slow-request count, and line count. +- `parse_line` matches the expected access-log format; lowercases the host and removes one trailing dot. +- `add` rejects input beyond `MAX_LINES`, ignores lines that do not parse, then updates host and status counts and increments `slow` when `millis > SLOW_REQUEST_MS`. +- `summarize` calculates total requests and busiest-host count, then returns those metrics, distinct-host count, statuses, and current UTC timestamp. +- `top_n` orders keys by descending count with lexical tie-breaking, then returns up to `n` keys. + +#### Subs +- `new($class, %args) -> object` — validate level and initialize counters. +- `parse_line($line) -> hashref or false` — parse and normalize one access-log line. +- `add($self, $line) -> 1 or 0` — count a parsed entry. +- `summarize($self) -> hashref` — build aggregate statistics. +- `top_n($counts, $n) -> list` — rank count keys and select top entries. +- `_normalize_host($host) -> string` — lowercase host and trim trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50_000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `$VERSION = '1.4'` +- `%LEVEL_RANK = (DEBUG => 0, INFO => 1, WARN => 2, ERROR => 3)` + +#### Dependencies +- `POSIX`: imports `strftime`. +- `List::Util`: imports `max`, `sum`. +- `Carp`: imports `croak`. +- `parent`: inherits from `Exporter`. +- Pragmas: `strict`, `warnings`. + +#### Exceptions / Errors +- `new` calls `croak` for a level not present in `%LEVEL_RANK`. +- `add` calls `croak` when the line count exceeds `MAX_LINES`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..dafd4c2d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/perl/log_digest.pl.ai.md @@ -0,0 +1,69 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:49Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Summarizes access-log requests by host and status-related metrics, printing the busiest hosts and request totals as text or JSON. + +#### Purpose +- Reads one or more access-log files, applies configured host aliases and exclusions, and summarizes requests. +- Prints a text summary with the top hosts or a canonical JSON summary. + +#### Type +- Script; package `main`; procedural. +- Imports `top_n` from `LogDigest`; no exports or object construction of its own. + +#### Input +- `--top` / `-n` → `$top`; integer, default `10`. +- `--level` → `$level`; string, default `WARN`. +- `--json` / `--nojson` → `$as_json`; boolean, default `0`. +- `--exclude-host` → `@exclude_hosts`; repeatable. +- `--help` / `-h` → prints usage and exits `0`. +- `@ARGV` → access-log file paths; each file is read line by line. +- `%ENV`: `LOG_DIGEST_CONFIG` → `$config_file`; defaults to `/etc/log-digest.conf`. +- Reads `$config_file` for host aliases; unreadable or missing config yields no aliases. +- Reads each log file via a file handle; no standard-input reading. + +#### Output +- Text mode: `" requests from hosts, slow\n"`, followed by one line per result from `top_n($digest->{hosts}, $top)`. +- JSON mode: canonical JSON encoding of the summary, followed by a newline. +- Returns `0` from `main`; process exits with that status. +- Errors print to standard error through `die`. + +#### Core logic +- Parses options; dies if `$top < 1`. +- Loads aliases from config lines, skipping blank and comment lines and splitting remaining lines at `=`. +- Builds an exclusion lookup from `@exclude_hosts`. +- Creates a `LogDigest` object with `level => $level`. +- For each log line, takes the first space-delimited field as the host; skips the line if its aliased host (or original host when no alias exists) is excluded. +- Adds remaining lines to the digest, summarizes it, then prints JSON or text with top hosts. + +#### Subs +- `usage() -> string` — formats usage text. +- `read_aliases($path) -> hash` — reads host alias mappings; returns an empty hash if opening fails. +- `main() -> 0` — reads logs, summarizes requests, and prints output. + +#### Constants and configuration +- `$config_file` — `$ENV{LOG_DIGEST_CONFIG}` or `/etc/log-digest.conf`. +- `$top` — `10`. +- `$level` — `'WARN'`. +- `$as_json` — `0`. +- `@exclude_hosts` — empty initially. + +#### Dependencies +- `strict`, `warnings` — enable compile-time and runtime checks. +- `FindBin` — imports `$Bin`. +- `Getopt::Long` — imports `GetOptions`. +- `JSON::PP` — uses `new`, `canonical`, and `encode`. +- `LogDigest` — imports `top_n`; calls `new`, `add`, and `summarize`. + +#### Exceptions / Errors +- `GetOptions` failure: dies with usage text. +- `$top < 1`: dies with `--top must be positive`. +- Log-file open failure: dies with `cannot read $file: $!`. +- Config-file open failure is ignored; `read_aliases` returns an empty hash. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/perl/package.ai.md new file mode 100644 index 00000000..1d02a769 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/perl/package.ai.md @@ -0,0 +1,47 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:04:52Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Aggregates web-server access logs into host and status metrics, identifies slow requests, and reports request summaries. + +#### Purpose +- Parse access-log records and calculate request counts by host and status, plus slow-request totals. +- Provide a command-line tool for filtering log inputs and emitting text or canonical JSON summaries. + +#### Responsibilities +- **Parsing and aggregation:** `LogDigest` normalizes parsed hosts, counts accepted requests by host and status, tracks slow requests, and computes summary metrics. +- **Ranking:** `top_n` orders count keys by descending count with lexical tie-breaking. +- **Command-line reporting:** `log_digest.pl` reads log files, applies host-based exclusions, and prints the summary and top hosts. +- **Configuration:** `read_aliases` loads host alias mappings from the configured file; an unavailable config file yields no aliases. + +#### Key units +- `LogDigest` — object API for validating log level, accepting log lines, and producing aggregate statistics. +- `parse_line` — parses an access-log line into normalized host, time, method, path, status, and milliseconds, or returns false if unmatched. +- `add` — counts a parsed request, subject to `MAX_LINES`. +- `summarize` — returns UTC generation time, request total, distinct-host count, busiest-host count, slow count, and status counts. +- `top_n` — selects the highest-count keys with lexical tie-breaking. +- `log_digest.pl::main` — parses options, reads files, summarizes records, and writes text or JSON output. +- `read_aliases` — reads host mappings from the configured file. + +#### Data flow +- `log_digest.pl` parses CLI options and loads aliases, then reads each specified log file line by line. +- For each line, it checks the first field against exclusions using the alias when present; non-excluded lines are passed to `LogDigest::add`. +- `LogDigest` parses and normalizes accepted entries, updates host/status/slow counters, and produces a summary. +- The script emits the summary as canonical JSON or prints request totals and the top hosts using `top_n`. + +#### Dependencies +- `log_digest.pl` uses `LogDigest`, `Getopt::Long`, `JSON::PP`, and `FindBin`. +- `LogDigest` uses `POSIX` for UTC timestamp formatting, `List::Util` for aggregate calculations, `Carp` for errors, and `Exporter` for optional exports. +- Configuration is read from `$ENV{LOG_DIGEST_CONFIG}` or `/etc/log-digest.conf`; log inputs are file paths supplied via `@ARGV`. + +#### Cross-cutting +- `LogDigest` defaults to level `WARN`, accepts only levels in `%LEVEL_RANK`, limits processing to `MAX_LINES` (50,000), and marks requests over 1,500 ms as slow. +- Invalid levels, exceeding the line limit, invalid CLI options, nonpositive `--top`, and unreadable log files raise errors; failure to open the alias config is ignored. +- Text output is the default; `--json` selects canonical JSON output. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..74584117 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,84 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:03:58Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Deploy a tagged release to every host in a staging or production environment, restarting and health-checking the service host by host. + +#### Purpose +- Deploys `build/$TAG.tar.gz` to each configured environment host, updates the current release, and restarts `orderd`; stops on the first failed health check. +- Runs directly; sources `lib/common.sh`. + +#### Type +- Bash (`#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- `-e ` sets `ENVIRONMENT`. +- `-t ` sets `TAG`. +- `-n` sets `DRY_RUN=1`; logs intended deployments without deploying. +- `-p ` logs that parallel deployment is unsupported and ignores the value. +- `-h` prints usage and exits successfully. +- `getopts` parses options; unknown options and missing option values are errors. +- Environment variables: `DEPLOY_USER` defaults to `deploy`; `SSH_KEY` defaults to `$HOME/.ssh/deploy_ed25519`. +- Reads `lib/common.sh`, the selected `$SCRIPT_DIR/hosts.staging` or `$SCRIPT_DIR/hosts.production`, and `build/$TAG.tar.gz` during deployment. +- Requires nonempty `ENVIRONMENT` and `TAG`; extra positional arguments are shifted away and otherwise unused. + +#### Output +- Logs timestamped status and error messages to stderr. +- Transfers the release archive to each host’s `/tmp/`; remotely extracts it under `/opt/releases/$TAG`, updates `/opt/releases/current`, and restarts `orderd`. +- Sends health-check requests to `http://$host:8080/health`. +- Removes `/tmp/deploy_release.$$.lock` on exit; the script does not create this lock. +- Exits `0` on success or help; exits `2` if required environment or tag is missing; exits `1` for `die` errors. Strict-mode failures can also terminate the script nonzero. + +#### Core logic +- Parses options and shifts consumed arguments; validates that `ENVIRONMENT` and `TAG` are set. +- Checks for `rsync`, `ssh`, and `curl`, and verifies that `SSH_KEY` is readable. +- Selects the host-list file from `HOST_FILES`; reads lines not beginning with `#` into `HOSTS` and rejects an empty list. +- For each host, `deploy_host` either logs the intended action in dry-run mode or transfers the archive and runs remote deployment commands. +- Remote commands create the release directory, extract the archive, repoint `current`, and restart the service. +- `wait_healthy` polls the host health endpoint every two seconds; deployment stops if the host remains unhealthy for `HEALTH_TIMEOUT`. +- Logs successful deployment per host; an `EXIT` trap removes the lock path. + +#### Functions +- `log` — Timestamp and print to stderr. +- `die` — Log an error and exit `1`. +- `usage` — Print the usage comment. +- `check_prereqs` — Check required commands and SSH key. +- `load_hosts` — Load hosts for the selected environment. +- `deploy_host` — Transfer, install, and restart a release. +- `wait_healthy` — Poll a host’s health endpoint. +- `cleanup` — Remove the temporary lock path. + +#### Constants and configuration +- `SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"` (readonly) +- `DEPLOY_USER="${DEPLOY_USER:-deploy}"` +- `SSH_KEY="${SSH_KEY:-$HOME/.ssh/deploy_ed25519}"` +- `RELEASE_ROOT="/opt/releases"` (exported) +- `SERVICE_NAME="orderd"` +- `HEALTH_TIMEOUT=30` +- `ENVIRONMENT=""` +- `TAG=""` +- `DRY_RUN=0` +- `HOSTS=()` +- `HOST_FILES=([staging]="hosts.staging" [production]="hosts.production")` + +#### Dependencies +- Sourced file: `$SCRIPT_DIR/lib/common.sh`. +- External commands: `bash`, `command`, `curl`, `date`, `grep`, `mapfile`, `mkdir`, `rm`, `rsync`, `sed`, `shift`, `sleep`, `ssh`, `sudo`, `systemctl`, `tar`. +- Host-list files: `$SCRIPT_DIR/hosts.staging`, `$SCRIPT_DIR/hosts.production`. +- Remote service: `orderd`; health endpoint pattern: `http://$host:8080/health`. + +#### Errors and exit codes +- `1`: `die` errors, including missing prerequisite, unreadable SSH key, unknown environment, empty host list, or failed health timeout. +- `2`: `ENVIRONMENT` or `TAG` is empty after option parsing. +- `0`: successful completion or `-h`. +- Unknown option and option missing a value call `die`. +- `set -euo pipefail` may also terminate on command failures or unset-variable use. +- `EXIT` trap calls `cleanup`, which removes `/tmp/deploy_release.$$.lock`. +- Health checks retry every two seconds until success or `HEALTH_TIMEOUT=30`; no retry is performed for deployment commands. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..cca02e18 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,62 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:04:10Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Manages the queue worker lifecycle and checks whether its process and heartbeat are healthy. + +#### Purpose +- Provides start, stop, restart, status, and heartbeat-health operations for the queue worker. +- Run directly with an operation as the first argument; not a sourced library. + +#### Type +- POSIX `sh`; no strict-mode settings. + +#### Input +- First positional argument: operation `start`, `stop`, `restart`, `status`, or `health`, parsed by a `case` statement. +- Environment variables: `PID_FILE` defaults to `/run/queue-worker.pid`; `HEARTBEAT_FILE` defaults to `/var/lib/queue-worker/heartbeat`. +- Reads the PID file and heartbeat file metadata. + +#### Output +- Starts or stops the worker process and creates or removes the PID file. +- Prints status or health messages; usage and critical messages go to standard error or standard output as written. +- Exit statuses: `0` for successful start, stop, restart, running status, or healthy probe; `1` for stale heartbeat; `2` when health check finds the worker stopped; `3` when status finds it stopped; `64` for an unknown operation. +- Other command failures may affect the resulting status. + +#### Core logic +- `start`: if the PID file identifies a live process, prints `already running`; otherwise launches the worker with `nohup`, redirects output, and records its PID. +- `stop`: returns immediately if the worker is not running; otherwise sends it a signal and removes the PID file if `kill` succeeds. +- `restart`: runs stop, then start. +- `status`: prints `running` if the PID identifies a live process; otherwise prints `stopped` and exits `3`. +- `health`: exits `2` with `CRITICAL: not running` if the worker is stopped; otherwise compares heartbeat age against 120 seconds, exiting `1` with a warning if stale or printing `OK`. +- Unknown operation prints usage to standard error and exits `64`. + +#### Functions +- `is_running`: checks PID file and process. +- `heartbeat_age`: computes heartbeat age in seconds. +- `start_worker`: launches worker and records PID. +- `stop_worker`: terminates worker and removes PID file. + +#### Constants and configuration +- `PID_FILE="${PID_FILE:-/run/queue-worker.pid}"` +- `HEARTBEAT_FILE="${HEARTBEAT_FILE:-/var/lib/queue-worker/heartbeat}"` +- `MAX_HEARTBEAT_AGE=120` +- `WORKER_BIN=/usr/local/bin/queue-worker` +- `now=$(date +%s)` +- `beat=$(stat -c %Y "$HEARTBEAT_FILE" 2>/dev/null || echo 0)` +- `age=$(heartbeat_age)` + +#### Dependencies +- External commands: `cat`, `date`, `stat`, `echo`, `kill`, `nohup`, `rm`. +- Worker executable: `/usr/local/bin/queue-worker`, invoked with `--heartbeat` and the heartbeat-file path. + +#### Errors and exit codes +- `status`: exits `3` when the worker is not running. +- `health`: exits `2` when the worker is not running; exits `1` when heartbeat age exceeds `MAX_HEARTBEAT_AGE`. +- Unknown operation: exits `64`. +- `heartbeat_age` substitutes timestamp `0` if `stat` fails; no traps, retries, or timeouts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..c5b9ac75 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,70 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:04:18Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Exports one business day of settled Oracle payments as a gzipped CSV with a row-count control file. + +#### Purpose +- Produces a dated payment extract and row-count control file for nightly settlement reporting. +- Runs directly as a command-line script. + +#### Type +- `ksh93` (`#!/bin/ksh93`); no strict-mode settings. + +#### Input +- `getopts` options: `-d` sets `business_day` (`YYYYMMDD`); `-o` sets `export_dir`. +- Environment: `ORACLE_SID` defaults to `PAYPRD`; `NLS_LANG` is set to `AMERICAN_AMERICA.AL32UTF8`. +- Reads Oracle table `settled_payment`; no local input files. + +#### Output +- Creates `export_dir` if absent. +- Writes `payments_.csv`, then replaces it with `payments_.csv.gz`. +- Writes `payments_.ctl` containing row count and business day. +- Logs timestamped status messages to standard error. +- Exit statuses: `0` success; `1` default `fail` status; `2` invalid usage; `3` missing required tool; `4` retries exhausted. + +#### Core logic +- Parses `-d` and `-o`; rejects other options with usage error. +- Requires `sqlplus` and `gzip`; creates the export directory if needed. +- Runs `sqlplus -s /nolog`, connects as SYSDBA, and selects payment ID, account number, amount, and currency from `settled_payment` for `business_day`. +- Retries failed exports up to `MAX_RETRIES`, sleeping 60 seconds after each failed attempt. +- On success, counts CSV lines, writes the `.ctl` file, gzips the CSV, logs success, and exits `0`. +- After retries are exhausted, reports failure and exits `4`. + +#### Functions +- `log` — Timestamp and print messages to standard error. +- `fail` — Log failure and exit with a status. +- `require_tools` — Check for required commands. +- `run_export` — Query Oracle and write CSV output. +- `write_control` — Write row count and business day. + +#### Constants and configuration +- `ORACLE_SID_DEFAULT=PAYPRD` +- `EXPORT_DIR_DEFAULT=/data/export/payments` +- `MAX_RETRIES=3` +- `attempt=0` +- `business_day=$(date +%Y%m%d)` +- `export_dir=$EXPORT_DIR_DEFAULT` +- `ORACLE_SID=${ORACLE_SID:-$ORACLE_SID_DEFAULT}` +- `NLS_LANG=AMERICAN_AMERICA.AL32UTF8` +- `csv=$export_dir/payments_$business_day.csv` + +#### Dependencies +- External commands: `date`, `sqlplus`, `gzip`, `wc`, `mkdir`, `sleep`. +- Shell commands and built-ins: `whence`, `getopts`, `print`. +- Oracle connection: `/ AS SYSDBA`. +- Oracle table: `settled_payment`; columns read: `payment_id`, `account_no`, `amount`, `currency`, `business_day`. + +#### Errors and exit codes +- `2` — Unsupported option; prints usage through `fail`. +- `3` — `sqlplus` or `gzip` unavailable. +- `1` — Default status for `fail`, including export-directory creation failure. +- `4` — Export fails through all three attempts. +- Retries wait 60 seconds after each failed attempt, including the final failed attempt. +- No traps. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/package.ai.md new file mode 100644 index 00000000..d3d522d7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/shell/package.ai.md @@ -0,0 +1,47 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:04:59Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates service release deployment and health monitoring, queue-worker lifecycle checks, and nightly Oracle payment exports for operational reporting. + +#### Purpose +- Provides command-line operations for rolling out `orderd`, managing the queue worker, and producing settlement payment extracts. +- Handles deployment validation, process and heartbeat checks, and export retry/control-file generation. + +#### Responsibilities +- **Release deployment (`deploy_release.sh`):** Select staging or production hosts, transfer and install a tagged archive, restart `orderd`, and halt rollout if host health checks fail. +- **Worker operations (`healthcheck.sh`):** Start, stop, restart, and report status for the queue worker; assess health using its heartbeat age. +- **Settlement reporting (`nightly_extract.ksh`):** Query Oracle `settled_payment` for a business day and produce a gzipped CSV with a row-count control file. + +#### Key units +- `deploy_host` — Transfers and installs a release on one host, then restarts the service. +- `wait_healthy` — Polls a host’s `/health` endpoint until success or timeout. +- `load_hosts` — Loads the host list for the selected deployment environment. +- `is_running` — Determines whether the PID-file process is live. +- `heartbeat_age` — Computes the worker heartbeat’s age in seconds. +- `start_worker` / `stop_worker` — Launch or terminate the worker and maintain its PID file. +- `run_export` — Runs the Oracle query and writes CSV output. +- `write_control` — Writes the export row count and business day to the `.ctl` file. + +#### Data flow +- **Deployment:** Environment and tag options → prerequisite and host-list checks → archive transfer and remote extraction → `current` release update and `orderd` restart → per-host HTTP health polling. +- **Worker:** Operation argument → PID/process check or lifecycle action; `health` additionally compares heartbeat-file age with the 120-second limit. +- **Payment export:** Business day and export directory → Oracle query → CSV line count and control file → gzip compression; failed exports are retried up to three times. + +#### Dependencies +- Deployment uses `lib/common.sh`, staging/production host-list files, `rsync`, `ssh`, `curl`, and remote `orderd` service commands. +- Worker management uses `/usr/local/bin/queue-worker`, PID and heartbeat files, and standard process/file utilities. +- Payment extraction uses `sqlplus` with `/ AS SYSDBA`, the Oracle `settled_payment` table, and `gzip`. + +#### Cross-cutting +- Each script is a directly invoked shell command; the package spans Bash, POSIX `sh`, and `ksh93`. +- Deployment and extraction emit timestamped logs; deployment uses Bash strict mode, while the other scripts specify no strict mode. +- Failure policies differ by task: deployment stops on failed host health checks, worker health returns distinct status codes, and extraction retries failed exports before returning an exhausted-retries code. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..4520598a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,45 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:04:29Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Configures the `invoice-service` Maven JAR for invoice creation, numbering, and archiving, with database migrations, tests, and optional PDF support. + +#### Purpose +- Builds the invoice service and configures its dependencies, migration plugin, test execution, and optional `native-pdf` profile. + +#### Type +- Maven POM; root element `project`. +- Namespaces: default `http://maven.apache.org/POM/4.0.0`; `xsi` = `http://www.w3.org/2001/XMLSchema-instance`. + +#### Definitions +- Coordinates: `org.example.billing:invoice-service:2.7.0` (`groupId` and `version` inherited from parent); packaging `jar`; name `Invoice service`. +- Parent: `org.example.billing:billing-parent:2.7.0`. +- Properties: `maven.compiler.release=17`; `jackson.version=2.19.2`; `flyway.version=11.4.0`; `invoice.archive.dir=${project.build.directory}/archive`. +- Dependencies: + - `com.fasterxml.jackson.core:jackson-databind` — compile, version `${jackson.version}`. + - `org.flywaydb:flyway-core` — compile, version `${flyway.version}`. + - `org.postgresql:postgresql` — runtime. + - `org.junit.jupiter:junit-jupiter` — test. + - `org.testcontainers:postgresql` — test. +- Plugins: + - `flyway-maven-plugin` — version `${flyway.version}`; migration location `filesystem:src/main/resources/db/migration`. + - `maven-surefire-plugin` — sets system property `invoice.archive.dir` to `${invoice.archive.dir}`. +- Profile `native-pdf`: adds `org.apache.pdfbox:pdfbox` version `3.0.5`. + +#### Configuration +- `maven.compiler.release=17`. +- `jackson.version=2.19.2`; `flyway.version=11.4.0`. +- `invoice.archive.dir=${project.build.directory}/archive`. +- Flyway migration location: `filesystem:src/main/resources/db/migration`. +- Surefire system property: `invoice.archive.dir=${invoice.archive.dir}`. + +#### Dependencies +- Parent POM: `org.example.billing:billing-parent:2.7.0`. +- Migration files: `src/main/resources/db/migration`. +- External systems/libraries: PostgreSQL, Jackson, Flyway, JUnit Jupiter, Testcontainers, Apache PDFBox (profile only). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/package.ai.md new file mode 100644 index 00000000..3ab91a66 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/package.ai.md @@ -0,0 +1,47 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:06Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Defines XML configuration, validation, and presentation assets for billing, overdue reminders, warehouse shipments, and account statements. + +#### Purpose +- Configure the invoice-service build and reminder scheduling. +- Specify shipment-notice validation and transform account statements into HTML. + +#### Responsibilities +- **Build and billing:** `invoice-service-pom.xml` defines the Maven JAR, database migrations, test setup, and optional PDF support. +- **Reminder delivery:** `scheduler-context.xml` wires database access, SMTP delivery, and a weekday job for overdue items. +- **Shipment validation:** `shipment.xsd` constrains shipment, recipient, carrier, parcel, and weight data. +- **Statement presentation:** `statement-to-html.xsl` renders statement details, booking rows, and totals, highlighting large amounts. + +#### Key units +- `invoice-service` Maven project — packages the service with Flyway migrations and an optional `native-pdf` profile. +- `overdueReminderJob` — invokes `OverdueReminderJob.sendDueReminders` on weekday mornings with a 14-day grace period. +- `shipmentNotice` / `ShipmentNoticeType` — defines the shipment payload, including required notice ID and one or more parcels. +- `CarrierCode` / `WeightGrams` — restrict carrier values and parcel weight to supported values and a maximum of 31,500 grams. +- `/st:statement` template — renders the HTML statement and applies booking templates. +- `statementHeader`, `statementTotal`, and `bookingsByDay` — provide header rendering, summed total rendering, and a booking key by value date. + +#### Data flow +- Spring loads `reminder.properties`, configures the data source and mail gateway, and runs the reminder job against the repository. +- Shipment notices are checked against `shipment.xsd` constraints. +- Namespaced statement XML is transformed into HTML, with booking amounts formatted and totaled. + +#### Dependencies +- Build: parent `org.example.billing:billing-parent:2.7.0`; Jackson, Flyway, PostgreSQL, JUnit Jupiter, Testcontainers, and optional Apache PDFBox. +- Reminder context: HikariCP and `org.example.reminder` repository, SMTP gateway, and job classes; settings from `reminder.properties`. +- Shipment schema: XML Schema built-in types and internal shipment types in `urn:example:shipment:1`. +- Statement stylesheet: statement vocabulary in `urn:example:statement`; XSLT `format-number()` and `sum()`. + +#### Cross-cutting +- Runtime and build settings are property-driven: Maven archive and migration locations, reminder database and SMTP settings, and XSLT currency and highlighting thresholds. +- Reminder scheduling uses a two-thread scheduler and a cron schedule of 07:00, Monday–Friday. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..6fe93a6c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,42 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:04:35Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Configures the reminder service’s database, repository, SMTP gateway, job, and weekday scheduler. + +#### Purpose +- Wires components for sending reminders for overdue items. +- Loads reminder settings from a classpath properties file and schedules the job on weekdays. + +#### Type +- Spring application context; root element `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` `http://www.w3.org/2001/XMLSchema-instance`; `context` `http://www.springframework.org/schema/context`; `task` `http://www.springframework.org/schema/task`. + +#### Definitions +- Beans: + - `reminderDataSource` — `com.zaxxer.hikari.HikariDataSource`; `destroy-method="close"`. + - `reminderRepository` — `org.example.reminder.JdbcReminderRepository`; constructor references `reminderDataSource`. + - `mailGateway` — `org.example.reminder.SmtpMailGateway`. + - `overdueReminderJob` — `org.example.reminder.OverdueReminderJob`; constructor references `reminderRepository` and `mailGateway`. + - `reminderScheduler` — Spring task scheduler. +- Component scan: `org.example.reminder.web`. +- Scheduled task: `overdueReminderJob.sendDueReminders`, using `reminderScheduler`. + +#### Configuration +- Property placeholder location: `classpath:reminder.properties`. +- `reminderDataSource`: `jdbcUrl=${reminder.db.url}`; `username=${reminder.db.user}`; `maximumPoolSize=8`. +- `mailGateway`: `host=${reminder.smtp.host}`; `port=587`. +- `overdueReminderJob`: `graceDays=14`. +- `reminderScheduler`: `pool-size=2`. +- Schedule: cron `0 0 7 * * MON-FRI` (07:00, Monday–Friday). + +#### Dependencies +- Properties file: `reminder.properties`. +- Classes: `com.zaxxer.hikari.HikariDataSource`, `org.example.reminder.JdbcReminderRepository`, `org.example.reminder.SmtpMailGateway`, `org.example.reminder.OverdueReminderJob`. +- Placeholder keys: `reminder.db.url`, `reminder.db.user`, `reminder.smtp.host`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..6e78cf85 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/shipment.xsd.ai.md @@ -0,0 +1,41 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:04:41Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Defines the warehouse shipment notice format, including recipient details, carrier codes, parcel tracking, and weight limits. + +#### Purpose +- Validates shipment notices sent when parcels leave a warehouse. +- Specifies required shipment and parcel data, with optional country defaulting to Germany. + +#### Type +- XML Schema; root element `schema`. +- Namespaces: `xs` = `http://www.w3.org/2001/XMLSchema`; `shp` = `urn:example:shipment:1`. +- Target namespace: `urn:example:shipment:1`. + +#### Definitions +- Top-level element: `shipmentNotice` of type `shp:ShipmentNoticeType`. +- Simple types: + - `CarrierCode`: enumeration of `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: positive integer, maximum inclusive `31500`. +- Complex types: + - `ParcelType`: ordered `trackingNumber` (`xs:string`), `weight` (`shp:WeightGrams`); required `sequence` attribute (`xs:positiveInteger`). + - `AddressType`: ordered `name`, `street`, `postalCode`, `city`, `country` (all `xs:string`); `country` is optional, default `DE`. + - `ShipmentNoticeType`: ordered `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), one or more `parcel` (`shp:ParcelType`); required `noticeId` attribute (`xs:ID`). + +#### Configuration +- `elementFormDefault`: `qualified`. +- `country`: `minOccurs="0"`; default `DE`. +- `parcel`: `maxOccurs="unbounded"` (minimum occurrence defaults to one). +- `CarrierCode` allowed values: `DHL`, `UPS`, `GLS`, `POST`. +- `WeightGrams`: positive integer with `maxInclusive="31500"`. + +#### Dependencies +- XML Schema built-in types: `xs:string`, `xs:positiveInteger`, `xs:dateTime`, `xs:ID`. +- Internal type references: `shp:ShipmentNoticeType`, `shp:CarrierCode`, `shp:WeightGrams`, `shp:AddressType`, `shp:ParcelType`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..73047330 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,38 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:04:46Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Transforms a namespaced monthly account statement into an HTML page with account details, booking rows, and a formatted total. + +#### Purpose +- Renders statement period and account number, one row per booking, and the sum of booking amounts. +- Marks bookings as `large` when their amount exceeds the configured threshold. + +#### Type +- XSLT 1.0 stylesheet; root `xsl:stylesheet`. +- Namespace: `xsl` — `http://www.w3.org/1999/XSL/Transform`; `st` — `urn:example:statement`. + +#### Definitions +- Templates: + - Match `/st:statement`: outputs the HTML page, invokes `statementHeader` and `statementTotal`, and applies templates to `st:booking`. + - Named `statementHeader`: outputs `st:accountNumber` and `@period`. + - Match `st:booking`: outputs `st:valueDate`, `st:purpose`, and formatted `st:amount`; conditionally sets row class `large`. + - Named `statementTotal`: outputs the formatted sum of `st:booking/st:amount`. +- Parameters: `currencySymbol` defaults to `'EUR'`; `highlightAbove` defaults to `1000`. +- Key: `bookingsByDay` matches `st:booking`, keyed by `st:valueDate`. +- Output method: `html`; encoding `UTF-8`; indentation enabled. + +#### Configuration +- `currencySymbol`: `'EUR'`. +- `highlightAbove`: `1000`; booking row receives class `large` when `number(st:amount) > $highlightAbove`. +- Amount format: `#,##0.00`. + +#### Dependencies +- Input vocabulary in namespace `urn:example:statement`: `st:statement`, `st:accountNumber`, `st:booking`, `st:valueDate`, `st:purpose`, `st:amount`; statement attribute `period`. +- Uses XSLT functions `format-number()` and `sum()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..29f22304 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/package.ai.md @@ -0,0 +1,51 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:20Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> Provides operational and billing support for monitoring traffic, deploying order services, managing workers, exporting payments, scheduling reminders, and validating or rendering business documents. + +#### Purpose +- Groups operational automation and billing artifacts for service release, settlement export, reminder delivery, and shipment and account-statement processing. +- Analyzes web access logs and emits summarized traffic metrics. + +#### Responsibilities +- **Traffic analytics:** Parse access logs, normalize and filter hosts, aggregate status counts, track slow requests, and produce text or JSON reports. +- **Service and worker operations:** Deploy tagged `orderd` releases with health checks; inspect, start, and stop queue workers using PID and heartbeat state. +- **Settlement export:** Query Oracle `settled_payment` for a business day and generate gzipped CSV output with a row-count control file and retry handling. +- **Billing and reminders:** Define the `invoice-service` Maven build and configure weekday overdue-reminder execution. +- **Business document formats:** Validate shipment notices against an XML schema and transform statement XML into HTML. + +#### Key units +- `LogDigest`, `log_digest.pl::main` — parse, aggregate, filter, and report access-log traffic. +- `deploy_host`, `load_hosts`, `wait_healthy` — select hosts, install a release, restart `orderd`, and check `/health`. +- `is_running`, `heartbeat_age`, `start_worker`, `stop_worker` — inspect and manage queue-worker lifecycle and health. +- `run_export`, `write_control` — export payment rows and write business-day and row-count metadata. +- `invoice-service` Maven project — package the billing service with Flyway migrations and optional `native-pdf` support. +- `overdueReminderJob` — schedule `OverdueReminderJob.sendDueReminders` with a 14-day grace period. +- `shipmentNotice`, `ShipmentNoticeType`, `CarrierCode`, `WeightGrams` — define and constrain shipment notice and parcel data. +- `/st:statement`, `statementHeader`, `statementTotal`, `bookingsByDay` — render statement structure, totals, and daily booking groups as HTML. + +#### Data flow +- Access-log files pass through CLI filtering and host alias resolution into `LogDigest`, then produce text or canonical JSON summaries. +- Deployment options and release tag drive host selection, archive transfer, installation, service restart, and per-host health polling. +- Worker commands inspect PID/process and heartbeat state or perform lifecycle actions; health checks use a 120-second heartbeat limit. +- Business day and export directory drive the Oracle query, CSV and control-file generation, and gzip; failures are retried up to three times. +- Reminder configuration invokes the weekday job through database and mail-gateway dependencies; shipment XML is schema-validated and statement XML is transformed to HTML. + +#### Dependencies +- **Log analytics:** Perl modules including `Getopt::Long`, `JSON::PP`, `POSIX`, `Carp`, and `Exporter`; configuration from `$ENV{LOG_DIGEST_CONFIG}` or `/etc/log-digest.conf`. +- **Operations and exports:** `lib/common.sh`, host-list configuration, `rsync`, `ssh`, `curl`, remote `orderd` commands, queue-worker files and utilities, Oracle `sqlplus`, `settled_payment`, and `gzip`. +- **Billing and reminders:** Maven parent `org.example.billing:billing-parent:2.7.0`; Jackson, Flyway, PostgreSQL, JUnit Jupiter, Testcontainers, optional PDFBox; reminder repository, SMTP gateway, job classes, and `reminder.properties`. +- **XML formats:** Shipment namespace `urn:example:shipment:1`; statement namespace `urn:example:statement`. + +#### Cross-cutting +- Runtime configuration comes from CLI options, environment/config files, Maven properties, reminder properties, and stylesheet parameters. +- Log processing defaults to `WARN`, limits input to 50,000 lines, and treats requests over 1,500 ms as slow. +- Failure handling is task-specific: deployment stops on failed health checks, worker health reports distinct status codes, and exports retry before reporting exhaustion. +- Reminder scheduling uses a two-thread scheduler and a 07:00 Monday–Friday cron schedule. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..cea3befa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-6-luna/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 7ADBF56D +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:28Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +This project combines billing and order operations with service deployment, worker management, and traffic monitoring. Perl tools summarize access logs and identify slow requests, while shell scripts handle releases, health checks, worker lifecycle checks, and nightly Oracle payment exports. XML assets support configuration, validation, and presentation for reminders, shipments, and account statements. + +#### Packages +- other — Supports billing and order operations through access-log analytics, service deployment and worker management, payment exports, reminder scheduling, shipment validation, and statement rendering. +- other/perl — Aggregates web-server access logs into host and status metrics, identifies slow requests, and reports request summaries. +- other/shell — Automates service release deployment and health monitoring, queue-worker lifecycle checks, and nightly Oracle payment exports for operational reporting. +- other/xml — Defines XML configuration, validation, and presentation assets for billing, overdue reminders, warehouse shipments, and account statements. +- . — Provides operational and billing support for monitoring traffic, deploying order services, managing workers, exporting payments, scheduling reminders, and validating or rendering business documents. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..7a8a446b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,47 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:06:31Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A multi‑language toolkit that aggregates web‑server logs, automates deployment and worker management, and supports invoicing workflows through XML validation and XSLT rendering. + +#### Purpose +- Consolidate and report access‑log metrics. +- Automate release deployment, worker lifecycle, and nightly payment extraction. +- Build, schedule, and validate invoicing and reminder processes. + +#### Responsibilities +- **Log Analysis (Perl)** – parse, aggregate, and report host, status, and latency statistics. +- **Deployment & Process Control (Shell)** – deploy releases, manage queue workers, and export payments. +- **Invoicing & Scheduling (XML/Maven)** – build service JAR, run migrations, schedule reminder jobs, validate shipment notices, and render statements. + +#### Key units +- **Perl**: `LogDigest` module (parsing, counting, ranking), `log_digest.pl` CLI driver. +- **Shell**: `deploy_release.sh` (remote deployment & health checks), `healthcheck.sh` (worker PID/heartbeat), `nightly_extract.ksh` (Oracle SQL export). +- **XML/Maven**: `invoice-service-pom.xml` (build & Flyway), `scheduler-context.xml` (Spring scheduler & mail gateway), `shipment.xsd` (shipment notice schema), `statement-to-html.xsl` (HTML rendering). + +#### Data flow +1. **Log Processing**: CLI → `LogDigest->add` per line → `summarize` → formatted output. +2. **Deployment**: script → rsync → SSH → remote extraction → service restart → health poll. +3. **Worker Management**: start → PID file; worker → heartbeat; healthcheck reads heartbeat age. +4. **Payment Export**: `sqlplus` query → CSV → control file → gzip. +5. **Invoicing**: Maven build → JAR → Flyway → database; scheduler triggers reminder job → mail gateway; shipment XML → XSD validation; statement XML → XSLT → HTML. + +#### Dependencies +- **Perl**: `Getopt::Long`, `JSON::PP`, `POSIX`, `List::Util`, `Carp`, `Exporter`, `FindBin`. +- **Shell**: `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `sqlplus`, `gzip`. +- **XML/Maven**: Jackson‑databind, Flyway‑core, PostgreSQL driver, JUnit‑Jupiter, Testcontainers‑PostgreSQL, PDFBox (profile), Spring scheduling, HikariCP, standard XSD/XSLT namespaces. + +#### Cross-cutting +- Robust error handling (`set -euo pipefail`, `croak`, `die`). +- Configuration via environment variables, host alias files, and property placeholders. +- Constants: `MAX_LINES=50000`, `SLOW_REQUEST_MS=1500`, default log level `WARN`. +- Ranking logic (`top_n`) and host normalization (`_normalize_host`). +- XML schemas use default values (`country="DE"`), XSLT parameters (`currencySymbol='EUR'`, `highlightAbove=1000`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..ef14a367 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,67 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:32Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Provides a log‑digesting class for web‑server access logs. +- Counts per‑host, per‑status, and slow requests. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: `new`, `add`, `summarize`. + +#### Input +- `new(level => $level)` – `$level` must be one of `DEBUG`, `INFO`, `WARN`, `ERROR`; defaults to `WARN`. +- `add($line)` – a single log line string. +- `parse_line($line)` – parses a log line. +- `top_n($counts, $n)` – helper for ranking counts. + +#### Output +- `add` returns `1` on successful parse, `0` if line ignored, dies on too many lines. +- `summarize` returns hashref: + - `generated` timestamp UTC. + - `total` total entries. + - `hosts` number of distinct hosts. + - `busiest` max requests per host. + - `slow` count of requests > 1500 ms. + - `statuses` hashref of status → count. +- `top_n` returns array of top `$n` keys sorted by count descending, then alphabetically. + +#### Core logic +- `new`: validate level, initialize counters. +- `parse_line`: regex extracts host, time, method, path, status, millis; normalizes host. +- `add`: enforce `MAX_LINES`; parse line; increment host/status counters; increment slow counter if millis > `SLOW_REQUEST_MS`. +- `summarize`: compute totals, busiest, and assemble summary hash. +- `top_n`: sort counts by value desc, key asc; slice top `$n`. + +#### Subs +- `new(%args) -> object` – create digest with level. +- `parse_line($line) -> hashref` – parse log line. +- `add($line) -> 1|0` – add entry. +- `summarize() -> hashref` – summary stats. +- `top_n($counts, $n) -> array` – top keys. +- `_normalize_host($host) -> host` – lowercase, strip trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `croak` if unknown level in `new`. +- `croak` if more than `MAX_LINES` added in `add`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..c8195ec9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,70 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:38Z +- G: +- A: 0.0.0 +- X: file +- P: 4F9ECAEF +--- +> Reads web server access logs, filters hosts, and outputs the busiest hosts and status‑code statistics in text or JSON. + +#### Purpose +- Script to analyze access logs and report host activity and status‑code counts. + +#### Type +- Script; no package; procedural. + +#### Input +- Command‑line options: + - `--top|n=i` → `$top` (default 10) + - `--level=s` → `$level` (default `'WARN'`) + - `--json!` → `$as_json` (default 0) + - `--exclude-host=s` → `@exclude_hosts` (multiple allowed) + - `--help|h` → prints usage +- Positional arguments: list of log files (`@ARGV`) +- Environment variable: `LOG_DIGEST_CONFIG` (default `'/etc/log-digest.conf'`) +- Configuration file: reads alias mappings (`from = to`) lines, ignores comments/blank lines. + +#### Output +- If `$as_json`: JSON string of `$summary` hash, newline‑terminated. +- Else: plain text: + - One line: `" requests from hosts, slow"` + - Followed by `` lines of host summaries from `top_n`. +- Exit status 0 on success; non‑zero on errors (e.g., file read failure, invalid `--top`). + +#### Core logic +- Load host aliases from config file. +- Build exclusion set from `@exclude_hosts`. +- Create `LogDigest` object with `level`. +- For each input file: + - Read line by line. + - Extract host (first field). + - Skip if host (or its alias) is excluded. + - Pass line to `$digest->add`. +- After processing all files, call `$digest->summarize`. +- Output results in chosen format. + +#### Subs +- `usage() -> string` – returns usage message. +- `read_aliases($path) -> hash` – parses alias file into `%aliases`. +- `main() -> int` – orchestrates parsing, digesting, and output. + +#### Constants and configuration +- `$config_file = $ENV{LOG_DIGEST_CONFIG} // '/etc/log-digest.conf'` +- `$top = 10` +- `$level = 'WARN'` +- `$as_json = 0` +- `@exclude_hosts = ()` + +#### Dependencies +- `FindBin qw($Bin)` +- `Getopt::Long qw(GetOptions)` +- `JSON::PP` (used for JSON encoding) +- `LogDigest` (provides `new`, `add`, `summarize`; also exported `top_n`) + +#### Exceptions / Errors +- `die usage()` if `GetOptions` fails. +- `die "--top must be positive\n"` if `$top < 1`. +- `die "cannot read $file: $!\n"` when opening a log file fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..24fdd862 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,42 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:06:05Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Condenses and reports web‑server access‑log activity, highlighting host usage, status‑code distribution, and slow requests. + +#### Purpose +- Aggregate access‑log statistics per host and status code. +- Identify slow requests and the busiest hosts. + +#### Responsibilities +- **Log parsing & normalization** – extract host, status, and latency from each line. +- **Counting & aggregation** – maintain per‑host, per‑status, and slow‑request tallies. +- **Reporting** – produce human‑readable or JSON summaries, optionally filtering hosts. + +#### Key units +- **`LogDigest` module** – OO class exposing `new`, `add`, `summarize`, and exported `parse_line`, `top_n`. +- **`log_digest.pl` script** – CLI driver that loads host aliases, applies exclusions, feeds lines to `LogDigest`, and outputs the final summary. + +#### Data flow +1. **CLI** parses options → creates `LogDigest` with chosen log level. +2. For each input file: read line → optionally skip excluded hosts → `LogDigest->add`. +3. After all files: `LogDigest->summarize` → hash of totals, host counts, slow count, status counts. +4. Script formats the hash as plain text or JSON and prints it. + +#### Dependencies +- **Internal**: `LogDigest` (provides parsing, counting, and ranking). +- **External**: `Getopt::Long`, `JSON::PP`, `POSIX`, `List::Util`, `Carp`, `Exporter`, `FindBin`. + +#### Cross-cutting +- **Host normalization**: lower‑case, strip trailing dot (`_normalize_host`). +- **Error handling**: `croak` for invalid log level or exceeding `MAX_LINES`; script dies on file I/O or bad options. +- **Configuration**: host alias file (`LOG_DIGEST_CONFIG`) supports `from = to` mappings; comments and blanks ignored. +- **Constants**: `MAX_LINES = 50000`, `SLOW_REQUEST_MS = 1500`, default log level `WARN`. +- **Ranking**: `top_n` sorts counts by value descending, then key ascending. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..a396faf0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,78 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:44Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploys a specified release to all hosts in an environment. +- Runs as a standalone script. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- Options parsed by `getopts`: + - `-e ` → `ENVIRONMENT`. + - `-t ` → `TAG`. + - `-n` → `DRY_RUN=1`. + - `-p ` → ignored, logged. + - `-h` → prints usage. +- Environment variables: + - `DEPLOY_USER` (default `deploy`). + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`). +- Files read: + - `$SCRIPT_DIR/lib/common.sh`. + - `$SCRIPT_DIR/hosts.staging` or `hosts.production` based on `ENVIRONMENT`. + +#### Output +- Logs to stderr. +- Copies `build/$TAG.tar.gz` to each host via `rsync`. +- Extracts tarball on host, updates symlink, restarts `orderd` service. +- Verifies health at `http://$host:8080/health`. +- Exits with status 1 on errors, 0 on success. + +#### Core logic +- Parse options; validate `ENVIRONMENT` and `TAG`. +- `check_prereqs`: ensure `rsync`, `ssh`, `curl` exist and SSH key readable. +- `load_hosts`: read host list from environment-specific file. +- For each host: + - `deploy_host`: rsync tarball, SSH into host to extract, symlink, restart service, wait for health. + - Log deployment success. + +#### Functions +- `log`: prints timestamped message to stderr. +- `die`: logs error and exits. +- `usage`: prints usage comment from script header. +- `check_prereqs`: verifies required tools and SSH key. +- `load_hosts`: loads host list into `HOSTS`. +- `deploy_host`: deploys release to a single host. +- `wait_healthy`: polls health endpoint until timeout. +- `cleanup`: removes temporary lock file on exit. + +#### Constants and configuration +- `SCRIPT_DIR` – directory of script. +- `DEPLOY_USER` – `deploy`. +- `SSH_KEY` – `$HOME/.ssh/deploy_ed25519`. +- `RELEASE_ROOT` – `/opt/releases`. +- `SERVICE_NAME` – `orderd`. +- `HEALTH_TIMEOUT` – `30`. +- `HOST_FILES` – associative array mapping environments to host list files. + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl`. +- SSH key file: `$SSH_KEY`. +- Host list files: `hosts.staging`, `hosts.production`. +- Remote tarball path: `build/$TAG.tar.gz`. + +#### Errors and exit codes +- `die` exits with status 1 on missing tools, unreadable key, empty host list, or health timeout. +- `usage` prints help and exits with status 0. +- Missing required options cause exit status 2 after printing usage. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..fde7774f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,66 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:48Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> A POSIX init-style wrapper that manages a queue worker, providing start, stop, status, restart, and health checks based on a PID file and heartbeat file age. + +#### Purpose +- Controls a queue worker process. +- Provides health probe for monitoring systems. + +#### Type +- `sh` (POSIX sh). +- No strict mode flags used. + +#### Input +- `$1`: command (`start`, `stop`, `restart`, `status`, `health`). +- Environment variables: + - `PID_FILE` (default `/run/queue-worker.pid`). + - `HEARTBEAT_FILE` (default `/var/lib/queue-worker/heartbeat`). +- No additional options or files read. + +#### Output +- Writes PID to `PID_FILE` when starting. +- Removes `PID_FILE` when stopping. +- Prints status messages (`running`, `stopped`, `OK`, `WARNING`, `CRITICAL`). +- Exits with codes: `0` success, `1` warning, `2` critical, `3` stopped, `64` usage error. + +#### Core logic +- `is_running`: checks if PID file exists and process is alive. +- `heartbeat_age`: calculates seconds since last heartbeat file modification. +- `start_worker`: starts worker with `nohup`, writes PID. +- `stop_worker`: kills process and removes PID file. +- Command dispatch via `case` on `$1`: + - `start`: invoke `start_worker`. + - `stop`: invoke `stop_worker`. + - `restart`: stop then start. + - `status`: report running/stopped, exit 3 if stopped. + - `health`: verify running and heartbeat age; warn if older than `MAX_HEARTBEAT_AGE` (120s). + +#### Functions +- `is_running`: check if worker process is active. +- `heartbeat_age`: compute heartbeat file age. +- `start_worker`: launch worker and record PID. +- `stop_worker`: terminate worker and clean PID file. + +#### Constants and configuration +- `PID_FILE`=`/run/queue-worker.pid` +- `HEARTBEAT_FILE`=`/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE`=`120` +- `WORKER_BIN`=`/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `kill`, `nohup`, `date`, `stat`, `cat`, `echo`. +- Worker binary: `/usr/local/bin/queue-worker` (expects `--heartbeat` option). + +#### Errors and exit codes +- `exit 2`: health check fails because worker not running. +- `exit 1`: heartbeat older than `MAX_HEARTBEAT_AGE`. +- `exit 3`: status reports stopped. +- `exit 64`: invalid command usage. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..2cc9b63d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,67 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:51Z +- G: +- A: 0.0.0 +- X: file +- P: 96B53C21 +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, creates a control file, and gzips the result. + +#### Purpose +- Performs nightly export of settled payments. +- Runs as a standalone script. + +#### Type +- `ksh93` with `set -e`? none; uses `typeset` and `whence`. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → sets `business_day`. + - `-o ` → sets `export_dir`. +- Environment variables: + - `ORACLE_SID` (default `PAYPRD`). + - `NLS_LANG` set to `AMERICAN_AMERICA.AL32UTF8`. +- No positional arguments. + +#### Output +- CSV file: `${export_dir}/payments_${business_day}.csv`. +- Control file: `${export_dir}/payments_${business_day}.ctl` with `rows=` and `business_day=`. +- Gzipped CSV: `${export_dir}/payments_${business_day}.csv.gz`. +- Logs to stderr. + +#### Core logic +- Parse options; set defaults. +- Ensure `export_dir` exists. +- Attempt export up to `MAX_RETRIES`: + - Run `sqlplus` to spool query result to CSV. + - If successful, write control file, gzip CSV, log success, exit. + - On failure, log, sleep 60, retry. +- On exhausting retries, exit with code 4. + +#### Functions +- `log` – prints timestamped message to stderr. +- `fail` – logs failure and exits with code. +- `require_tools` – checks for `sqlplus` and `gzip`. +- `run_export` – runs SQL query via `sqlplus`, writes to given file. +- `write_control` – counts rows in CSV, writes control file. + +#### Constants and configuration +- ``ORACLE_SID_DEFAULT=PAYPRD`` +- ``EXPORT_DIR_DEFAULT=/data/export/payments`` +- ``MAX_RETRIES=3`` +- ``attempt=0`` +- ``business_day=$(date +%Y%m%d)`` +- ``export_dir=$EXPORT_DIR_DEFAULT`` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle connection: `CONNECT / AS SYSDBA` via `sqlplus`. + +#### Errors and exit codes +- `fail` exits with code 1 by default, or specified. +- Missing tools → exit 3. +- Cannot create export directory → exit 1. +- Exceeding retries → exit 4. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..bab18d1c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,44 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:06:09Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> A collection of shell utilities for deploying releases, managing a queue worker, and nightly payment extraction. + +#### Purpose +- Deploy application releases to multiple hosts. +- Control and monitor a queue worker process. +- Export settled payments from Oracle to CSV. + +#### Responsibilities +- **Deployment**: `deploy_release.sh` handles tarball transfer, extraction, service restart, and health verification across environments. +- **Process Management**: `healthcheck.sh` provides start/stop/status/health commands for a queue worker, tracking PID and heartbeat. +- **Data Export**: `nightly_extract.ksh` pulls settled payments for a business day, writes CSV and control files, and gzips the output. + +#### Key units +- `deploy_release.sh` – orchestrates remote deployment and health checks. +- `healthcheck.sh` – PID/heartbeat‑based worker controller. +- `nightly_extract.ksh` – Oracle SQL export pipeline with retry logic. + +#### Data flow +1. **Deployment**: script → rsync tarball → SSH → remote extraction → symlink update → service restart → health endpoint poll. +2. **Healthcheck**: start → writes PID → worker writes heartbeat → health command reads heartbeat age → reports status. +3. **Export**: script → `sqlplus` query → CSV spool → control file generation → gzip → completion. + +#### Dependencies +- **External tools**: `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `sqlplus`, `gzip`. +- **Files**: host lists (`hosts.staging`, `hosts.production`), release tarballs (`build/$TAG.tar.gz`), worker binary (`/usr/local/bin/queue-worker`). +- **Environment**: SSH key (`$SSH_KEY`), Oracle SID (`$ORACLE_SID`), NLS settings. + +#### Cross-cutting +- Strict error handling (`set -euo pipefail` in deploy script; `set -e` in export). +- Timestamped logging via `log` functions. +- Configuration via environment variables and defaults. +- Retry logic in export script; health timeout in deploy script. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..6711bb3b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,57 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:54Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Configures the Maven build for the Invoice Service module, defining dependencies, compiler settings, and build plugins. + +#### Purpose +- Builds the `invoice-service` JAR. +- Manages database migrations with Flyway. +- Supplies test dependencies and optional PDF support. + +#### Type +- Maven POM + Root element: `project` + Namespaces: + - `xmlns="http://maven.apache.org/POM/4.0.0"` + - `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release` = `17` + - `jackson.version` = `2.19.2` + - `flyway.version` = `11.4.0` + - `invoice.archive.dir` = `${project.build.directory}/archive` +- **Dependencies**: + - `com.fasterxml.jackson.core:jackson-databind:${jackson.version}` + - `org.flywaydb:flyway-core:${flyway.version}` + - `org.postgresql:postgresql` (runtime) + - `org.junit.jupiter:junit-jupiter` (test) + - `org.testcontainers:postgresql` (test) +- **Plugins**: + - `org.flywaydb:flyway-maven-plugin:${flyway.version}` + - `locations` → `filesystem:src/main/resources/db/migration` + - `org.apache.maven.plugins:maven-surefire-plugin` + - `systemPropertyVariables` → `invoice.archive.dir=${invoice.archive.dir}` +- **Profile** `native-pdf` + - Adds dependency `org.apache.pdfbox:pdfbox:3.0.5` + +#### Configuration +- `maven.compiler.release` = `17` +- `invoice.archive.dir` = `${project.build.directory}/archive` +- Flyway location: `filesystem:src/main/resources/db/migration` +- Surefire system property: `invoice.archive.dir=${invoice.archive.dir}` + +#### Dependencies +- External libraries: `jackson-databind`, `flyway-core`, `postgresql`, `junit-jupiter`, `testcontainers-postgresql`, `pdfbox` (profile) +- Maven plugins: `flyway-maven-plugin`, `maven-surefire-plugin` +- Parent project: `billing-parent` (org.example.billing) +- Target Java release: 17 diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..807943c6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,51 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:06:12Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides build, scheduling, and XML schema/transformations for an invoicing and reminder system. + +#### Purpose +- Build the `invoice-service` JAR and manage migrations. +- Wire a reminder scheduler that sends overdue notices. +- Validate shipment notices from warehouses. +- Render monthly account statements as HTML. + +#### Responsibilities +- **Build & Deployment** – Maven POM, compiler settings, Flyway migrations, test dependencies, optional PDF support. +- **Scheduling** – Spring context for a reminder job, data source, repository, mail gateway, cron trigger. +- **Shipment Validation** – XML Schema for shipment notices, carrier codes, parcel weight limits, address defaults. +- **Statement Rendering** – XSLT stylesheet that transforms statement XML into an HTML page with highlighting. + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, dependencies, Flyway plugin, PDF profile. +- `scheduler-context.xml` – Spring beans: data source, repository, mail gateway, reminder job, scheduler, cron task. +- `shipment.xsd` – XML Schema for `shipmentNotice` with `CarrierCode`, `WeightGrams`, `ParcelType`, `AddressType`. +- `statement-to-html.xsl` – XSLT stylesheet with parameters `currencySymbol`, `highlightAbove`; templates for header, bookings, and total. + +#### Data flow +- Maven build → `invoice-service` JAR → Flyway migrations → database. +- Scheduler triggers `OverdueReminderJob.sendDueReminders` → repository fetches overdue records → mail gateway sends emails. +- Warehouse emits `shipmentNotice` XML → validated against `shipment.xsd`. +- Statement XML → XSLT transforms to HTML → rendered in browser. + +#### Dependencies +- **External libraries**: Jackson‑databind, Flyway‑core, PostgreSQL driver, JUnit‑Jupiter, Testcontainers‑PostgreSQL, PDFBox (profile). +- **Maven plugins**: Flyway‑maven‑plugin, Surefire‑plugin. +- **Spring**: task scheduling, context, component scanning. +- **HikariCP**: JDBC data source. +- **XML**: standard XSD namespace, XSLT namespace, statement namespace. + +#### Cross-cutting +- Property placeholders (`reminder.properties`) for database and SMTP settings. +- XML namespaces: `urn:example:shipment:1`, `urn:example:statement`. +- Default values in schema (`country` defaults to `"DE"`). +- XSLT parameters with defaults (`currencySymbol='EUR'`, `highlightAbove=1000`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..cc155b8c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,42 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:56Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Configures a Spring application context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled trigger. + +#### Purpose +- Wire data source, repository, mail gateway, and reminder job. +- Schedule `OverdueReminderJob.sendDueReminders` to run every weekday at 7 AM. + +#### Type +- Spring context XML (`` root). +- Namespaces: `xmlns` (beans), `xmlns:context`, `xmlns:task`. + +#### Definitions +- **Data source**: bean `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`) with properties `jdbcUrl`, `username`, `maximumPoolSize`. +- **Repository**: bean `reminderRepository` (`org.example.reminder.JdbcReminderRepository`) constructor‑arg `reminderDataSource`. +- **Mail gateway**: bean `mailGateway` (`org.example.reminder.SmtpMailGateway`) properties `host`, `port`. +- **Job**: bean `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`) constructor‑args `reminderRepository`, `mailGateway`; property `graceDays`. +- **Scheduler**: bean `reminderScheduler` (`task:scheduler`) with `pool-size="2"`. +- **Scheduled task**: `task:scheduled` referencing `overdueReminderJob.sendDueReminders` with cron `0 0 7 * * MON-FRI`. + +#### Configuration +- `context:property-placeholder` loads `classpath:reminder.properties`. +- `context:component-scan` base‑package `org.example.reminder.web`. +- `reminderDataSource` properties: `jdbcUrl="${reminder.db.url}"`, `username="${reminder.db.user}"`. +- `mailGateway` properties: `host="${reminder.smtp.host}"`, `port="587"`. +- `overdueReminderJob` property: `graceDays="14"`. +- Scheduler pool size: `2`. +- Cron expression: `0 0 7 * * MON-FRI`. + +#### Dependencies +- External properties file: `reminder.properties`. +- JDBC driver implied by `com.zaxxer.hikari.HikariDataSource`. +- SMTP host from properties. +- Spring task scheduling framework. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..16591e74 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,41 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:05:59Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Validates shipment notice documents. +- Enforces structure and value constraints for parcels, addresses, and carrier codes. + +#### Type +- XML Schema (`xs:schema`). +- Root element: `shipmentNotice`. +- Namespace: `urn:example:shipment:1` with prefix `shp`. + +#### Definitions +- **Simple types** + - `CarrierCode`: enumeration of `"DHL"`, `"UPS"`, `"GLS"`, `"POST"`. + - `WeightGrams`: positive integer ≤ 31500. +- **Complex types** + - `ParcelType` + - Elements: `trackingNumber` (`xs:string`), `weight` (`shp:WeightGrams`). + - Attribute: `sequence` (`xs:positiveInteger`, required). + - `AddressType` + - Elements: `name`, `street`, `postalCode`, `city` (`xs:string`). + - Element: `country` (`xs:string`, optional, default `"DE"`). + - `ShipmentNoticeType` + - Elements: `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), `parcel` (`shp:ParcelType`, unbounded). + - Attribute: `noticeId` (`xs:ID`, required). + +#### Configuration +- `country` element defaults to `"DE"` when omitted. + +#### Dependencies +- Relies on standard XML Schema namespace `http://www.w3.org/2001/XMLSchema`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..31e6c528 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,38 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:06:02Z +- G: +- A: 0.0.0 +- X: file +- P: 326D0B29 +--- +> Transforms a monthly account statement XML into an HTML page with header, rows per booking, and a total. + +#### Purpose +- Render a monthly account statement as an HTML page. +- Highlight bookings exceeding a threshold. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespace: `xmlns:xsl="http://www.w3.org/1999/XSL/Transform"`, `xmlns:st="urn:example:statement"`. + +#### Definitions +- **Parameters** + - `currencySymbol` (default `'EUR'`) + - `highlightAbove` (default `1000`) +- **Key** + - `bookingsByDay` matches `st:booking` using `st:valueDate`. +- **Templates** + - `match="/st:statement"`: outputs `` with header, table of bookings, and total. + - `name="statementHeader"`: outputs `

` with account number and `

` with period. + - `match="st:booking"`: outputs a ``; adds `class="large"` if `st:amount` > `$highlightAbove`; contains `` cells for date, purpose, and formatted amount with currency symbol. + - `name="statementTotal"`: outputs `

` with total amount formatted. + +#### Configuration +- `xsl:output` method `html`, encoding `UTF-8`, indent `yes`. +- Parameter values: `currencySymbol='EUR'`, `highlightAbove=1000`. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: `statement`, `accountNumber`, `period`, `booking`, `valueDate`, `purpose`, `amount`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..bd83fedf --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,45 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:06:35Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A toolkit that aggregates web‑server logs, automates deployment and worker lifecycle, and orchestrates invoicing workflows via XML validation and XSLT rendering. + +#### Purpose +- Consolidate and report access‑log metrics. +- Automate release deployment, worker management, and nightly payment extraction. +- Build, schedule, and validate invoicing and reminder processes. + +#### Responsibilities +- **Log Analysis (Perl)** – parse, aggregate, and report host, status, and latency statistics. +- **Deployment & Process Control (Shell)** – deploy releases, manage queue workers, and export payments. +- **Invoicing & Scheduling (XML/Maven)** – build service JAR, run migrations, schedule reminder jobs, validate shipment notices, and render statements. + +#### Key units +- **Perl**: `LogDigest` module (parsing, counting, ranking), `log_digest.pl` CLI driver. +- **Shell**: `deploy_release.sh` (remote deployment & health checks), `healthcheck.sh` (worker PID/heartbeat), `nightly_extract.ksh` (Oracle SQL export). +- **XML/Maven**: `invoice-service-pom.xml` (build & Flyway), `scheduler-context.xml` (Spring scheduler & mail gateway), `shipment.xsd` (shipment notice schema), `statement-to-html.xsl` (HTML rendering). + +#### Data flow +1. **Log Processing**: CLI → `LogDigest->add` per line → `summarize` → formatted output. +2. **Deployment**: script → rsync → SSH → remote extraction → service restart → health poll. +3. **Worker Management**: start → PID file; worker → heartbeat; healthcheck reads heartbeat age. +4. **Payment Export**: `sqlplus` query → CSV → control file → gzip. +5. **Invoicing**: Maven build → JAR → Flyway → database; scheduler triggers reminder job → mail gateway; shipment XML → XSD validation; statement XML → XSLT → HTML. + +#### Dependencies +- **Perl**: `Getopt::Long`, `JSON::PP`, `POSIX`, `List::Util`, `Carp`, `Exporter`, `FindBin`. +- **Shell**: `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `sqlplus`, `gzip`. +- **XML/Maven**: Jackson‑databind, Flyway‑core, PostgreSQL driver, JUnit‑Jupiter, Testcontainers‑PostgreSQL, PDFBox, Spring scheduling, HikariCP, standard XSD/XSLT namespaces. + +#### Cross-cutting +- Robust error handling (`set -euo pipefail`, `croak`, `die`). +- Configuration via environment variables, host alias files, and property placeholders. +- Constants: `MAX_LINES=50000`, `SLOW_REQUEST_MS=1500`, default log level `WARN`. +- Ranking logic (`top_n`) and host normalization (`_normalize_host`). +- XML schemas use default values (`country="DE"`), XSLT parameters (`currencySymbol='EUR'`, `highlightAbove=1000`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..001843d5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04/languages/run3/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 60D2149E +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T08:06:40Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard project centers on a unified toolkit that aggregates web‑server logs, automates deployment, and manages worker lifecycles. It exposes Perl utilities for summarizing access‑log activity, shell scripts for release deployment, queue handling, and nightly payment extraction, while XML modules provide schema validation and XSLT transformations for invoicing and reminder workflows. Together these subsystems orchestrate end‑to‑end log processing, deployment automation, and billing operations. + +#### Packages +- other — A multi‑language toolkit that aggregates web‑server logs, automates deployment and worker management, and supports invoicing workflows through XML validation and XSLT rendering. +- other/perl — Condenses and reports web‑server access‑log activity, highlighting host usage, status‑code distribution, and slow requests. +- other/shell — A collection of shell utilities for deploying releases, managing a queue worker, and nightly payment extraction. +- other/xml — Provides build, scheduling, and XML schema/transformations for an invoicing and reminder system. +- . — A toolkit that aggregates web‑server logs, automates deployment and worker lifecycle, and orchestrates invoicing workflows via XML validation and XSLT rendering. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/README.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/README.md new file mode 100644 index 00000000..b68bed7a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/README.md @@ -0,0 +1,65 @@ + +# Re-measurement after the prompt changes, 2026-11-04 + +The runs behind three changes that followed [`remeasure-2026-11-04/`](../remeasure-2026-11-04/README.md) +the same day: the user message of a file starts with its path below the base directory instead of its +name, `file-body-oop` names the private functions, constants and fields the logic uses and each call +on a dependency, and `file-body-ops` names a CI workflow or pipeline and defines Gradle scripts. +gpt-oss-20b and GPT-6 Luna on OpenRouter, one run after the other. Every run directory holds +`meta/.json` and `out//`. + +**What ran.** srcmorph at `51fcd23` (the core jar built from it; `meta` records the CLI jar, which did +not change), `profiles/v3` at that commit, the tools of `modelcard/` at that commit. Between the two +measurements the fact counters changed as well (`java-facts` skips comments and strings, new facts +files); a facts line reaches the model only in a reduce call, which no file of these corpora needs, +and the scores read names, not counts. + +| Directory | Corpus | Options | +|---|---|---| +| `benchmark/run1..6` | the model-card corpus | `--profile v3` (Java takes `file-body-oop`); runs 4 to 6 gpt-oss-20b only | +| `languages/run1..9` | [`corpus-languages/`](../corpus-languages/) | `--profile v3`; runs 4 to 9 gpt-oss-20b only | +| `enterprise/run1..3` | [`corpus-enterprise/`](../corpus-enterprise/README.md) | `--profile v3 --facts` | + +Scored with `score.py` (the language corpus with `facts-languages.json`, the enterprise corpus with +`facts-enterprise.json`); quality is the model card's, the mean of the kinds' recalls and the format +share (`repeat.quality`). No reader search ran. + +| | Runs | Mean | Before (`remeasure-2026-11-04`) | s/file | USD per run (token cost) | +|---|---|---|---|---|---| +| gpt-oss-20b, card corpus | 100 / 98.8 / 99.2 / 99.1 / 100 / 99.7 % | 99.5 % | 99.9 % (3 runs) | 4.4 to 8.5 | 0.005 | +| GPT-6 Luna, card corpus | 100 / 100 / 100 % | 100 % | 100 % | 7.5 to 8.5 | 0.011 to 0.018 | +| gpt-oss-20b, language corpus | 99.0 / 98.9 / 99.3 / 99.3 / 98.8 / 99.3 / 98.6 / 99.0 / 98.6 % | 99.0 % | 98.7 % (3 runs) | 3.0 to 6.3 | 0.001 | +| GPT-6 Luna, language corpus | 99.3 / 99.3 / 100 % | 99.5 % | 99.8 % | 7.4 to 8.0 | 0.004 to 0.005 | +| gpt-oss-20b, enterprise corpus | 99.9 / 99.8 / 99.4 % | 99.7 % | 97.9 % | 3.8 to 11.1 | 0.002 to 0.003 | +| GPT-6 Luna, enterprise corpus | 100 / 100 / 99.8 % | 99.9 % | 97.3 % | 5.9 to 6.9 | 0.005 to 0.006 | + +The cost column is the file phase's tokens at the list prices (`tokenCostUsd`); the account delta +(`costUsd`, all three phases) came back as 0 for two of the short language runs, booked late. No run +failed a file, wrote a code fence or a `###` heading, or copied the password the enterprise corpus's +`persistence.xml` holds (`secretsLeaked` 0 in every run). + +- **The enterprise corpus** is where the two prompt sentences aimed, and both took: the workflow's + name `release-backoffice` (missing in all three gpt-oss runs before) and the Kotlin service's + `nextNumber` and `PREFIX` and the Java resource's `refund` call (missing in all three Luna runs) + are named in all six runs. What is left: gpt-oss the Kotlin `defaultCurrency` (two runs, as + before), the Spock specification's `heavyOrder` (two) and the MyBatis mapper's `CUSTOMER` table + (one); Luna the JSP's `pageSize` (one). `ejb-jar.xml`'s session types, which one gpt-oss run lost + before, are named in every run. +- **The language corpus** answers what three runs could not: gpt-oss scores 99.0 % over nine runs + (99.1 % over three on 2026-11-02, 98.7 % over three in the morning), and the deploy script's + `systemctl`, missing in two of the morning's three runs, is named in all nine. Its misses are + those of every earlier round: the XSLT's `format-number` (nine of nine), the deploy script's + `lib/common.sh` (five), the Perl module's `LEVEL_RANK` (three) and once `HOSTS`. Luna lost + `format-number` in two of three runs (one of three before). +- **The card corpus** holds Java: Luna 100 % in all three runs, gpt-oss's Java misses are the one + of every earlier round (`setCachePrompt` of `AiGenerationConfig`, two of six). Its other misses are + in files whose prompts did not change but for the path line: the SQL migration's + `book_free_le_total` (three of six; one of three before) and once + `joined_on` and `member_since`, and in two + of six runs `ringbuf.c`'s `malloc` and `memcpy`, where the summary named the headers + (`stdlib.h`, `string.h`) and not the functions it uses from them. Six runs against three cannot + tell that from variation (Fisher's exact test, p = 0.5): the three extra runs named both. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/meta/gpt-6-luna.json new file mode 100644 index 00000000..a0ce0089 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/meta/gpt-6-luna.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T11:46:43Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 197.1, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 86.0, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.9, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T11:51:30Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 86745, + "cachedPromptTokens": 12001, + "completionTokens": 20697, + "seconds": 196.3990859 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.017943, + "costUsd": 0.026031, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/meta/gpt-oss-20b.json new file mode 100644 index 00000000..47c27ba0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T11:51:30Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 204.8, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 65.6, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.8, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T11:56:04Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 88262, + "cachedPromptTokens": 2950, + "completionTokens": 18933, + "seconds": 204.121877 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.005109, + "costUsd": 0.005494, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..be9219f3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,66 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:46:45Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Evaluates file-indexing conditions for extensions, size, line count, modification time, and relative-path globs. + +#### Purpose +- `AiConditionEvaluator` validates condition trees, tests them against file facts, and detects whether a tree requires line counts. + +#### Type +- `public final class AiConditionEvaluator` — class; no supertypes or annotations. + +#### Input +- `AiConditionEvaluator()` — no inputs. +- `matches(AiCondition condition, AiFileContext context)` consumes a condition tree and file name, size, line count, modification time, and relative path from `context`. +- `validate(AiCondition condition)` and `usesLines(AiCondition condition)` consume condition trees. +- Condition fields read: `and`, `or`, `not`, `extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, `pathGlob`; combinator children are read from `AiConditionGroup.getConditions()`. + +#### Output +- `matches(...) -> boolean` reports whether the context satisfies the condition. +- `validate(...) -> void` validates the tree; does not mutate it. +- `usesLines(...) -> boolean` reports whether any reachable condition uses `lines`. + +#### Core logic +- `matches` evaluates the first non-null branch in order: `and`, `or`, `not`, `extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, `pathGlob`. + - `and` requires every child to match; null children list acts as an empty list and matches. + - `or` requires any child to match; null children list does not match. + - `not` negates recursive `matches`. + - Extension leaves use `matchesExtension`, which accepts any non-null extension for which `fileName.endsWith(extension)`. + - Size and line leaves call `AiRangeCondition.contains(...)` with `context.sizeBytes()` and `context.lineCount()`. + - Modification-time leaves compare `context.lastModifiedEpochMilli()` strictly greater than `parseEpochMilli(modifiedAfter)` or strictly less than `parseEpochMilli(modifiedBefore)`. + - Path-glob leaves call `globMatches`, which constructs `new AiSourceExcludeFilter(Collections.singletonList(glob))` and calls `.isExcluded(relativePath)`. + - No recognized branch throws `IllegalStateException` with `ERROR_ONE_BRANCH`. +- `validate` requires `branchCount(condition) == 1`, then validates the selected branch: + - `and` / `or`: `validateGroup` requires a non-null, non-empty child list and recursively validates each child. + - `not`: recursively calls `validate`. + - `extensions`: rejects an empty list. + - `size` / `lines`: requires `hasBound()`. + - `modifiedAfter` / `modifiedBefore`: parses the ISO-8601 instant with `parseEpochMilli`. + - `pathGlob`: rejects a trimmed blank string. +- `branchCount` counts non-null branch and leaf fields: `and`, `or`, `not`, `extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, `pathGlob`. +- `usesLines` returns true for a node with `lines`; otherwise searches `and`, `or`, or `not` recursively. `anyUsesLines` treats a null child list as false. +- `parseEpochMilli` calls `Instant.parse(isoInstant).toEpochMilli()` and wraps `DateTimeParseException` in `IllegalArgumentException`. + +#### Public API +- `AiConditionEvaluator()` — constructs evaluator. +- `matches(AiCondition condition, AiFileContext context) -> boolean` — tests file conditions. +- `validate(AiCondition condition) -> void` — validates condition tree. +- `usesLines(AiCondition condition) -> boolean` — detects line-count conditions. + +#### Dependencies +- `AiCondition`, `AiConditionGroup`, `AiFileContext`, `AiRangeCondition` +- `AiSourceExcludeFilter` +- `Instant`, `DateTimeParseException`, `Collections`, `List`, `Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for nodes with other than one branch, empty combinators or extension lists, unbounded size/line ranges, invalid instants, or blank path globs. +- `parseEpochMilli` wraps `DateTimeParseException` in `IllegalArgumentException`. +- `matches` throws `IllegalStateException` if no branch is set; assumes prior validation. +- `matches` does not guard against null `condition` or `context`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..fef61871 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,44 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:46:54Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Groups child AI conditions for Maven-configured `` and `` combinators. + +#### Purpose +- Holds child `AiCondition` entries in the `conditions` collection used by `AiCondition` combinators. +- Uses a plural field name so Maven binds children as `…`. + +#### Type +- `public class AiConditionGroup` — class; annotated `@ToString`; extends `Object`. + +#### Input +- `setConditions(Collection)` accepts child conditions; parameter may be `null`. +- No-argument constructor accepts no inputs. + +#### Output +- `getConditions()` returns the configured child conditions or `null`. +- `setConditions(...)` stores a defensive `ArrayList` copy, or stores `null`. + +#### Core logic +- `setConditions` copies a non-null collection with `new ArrayList<>(conditions)`; otherwise assigns `null` to `this.conditions`. +- `getConditions` returns the `conditions` field directly. + +#### Public API +- `AiConditionGroup()` -> constructor; creates an empty group. +- `getConditions()` -> `@Nullable List`; returns child conditions. +- `setConditions(@Nullable Collection)` -> `void`; defensively stores child conditions. + +#### Dependencies +- `AiCondition` +- `ArrayList`, `Collection`, `List` +- Lombok `ToString` +- JSpecify `Nullable` + +#### Exceptions / Errors +- `conditions` is nullable; no explicit validation or exception handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..943aae00 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,59 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:46:59Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Produces exact, whole-source regex counts for configured code facts and formats them for inclusion with an AI summary. + +#### Purpose +- Builds a deterministic facts block from configured `AiFactCounter` entries. +- Validates fact labels and regex patterns so invalid configuration fails fast. + +#### Type +- `public final class AiFactExtractor` — class; no supertypes; utility class with a private constructor. + +#### Input +- `factsBlock(List counters, String source)` — accepts nullable counters and the full source text. +- `validate(List counters)` — accepts nullable counters; checks each non-null counter’s label and pattern. + +#### Output +- `factsBlock(...)` returns `""` for null or empty counters, or when all entries are skipped; otherwise returns a header, `label: count` entries, and a trailing blank line. +- Counts non-overlapping regex matches across the full source; appends no persistent state and performs no I/O. + +#### Core logic +- `factsBlock` returns immediately when `counters == null || counters.isEmpty()`. +- Iterates counters, skipping null counters and counters with null `getLabel()` or `getPattern()`. +- Appends each label, `LABEL_COUNT_SEPARATOR`, and `countMatches(counter.getPattern(), source)`; separates entries with `ENTRY_SEPARATOR`. +- Returns `""` if no entries were appended; otherwise prefixes `FACTS_HEADER` and appends `FACTS_SUFFIX`. +- `validate` returns for null counters and skips null entries; throws `IllegalArgumentException` for a null label or pattern. +- `validate` calls `Pattern.compile(counter.getPattern())`; wraps `PatternSyntaxException` in `IllegalArgumentException`, including the label and syntax error message. +- `countMatches` compiles the pattern, creates a matcher over `source`, and increments a count for each `matcher.find()` result, including zero-width matches. + +#### Public API +- `FACTS_HEADER: String` — exact whole-file facts header. +- `LABEL_COUNT_SEPARATOR: String` — separates label and count. +- `ENTRY_SEPARATOR: String` — separates fact entries. +- `FACTS_SUFFIX: String` — separates facts line from following body. +- `factsBlock(List, String) -> String` — formats exact fact counts. +- `validate(List) -> void` — validates configured fact counters. + +#### Dependencies +- `AiFactCounter` +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` when a non-null counter lacks a label or pattern, or has an invalid regex. +- `factsBlock` skips null counters and counters with null labels or patterns. +- `countMatches` assumes `source` is non-null; no null handling is present. + +#### Concurrency +- Pure computation with no I/O, shared mutable state, or synchronization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..2c002f4e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,100 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:47:05Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Carries per-model AI generation settings, including prompt limits, sampling, runtime tuning, provider routing, and stopping rules. + +#### Purpose +- `AiGenerationConfig` supplies mutable defaults and Maven-settable parameters to AI generation providers. +- Holds model/runtime options, remote-provider configuration, token budgets, and optional machine calibration. + +#### Type +- `public class AiGenerationConfig` — class; annotated `@ToString` and `@SuppressWarnings`; no explicit supertypes. +- `@ToString` generates a diagnostic string; `equals` and `hashCode` are not generated. + +#### Input +- No-argument constructor; configuration values are supplied through setters. +- Settings cover model path, context and input limits, sampling, CPU/GPU execution, KV cache, provider routing, reasoning, DRY repetition controls, and stop strings. +- `setCalibration` accepts optional `AiCalibration`; nullable inputs are also accepted for model path, thinking mode, and selected string/list settings. + +#### Output +- Getters expose configuration values; list getters return unmodifiable views. +- Setters mutate instance fields. Nullable list and selected string setters reset to defaults or empty lists. +- Public `DEFAULT_*` constants provide configuration defaults; `DEFAULT_THREADS` is capped at four or the available processor count. + +#### Core logic +- Initializes fields from defaults for context size, output tokens, temperature, threads, prompt trimming, sampling, cache/runtime options, provider routing, and reasoning; initializes `drySequenceBreakers` and `stopStrings` as empty `ArrayList`s. +- `setLazyMode`, `setCacheTypeK`, and `setCacheTypeV` replace `null` with their corresponding empty-string defaults. +- `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, and `setApiKeyEnv` replace `null` with their corresponding defaults. +- `setDrySequenceBreakers` and `setStopStrings` replace `null` with new empty lists; `getDrySequenceBreakers` and `getStopStrings` wrap the current lists with `Collections.unmodifiableList`. +- `getModelPath`, `getChatTemplateEnableThinking`, `getCalibration`, and their setters preserve nullable values; `null` thinking mode means unset. +- Other setters directly assign values without validation. + +#### Public API +- `AiGenerationConfig()` — initialize defaults. +- `getModelPath()` -> `@Nullable String` / `setModelPath(@Nullable String)` -> model file path. +- `getContextSize()` -> `int` / `setContextSize(int)` -> context window. +- `getMaxOutputTokens()` -> `int` / `setMaxOutputTokens(int)` -> output token limit. +- `getTemperature()` -> `float` / `setTemperature(float)` -> sampling temperature. +- `getThreads()` -> `int` / `setThreads(int)` -> inference thread count. +- `getCharsPerToken()` -> `int` / `setCharsPerToken(int)` -> input sizing ratio. +- `getMaxInputChars()` -> `int` / `setMaxInputChars(int)` -> prompt input limit. +- `isWarnOnTrim()` -> `boolean` / `setWarnOnTrim(boolean)` -> trim warning setting. +- `getTopP()` -> `float` / `setTopP(float)` -> nucleus sampling threshold. +- `getTopK()` -> `int` / `setTopK(int)` -> top-k limit. +- `getRepeatPenalty()` -> `float` / `setRepeatPenalty(float)` -> repetition penalty. +- `getMinP()` -> `float` / `setMinP(float)` -> min-p threshold. +- `getTopNSigma()` -> `float` / `setTopNSigma(float)` -> top-n-sigma threshold. +- `getChatTemplateEnableThinking()` -> `@Nullable Boolean` / `setChatTemplateEnableThinking(@Nullable Boolean)` -> thinking mode. +- `isCachePrompt()` -> `boolean` / `setCachePrompt(boolean)` -> prompt cache setting. +- `isSwaFull()` -> `boolean` / `setSwaFull(boolean)` -> full SWA cache setting. +- `getCacheReuse()` -> `int` / `setCacheReuse(int)` -> KV prefix reuse chunk. +- `getGpuLayers()` -> `int` / `setGpuLayers(int)` -> GPU layer offload. +- `getCpuMoeLayers()` -> `int` / `setCpuMoeLayers(int)` -> CPU MoE layers. +- `getSeed()` -> `int` / `setSeed(int)` -> generation RNG seed. +- `getCpuFfnLayers()` -> `int` / `setCpuFfnLayers(int)` -> CPU FFN layers. +- `getKvUnifiedPerSlot()` -> `int` / `setKvUnifiedPerSlot(int)` -> per-slot KV cap. +- `getLazyMode()` -> `String` / `setLazyMode(@Nullable String)` -> tensor-read laziness. +- `getRepeatLastN()` -> `int` / `setRepeatLastN(int)` -> repetition penalty window. +- `getCacheTypeK()` -> `String` / `setCacheTypeK(@Nullable String)` -> K-cache data type. +- `getCacheTypeV()` -> `String` / `setCacheTypeV(@Nullable String)` -> V-cache data type. +- `isFlashAttn()` -> `boolean` / `setFlashAttn(boolean)` -> Flash Attention setting. +- `getBatchSize()` -> `int` / `setBatchSize(int)` -> logical batch size. +- `getUbatchSize()` -> `int` / `setUbatchSize(int)` -> physical batch size. +- `getThreadsBatch()` -> `int` / `setThreadsBatch(int)` -> batch-processing threads. +- `getMainGpu()` -> `int` / `setMainGpu(int)` -> primary GPU index. +- `getDevices()` -> `String` / `setDevices(String)` -> selected backend devices. +- `getProvider()` -> `String` / `setProvider(String)` -> per-model provider. +- `getRemoteModel()` -> `String` / `setRemoteModel(String)` -> remote model ID. +- `getBaseUrl()` -> `String` / `setBaseUrl(String)` -> OpenAI-compatible API base URL. +- `getApiKeyEnv()` -> `String` / `setApiKeyEnv(String)` -> API-key environment variable name. +- `getReasoningEffort()` -> `String` / `setReasoningEffort(String)` -> reasoning-effort level. +- `getReasoningBudgetTokens()` -> `int` / `setReasoningBudgetTokens(int)` -> reasoning token budget. +- `getDryMultiplier()` -> `float` / `setDryMultiplier(float)` -> DRY penalty multiplier. +- `getDryBase()` -> `float` / `setDryBase(float)` -> DRY penalty base. +- `getDryAllowedLength()` -> `int` / `setDryAllowedLength(int)` -> DRY unpenalized n-gram length. +- `getDryPenaltyLastN()` -> `int` / `setDryPenaltyLastN(int)` -> DRY look-back window. +- `getDrySequenceBreakers()` -> `List` / `setDrySequenceBreakers(@Nullable List)` -> DRY sequence breakers. +- `getStopStrings()` -> `List` / `setStopStrings(@Nullable List)` -> generation stop strings. +- `getCalibration()` -> `@Nullable AiCalibration` / `setCalibration(@Nullable AiCalibration)` -> per-machine timing calibration. +- Public constants: `DEFAULT_CONTEXT_SIZE`, `DEFAULT_MAX_OUTPUT_TOKENS`, `DEFAULT_TEMPERATURE`, `DEFAULT_THREADS`, `DEFAULT_MAX_INPUT_CHARS`, `DEFAULT_CHARS_PER_TOKEN`, `DEFAULT_SAFETY_MARGIN_CHARS`, `DEFAULT_WARN_ON_TRIM`, `DEFAULT_TOP_P`, `DEFAULT_TOP_K`, `DEFAULT_MIN_P`, `DEFAULT_TOP_N_SIGMA`, `DEFAULT_REPEAT_PENALTY`, `DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING`, `DEFAULT_CACHE_PROMPT`, `DEFAULT_REASONING_EFFORT`, `DEFAULT_REASONING_BUDGET_TOKENS`, `DEFAULT_SWA_FULL`, `DEFAULT_CACHE_REUSE`, `DEFAULT_GPU_LAYERS`, `DEFAULT_SEED`, `DEFAULT_CPU_MOE_LAYERS`, `DEFAULT_CPU_FFN_LAYERS`, `DEFAULT_KV_UNIFIED_PER_SLOT`, `DEFAULT_LAZY_MODE`, `DEFAULT_REPEAT_LAST_N`, `DEFAULT_CACHE_TYPE_K`, `DEFAULT_CACHE_TYPE_V`, `DEFAULT_FLASH_ATTN`, `DEFAULT_BATCH_SIZE`, `DEFAULT_UBATCH_SIZE`, `DEFAULT_THREADS_BATCH`, `DEFAULT_MAIN_GPU`, `DEFAULT_DEVICES`, `DEFAULT_PROVIDER`, `DEFAULT_REMOTE_MODEL`, `DEFAULT_BASE_URL`, `DEFAULT_API_KEY_ENV`, `DEFAULT_DRY_MULTIPLIER`, `DEFAULT_DRY_BASE`, `DEFAULT_DRY_ALLOWED_LENGTH`, `DEFAULT_DRY_PENALTY_LAST_N`. + +#### Dependencies +- `AiCalibration` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `java.lang.Runtime` + +#### Exceptions / Errors +- No explicit exceptions or validation checks. +- Nullable setters preserve `null` for model path, thinking mode, and calibration; selected other setters normalize `null` to defaults or empty lists. + +#### Concurrency +- Mutable, unsynchronized JavaBean; list getters are unmodifiable views, not defensive snapshots. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..cd3da4f0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,51 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:47:21Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Configures how source files exceeding a routed model’s context window are handled: fail, sample, summarize chunks, or emit deterministic metadata. + +#### Purpose +- Maps `` configuration tokens to oversized-source handling strategies. +- Provides `FAIL` as the default when the configuration is absent or blank. + +#### Type +- `public enum AiOversizeStrategy` — enum; constants `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`. + +#### Input +- `fromConfig(@Nullable String value)` — configured strategy token; accepts `null`, blank, and case-insensitive tokens. + +#### Output +- `configValue()` returns the strategy’s configuration token. +- `fromConfig(...)` returns the matching enum constant or `DEFAULT`; no mutable state or external resource writes. + +#### Core logic +- Each enum constant stores its token in private final field `configValue`; `DEFAULT` is `FAIL`. +- `fromConfig` returns `DEFAULT` for `null` or trimmed-empty input. +- Otherwise, iterates over `values()` and matches `configValue` using `equalsIgnoreCase(trimmed)`. +- If no token matches, throws `IllegalArgumentException` containing the original input and expected tokens. + +#### Public API +- `FAIL` — abort build; requires a larger-context model. +- `SAMPLE` — summarize the trimmed file head in one call. +- `MAP_REDUCE` — summarize line-boundary chunks, then combine summaries. +- `DETERMINISTIC` — produce model-free metadata and head/tail sample. +- `DEFAULT: AiOversizeStrategy` — default strategy (`FAIL`). +- `configValue() -> String` — return configuration token. +- `fromConfig(String) -> AiOversizeStrategy` — parse configuration token. + +#### Dependencies +- `org.jspecify.annotations.Nullable` +- `java.lang.IllegalArgumentException` + +#### Exceptions / Errors +- `fromConfig` throws `IllegalArgumentException` for non-blank values not matching `fail`, `sample`, `mapReduce`, or `deterministic`. +- `null` and blank values resolve to `DEFAULT`. + +#### Concurrency +- Enum constants and their `configValue` values are immutable; no synchronization or concurrent operations. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..b157b1ce --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,102 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:47:26Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Configures source-file AI indexing, generation routing, model inference, and output metadata for a srcmorph run. + +#### Purpose +- Provides a mutable JavaBean configuration shared across Maven, future file-based binding, and direct Java callers. +- Holds source-selection rules, AI prompt/model routing, llama.cpp fallback settings, and generated-index metadata. + +#### Type +- `public class SrcMorphConfiguration` — class; annotated `@ToString`; mutable JavaBean with no declared supertypes. +- Constants define default output directory, generation provider, llama.cpp context size, output tokens, temperature, thread count, and AI version. + +#### Input +- No-argument constructor; initializes defaults. +- Setters accept project and output directories; source subtree, exclude, and extension lists; file-size bounds; force and plan-only flags; provider; prompt, model, field-generation, and fact-definition lists; model paths and llama.cpp settings; plugin and AI versions; project title. +- Nullable configuration includes `subtrees`, `excludes`, `fileExtensions`, prompt/model/routing/fact lists, `modelDirectory`, `llamaModelPath`, and `projectName`. + +#### Output +- Getters expose all configured values; setters mutate the corresponding fields. +- Defaults: `outputDirectory = "src/site/ai"`, `generationProvider = "mock"`, `llamaContextSize = 2048`, `llamaMaxOutputTokens = 128`, `llamaTemperature = 0.15f`, `llamaThreads = AiGenerationConfig.DEFAULT_THREADS`, `pluginVersion = ""`, and `aiVersion = "0.0.0"`. +- Primitive booleans and numeric limits default to Java zero values; nullable references default to `null`. + +#### Core logic +- Constructor `SrcMorphConfiguration()` performs no additional work; field initializers supply configured defaults. +- Stores source-selection controls: `baseDirectory`, `subtrees`, `excludes`, `fileExtensions`, `minFileSizeBytes`, and `maxFileSizeBytes`. +- Stores output and execution controls: `outputDirectory`, `force`, and `planOnly`. +- Stores AI routing definitions: `generationProvider`, `promptDefinitions`, `aiDefinitions`, `fieldGenerations`, and `factDefinitions`. +- Stores model resolution and llama.cpp fallback settings: `modelDirectory`, `llamaModelPath`, `llamaContextSize`, `llamaMaxOutputTokens`, `llamaTemperature`, and `llamaThreads`. +- Stores generated-file metadata: `pluginVersion`, `aiVersion`, and `projectName`. +- Relative model paths resolve against `modelDirectory` when configured; otherwise they remain relative to the JVM working directory. Absolute paths remain unchanged. +- `llamaModelPath` and `llamaContextSize` are fallback settings used only when `fieldGenerations` is empty. + +#### Public API +- `SrcMorphConfiguration()` -> constructor; initializes defaults. +- `getBaseDirectory()` -> `File`; reads project base directory. +- `setBaseDirectory(File)` -> `void`; sets project base directory. +- `getOutputDirectory()` -> `File`; reads AI output directory. +- `setOutputDirectory(File)` -> `void`; sets AI output directory. +- `isForce()` -> `boolean`; reads forced regeneration flag. +- `setForce(boolean)` -> `void`; sets forced regeneration flag. +- `getSubtrees()` -> `@Nullable List`; reads source subtrees. +- `setSubtrees(@Nullable List)` -> `void`; sets source subtrees. +- `getExcludes()` -> `@Nullable List`; reads excluded-file globs. +- `setExcludes(@Nullable List)` -> `void`; sets excluded-file globs. +- `getFileExtensions()` -> `@Nullable List`; reads indexed extensions. +- `setFileExtensions(@Nullable List)` -> `void`; sets indexed extensions. +- `getMinFileSizeBytes()` -> `long`; reads exclusive lower size bound. +- `setMinFileSizeBytes(long)` -> `void`; sets exclusive lower size bound. +- `getMaxFileSizeBytes()` -> `long`; reads inclusive upper size bound. +- `setMaxFileSizeBytes(long)` -> `void`; sets inclusive upper size bound. +- `isPlanOnly()` -> `boolean`; reads planning-only flag. +- `setPlanOnly(boolean)` -> `void`; sets planning-only flag. +- `getGenerationProvider()` -> `String`; reads default AI provider. +- `setGenerationProvider(String)` -> `void`; sets default AI provider. +- `getPromptDefinitions()` -> `@Nullable List`; reads prompt templates. +- `setPromptDefinitions(@Nullable List)` -> `void`; sets prompt templates. +- `getAiDefinitions()` -> `@Nullable List`; reads model definitions. +- `setAiDefinitions(@Nullable List)` -> `void`; sets model definitions. +- `getModelDirectory()` -> `@Nullable File`; reads relative model-path base. +- `setModelDirectory(@Nullable File)` -> `void`; sets relative model-path base. +- `getFieldGenerations()` -> `@Nullable List`; reads field-routing rules. +- `setFieldGenerations(@Nullable List)` -> `void`; sets field-routing rules. +- `getFactDefinitions()` -> `@Nullable List`; reads reusable fact groups. +- `setFactDefinitions(@Nullable List)` -> `void`; sets reusable fact groups. +- `getLlamaModelPath()` -> `@Nullable String`; reads llama.cpp fallback model path. +- `setLlamaModelPath(@Nullable String)` -> `void`; sets llama.cpp fallback model path. +- `getLlamaContextSize()` -> `int`; reads llama.cpp fallback context size. +- `setLlamaContextSize(int)` -> `void`; sets llama.cpp fallback context size. +- `getLlamaMaxOutputTokens()` -> `int`; reads llama.cpp output-token limit. +- `setLlamaMaxOutputTokens(int)` -> `void`; sets llama.cpp output-token limit. +- `getLlamaTemperature()` -> `float`; reads llama.cpp sampling temperature. +- `setLlamaTemperature(float)` -> `void`; sets llama.cpp sampling temperature. +- `getLlamaThreads()` -> `int`; reads llama.cpp CPU thread count. +- `setLlamaThreads(int)` -> `void`; sets llama.cpp CPU thread count. +- `getPluginVersion()` -> `String`; reads generator version metadata. +- `setPluginVersion(String)` -> `void`; sets generator version metadata. +- `getAiVersion()` -> `String`; reads AI logic version metadata. +- `setAiVersion(String)` -> `void`; sets AI logic version metadata. +- `getProjectName()` -> `@Nullable String`; reads aggregate index title. +- `setProjectName(@Nullable String)` -> `void`; sets aggregate index title. + +#### Dependencies +- `java.io.File`, `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `AiGenerationConfig`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- Nullable fields and setters permit `null`; no validation, explicit exception handling, or precondition checks. +- Size-bound documentation specifies that values `<= 0` disable the lower bound or make the upper bound unlimited. + +#### Concurrency +- Mutable, unsynchronized configuration object; no thread-safety guarantees are declared. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/package.ai.md new file mode 100644 index 00000000..7891f847 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/config/package.ai.md @@ -0,0 +1,51 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:50:02Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> Defines source-file selection, AI generation, and indexing configuration, including condition matching, exact source facts, model settings, and oversized-file policies. + +#### Purpose +- Centralizes Maven-bindable settings for which source files are indexed and how AI summaries are generated. +- Provides utilities for evaluating file conditions and adding configured regex-count facts to generated summaries. + +#### Responsibilities +- **File conditions:** `AiConditionEvaluator` validates and evaluates nested extension, size, line-count, modification-time, and path-glob rules; `AiConditionGroup` holds `` / `` child conditions. +- **Fact extraction:** `AiFactExtractor` validates configured labels and regexes, counts matches across source text, and formats a facts block. +- **Generation settings:** `AiGenerationConfig` stores per-model sampling, runtime, provider, token-budget, reasoning, and stopping settings. +- **Source-index configuration:** `SrcMorphConfiguration` stores source-selection rules, prompts, model and field-generation routing, fact definitions, llama.cpp fallback settings, and output metadata. +- **Oversize policy:** `AiOversizeStrategy` parses the configured action for files exceeding a routed model’s context window. + +#### Key units +- `SrcMorphConfiguration` — mutable top-level configuration for source indexing, AI routing, fallback inference, and generated-index metadata. +- `AiGenerationConfig` — per-model generation options with defaults and Maven-settable properties. +- `AiConditionEvaluator` — validates condition trees, matches them against `AiFileContext`, and detects line-count requirements. +- `AiConditionGroup` — stores child `AiCondition` entries for combinators. +- `AiFactExtractor` — validates `AiFactCounter` definitions and formats whole-source regex match counts. +- `AiOversizeStrategy` — represents `FAIL`, `SAMPLE`, `MAP_REDUCE`, and `DETERMINISTIC` handling modes. + +#### Data flow +- `SrcMorphConfiguration` supplies source filters, field/model routing, prompts, facts, and generation settings to the indexing workflow. +- `AiConditionEvaluator` validates an `AiCondition` tree, then compares its selected rules with file facts from `AiFileContext`. +- `AiFactExtractor` validates configured counters and produces a formatted facts block from the source text. +- `AiOversizeStrategy.fromConfig` converts a configured token into a strategy; the enum describes the available oversized-source behaviors. + +#### Dependencies +- Condition matching uses `AiCondition`, `AiConditionGroup`, `AiFileContext`, `AiRangeCondition`, and `AiSourceExcludeFilter`. +- Configuration references `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiFactCounter`, and `AiCalibration`. +- Uses Java collections, regex, and time APIs; uses Lombok `@ToString` and JSpecify `@Nullable`. + +#### Cross-cutting +- Configuration objects are mutable JavaBeans without declared thread-safety; `AiGenerationConfig` exposes unmodifiable views of its stop-string and DRY-breaker lists. +- Defaults are defined for generation, provider routing, output location, llama.cpp fallback settings, and oversize handling (`FAIL`). +- Validation is explicit for condition trees and fact definitions; most configuration setters do not validate values. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..1973bbdd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,51 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:50:19Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Configures source-code indexing and generates AI summaries through local or OpenAI-compatible models. + +#### Purpose +- Define which source files are included, what facts and prompts feed summaries, and how generation and oversized files are handled. +- Route completion requests to mock, llama.cpp JNI, or OpenAI-compatible backends. + +#### Responsibilities +- **Indexing configuration:** Store source-selection rules, prompts, model and field routing, fact definitions, output metadata, and fallback settings. +- **Selection and facts:** Validate and evaluate file-condition trees against file context; count configured regex matches in source text. +- **Generation settings:** Configure per-model sampling, runtime, provider, token budgets, reasoning, and stop conditions; represent oversized-file strategies. +- **Provider construction and inference:** Resolve provider overrides and create the selected backend; generate completions locally or through OpenAI-compatible support. +- **Response and timing support:** Clean completion text, report inference timings where available, and handle provider-specific response details. + +#### Key units +- `SrcMorphConfiguration` — top-level source-indexing, routing, prompt, facts, fallback, and output configuration. +- `AiConditionEvaluator` / `AiConditionGroup` — validate and evaluate nested source-file selection rules. +- `AiFactExtractor` — validate fact-counter definitions and format regex match counts from source text. +- `AiGenerationConfig` / `AiOversizeStrategy` — hold generation options and define oversized-source handling modes. +- `AiGenerationProvider` / `AiGenerationProviderFactory` — define the backend contract and select a provider from model- or run-level settings. +- `LlamaCppJniConfig` / `LlamaCppJniAiGenerationProvider` — configure local inference and generate completions using llama.cpp JNI. +- `OpenAiCompatibleProviderSupport` — build chat-completion requests, enforce transport safety for keyed requests, and derive timings. +- `AiCompletionParser` — trim completion text and remove a leading Gemma-4 thinking block. + +#### Data flow +- `SrcMorphConfiguration` supplies source filters, prompts, routing, facts, and generation settings to the indexing workflow. +- `AiConditionEvaluator` matches configured rules against `AiFileContext`; `AiFactExtractor` turns source text into a formatted facts block. +- `AiGenerationRequest` and generation configuration flow through `AiGenerationProviderFactory` to the selected backend. +- The local backend invokes `LlamaModel.chatComplete` and returns parsed completion text or timing data; OpenAI-compatible support serializes chat requests and derives timings from response usage and elapsed time. + +#### Dependencies +- Internal configuration types include `AiCondition`, `AiRangeCondition`, `AiSourceExcludeFilter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiFactCounter`, and `AiCalibration`. +- Provider support uses `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, `AiGenerationConfig`, and `LlamaCppJniProviderSupport`. +- External integrations include llama.cpp JNI, Jackson JSON, Java regex/time/I/O/URL APIs, Lombok, and JSpecify. + +#### Cross-cutting +- Configuration is primarily mutable JavaBeans; `LlamaCppJniConfig` is immutable, and its builder is not thread-safe. +- Defaults cover generation, provider routing, output location, llama.cpp fallback, and oversized-source handling (`FAIL`). +- Condition trees and fact definitions have explicit validation; most configuration setters do not. +- The llama.cpp provider lazily caches its model without synchronization; generation and `close()` are not coordinated. +- Provider timing defaults are zero-valued, and the base `close()` is a no-op; keyed plain-HTTP requests are limited to recognized loopback hosts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..31a1deb1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,45 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:47:37Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Removes leading Gemma-4 chain-of-thought text from model completions before the answer is stored. + +#### Purpose +- `AiCompletionParser` cleans raw model completion text, preserving answer text while preventing leading internal reasoning from being persisted. + +#### Type +- `public class AiCompletionParser` — class; non-final; no supertypes declared; annotated `@ToString`. + +#### Input +- `AiCompletionParser()` takes no parameters. +- `parseCompletion(String response)` consumes raw completion text; `null` is allowed and treated as empty. + +#### Output +- `parseCompletion` returns a non-null, trimmed answer `String`. +- Produces `IOException` when a leading thinking block has no closing marker. + +#### Core logic +- `parseCompletion` returns `""` for `null`; otherwise trims `response`. +- If the trimmed text does not start with `THINKING_BLOCK_START_MARKER`, returns it unchanged apart from trimming; markers elsewhere remain text. +- For a leading thinking block, removes the start marker, finds the first `THINKING_BLOCK_END_MARKER`, and returns the trimmed text after it. +- If no end marker is found, throws `IOException` advising an increase to `maxOutputTokens`; message includes the original response length. + +#### Public API +- `AiCompletionParser()` — creates parser. +- `parseCompletion(String response) -> String` — strips leading thinking block. +- `THINKING_BLOCK_START_MARKER: String` — opening marker. +- `THINKING_BLOCK_END_MARKER: String` — closing marker. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` if a response starts with `THINKING_BLOCK_START_MARKER` but lacks `THINKING_BLOCK_END_MARKER`. +- Handles `null` input; returned value is never `null`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..b47f4807 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,46 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:47:42Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Generates text from source-aware AI requests and optionally reports model timing for calibration. + +#### Purpose +- Defines the pluggable AI backend contract for generating text from `AiGenerationRequest`. +- Provides default timing and resource-close behavior for providers. + +#### Type +- `public interface AiGenerationProvider` — interface; extends `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume a request containing a prompt key, source file, source text, and current header. + +#### Output +- `generate` returns generated `String` text. +- `generateWithTimings` returns `AiGenerationTimings`; default rates and timing values are zero. +- `close()` has no default side effects. + +#### Core logic +- Default `generateWithTimings(final AiGenerationRequest request)` calls `generate(request)` and wraps the text in `new AiGenerationTimings(..., 0, 0, 0.0d, 0, 0.0d)`. +- Providers may override `generateWithTimings` to supply measured timings. +- Default `close()` does nothing. + +#### Public API +- `generate(AiGenerationRequest)` -> `String` — generate text using default sampling parameters. +- `generateWithTimings(AiGenerationRequest)` -> `AiGenerationTimings` — generate text with timing data. +- `close()` -> `void` — close provider resources. + +#### Dependencies +- `java.io.IOException` +- `java.lang.AutoCloseable` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `AiGenerationTimings` + +#### Exceptions / Errors +- `generate`, `generateWithTimings`, and `close` declare `IOException`. +- Generated text is documented as non-null; it may be blank. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..6d35f5ad --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,56 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:47:47Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Selects a mock, llama.cpp, or OpenAI-compatible AI generation provider for a model run. + +#### Purpose +- Resolves the run’s provider key against the model’s provider override and creates the selected `AiGenerationProvider`. +- Falls back to the deterministic mock provider when no provider key is specified. + +#### Type +- `public class AiGenerationProviderFactory` — class; annotated `@ToString`. + +#### Input +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` consumes the run provider key, model configuration, and prompt lookup support. +- `effectiveProvider(String runProvider, String modelProvider)` consumes nullable provider keys. +- Private `compatibilityHelper` is a `Java8CompatibilityHelper`. + +#### Output +- `effectiveProvider` returns the trimmed model provider when nonblank; otherwise returns the run provider. +- `create` returns a newly constructed `AiGenerationProvider`. +- `@ToString` generates a string representation. + +#### Core logic +- `effectiveProvider` checks whether `modelProvider` is null or blank after `trim()`; if so, returns `runProvider`, otherwise returns `modelProvider.trim()`. +- `create` calls `effectiveProvider(providerName, llamaConfig.provider())`. +- If the effective key is null or `compatibilityHelper.isBlank(effective)`, returns `new MockAiGenerationProvider()`. +- Switches on `effective`: + - `PROVIDER_MOCK` → `new MockAiGenerationProvider()`. + - `PROVIDER_LLAMACPP_JNI` → `new LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)`. + - `PROVIDER_OPENAI_COMPATIBLE` → `new OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)`. + - Otherwise throws `IllegalArgumentException("Unsupported AI provider: " + effective)`. + +#### Public API +- `AiGenerationProviderFactory()` → constructs the factory. +- `PROVIDER_MOCK: String` — mock provider key. +- `PROVIDER_LLAMACPP_JNI: String` — llama.cpp JNI provider key. +- `PROVIDER_OPENAI_COMPATIBLE: String` — OpenAI-compatible provider key. +- `effectiveProvider(String runProvider, String modelProvider) -> String` — resolves provider override. +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport) -> AiGenerationProvider` — creates the selected provider. +- `toString() -> String` — Lombok-generated representation. + +#### Dependencies +- `AiGenerationProvider`, `MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider` +- `LlamaCppJniConfig`, `AiPromptSupport`, `Java8CompatibilityHelper` +- `Nullable`, Lombok `ToString` + +#### Exceptions / Errors +- `create` throws `IllegalArgumentException` for unrecognized nonblank provider keys. +- `effectiveProvider` accepts nullable keys; blank model keys fall back to the run key. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..d591fe82 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,60 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:47:57Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Runs local GGUF language models through llama.cpp to generate completions and report inference throughput and KV-cache reuse. + +#### Purpose +- Provides AI completion generation backed by the `net.ladenthin:llama` JNI binding, with lazy GGUF model loading. +- Configures llama.cpp model and inference parameters, parses chat responses, and exposes generation timings. + +#### Type +- `public final class LlamaCppJniAiGenerationProvider` — class; implements `AiGenerationProvider`, `AutoCloseable`; annotated `@ToString`. +- Declares no nested types. + +#### Input +- Constructor receives `LlamaCppJniConfig config` and `AiPromptSupport promptSupport`; both are required non-null. +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume generation requests. +- `model()` reads model and inference options from `config`; `support` builds chat-template kwargs and inference parameters using the configuration and prompt support. + +#### Output +- `generate(...)` returns parsed completion text; reports truncation and prompt-cache reuse through `support`. +- `generateWithTimings(...)` returns `AiGenerationTimings` with completion text, prompt/cache/predicted token counts, and measured rates; absent timings produce zero values. +- Lazily creates and caches a `LlamaModel`; `close()` closes it if loaded. + +#### Core logic +- `model()` returns cached `model` if present; otherwise: + - Calls `support.buildChatTemplateKwargs()` and creates `ModelParameters` with `config.modelPath()`, `config.contextSize()`, `config.threads()`, `ReasoningFormat.AUTO`, and the template kwargs. + - Applies optional settings when their guards pass: `swaFull`, `cacheReuse`, `gpuLayers`, `cpuMoeLayers`, `cpuFfnLayers`, `kvUnifiedPerSlot`, `lazyMode`, `flashAttn`, `cacheTypeK`, `cacheTypeV`, `batchSize`, `ubatchSize`, `threadsBatch`, `mainGpu`, and `devices`. + - Converts lazy mode and cache types using `LlamaCppJniProviderSupport.lazyMode(...)` and `LlamaCppJniProviderSupport.cacheType(...)`; creates `new LlamaModel(modelParameters)` and stores it in `model`. +- `chatResponse(request)` calls `support.buildInferenceParameters(request)`, `model().chatComplete(...)`, then `chatResponseParser.parseResponse(...)`. +- `generate(request)` obtains the response, calls `support.warnOnTruncatedAnswer(request, response)` and `support.logPromptCacheReuse(request, response)`, then parses `response.getFirstContent()` with `completionParser.parseCompletion(...)`. +- `generateWithTimings(request)` reads response content and timings. If `response.getTimings()` is null, returns zero token counts and rates; otherwise forwards `getPromptN()`, `getCacheN()`, `getPromptPerSecond()`, `getPredictedN()`, and `getPredictedPerSecond()`. +- `close()` closes the current model only when non-null. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport)` — initializes provider dependencies. +- `generate(AiGenerationRequest) -> String` — generate parsed completion. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` — generate completion with model timings. +- `close() -> void` — close loaded model. + +#### Dependencies +- `AiGenerationProvider`, `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, `LlamaCppJniConfig`, `LlamaCppJniProviderSupport` +- `LlamaModel`, `FlashAttn`, `ReasoningFormat`, `ChatResponseParser`, `ModelParameters`, `ChatResponse`, `Timings` +- `AiCompletionParser`, `Java8CompatibilityHelper` +- `IOException`, `Map`, `Objects`, Lombok `ToString`, JSpecify `Nullable` + +#### Exceptions / Errors +- Constructor uses `Objects.requireNonNull` for `config` and `promptSupport`, with corresponding parameter names as messages. +- `generate(...)` declares `IOException`; `generateWithTimings(...)` does not. +- Invalid or unsupported model parameters and native inference failures are not caught here. + +#### Concurrency +- Lazy model initialization and assignment are unsynchronized; concurrent first calls can initialize multiple models. +- `close()` and generation have no synchronization or coordination. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..e4702f3a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,106 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:48:05Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Configures llama.cpp JNI model loading, sampling, hardware, caching, and compatible remote-provider options for AI generation. + +#### Purpose +- `LlamaCppJniConfig` holds immutable, defaulted generation settings for a GGUF model. +- `Builder` provides named fluent setters to customize those settings. + +#### Type +- `LlamaCppJniConfig` — `public final class`; annotated `@ConvertToRecord`, Lombok `@ToString`, and `@EqualsAndHashCode`. +- `Builder` — `public static final class`; nested in `LlamaCppJniConfig`. + +#### Input +- `builder(String modelPath)` requires the GGUF model path. +- Builder setters accept sampling, context, threading, cache, GPU/device, provider, reasoning, DRY, and stop-string options. +- Builder fields default to `AiGenerationConfig.DEFAULT_*`; list options default to empty lists. +- Private `LlamaCppJniConfig(Builder builder)` reads all builder fields. + +#### Output +- Immutable config with 41 values and record-style accessors. +- `drySequenceBreakers()` and `stopStrings()` return unmodifiable views. +- Lombok generates `equals`, `hashCode`, and `toString`. + +#### Core logic +- `builder(String)` creates a builder; its constructor checks `modelPath` with `Objects.requireNonNull(modelPath, "modelPath")`. +- Builder setters store supplied values and return `this`; nullable string options restore their corresponding `AiGenerationConfig.DEFAULT_*` values, while nullable list options become `Collections.emptyList()`. +- `build()` constructs `LlamaCppJniConfig(this)`, copying all 41 builder values without further normalization. +- `chatTemplateEnableThinking` preserves nullable `Boolean`; unset can represent omission of the chat-template kwarg. +- List accessors wrap the stored lists with `Collections.unmodifiableList(...)`. +- `@EqualsAndHashCode` applies value semantics across fields; source documentation notes exact-bit float comparison. + +#### Public API +- `builder(String) -> Builder` — start with model and defaults. +- `modelPath() -> String` — model file path. +- `contextSize() -> int` — context window. +- `maxOutputTokens() -> int` — output token limit. +- `temperature() -> float` — sampling temperature. +- `threads() -> int` — CPU thread count. +- `topP() -> float` — nucleus threshold. +- `topK() -> int` — top-k limit. +- `minP() -> float` — min-p threshold. +- `topNSigma() -> float` — top-n-sigma threshold. +- `repeatPenalty() -> float` — repetition penalty. +- `chatTemplateEnableThinking() -> @Nullable Boolean` — chat-template thinking mode. +- `cachePrompt() -> boolean` — prompt-prefix caching. +- `swaFull() -> boolean` — full-size SWA KV cache. +- `cacheReuse() -> int` — KV prefix-reuse chunk size. +- `gpuLayers() -> int` — GPU offload layers. +- `seed() -> int` — generation RNG seed. +- `cpuMoeLayers() -> int` — CPU MoE layers. +- `cpuFfnLayers() -> int` — CPU FFN layers. +- `kvUnifiedPerSlot() -> int` — per-slot KV context cap. +- `lazyMode() -> String` — tensor-read laziness. +- `repeatLastN() -> int` — repetition-penalty window. +- `cacheTypeK() -> String` — K cache data type. +- `cacheTypeV() -> String` — V cache data type. +- `flashAttn() -> boolean` — Flash Attention setting. +- `batchSize() -> int` — logical batch size. +- `ubatchSize() -> int` — physical batch size. +- `threadsBatch() -> int` — batch-processing threads. +- `mainGpu() -> int` — primary GPU index. +- `devices() -> String` — device selection. +- `provider() -> String` — AI provider. +- `remoteModel() -> String` — remote model ID. +- `baseUrl() -> String` — compatible API base URL. +- `apiKeyEnv() -> String` — API-key environment variable name. +- `reasoningEffort() -> String` — reasoning-effort value. +- `reasoningBudgetTokens() -> int` — reasoning token budget. +- `dryMultiplier() -> float` — DRY sampling multiplier. +- `dryBase() -> float` — DRY base. +- `dryAllowedLength() -> int` — DRY allowed length. +- `dryPenaltyLastN() -> int` — DRY look-back window. +- `drySequenceBreakers() -> List` — DRY sequence breakers. +- `stopStrings() -> List` — generation stop strings. +- `Builder.contextSize(int) -> Builder`, `maxOutputTokens(int) -> Builder`, `temperature(float) -> Builder`, `threads(int) -> Builder`, `topP(float) -> Builder`, `topK(int) -> Builder`, `minP(float) -> Builder`, `topNSigma(float) -> Builder`, `repeatPenalty(float) -> Builder` — set generation sampling and limits. +- `Builder.chatTemplateEnableThinking(@Nullable Boolean) -> Builder` — set nullable thinking mode. +- `Builder.cachePrompt(boolean) -> Builder`, `swaFull(boolean) -> Builder`, `cacheReuse(int) -> Builder` — set prompt and KV caching. +- `Builder.gpuLayers(int) -> Builder`, `seed(int) -> Builder`, `cpuMoeLayers(int) -> Builder`, `cpuFfnLayers(int) -> Builder`, `kvUnifiedPerSlot(int) -> Builder`, `lazyMode(String) -> Builder`, `repeatLastN(int) -> Builder`, `cacheTypeK(String) -> Builder`, `cacheTypeV(String) -> Builder`, `flashAttn(boolean) -> Builder`, `batchSize(int) -> Builder`, `ubatchSize(int) -> Builder`, `threadsBatch(int) -> Builder`, `mainGpu(int) -> Builder`, `devices(String) -> Builder` — set runtime and hardware options. +- `Builder.provider(String) -> Builder`, `remoteModel(String) -> Builder`, `baseUrl(String) -> Builder`, `apiKeyEnv(String) -> Builder`, `reasoningEffort(String) -> Builder`, `reasoningBudgetTokens(int) -> Builder` — set provider and reasoning options. +- `Builder.dryMultiplier(float) -> Builder`, `dryBase(float) -> Builder`, `dryAllowedLength(int) -> Builder`, `dryPenaltyLastN(int) -> Builder`, `drySequenceBreakers(List) -> Builder` — set DRY sampling options. +- `Builder.stopStrings(List) -> Builder` — set stop strings. +- `Builder.build() -> LlamaCppJniConfig` — create immutable config. + +#### Dependencies +- `AiGenerationConfig` +- `ConvertToRecord` +- `Nullable` +- Lombok `EqualsAndHashCode`, `ToString` +- `Collections`, `List`, `Objects` + +#### Exceptions / Errors +- `builder(null)` throws `NullPointerException` via `Objects.requireNonNull`. +- `lazyMode`, `cacheTypeK`, `cacheTypeV`, `devices`, `provider`, `remoteModel`, `baseUrl`, `apiKeyEnv`, and `reasoningEffort` replace `null` with their `AiGenerationConfig.DEFAULT_*`. +- `drySequenceBreakers(null)` and `stopStrings(null)` become empty lists. +- `chatTemplateEnableThinking` accepts `null`. + +#### Concurrency +- `LlamaCppJniConfig` is immutable; builder is documented as not thread-safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..148af75c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,77 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:48:21Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds OpenAI-compatible chat-completion requests, protects API keys from cleartext remote transmission, and converts responses into generation timings. + +#### Purpose +- `OpenAiCompatibleProviderSupport` prepares request JSON and endpoint details for an OpenAI-compatible model provider. +- It validates key transport safety, classifies HTTP responses, formats errors, and computes generation timings. + +#### Type +- `OpenAiCompatibleProviderSupport` — final class; package-private; annotated `@ToString`. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, and `Function environment`. +- `requestBody(AiGenerationRequest request)` reads prompt key, source file, and source text from the request; reads model, sampling, stop-string, and reasoning settings from `config`. +- `endpoint()` reads `config.baseUrl()`. +- `apiKey()` reads `config.apiKeyEnv()` and looks up that environment variable through `environment`. +- `apiKeyFor(String endpoint)` parses the endpoint host when a configured key would be sent over HTTP. +- `errorMessage(String endpoint, int status, String body)` consumes an error response body. +- `timings(String text, ChatResponse response, double seconds)` consumes response usage counts and elapsed wall-clock seconds. + +#### Output +- `requestBody(...)` returns serialized JSON with system and user messages, sampling options, and `stream: false`. +- `endpoint()` returns the normalized chat-completions URL. +- `apiKey()` and `apiKeyFor(...)` return a trimmed key or `null`. +- `isLoopbackHost(...)` and `isSuccess(...)` return booleans; `errorMessage(...)` returns formatted text. +- `timings(...)` returns `AiGenerationTimings` with prompt, cached, and completion token counts, zero prefill rate, and computed decode rate. +- No fields are mutated; `MAPPER` is used for JSON serialization. + +#### Core logic +- `requestBody(...)` creates an `ObjectNode` using `MAPPER`; includes `model` and `reasoning.effort` only when non-blank, always adds system/user messages and `max_tokens`, `temperature`, `top_p`, `repetition_penalty`, and `stream: false`. +- Adds `top_k` only when `config.topK() > 0`, `min_p` only when `config.minP() > 0.0f`, `seed` only when `config.seed() >= 0`, and `stop` only when `config.stopStrings()` is non-empty; serializes with `MAPPER.writeValueAsString(body)`. +- Builds `endpoint()` from trimmed `config.baseUrl()`: accepts only `HTTP_SCHEME` or `HTTPS_SCHEME`, removes trailing slashes, then appends `CHAT_COMPLETIONS_PATH`. +- `apiKey()` returns `null` if `config.apiKeyEnv()` is blank, the lookup is unset, or the value is blank; otherwise returns the trimmed environment value from `environment.apply(...)`. +- `apiKeyFor(...)` returns the key unchanged for HTTPS or when no key is configured. For HTTP with a key, parses the URL using `new URL(endpoint)` and permits it only if `isLoopbackHost(host)`; otherwise throws `IOException`. +- `isLoopbackHost(...)` accepts exactly lowercase `localhost`, an IPv4 literal matching `IPV4_LOOPBACK`, or `[::1]`. +- `isSuccess(...)` recognizes statuses `200` through `299`. +- `errorMessage(...)` uses the whole body up to `ERROR_BODY_EXCERPT` characters; longer bodies are truncated and suffixed with `ELLIPSIS`. +- `timings(...)` reads usage through `response.getUsage()`, casts token counts to `int`, and computes `completionTokens / seconds` when `seconds > 0.0d`, otherwise `0.0d`. + +#### Public API +- `CHAT_COMPLETIONS_PATH: String` — chat-completions endpoint path. +- `ERROR_BODY_EXCERPT: int` — maximum error-body excerpt length. +- `HTTP_SCHEME: String` — plain HTTP scheme prefix. +- `HTTPS_SCHEME: String` — HTTPS scheme prefix. +- `OpenAiCompatibleProviderSupport(LlamaCppJniConfig, AiPromptSupport, Function)` — initialize model support. +- `requestBody(AiGenerationRequest) -> String` — serialize chat request. +- `endpoint() -> String` — resolve chat-completions URL. +- `apiKey() -> @Nullable String` — look up configured key. +- `apiKeyFor(String) -> @Nullable String` — enforce safe key transport. +- `isLoopbackHost(String) -> boolean` — identify loopback host. +- `isSuccess(int) -> boolean` — classify HTTP status. +- `errorMessage(String, int, String) -> String` — format HTTP failure. +- `timings(String, ChatResponse, double) -> AiGenerationTimings` — calculate generation metrics. + +#### Dependencies +- Jackson: `ObjectMapper`, `ArrayNode`, `ObjectNode`. +- Java: `IOException`, `URL`, `List`, `Objects`, `Function`, `Pattern`. +- Lombok: `ToString`. +- `ChatResponse`, `Usage`, `AiGenerationRequest`, `AiPromptSupport`, `Java8CompatibilityHelper`, `LlamaCppJniConfig`, `AiGenerationTimings`. +- JSpecify: `Nullable`. + +#### Exceptions / Errors +- Constructor uses `Objects.requireNonNull` for `config`, `promptSupport`, and `environment`, with corresponding parameter names in failure messages. +- `requestBody(...)` declares `IOException` for JSON serialization failure. +- `endpoint()` throws `IllegalArgumentException` when `baseUrl` does not start with `http://` or `https://`. +- `apiKeyFor(...)` declares `IOException` for an unparsable endpoint or a configured key sent over plain HTTP to a non-loopback host. + +#### Concurrency +- No synchronization, threading, or coroutine behavior; mutable state is not exposed. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/package.ai.md new file mode 100644 index 00000000..a8aca587 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/java/provider/package.ai.md @@ -0,0 +1,50 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:50:10Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Generates source-aware AI completions through selectable mock, local llama.cpp, or OpenAI-compatible backends, with configurable inference and response cleanup. + +#### Purpose +- Provide a pluggable contract and factory for AI text generation, with optional inference timing data. +- Configure local GGUF inference and OpenAI-compatible requests, including model parameters, provider settings, and safe API-key handling. + +#### Responsibilities +- **Provider selection and contract:** `AiGenerationProvider` defines generation, timing, and close behavior; `AiGenerationProviderFactory` resolves model overrides and selects mock, llama.cpp JNI, or OpenAI-compatible providers. +- **Local inference:** `LlamaCppJniAiGenerationProvider` lazily loads a llama.cpp model, builds inference parameters, parses responses, logs truncation and cache reuse, and reports available timings. +- **Remote request support:** `OpenAiCompatibleProviderSupport` builds chat-completion JSON, resolves endpoints and API keys, checks HTTP transport safety, formats errors, and derives timing metrics. +- **Configuration and cleanup:** `LlamaCppJniConfig` captures model, sampling, hardware, caching, provider, reasoning, DRY, and stop-string options; `AiCompletionParser` strips a leading Gemma-4 thinking block from completion text. + +#### Key units +- `AiGenerationProvider` — backend contract for generation, optional timing results, and resource closure. +- `AiGenerationProviderFactory` — provider-key resolution and backend construction. +- `LlamaCppJniConfig` / `LlamaCppJniConfig.Builder` — immutable generation settings and fluent configuration. +- `LlamaCppJniAiGenerationProvider` — local llama.cpp JNI model loading and completion generation. +- `OpenAiCompatibleProviderSupport` — OpenAI-compatible request construction, HTTP/key safety checks, and timing conversion. +- `AiCompletionParser` — trims completion text and removes a leading thinking block, throwing `IOException` if it is unterminated. + +#### Data flow +- `AiGenerationRequest` and `LlamaCppJniConfig` flow through provider selection into a backend. +- The llama.cpp provider builds inference parameters, calls `LlamaModel.chatComplete`, parses the response, and returns cleaned text or `AiGenerationTimings`. +- OpenAI-compatible support combines request and config values into serialized chat JSON; response usage and elapsed time feed timing results. +- Provider selection prefers a nonblank model-level provider override, then the run-level key; absent keys select the mock provider. + +#### Dependencies +- Internal: `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, `AiGenerationConfig`, `LlamaCppJniProviderSupport`, and the mock, llama.cpp JNI, and OpenAI-compatible provider types. +- External: llama.cpp JNI model and response APIs; Jackson JSON nodes and mapper; Java I/O, URL, collections, and functional APIs; Lombok and JSpecify annotations. + +#### Cross-cutting +- `LlamaCppJniConfig` is immutable and defaulted; its builder is documented as not thread-safe. +- The llama.cpp provider caches a lazily created model without synchronization; generation and `close()` are not coordinated. +- `AiGenerationProvider` supplies zero-valued default timings and a no-op `close()` unless providers override them. +- OpenAI-compatible support permits API keys over HTTPS or HTTP to recognized loopback hosts, and rejects keyed plain-HTTP requests to other hosts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..a26bd38d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/kernels/histogram.cl.ai.md @@ -0,0 +1,45 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:49:27Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Computes a 256-bin frequency histogram of byte values from an image or other byte stream. + +#### Purpose +- Counts occurrences of each byte value using per-work-group partial histograms, then reduces them into a final histogram. + +#### Type +- OpenCL C 1.2 kernel source; defines two `__kernel` entry points. + +#### Input +- `histogram_partial`: `input` byte buffer, `length`, and `local_bins` local-memory buffer. +- `histogram_reduce`: `partial` buffer of per-group counts and `group_count`. + +#### Output +- `histogram_partial` writes `BINS` counters per work-group to `partial`. +- `histogram_reduce` writes the final 256-bin counts to `histogram`. + +#### Core logic +- `histogram_partial` initializes local bins cooperatively, then each work-item processes input indices in a global-size stride and atomically increments the matching byte-value bin. +- After a local-memory barrier, work-items copy the local histogram to the group’s segment of `partial`. +- `histogram_reduce` assigns one work-item per bin, sums that bin across all work-groups, and stores the result; work-items with bin indices outside `BINS` return. + +#### Public API +- `histogram_partial(input, length, partial, local_bins) -> void` — count bytes per work-group. +- `histogram_reduce(partial, group_count, histogram) -> void` — combine partial counts by bin. + +#### Constants and configuration +- `BINS = 256`. + +#### Dependencies +- OpenCL built-ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `barrier`. +- OpenCL synchronization and atomics: `CLK_LOCAL_MEM_FENCE`, `atomic_inc`. +- OpenCL types and address spaces: `uchar`, `uint`, `__global`, `__local`. + +#### Exceptions / Errors +- No explicit error handling or error codes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/kernels/package.ai.md new file mode 100644 index 00000000..e01d07c4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/kernels/package.ai.md @@ -0,0 +1,34 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:50:27Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Counts byte-value frequencies across an input stream, producing a 256-bin histogram. + +#### Purpose +- Compute byte frequencies using per-work-group partial histograms and a final reduction. + +#### Responsibilities +- Build partial histograms with local-memory bins and atomic increments. +- Reduce per-group counts into one final count for each byte value. + +#### Key units +- `histogram_partial` — counts input bytes into a 256-bin histogram for each work-group. +- `histogram_reduce` — sums each bin across work-groups into the final `histogram`. +- `BINS` — constant defining the 256 byte-value bins. + +#### Data flow +- `input` bytes and `length` feed `histogram_partial`, which writes per-group counts to `partial`. +- `histogram_reduce` combines `partial` using `group_count` and writes the final histogram. + +#### Dependencies +- OpenCL C 1.2 built-ins for work-item and work-group indexing, barriers, local-memory synchronization, and atomic increments. + +#### Cross-cutting +- Uses local-memory partial counts and `atomic_inc` to coordinate parallel bin updates. +- Provides no explicit error handling or error codes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..53bdef64 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,46 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:50:42Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides low-level byte-processing and transfer utilities alongside command-line tools for backup rotation and regional monthly sales reporting. + +#### Purpose +- Counts byte-value frequencies in parallel and supports bounded FIFO byte-stream transfer. +- Maintains timestamped backup archives and summarizes CSV order revenue by month and region. + +#### Responsibilities +- **Byte processing:** OpenCL kernels build per-work-group byte histograms and reduce them into a final 256-bin count. +- **Byte-stream storage:** C ring buffer manages fixed-capacity storage, lifecycle, occupancy, and partial reads and writes. +- **Operational and reporting scripts:** Bash backup rotation creates compressed archives and prunes older ones; Python sales reporting validates and aggregates currency-filtered orders. + +#### Key units +- `histogram_partial` / `histogram_reduce` — compute and combine byte-frequency counts; `BINS` defines the 256 bins. +- `ringbuf_t` / `ringbuf_status_t` — represent ring-buffer state and initialization outcomes. +- `ringbuf_init`, `ringbuf_free`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space` — manage buffer lifecycle, transfers, and capacity queries. +- `rotate_backups.sh` — creates timestamped compressed archives and enforces retention. +- `Order`, `parse_orders`, `revenue_by_month_and_region`, `main` — represent, parse, aggregate, and report sales records. + +#### Data flow +- Input bytes → per-work-group local histograms → reduction across groups → final byte histogram. +- Buffer initialization → partial writes and reads across wraparound boundaries → updated occupancy. +- Backup source and retention limit → timestamped archive → newest-first pruning. +- CSV files → validated currency-matched orders → monthly regional revenue totals → minimum-revenue filtering → tab-separated output. + +#### Dependencies +- Histogram kernels use OpenCL C 1.2 work-group, synchronization, local-memory, and atomic built-ins. +- Ring buffer uses `ringbuf.h`, C standard allocation and copy functions, and standard size and integer types. +- Backup rotation uses Bash and external commands including `tar`, `date`, `mv`, `du`, `ls`, and `rm`. +- Sales reporting uses Python standard-library CSV, argument parsing, date, and decimal utilities. + +#### Cross-cutting +- Ring-buffer operation assumes a single producer and single consumer; power-of-two capacity leaves one slot unused to distinguish full from empty. +- Backup cleanup traps unfinished `.partial` archives; sales parsing reports contextual errors for missing columns and invalid dates or amounts. +- Histogram kernels use local-memory partial counts and atomic increments; they provide no explicit error codes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/ringbuf/package.ai.md new file mode 100644 index 00000000..04567d26 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/ringbuf/package.ai.md @@ -0,0 +1,41 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:50:31Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides bounded FIFO byte-stream storage for single-producer/single-consumer data transfer. + +#### Purpose +- Initialize, query, write to, read from, and release a fixed-capacity byte ring buffer. +- Preserve FIFO order while allowing partial transfers when the buffer is full or empty. + +#### Responsibilities +- **Buffer lifecycle and validation:** allocate and initialize storage only for nonzero power-of-two capacities; release storage and reset buffer state. +- **Byte transfer and occupancy:** append and remove available bytes across wraparound boundaries, and report used or writable space. + +#### Key units +- `ringbuf_t` — buffer state containing storage, capacity, and volatile `head` and `tail` indices. +- `ringbuf_status_t` — initialization status codes: `RINGBUF_OK`, `RINGBUF_EINVAL`, and `RINGBUF_ENOMEM`. +- `ringbuf_init` / `ringbuf_free` — initialize the ring buffer or release and reset it. +- `ringbuf_write` / `ringbuf_read` — transfer bytes into or out of the buffer, returning the actual byte count. +- `ringbuf_used` / `ringbuf_free_space` — report occupied bytes and available writable space. + +#### Data flow +- `ringbuf_init` validates capacity, allocates storage, and zeros the indices. +- `ringbuf_write` copies up to available space and advances `head`; `ringbuf_read` copies up to available data and advances `tail`. +- Transfers wrap around the backing array as needed; one slot remains unused to distinguish full from empty. + +#### Dependencies +- `ringbuf.c` uses `ringbuf.h` for buffer types and status definitions, plus `` for allocation and `` for copying. +- `ringbuf.h` uses `` and `` for `size_t` and `uint8_t`. + +#### Cross-cutting +- Requires a nonzero power-of-two capacity; usable storage is `capacity - 1` bytes. +- Intended for single-producer/single-consumer use, with volatile producer-owned `head` and consumer-owned `tail` indices. +- Initialization returns `RINGBUF_EINVAL` for invalid capacity and `RINGBUF_ENOMEM` if allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..6963885f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,57 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:49:32Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Stores and retrieves byte streams in a bounded circular buffer while preserving FIFO order. + +#### Purpose +- Implements byte-oriented ring-buffer initialization, cleanup, occupancy queries, writes, and reads. +- Uses one unused slot to distinguish full from empty. + +#### Type +- C implementation file; exports `ringbuf_*` functions declared in `ringbuf.h`. + +#### Input +- `ringbuf_init(rb, capacity)`: buffer state pointer and requested capacity. +- `ringbuf_write(rb, src, len)`: source bytes and requested write length. +- `ringbuf_read(rb, dst, len)`: destination buffer and requested read length. +- Query and cleanup functions take `rb`. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`; other operations return byte counts or `void`. +- Mutates `rb->data`, `capacity`, `head`, and `tail`; allocates and frees the backing buffer. + +#### Core logic +- `ringbuf_init` accepts only nonzero power-of-two capacities, allocates storage, and initializes indices to zero. +- `ringbuf_used` computes occupancy as `(head - tail) & (capacity - 1)`; `ringbuf_free_space` subtracts occupancy and the reserved slot from capacity. +- `ringbuf_write` writes up to available space, copying in up to two chunks across the array boundary, then advances `head` with a capacity mask. +- `ringbuf_read` reads up to available data using the same two-chunk wraparound strategy, then advances `tail` with a capacity mask. +- `ringbuf_free` releases storage and resets all buffer fields. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — allocate and initialize +- `ringbuf_free(ringbuf_t *rb) -> void` — release and reset +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report occupied bytes +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report writable bytes +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — append bytes +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — remove bytes +- Internal helpers: `is_power_of_two`, `min_size` + +#### Constants and configuration +- `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`, `RINGBUF_OK` — status codes returned by `ringbuf_init`; values are not defined in this file. +- Capacity must be a nonzero power of two. + +#### Dependencies +- `"ringbuf.h"` — ring-buffer types and status definitions. +- ``: `malloc`, `free`. +- ``: `memcpy`. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` for zero or non-power-of-two capacity. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..e3cf366d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,59 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:49:39Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Stores and transfers bytes between a single producer and consumer through a fixed-capacity ring buffer. + +#### Purpose +- Declares the `ringbuf_t` byte buffer API for bounded writes, reads, and occupancy queries. +- Supports single-producer/single-consumer use; one slot remains unused to distinguish full from empty. + +#### Type +- C header with C++ linkage guards. +- `ringbuf_t`: struct containing a data pointer, capacity, and volatile producer-owned `head` and consumer-owned `tail` indices. +- `ringbuf_status_t`: status enum. + +#### Input +- Buffer pointer and power-of-two `capacity` for initialization. +- Source/destination byte pointers and requested `len` for transfers. +- `ringbuf_t` pointer for lifecycle and occupancy operations. + +#### Output +- `ringbuf_init` returns a status code. +- `ringbuf_write` and `ringbuf_read` return bytes actually copied, up to the requested length. +- `ringbuf_used` and `ringbuf_free_space` return occupancy measures. +- `ringbuf_free` releases buffer resources. + +#### Core logic +- Requires capacity to be a nonzero power of two; usable storage is `capacity - 1` bytes. +- Exposes producer write and consumer read operations that may copy fewer bytes than requested. +- Exposes queries for used bytes and available space. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — initialize buffer. +- `ringbuf_free(ringbuf_t *rb) -> void` — release buffer. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — copy bytes into buffer. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — copy bytes out. +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — query occupied bytes. +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — query available bytes. +- Internal helpers: none declared. + +#### Constants and configuration +- `RINGBUF_H`: include guard. +- `RINGBUF_OK = 0`: success. +- `RINGBUF_EINVAL = -1`: capacity is zero or not a power of two. +- `RINGBUF_ENOMEM = -2`: allocation failed. + +#### Dependencies +- ``: `size_t`. +- ``: `uint8_t`. +- C++ linkage guards: `__cplusplus`, `extern "C"`. + +#### Exceptions / Errors +- Initialization reports invalid capacity with `RINGBUF_EINVAL` and allocation failure with `RINGBUF_ENOMEM`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/scripts/package.ai.md new file mode 100644 index 00000000..d1288f6f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/scripts/package.ai.md @@ -0,0 +1,39 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:50:37Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides command-line utilities for maintaining timestamped backup archives and summarizing order revenue by month and region. + +#### Purpose +- Create compressed backups with configurable retention, and aggregate CSV orders into currency-specific monthly regional revenue reports. +- Expose both tasks as standalone scripts with command-line inputs and stdout/stderr output. + +#### Responsibilities +- **Backup rotation:** `rotate_backups.sh` validates a source and retention count, creates a timestamped `.tar.gz` archive, and removes older matching archives beyond the configured limit. +- **Sales reporting:** `sales_report.py` parses order CSVs, selects a currency, aggregates revenue by month and region, and filters totals by minimum revenue. + +#### Key units +- `rotate_backups.sh` — Bash utility for archive creation, atomic rename from a `.partial` file, and retention pruning. +- `Order` — immutable sales record with order date, region, and decimal amount. +- `parse_orders(path, currency)` — validates CSV columns and yields matching-currency orders. +- `revenue_by_month_and_region(orders)` — returns sorted monthly regional revenue totals. +- `main(argv=None)` — parses report options, aggregates input files, and prints qualifying totals. + +#### Data flow +- Backup: source directory and retention count → compressed UTC-timestamped archive → newest-first archive listing → deletion of entries beyond `KEEP`. +- Sales: CSV files → validated, currency-filtered `Order` records → monthly and regional totals → minimum-revenue filter → tab-separated report. + +#### Dependencies +- Backup script uses Bash facilities and external commands including `tar`, `date`, `mv`, `du`, `ls`, and `rm`. +- Sales report uses Python standard-library CSV, argument parsing, date, and decimal utilities. + +#### Cross-cutting +- Both are standalone command-line tools with positional or option-based inputs and explicit status/output behavior. +- Backup cleanup uses an EXIT trap for unfinished `.partial` archives; the report raises contextual `ValueError`s for missing columns or invalid date and amount values. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..775541e3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,58 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:49:46Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Creates timestamped compressed backups of a source directory and prunes older archives to retain a configured number. + +#### Purpose +- Back up one directory into dated `.tar.gz` archives and retain the newest requested number. +- Run directly with source and backup directory arguments; not a sourced library. + +#### Type +- Bash (`#!/usr/bin/env bash`); strict mode: `set -euo pipefail`. + +#### Input +- Positional arguments: `$1` sets `SOURCE_DIR`; `$2` sets `BACKUP_DIR`; optional `$3` sets `KEEP`, defaulting to `7`. +- Requires `KEEP` to be a positive integer and `SOURCE_DIR` to exist as a directory. +- Reads the contents of `SOURCE_DIR`; examines matching archives in `BACKUP_DIR`. + +#### Output +- Creates `BACKUP_DIR` if needed; writes a compressed timestamped archive and prints its path and human-readable size. +- Deletes archives beyond the newest `KEEP` and prints each removed path. +- Exits with status `2` for invalid `KEEP` or a missing source directory. With `set -e`, command failures terminate with a nonzero status. +- EXIT trap removes the temporary `.partial` archive. + +#### Core logic +- Validate `KEEP` and confirm `SOURCE_DIR` exists; create `BACKUP_DIR`. +- Derive the source directory’s basename and construct a UTC-timestamped archive path plus a `.partial` temporary path. +- Register cleanup of the temporary file on exit. +- Create a gzip-compressed tar archive of the source directory’s contents in the temporary path, then rename it to the final archive path. +- Print the archive path and size. +- List matching archives newest-first and remove entries after the first `KEEP`. + +#### Constants and configuration +- `SOURCE_DIR="${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR="${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP="${3:-7}"` +- `name="$(basename "$SOURCE_DIR")"` +- `archive="$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp="$archive.partial"` +- `archives` = array populated from the matching archive listing +- `old` = each archive selected for removal + +#### Dependencies +- External commands: `basename`, `date`, `mkdir`, `tar`, `dirname`, `mv`, `echo`, `du`, `cut`, `ls`, `rm`. +- Uses Bash `mapfile` and process substitution. +- Archive naming pattern: `BACKUP_DIR/${name}_*.tar.gz`. + +#### Errors and exit codes +- Exit `2` if `KEEP` is not a positive integer or `SOURCE_DIR` is not a directory. +- Positional parameter expansion reports usage and terminates if `$1` or `$2` is unset. +- `set -e` terminates on failing commands; `set -u` treats unset variables as errors; `pipefail` propagates pipeline failures. +- EXIT trap runs `rm -f "$tmp"` to remove an unfinished archive. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..2a6d8e78 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/other/scripts/sales_report.py.ai.md @@ -0,0 +1,57 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:49:54Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Aggregates order CSV exports into monthly revenue totals by region for a selected currency, with an optional minimum-revenue filter. + +#### Purpose +- Reads one or more order CSV files and reports monthly revenue per region. +- Skips orders in other currencies and filters totals below the configured minimum. + +#### Type +- Python command-line script. +- `Order`: frozen dataclass containing `order_date: date`, `region: str`, and `amount: Decimal`. + +#### Input +- Positional `csv_files`: one or more CSV paths. +- `--currency`: currency to include; defaults to `EUR`. +- `--min-revenue`: minimum total to print; parsed as `Decimal`, defaults to `Decimal("0")`. +- CSV columns: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints qualifying totals to stdout as `YYYY-MMregionamount currency`, with amounts formatted to two decimal places. +- Prints `no orders found` to stderr and returns status `1` if no matching orders are read. +- Returns status `0` after reporting results. + +#### Core logic +- `parse_orders` validates required CSV headers, skips rows whose currency differs from the selected currency, and yields `Order` records. +- Parses order dates with ISO format, trims region whitespace, and parses amounts as `Decimal`. +- `revenue_by_month_and_region` sums amounts by `(YYYY-MM, region)` and returns sorted totals. +- `main` combines orders from all input files, filters grouped totals by minimum revenue, and prints qualifying rows. + +#### Public API +- `Order(order_date, region, amount) -> Order` — immutable order data. +- `parse_orders(path, currency) -> iterator[Order]` — yield matching-currency orders. +- `revenue_by_month_and_region(orders) -> dict` — aggregate sorted monthly regional revenue. +- `main(argv=None) -> int` — parse CLI arguments and run report. +- `__main__` entry point — exits with `main()` status. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")`. +- `--currency`: default `EUR`. +- `--min-revenue`: default `Decimal("0")`. + +#### Dependencies +- Standard library: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. +- Referenced functions: `open`, `csv.DictReader`, `date.fromisoformat`, `Decimal`, `enumerate`, `defaultdict`, `sys.exit`. + +#### Exceptions / Errors +- `parse_orders` raises `ValueError` listing missing required columns. +- Invalid order date or amount raises a path-and-line-number `ValueError`, chained from `ValueError` or `InvalidOperation`. +- File-opening and CSV parsing errors are not handled in this file. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..6ebfa6d2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/package.ai.md @@ -0,0 +1,54 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:51:17Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> Supports source-code indexing and AI-generated summaries alongside byte utilities, backup and sales tools, and database workflows for lending, order fulfillment, and inventory. + +#### Purpose +- Configure source selection, facts, prompts, and model-backed generation for code indexing. +- Provide supporting byte-processing and operational tools, plus SQL data models and workflows for library, shop, and warehouse operations. + +#### Responsibilities +- **AI indexing and generation (`java/`):** Define indexing configuration, validate file-selection conditions, extract regex-based facts, and route completion requests to mock, llama.cpp JNI, or OpenAI-compatible providers. +- **Byte and operational utilities (`other/`):** Compute byte histograms with OpenCL, manage a bounded C ring buffer, rotate compressed backups, and report monthly regional sales from CSV. +- **Database operations (`sql/`):** Model library catalogs and circulation, shop orders and stock, and warehouse supplier-feed synchronization; provide reports, routines, migrations, and seed data. + +#### Key units +- `SrcMorphConfiguration` — holds source filters, prompts, model and field routing, facts, fallback, and output settings. +- `AiConditionEvaluator` / `AiFactExtractor` — evaluate source-file conditions and format regex-match facts. +- `AiGenerationProviderFactory` / `LlamaCppJniAiGenerationProvider` / `OpenAiCompatibleProviderSupport` — select and support AI completion backends. +- `histogram_partial` / `histogram_reduce` — calculate and combine 256-bin byte-frequency counts. +- `ringbuf_t` and `ringbuf_init`, `ringbuf_write`, `ringbuf_read` — manage bounded byte-stream storage and transfers. +- `rotate_backups.sh` — create timestamped compressed archives and prune older backups. +- `parse_orders` / `revenue_by_month_and_region` — parse sales records and aggregate revenue by month and region. +- `fn_checkout_book` / `sp_return_book` / `fn_late_fee` — implement library checkout, return, and late-fee workflows. +- `overdue_loans`, `member_loan_stats`, `popular_books` — provide library circulation reports. +- `add_order_item` — validate and lock a shop product, update order lines and stock, and recalculate order totals. +- `dbo.usp_SyncStock(@Since)` — merge recent supplier-feed quantities into warehouse stock and log synchronization results. + +#### Data flow +- Source filters and facts feed the indexing workflow; generation requests pass through provider selection to local or OpenAI-compatible inference. +- Input bytes flow through OpenCL partial histograms and reduction; ring-buffer clients exchange bytes through bounded partial reads and writes. +- Backup inputs produce timestamped archives followed by retention pruning; CSV orders are validated, aggregated by month and region, filtered by minimum revenue, and reported. +- Library seed and lending operations update circulation records and inventory, with loan events audited; reports derive summaries from loan data. +- Shop order-item updates lock product stock, adjust lines and inventory, then recalculate totals; warehouse synchronization groups recent feed quantities by warehouse and SKU, merges stock, and logs outcomes. + +#### Dependencies +- AI support uses internal configuration and request types, llama.cpp JNI, Jackson, and Java regex, time, I/O, and URL APIs. +- OpenCL kernels use OpenCL C 1.2; the ring buffer uses C standard allocation and copy functions. +- Backup and sales tools use Bash utilities (`tar`, `date`, `mv`, `du`, `ls`, `rm`) and Python standard-library CSV, argument parsing, date, and decimal utilities. +- SQL workflows depend on their library, shop, and warehouse tables; the library migration also uses PostgreSQL `generate_series`, while warehouse synchronization uses SQL Server functions. + +#### Cross-cutting +- AI configuration is mostly mutable JavaBeans; condition trees and fact definitions have explicit validation. The llama.cpp model is lazily cached without synchronization, and generation is not coordinated with `close()`. +- Ring-buffer operation assumes one producer and one consumer and reserves a slot to distinguish full from empty; histogram kernels use local-memory partial counts and atomic increments. +- Sales parsing reports contextual errors; backup cleanup handles unfinished `.partial` archives. +- SQL constraints and indexes enforce relationships and access patterns; shop operations use integer cents and report invalid or insufficient stock, while warehouse synchronization is transactional with rollback, error logging, and rethrow on failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..4fc86899 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: F118A7E4 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:51:28Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project combines Java source-code indexing and AI-generated summaries, with configurable file selection, model settings, and selectable mock, local llama.cpp, or OpenAI-compatible providers. Its other utilities handle byte processing, bounded FIFO streams, backup rotation, and regional sales reporting. SQL packages cover library lending, shop orders and stock reservations, and warehouse inventory synchronization. + +#### Packages +- java/config — Defines source-file selection, AI generation, and indexing configuration, including condition matching, exact source facts, model settings, and oversized-file policies. +- java — Configures source-code indexing and generates AI summaries through local or OpenAI-compatible models. +- java/provider — Generates source-aware AI completions through selectable mock, local llama.cpp, or OpenAI-compatible backends, with configurable inference and response cleanup. +- other/kernels — Counts byte-value frequencies across an input stream, producing a 256-bin histogram. +- other — Provides low-level byte-processing and transfer utilities alongside command-line tools for backup rotation and regional monthly sales reporting. +- other/ringbuf — Provides bounded FIFO byte-stream storage for single-producer/single-consumer data transfer. +- other/scripts — Provides command-line utilities for maintaining timestamped backup archives and summarizing order revenue by month and region. +- . — Supports source-code indexing and AI-generated summaries alongside byte utilities, backup and sales tools, and database workflows for lending, order fulfillment, and inventory. +- sql/library — Supports library cataloging and member borrowing, tracking loan availability, returns, overdue activity, and branch-level book copies. +- sql — Implements database workflows for library lending, retail order fulfillment, and warehouse stock synchronization. +- sql/shop — Maintains a shop catalog and inventory alongside customer orders, and adds order items while reserving stock and updating order totals. +- sql/warehouse — Supplier inventory updates are aggregated by warehouse and SKU, applied to stock levels, and recorded with synchronization results. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..3ca11fa4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/01_schema.sql.ai.md @@ -0,0 +1,32 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:48:33Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Models library authors, books, members, and loans, including availability counts and overdue-loan tracking. + +#### Purpose +- Defines the core lending-library schema for catalog, membership, and loan records. +- Enforces book availability, loan dates, and author/book/member references. + +#### Type +- PostgreSQL tables: `author`, `book`, `member`, `loan`. + +#### Schema +- `author`: `author_id BIGSERIAL` (PK); `full_name VARCHAR(200) NOT NULL`; `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)`; `country_code CHAR(2)`. +- `book`: `book_id BIGSERIAL` (PK); `isbn VARCHAR(17) NOT NULL UNIQUE`; `title VARCHAR(300) NOT NULL`; `author_id BIGINT NOT NULL` (FK); `published_year SMALLINT`; `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)`; `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)`; named constraint `book_free_le_total CHECK (copies_free <= copies_total)`. +- `member`: `member_id BIGSERIAL` (PK); `email VARCHAR(254) NOT NULL UNIQUE`; `full_name VARCHAR(200) NOT NULL`; `joined_on DATE NOT NULL DEFAULT CURRENT_DATE`; `is_blocked BOOLEAN NOT NULL DEFAULT FALSE`. +- `loan`: `loan_id BIGSERIAL` (PK); `book_id BIGINT NOT NULL` (FK); `member_id BIGINT NOT NULL` (FK, `ON DELETE CASCADE`); `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE`; `due_on DATE NOT NULL`; `returned_on DATE`; named constraint `loan_due_after_loan CHECK (due_on > loaned_on)`. +- Index `idx_book_author`: `book(author_id)`, default method. +- Index `idx_loan_member`: `loan(member_id)`, default method. +- Index `idx_loan_open`: `loan(due_on)`, default method, predicate `returned_on IS NULL`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (cascade on member deletion) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..badad826 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/02_views.sql.ai.md @@ -0,0 +1,57 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:48:38Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Provides lending-library reports for overdue loans, member borrowing activity, and frequently borrowed books. + +#### Purpose +- Exposes overdue-loan details and per-member loan statistics. +- Materializes books loaned at least five times in the past 365 days. + +#### Type +- PostgreSQL views: `overdue_loans`, `member_loan_stats`; materialized view: `popular_books`. +- Index: `idx_popular_books_id`. + +#### Schema +- `overdue_loans`: + - `loan_id` — inherited from `loan.loan_id` + - `member_id` — inherited from `member.member_id` + - `email` — inherited from `member.email` + - `title` — inherited from `book.title` + - `due_on` — inherited from `loan.due_on` + - `days_overdue` — integer expression, `CURRENT_DATE - due_on` +- `member_loan_stats`: + - `member_id` — inherited from `member.member_id` + - `full_name` — inherited from `member.full_name` + - `loans_total` — bigint, `COUNT(loan_id)` + - `loans_open` — bigint, filtered count where `returned_on IS NULL` + - `last_loan_on` — type inherited from `loan.loaned_on`, `MAX(loaned_on)` +- `popular_books`: + - `book_id` — inherited from `book.book_id` + - `title` — inherited from `book.title` + - `author_name` — inherited from `author.full_name` + - `times_loaned` — bigint, `COUNT(*)` +- Index: `idx_popular_books_id` — unique B-tree on `popular_books (book_id)`. + +#### Reads +- `overdue_loans`: `loan.loan_id`, `loan.member_id`, `loan.book_id`, `loan.due_on`, `loan.returned_on`; `member.member_id`, `member.email`; `book.book_id`, `book.title`. +- `member_loan_stats`: `member.member_id`, `member.full_name`; `loan.loan_id`, `loan.member_id`, `loan.returned_on`, `loan.loaned_on`. +- `popular_books`: `loan.book_id`, `loan.loaned_on`; `book.book_id`, `book.title`, `book.author_id`; `author.author_id`, `author.full_name`. + +#### Writes +- `popular_books`: materialized result rows from its defining query; rows meet the 365-day loan window and `COUNT(*) >= 5` condition. + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` +- `popular_books.book_id` has a unique index. + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..ee0b7069 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/03_routines.sql.ai.md @@ -0,0 +1,61 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:48:47Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Implements library book checkout and return workflows, calculates overdue lending fees, and records checkout/return events for audit. + +#### Purpose +- Manage book-copy availability and loan lifecycle for library members. +- Calculate capped late fees and audit loan checkouts and returns. + +#### Type +- PostgreSQL; table, functions, procedure, trigger function, trigger. + +#### Schema +- `loan_audit` + - `audit_id BIGSERIAL` — primary key; `NOT NULL`; implicit sequence-backed default. + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL` — CHECK `action IN ('CHECKOUT', 'RETURN')` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + - Primary-key constraint: generated name `loan_audit_pkey`; CHECK constraint is unnamed. + - Index: generated `loan_audit_pkey`, on `loan_audit(audit_id)`, unique B-tree. + +#### Reads +- `fn_checkout_book`: `member(member_id, is_blocked)`; `book(book_id, copies_free)`. +- `sp_return_book`: `loan(loan_id, returned_on, book_id)`. +- `fn_late_fee`: parameters `p_due_on`, `p_returned_on`; `CURRENT_DATE`. +- `trg_loan_audit_fn`: trigger row fields `NEW.loan_id`, `NEW.returned_on`, `OLD.returned_on`; trigger operation `TG_OP`. + +#### Writes +- `fn_checkout_book`: updates `book.copies_free`; inserts one `loan` row with `book_id`, `member_id`, `due_on`; returns `loan.loan_id`. +- `sp_return_book`: updates `loan.returned_on`; updates `book.copies_free`. +- `trg_loan_audit_fn`: inserts one `loan_audit` row per matching trigger event: `CHECKOUT` on insert, or `RETURN` when `returned_on` changes from NULL to non-NULL. + +#### Relationships +- `trg_loan_audit_fn`: `loan.loan_id -> loan_audit.loan_id` (audit association; no foreign key declared). +- `fn_checkout_book`: `member.member_id -> loan.member_id`; `book.book_id -> loan.book_id` (workflow associations; no foreign keys declared). +- `sp_return_book`: `loan.book_id -> book.book_id` (workflow association; no foreign key declared). + +#### Routine logic +- `fn_checkout_book(p_member_id BIGINT, p_book_id BIGINT, p_days INTEGER DEFAULT 21) RETURNS BIGINT` + - Rejects blocked members; decrements one free book copy if available, otherwise raises an exception. + - Inserts a loan due `p_days` after `CURRENT_DATE`; returns its `loan_id`. +- `sp_return_book(p_loan_id BIGINT)` + - Sets `returned_on` to `CURRENT_DATE` for an unreturned loan; raises an exception if unknown or already returned. + - Increments the corresponding book’s `copies_free`. +- `fn_late_fee(p_due_on DATE, p_returned_on DATE) RETURNS INTEGER` + - Immutable SQL function; computes overdue days using `p_returned_on` or `CURRENT_DATE`, floors at zero, charges 50 cents per day, and caps at 2000 cents. +- `trg_loan_audit_fn() RETURNS TRIGGER` + - Inserts a `CHECKOUT` audit event after loan insertion; inserts a `RETURN` event when a loan becomes returned; returns `NEW`. +- `trg_loan_audit` + - Row-level `AFTER INSERT OR UPDATE OF returned_on` trigger on `loan`; executes `trg_loan_audit_fn`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Built-ins: `now()`, `CURRENT_DATE`, `COALESCE`, `GREATEST`, `LEAST`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..c0c859f0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,55 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:48:59Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Adds branch-specific copy inventory to a lending library, associates loans and members with copies and branches, and retires book-level copy counters. + +#### Purpose +- Migrate the library schema to track individual book copies by branch. +- Assign members a home branch and replace book copy counters with copy records. + +#### Type +- PostgreSQL schema migration; creates tables and an index, alters existing tables, and inserts and updates data. + +#### Schema +- `branch` + - `branch_id SMALLSERIAL` — primary key; unnamed constraint. + - `name VARCHAR(100) NOT NULL` — unique; unnamed constraint. + - `city VARCHAR(100) NOT NULL`. +- `book_copy` + - `copy_id BIGSERIAL` — primary key; unnamed constraint. + - `book_id BIGINT NOT NULL` — FK to `book(book_id)`. + - `branch_id SMALLINT NOT NULL` — FK to `branch(branch_id)`. + - `barcode VARCHAR(32) NOT NULL` — unique; unnamed constraint. + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE'` — CHECK `status IN ('AVAILABLE', 'ON_LOAN', 'LOST')`; unnamed constraint. +- `loan`: adds `copy_id BIGINT`, FK to `book_copy(copy_id)`. +- `member`: renames `joined_on` to `member_since`; adds `home_branch_id SMALLINT`, FK to `branch(branch_id)`. +- `book`: drops constraint `book_free_le_total`; drops columns `copies_free` and `copies_total`. +- Index `idx_book_copy_book` on `book_copy(book_id)`; default method and operator class. + +#### Reads +- `book`: `book_id`, `isbn`, `copies_total`, `copies_free` (copy-generation query). + +#### Writes +- `branch`: 1 row inserted (`Main`, `Springfield`). +- `book_copy`: `INSERT ... SELECT`; one row per generated copy for each `book` row, with barcode derived from `isbn` and series number and status derived from `copies_free`. +- `loan`: adds `copy_id` column. +- `member`: renames `joined_on` to `member_since`; adds `home_branch_id`; updates `home_branch_id = 1` where NULL. +- `book`: drops `book_free_le_total`, `copies_free`, and `copies_total`. +- `book_copy`: creates index `idx_book_copy_book`. + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- Tables: `book`, `loan`, `member` +- PostgreSQL function: `generate_series` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..083a8605 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,35 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:49:07Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Seeds a lending-library catalog with authors, books, members, and historical loan records. + +#### Purpose +- Populate library catalog, membership, inventory availability, and borrowing history with deterministic sample data. +- Wrap all inserts in one transaction. + +#### Type +- PostgreSQL DML transaction; no schema objects created. + +#### Writes +- `author`: 15 rows; columns `author_id`, `full_name`, `birth_year`, `country_code` (IDs 1–15). +- `book`: 110 rows; columns `book_id`, `isbn`, `title`, `author_id`, `published_year`, `copies_total`, `copies_free` (IDs 1–110). +- `member`: 50 rows; columns `member_id`, `email`, `full_name`, `joined_on`, `is_blocked` (IDs 1–50). +- `loan`: 150 rows; columns `loan_id`, `book_id`, `member_id`, `loaned_on`, `due_on`, `returned_on` (IDs 1–150); `returned_on` is NULL for open loans. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- `author` +- `book` +- `member` +- `loan` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/package.ai.md new file mode 100644 index 00000000..4ac70e89 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/library/package.ai.md @@ -0,0 +1,56 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:50:49Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> Supports library cataloging and member borrowing, tracking loan availability, returns, overdue activity, and branch-level book copies. + +#### Purpose +- Defines a PostgreSQL lending-library database for authors, books, members, loans, and borrowing reports. +- Provides checkout, return, late-fee, audit, migration, and sample-data operations. + +#### Responsibilities +- **Catalog and lending schema:** `author`, `book`, `member`, and `loan` tables with keys, constraints, and indexes. +- **Borrowing reports:** overdue-loan and member-activity views, plus a materialized ranking of frequently borrowed books. +- **Loan workflows and audit:** checkout and return routines, late-fee calculation, and trigger-based `loan_audit` records. +- **Branch inventory migration:** adds `branch` and `book_copy`, links loans and members to copies and branches, and replaces book-level copy counters. +- **Sample data:** transactionally seeds authors, books, members, and historical loans. + +#### Key units +- `author`, `book`, `member`, `loan` — core catalog, membership, and borrowing records. +- `overdue_loans` — lists open loans past their due dates with member and book details. +- `member_loan_stats` — aggregates total and open loans and most recent loan date per member. +- `popular_books` — materialized list of books loaned at least five times in the preceding 365 days. +- `fn_checkout_book` — validates member and copy availability, creates a loan, and returns its ID. +- `sp_return_book` — marks an open loan returned and restores book availability. +- `fn_late_fee` — computes a capped fee of 50 cents per overdue day. +- `loan_audit` / `trg_loan_audit_fn` / `trg_loan_audit` — record checkout and return events. +- `branch` / `book_copy` — represent library locations and individually identified copies. +- `04_migration_v2.sql` — migrates from book-level inventory counts to branch-specific copy records. + +#### Data flow +- `05_seed_data.sql` populates the core catalog, membership, and loan tables with deterministic records. +- `fn_checkout_book` checks member status and availability, updates inventory, and inserts a loan; the loan trigger records checkout. +- `sp_return_book` updates the loan and inventory; the trigger records a return when `returned_on` changes from NULL. +- Views derive overdue and member statistics from loan and member records; `popular_books` materializes recent borrowing counts. +- The v2 migration creates a default branch and generates `book_copy` records from existing book counts, then assigns members a home branch and adds loan copy references. + +#### Dependencies +- Views and routines depend on the core `loan`, `member`, `book`, and `author` tables. +- Checkout and return workflows update `book` and `loan`; audit trigger writes to `loan_audit`. +- Migration depends on existing `book`, `loan`, and `member` data, and PostgreSQL `generate_series`. +- Seed data targets `author`, `book`, `member`, and `loan`. + +#### Cross-cutting +- Primary keys, foreign keys, uniqueness, checks, and indexes enforce identifiers, relationships, inventory bounds, valid loan dates, and report access. +- The migration drops `book.copies_free` and `book.copies_total`; checkout and return routines are summarized as reading or updating `book.copies_free`, so the summaries describe differing inventory schemas. +- Late-fee logic uses `CURRENT_DATE` when no return date is supplied and caps the result at 2000 cents. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/package.ai.md new file mode 100644 index 00000000..5dd09872 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/package.ai.md @@ -0,0 +1,52 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:51:08Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> Implements database workflows for library lending, retail order fulfillment, and warehouse stock synchronization. + +#### Purpose +- Provides SQL schemas, reports, routines, migrations, and seed data for three operational domains: library circulation, shop orders, and warehouse inventory. +- Keeps inventory and transaction records synchronized through checkout/return, order-item, and supplier-feed workflows. + +#### Responsibilities +- **Library catalog and circulation:** Store authors, books, members, loans, branch locations, and individual copies; provide overdue and member activity reports. +- **Library loan operations and migration:** Check out and return books, calculate late fees, audit loan events, migrate from book-level counts to branch-level copies, and seed sample records. +- **Shop catalog and order fulfillment:** Track products, SKUs, stock, customer orders, and order items; reserve stock and recalculate order totals. +- **Warehouse stock synchronization:** Aggregate recent supplier feeds by warehouse and SKU, merge quantities into stock levels, and log synchronization results. + +#### Key units +- `library.author`, `library.book`, `library.member`, `library.loan` — library catalog, membership, and borrowing records. +- `overdue_loans`, `member_loan_stats`, `popular_books` — library reports for overdue loans, member borrowing activity, and frequently borrowed books. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee` — library checkout, return, and capped overdue-fee workflows. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — record library checkout and return events. +- `branch`, `book_copy`, `04_migration_v2.sql` — represent branch inventory and migrate existing book counts to individual copies. +- `shop.product`, `shop.customer_order`, `shop.order_item` — shop catalog, customer orders, and per-order product quantities. +- `add_order_item` — MySQL procedure that validates and locks a product by SKU, updates order lines and stock, and recalculates the order total. +- `dbo.usp_SyncStock(@Since)` — aggregates supplier feed quantities, merges them into stock levels, and logs the outcome. +- `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog` — warehouse feed input, current stock, and synchronization result records. + +#### Data flow +- Library seed data populates catalog, membership, and loan records; checkout and return routines update lending and inventory records, while a trigger audits loan events. +- Library views derive overdue and member statistics from loans and members; `popular_books` materializes recent borrowing counts. +- `add_order_item` locks an in-stock product by SKU, inserts or increments its order line, decrements stock, and recalculates `customer_order.total_cents`. +- `dbo.usp_SyncStock` filters `dbo.SupplierFeed` by `ReceivedAt >= @Since`, groups quantities by warehouse and SKU, merges totals into `dbo.StockLevel`, and records insert/update counts in `dbo.SyncLog`. + +#### Dependencies +- Library reports and routines use `loan`, `member`, `book`, and `author`; loan auditing writes to `loan_audit`. +- The library inventory migration uses existing `book`, `loan`, and `member` data and PostgreSQL `generate_series`. +- `shop.add_order_item` depends on `product`, `customer_order`, and `order_item`; order-item foreign keys connect orders and products, with order deletion cascading to items. +- `dbo.usp_SyncStock` depends on SQL Server tables `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`, plus `SYSUTCDATETIME()` and `ERROR_MESSAGE()`. + +#### Cross-cutting +- Relational constraints and indexes enforce identifiers, relationships, inventory bounds, and report access. +- Shop monetary amounts use integer cents; product lookup uses `FOR UPDATE`, and invalid or insufficient stock signals SQLSTATE `45000`. +- Warehouse synchronization uses a transaction; failures roll back active work, log zero counts and the error, then rethrow. +- Library summaries describe differing inventory schemas: migration removes `book.copies_free` and `book.copies_total`, while checkout and return routines are also summarized as updating `book.copies_free`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..021e5102 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,65 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:49:10Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Models shop products, customer orders, and order lines, with a procedure that adds order items while reserving inventory and updating order totals. + +#### Purpose +- Stores product catalog and stock, customer orders, and per-product order lines. +- `add_order_item` adds or increments an order line, decrements stock, and recalculates the order total. + +#### Type +- MySQL 8; tables: `product`, `customer_order`, `order_item`; procedure: `add_order_item`. +- Enum type `customer_order.status`: `NEW`, `PAID`, `SHIPPED`, `CANCELLED`. + +#### Schema +- `product` + - `product_id INT UNSIGNED` — NOT NULL, AUTO_INCREMENT, PRIMARY KEY. + - `sku VARCHAR(40)` — NOT NULL, UNIQUE KEY `uk_product_sku`. + - `name VARCHAR(200)` — NOT NULL. + - `price_cents INT UNSIGNED` — NOT NULL. + - `stock INT` — NOT NULL, DEFAULT `0`. + - Index: `PRIMARY` on `product(product_id)`. + - Index: `uk_product_sku` on `product(sku)`; UNIQUE. +- `customer_order` + - `order_id BIGINT UNSIGNED` — NOT NULL, AUTO_INCREMENT, PRIMARY KEY. + - `customer_id BIGINT UNSIGNED` — NOT NULL. + - `status ENUM('NEW', 'PAID', 'SHIPPED', 'CANCELLED')` — NOT NULL, DEFAULT `'NEW'`. + - `created_at DATETIME` — NOT NULL, DEFAULT `CURRENT_TIMESTAMP`. + - `total_cents INT UNSIGNED` — NOT NULL, DEFAULT `0`. + - Index: `PRIMARY` on `customer_order(order_id)`. + - Index: `idx_order_customer` on `customer_order(customer_id, created_at)`. +- `order_item` + - `order_id BIGINT UNSIGNED` — NOT NULL, part of PRIMARY KEY; FK `fk_item_order`, ON DELETE CASCADE. + - `product_id INT UNSIGNED` — NOT NULL, part of PRIMARY KEY; FK `fk_item_product`. + - `quantity SMALLINT UNSIGNED` — NOT NULL. + - `unit_price_cents INT UNSIGNED` — NOT NULL. + - Index: `PRIMARY` on `order_item(order_id, product_id)`. + +#### Reads +- `product`: `product_id`, `price_cents`, `sku`, `stock` (procedure lookup filtered by `sku` and stock, with `FOR UPDATE`). +- `order_item`: `quantity`, `unit_price_cents`, `order_id` (procedure total calculation). + +#### Writes +- `order_item`: procedure INSERT with duplicate-key UPDATE; inserts one line per call, or increments existing `quantity`. +- `product`: UPDATE `stock` by subtracting requested quantity. +- `customer_order`: UPDATE `total_cents` from the order’s summed line amounts. + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (`fk_item_order`, ON DELETE CASCADE). +- `order_item.product_id -> product.product_id` (`fk_item_product`). + +#### Routine logic +- `add_order_item(IN p_order_id BIGINT UNSIGNED, IN p_sku VARCHAR(40), IN p_qty SMALLINT UNSIGNED)`. +- Selects and locks a matching in-stock product; signals SQLSTATE `45000` with `unknown SKU or not enough stock` if none is found. +- Inserts an order line with the current product price, or adds `p_qty` to an existing line’s quantity. +- Decrements product stock and recalculates the order’s `total_cents` as the sum of `quantity * unit_price_cents` for that order. + +#### Dependencies +- Tables: `product`, `order_item`, `customer_order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/shop/package.ai.md new file mode 100644 index 00000000..5eac16b2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/shop/package.ai.md @@ -0,0 +1,40 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:50:58Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Maintains a shop catalog and inventory alongside customer orders, and adds order items while reserving stock and updating order totals. + +#### Purpose +- Defines the product, customer-order, and order-item data model. +- Adds order items by SKU, tracking inventory changes and recalculating the order total. + +#### Responsibilities +- **Catalog and orders:** Store product SKUs, prices, and stock; track customer orders, their statuses, creation times, and totals. +- **Order lines and inventory:** Associate products with orders, recording quantities and unit prices; cascade order deletion to its items. +- **Order-item routine:** Lock and validate a requested product, add or increment its order line, decrement stock, and recalculate the order total. + +#### Key units +- `product` — product catalog and available stock, with unique SKU lookup. +- `customer_order` — customer order status and aggregate total. +- `order_item` — per-order product quantities and unit prices, keyed by order and product. +- `add_order_item` — MySQL procedure that adds an item by SKU and updates stock and order totals. + +#### Data flow +- `add_order_item` finds and locks an in-stock `product` by SKU; if none is available, it signals SQLSTATE `45000` with `unknown SKU or not enough stock`. +- The procedure inserts an `order_item` at the current product price or increments an existing line’s quantity, then subtracts the requested quantity from product stock. +- It sums each order line’s `quantity * unit_price_cents` and writes the result to `customer_order.total_cents`. + +#### Dependencies +- Internal tables: `product`, `customer_order`, and `order_item`. +- Foreign keys link order items to their order and product; deleting an order cascades to its items. + +#### Cross-cutting +- Uses MySQL 8 tables and a stored procedure. +- Product lookup uses `FOR UPDATE` to lock the matching in-stock product. +- Monetary values are stored in integer cents; order status is `NEW`, `PAID`, `SHIPPED`, or `CANCELLED`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/warehouse/package.ai.md new file mode 100644 index 00000000..353387ec --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/warehouse/package.ai.md @@ -0,0 +1,38 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:51:03Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Supplier inventory updates are aggregated by warehouse and SKU, applied to stock levels, and recorded with synchronization results. + +#### Purpose +- Synchronize `dbo.StockLevel` using supplier feed quantities received since a specified time. +- Record inserted and updated row counts, or error details, for each synchronization attempt. + +#### Responsibilities +- Aggregate recent `dbo.SupplierFeed` quantities by `WarehouseId` and `Sku`. +- Insert new stock keys or add feed totals to existing `OnHand` values, updating timestamps. +- Log synchronization outcomes in `dbo.SyncLog`. + +#### Key units +- `dbo.usp_SyncStock(@Since)`: aggregates eligible feed rows, merges totals into stock, and logs success or failure. +- `dbo.SupplierFeed`: source rows keyed by warehouse, SKU, quantity, and received time. +- `dbo.StockLevel`: current quantities keyed by `WarehouseId` and `Sku`. +- `dbo.SyncLog`: per-call start time, insert/update counts, and optional error message. + +#### Data flow +- Filter `dbo.SupplierFeed` by `ReceivedAt >= @Since`; group by warehouse and SKU and sum quantities. +- `MERGE` totals into `dbo.StockLevel`: insert unmatched keys or increment matching `OnHand` values and refresh `UpdatedAt`. +- Capture `MERGE` actions in `@Changes`, count inserts and updates, and write the result to `dbo.SyncLog`. + +#### Dependencies +- SQL Server tables `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. +- `SYSUTCDATETIME()` for start and update timestamps; `ERROR_MESSAGE()` for failure logging. + +#### Cross-cutting +- `dbo.usp_SyncStock` wraps the merge in a transaction; on failure it rolls back any active transaction, logs zero counts and the error, then rethrows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..993ef09b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,66 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:49:18Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Aggregates recent supplier inventory quantities by warehouse and SKU, updates stock levels, and records synchronization outcomes. + +#### Purpose +- Synchronizes `dbo.StockLevel` from supplier feed rows received since a specified time. +- Logs inserted and updated stock counts, or an error if synchronization fails. + +#### Type +- SQL Server (T-SQL): tables `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`; procedure `dbo.usp_SyncStock`. + +#### Schema +- `dbo.StockLevel` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT (0)`; default constraint `DF_StockLevel_OnHand` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())`; default constraint `DF_StockLevel_UpdatedAt` + - Primary key `PK_StockLevel` (`WarehouseId`, `Sku`) +- `dbo.SupplierFeed` + - `FeedRowId BIGINT IDENTITY(1, 1) NOT NULL`; primary key `PK_SupplierFeed` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` +- `dbo.SyncLog` + - `SyncLogId INT IDENTITY(1, 1) NOT NULL`; primary key `PK_SyncLog` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + +#### Reads +- `dbo.SupplierFeed`: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`; filters by `ReceivedAt >= @Since`, groups by `WarehouseId`, `Sku`, and sums `Quantity`. +- `dbo.StockLevel`: `WarehouseId`, `Sku`, `OnHand`; matches source keys and adds aggregated quantity to existing `OnHand`. +- `@Changes` table variable: `MergeAction`, read to count `INSERT` and `UPDATE` actions. + +#### Writes +- `dbo.StockLevel`: `MERGE` inserts unmatched warehouse/SKU pairs or updates matched rows’ `OnHand` and `UpdatedAt`. +- `dbo.SyncLog`: one success row per procedure call with `StartedAt`, inserted count, and updated count; on failure, one error row with zero counts and `ERROR_MESSAGE()`. +- `@Changes`: receives each `MERGE` action via `OUTPUT $action`. + +#### Relationships +- `dbo.StockLevel.WarehouseId -> dbo.SupplierFeed.WarehouseId` (MERGE match) +- `dbo.StockLevel.Sku -> dbo.SupplierFeed.Sku` (MERGE match) + +#### Routine logic +- `dbo.usp_SyncStock(@Since DATETIME2(0))` + - Captures UTC start time; begins a transaction. + - Aggregates feed quantities received since `@Since`, then merges totals into stock levels. + - Logs merge insert/update counts and commits. + - On error, rolls back any active transaction, logs the error, and rethrows. + +#### Dependencies +- `dbo.SupplierFeed` +- `dbo.StockLevel` +- `dbo.SyncLog` +- `SYSUTCDATETIME()` +- `ERROR_MESSAGE()` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..56a91e29 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,89 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:51:31Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Evaluates and validates file‑selection conditions for the source‑morph indexer. + +#### Purpose +- Traverses `AiCondition` trees to determine file matches. +- Validates condition syntax and bounds. +- Detects if line counting is required. + +#### Type +- `final class AiConditionEvaluator` (class) + - Extends `Object`. + - No annotations. + +#### Input +- `matches(AiCondition, AiFileContext)` – condition tree, file facts. +- `validate(AiCondition)` – condition tree. +- `usesLines(AiCondition)` – condition tree. +- Dependencies: `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, `AiSourceExcludeFilter`, `Instant`, `DateTimeParseException`, `Collections`, `List`. + +#### Output +- `matches` → `boolean` (file matches). +- `validate` → void (throws `IllegalArgumentException` on error). +- `usesLines` → `boolean` (needs line count). +- `parseEpochMilli` → `long` (epoch ms). +- `matchesExtension` → `boolean`. +- `globMatches` → `boolean`. + +#### Core logic +- `matches`: + - If `and` group → all children must match. + - If `or` group → any child must match. + - If `not` group → negated child match. + - `extensions` → file name ends with any listed extension. + - `size` → `AiRangeCondition.contains(sizeBytes)`. + - `lines` → `AiRangeCondition.contains(lineCount)`. + - `modifiedAfter` → file lastModified > parsed epoch. + - `modifiedBefore` → file lastModified < parsed epoch. + - `pathGlob` → `AiSourceExcludeFilter.isExcluded(relativePath)` (true if excluded). + - Else throw `IllegalStateException(ERROR_ONE_BRANCH + condition)`. + +- `validate`: + - Ensure exactly one branch/leaf (`branchCount == 1`). + - For groups: `validateGroup`. + - For `extensions`: non‑empty list. + - For `size`/`lines`: at least one bound. + - For `modifiedAfter`/`modifiedBefore`: parse ISO‑8601. + - For `pathGlob`: non‑blank. + +- `usesLines`: recursively checks for `lines` in node or any child group. + +- `validateGroup`: ensures group has ≥1 child, validates each child. + +- `branchCount`: counts non‑null branch/leaf fields. + +- `matchesExtension`: iterates extensions, checks `fileName.endsWith(extension)`. + +- `globMatches`: creates `AiSourceExcludeFilter` with single glob, calls `isExcluded`. + +- `parseEpochMilli`: `Instant.parse(isoInstant).toEpochMilli()`, wraps `DateTimeParseException` in `IllegalArgumentException`. + +#### Public API +- `matches(AiCondition, AiFileContext) -> boolean` – checks file against condition. +- `validate(AiCondition) -> void` – validates condition tree. +- `usesLines(AiCondition) -> boolean` – detects line‑count requirement. + +#### Dependencies +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter` +- `java.time.Instant` +- `java.time.format.DateTimeParseException` +- `java.util.Collections` +- `java.util.List` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalStateException` if condition node has no branch/leaf. +- `IllegalArgumentException` for invalid configuration (missing bounds, empty lists, blank glob, bad ISO instant). +- `DateTimeParseException` wrapped in `IllegalArgumentException` by `parseEpochMilli`. + +#### Concurrency +- Stateless; no shared mutable state. Thread‑safe by design. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..fe2bd96b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,54 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:51:36Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Holds a list of child AI conditions for logical combinators in the configuration. + +#### Purpose +- Stores child `AiCondition` objects for `` / `` combinators. +- Provides defensive copying when setting the list. + +#### Type +- `public class AiConditionGroup` + - Modifiers: public, final (implicit), no superclass. + - Field: `private @Nullable List conditions`. + - Constructor: `public AiConditionGroup()`. + - Methods: + - `public @Nullable List getConditions()`. + - `public void setConditions(final @Nullable Collection conditions)`. + +#### Input +- Constructor: none. +- `setConditions`: a `Collection` (nullable). + +#### Output +- `getConditions`: returns the internal `List` or `null`. +- `setConditions`: assigns a defensive copy of the input collection to `conditions`. + +#### Core logic +- `setConditions`: + - If input `conditions` is non‑null, create `new ArrayList<>(conditions)` and assign to field. + - Else assign `null` to field. + +#### Public API +- `getConditions() -> List` – retrieve child conditions. +- `setConditions(Collection) -> void` – set child conditions defensively. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List`. +- `lombok.ToString`. +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.config.AiCondition`. + +#### Exceptions / Errors +- No explicit exceptions thrown. +- Defensive copying prevents external mutation of internal list. + +#### Concurrency +- No synchronization; class is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..209a9ddd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,79 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:51:39Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Computes deterministic, language‑agnostic fact counts from source text using regex counters. + +#### Purpose +- Provides exact, whole‑file counts of language constructs for AI summaries. +- Validates fact counter configurations. + +#### Type +- `final class AiFactExtractor` (class, final) + - Supertypes: `Object` + - Annotations: none + - Fields: + - `public static final String FACTS_HEADER` (String) + - `public static final String LABEL_COUNT_SEPARATOR` (String) + - `public static final String ENTRY_SEPARATOR` (String) + - `public static final String FACTS_SUFFIX` (String) + - Methods: + - `private AiFactExtractor()` (constructor, private) + - `public static String factsBlock(List, String)` + - `public static void validate(List)` + - `private static int countMatches(String, String)` + +#### Input +- `factsBlock`: `counters` (nullable `List`), `source` (`String`) +- `validate`: `counters` (nullable `List`) +- `countMatches`: `pattern` (`String`), `source` (`String`) + +#### Output +- `factsBlock`: `String` facts block or empty string +- `validate`: void, throws `IllegalArgumentException` on invalid config +- `countMatches`: `int` number of non‑overlapping regex matches + +#### Core logic +- `factsBlock` + - Return empty if `counters` null/empty. + - Iterate counters; skip if counter, label, or pattern null. + - Append `ENTRY_SEPARATOR` between entries. + - Append `label + LABEL_COUNT_SEPARATOR + countMatches(pattern, source)`. + - If no entries, return empty. + - Return `FACTS_HEADER + sb + FACTS_SUFFIX`. +- `validate` + - Return if `counters` null. + - For each counter: + - Throw if counter null? (continues). + - Throw if label null. + - Throw if pattern null. + - Compile pattern; catch `PatternSyntaxException` and rethrow as `IllegalArgumentException` with label context. +- `countMatches` + - Compile pattern, create matcher on source. + - Loop `matcher.find()` incrementing `count`. + - Return `count`. + +#### Public API +- `factsBlock(List, String) -> String` – build facts block +- `validate(List) -> void` – validate counters + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiFactCounter` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for missing label/pattern or invalid regex. +- `countMatches` may throw `PatternSyntaxException` internally, caught in `validate`. + +#### Concurrency +- All methods are static, stateless, thread‑safe. No shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..2526ac09 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,142 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:51:49Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> A mutable configuration holder for a single AI generation step, exposing all model, sampling, retry, and runtime options for Maven‑plugin driven AI providers. + +#### Purpose +- Stores AI generation parameters (model path, context size, sampling, GPU/CPU settings, prompt‑caching, API details). +- Provides getters/setters for Maven configuration binding. +- Supplies defaults for every option. + +#### Type +- `public class AiGenerationConfig` (class, public, mutable, Lombok `@ToString`). + +#### Input +- Constructor: no arguments (defaults applied). +- Setter methods for each field (e.g. `setModelPath`, `setContextSize`, `setTemperature`, …). +- Optional `AiCalibration` calibration object. +- Lists: `drySequenceBreakers`, `stopStrings` (modifiable via setters). + +#### Output +- Getter methods return current values (e.g. `getModelPath`, `getContextSize`, `getTemperature`, …). +- `getDrySequenceBreakers` and `getStopStrings` return unmodifiable lists. +- `getCalibration` returns optional calibration. + +#### Core logic +- All fields initialized to static defaults (`DEFAULT_*` constants). +- Setters assign values directly; some normalize `null` to defaults (e.g. `setLazyMode`, `setCacheTypeK`, `setCacheTypeV`, `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, `setApiKeyEnv`). +- List setters replace internal list with new list or empty list if `null`. +- No additional computation; configuration is a plain data holder. + +#### Public API +- `AiGenerationConfig()` -> constructor +- `String getModelPath() -> model path` +- `void setModelPath(String)` -> set model path +- `int getContextSize() -> context size` +- `void setContextSize(int)` -> set context size +- `int getMaxOutputTokens() -> max output tokens` +- `void setMaxOutputTokens(int)` -> set max output tokens +- `float getTemperature() -> sampling temperature` +- `void setTemperature(float)` -> set temperature +- `int getThreads() -> CPU threads` +- `void setThreads(int)` -> set CPU threads +- `int getCharsPerToken() -> chars per token` +- `void setCharsPerToken(int)` -> set chars per token +- `int getMaxInputChars() -> max input chars` +- `void setMaxInputChars(int)` -> set max input chars +- `boolean isWarnOnTrim() -> trim warning flag` +- `void setWarnOnTrim(boolean)` -> set trim warning flag +- `float getTopP() -> nucleus threshold` +- `void setTopP(float)` -> set nucleus threshold +- `int getTopK() -> top‑k limit` +- `void setTopK(int)` -> set top‑k limit +- `float getMinP() -> min‑p threshold` +- `void setMinP(float)` -> set min‑p threshold +- `float getTopNSigma() -> top‑n‑sigma threshold` +- `void setTopNSigma(float)` -> set top‑n‑sigma threshold +- `float getRepeatPenalty() -> repetition penalty` +- `void setRepeatPenalty(float)` -> set repetition penalty +- `Boolean getChatTemplateEnableThinking() -> chat‑template thinking flag` +- `void setChatTemplateEnableThinking(Boolean)` -> set chat‑template thinking flag +- `boolean isCachePrompt() -> prompt‑caching flag` +- `void setCachePrompt(boolean)` -> set prompt‑caching flag +- `boolean isSwaFull() -> SWA full flag` +- `void setSwaFull(boolean)` -> set SWA full flag +- `int getCacheReuse() -> cache‑reuse chunk size` +- `void setCacheReuse(int)` -> set cache‑reuse chunk size +- `int getGpuLayers() -> GPU layers` +- `void setGpuLayers(int)` -> set GPU layers +- `int getSeed() -> RNG seed` +- `void setSeed(int)` -> set RNG seed +- `int getCpuMoeLayers() -> CPU MoE layers` +- `void setCpuMoeLayers(int)` -> set CPU MoE layers +- `int getCpuFfnLayers() -> CPU FFN layers` +- `void setCpuFfnLayers(int)` -> set CPU FFN layers +- `int getKvUnifiedPerSlot() -> KV unified per‑slot cap` +- `void setKvUnifiedPerSlot(int)` -> set KV unified per‑slot cap +- `String getLazyMode() -> tensor‑read laziness` +- `void setLazyMode(String)` -> set tensor‑read laziness +- `int getRepeatLastN() -> repeat‑penalty window` +- `void setRepeatLastN(int)` -> set repeat‑penalty window +- `String getCacheTypeK() -> KV cache type K` +- `void setCacheTypeK(String)` -> set KV cache type K +- `String getCacheTypeV() -> KV cache type V` +- `void setCacheTypeV(String)` -> set KV cache type V +- `boolean isFlashAttn() -> Flash Attention flag` +- `void setFlashAttn(boolean)` -> set Flash Attention flag +- `int getBatchSize() -> logical batch size` +- `void setBatchSize(int)` -> set logical batch size +- `int getUbatchSize() -> physical batch size` +- `void setUbatchSize(int)` -> set physical batch size +- `int getThreadsBatch() -> batch thread count` +- `void setThreadsBatch(int)` -> set batch thread count +- `int getMainGpu() -> primary GPU index` +- `void setMainGpu(int)` -> set primary GPU index +- `String getDevices() -> device list` +- `void setDevices(String)` -> set device list +- `String getProvider() -> AI provider` +- `void setProvider(String)` -> set AI provider +- `String getRemoteModel() -> remote model id` +- `void setRemoteModel(String)` -> set remote model id +- `String getBaseUrl() -> API base URL` +- `void setBaseUrl(String)` -> set API base URL +- `String getApiKeyEnv() -> API key env var` +- `void setApiKeyEnv(String)` -> set API key env var +- `String getReasoningEffort() -> reasoning effort` +- `void setReasoningEffort(String)` -> set reasoning effort +- `int getReasoningBudgetTokens() -> reasoning budget` +- `void setReasoningBudgetTokens(int)` -> set reasoning budget +- `float getDryMultiplier() -> DRY multiplier` +- `void setDryMultiplier(float)` -> set DRY multiplier +- `float getDryBase() -> DRY base` +- `void setDryBase(float)` -> set DRY base +- `int getDryAllowedLength() -> DRY allowed length` +- `void setDryAllowedLength(int)` -> set DRY allowed length +- `int getDryPenaltyLastN() -> DRY penalty last‑n` +- `void setDryPenaltyLastN(int)` -> set DRY penalty last‑n +- `List getDrySequenceBreakers() -> DRY sequence breakers` +- `void setDrySequenceBreakers(List)` -> set DRY sequence breakers +- `List getStopStrings() -> stop strings` +- `void setStopStrings(List)` -> set stop strings +- `AiCalibration getCalibration() -> calibration` +- `void setCalibration(AiCalibration)` -> set calibration + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCalibration` + +#### Exceptions / Errors +- No checked exceptions thrown. +- Setters accept `null` for optional fields and normalize to defaults. + +#### Concurrency +- No synchronization; intended for single‑threaded Maven configuration use. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..c3851bb2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,55 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:52:15Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Defines how oversized source files are handled during routing: abort, sample, map‑reduce, or deterministic metadata. + +#### Purpose +- Provides strategies for processing source files that exceed the model’s context window. +- Parses strategy tokens from configuration and supplies default behavior. + +#### Type +- `public enum AiOversizeStrategy` + - extends `java.lang.Enum` + - constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` + - fields: + - `public static final AiOversizeStrategy DEFAULT = FAIL` + - `private final String configValue` + - constructor: `AiOversizeStrategy(String configValue)` + - methods: + - `public String configValue()` + - `public static AiOversizeStrategy fromConfig(@Nullable String value)` + +#### Input +- `fromConfig` receives a `String value` (nullable) from configuration. + +#### Output +- `fromConfig` returns an `AiOversizeStrategy` (one of the enum constants). +- `configValue()` returns the strategy’s config token string. + +#### Core logic +- `fromConfig`: + 1. If `value` is `null` → return `DEFAULT`. + 2. Trim `value`; if empty → return `DEFAULT`. + 3. Iterate `values()`; compare each `strategy.configValue` to trimmed value, case‑insensitive. + 4. Return matching strategy. + 5. If none match → throw `IllegalArgumentException` with message listing expected tokens. + +#### Public API +- `configValue() -> String` – returns the config token for the strategy. +- `fromConfig(@Nullable String) -> AiOversizeStrategy` – parses a config token into a strategy. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `fromConfig` when a non‑blank value does not match any strategy. + +#### Concurrency +- No concurrency constructs; enum is immutable and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..6b3b1fff --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,101 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:52:19Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> A mutable configuration bean that aggregates all parameters required for a srcmorph run, bindable from Maven, JSON/YAML, or Java code. + +#### Purpose +- Holds runtime parameters for srcmorph AI generation. +- Provides defaults and mutable JavaBean accessors. + +#### Type +- `public class SrcMorphConfiguration` + - Modifiers: public + - Extends: none + - Implements: none + - Annotations: `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`, `@ToString` + - Fields: 23 (listed below) + +#### Input +- Constructor: no parameters. +- Setter methods accept: `File`, `boolean`, `List`, `long`, `String`, `List`, `List`, `File`, `List`, `List`, `int`, `float`. +- Dependencies: `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiGenerationConfig`. + +#### Output +- Getter methods return the corresponding field values. +- No state mutation beyond setters. + +#### Core logic +- No additional logic; the class is a plain data holder. + +#### Public API +- `SrcMorphConfiguration()` → constructor, no args +- `File getBaseDirectory()` → base directory +- `void setBaseDirectory(File)` → set base directory +- `File getOutputDirectory()` → output directory +- `void setOutputDirectory(File)` → set output directory +- `boolean isForce()` → force flag +- `void setForce(boolean)` → set force flag +- `List getSubtrees()` → subtrees list +- `void setSubtrees(List)` → set subtrees +- `List getExcludes()` → excludes list +- `void setExcludes(List)` → set excludes +- `List getFileExtensions()` → file extensions +- `void setFileExtensions(List)` → set file extensions +- `long getMinFileSizeBytes()` → min file size +- `void setMinFileSizeBytes(long)` → set min file size +- `long getMaxFileSizeBytes()` → max file size +- `void setMaxFileSizeBytes(long)` → set max file size +- `boolean isPlanOnly()` → plan‑only flag +- `void setPlanOnly(boolean)` → set plan‑only flag +- `String getGenerationProvider()` → provider name +- `void setGenerationProvider(String)` → set provider name +- `List getPromptDefinitions()` → prompt definitions +- `void setPromptDefinitions(List)` → set prompt definitions +- `List getAiDefinitions()` → AI model definitions +- `void setAiDefinitions(List)` → set AI model definitions +- `File getModelDirectory()` → model directory +- `void setModelDirectory(File)` → set model directory +- `List getFieldGenerations()` → field generation rules +- `void setFieldGenerations(List)` → set field generation rules +- `List getFactDefinitions()` → fact definitions +- `void setFactDefinitions(List)` → set fact definitions +- `String getLlamaModelPath()` → llama model path +- `void setLlamaModelPath(String)` → set llama model path +- `int getLlamaContextSize()` → llama context size +- `void setLlamaContextSize(int)` → set llama context size +- `int getLlamaMaxOutputTokens()` → llama max output tokens +- `void setLlamaMaxOutputTokens(int)` → set llama max output tokens +- `float getLlamaTemperature()` → llama temperature +- `void setLlamaTemperature(float)` → set llama temperature +- `int getLlamaThreads()` → llama threads +- `void setLlamaThreads(int)` → set llama threads +- `String getPluginVersion()` → plugin version +- `void setPluginVersion(String)` → set plugin version +- `String getAiVersion()` → AI version +- `void setAiVersion(String)` → set AI version +- `String getProjectName()` → project name +- `void setProjectName(String)` → set project name + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiModelDefinition` +- `net.ladenthin.srcmorph.config.AiFieldGenerationConfig` +- `net.ladenthin.srcmorph.config.AiFactDefinition` +- `net.ladenthin.srcmorph.config.AiGenerationConfig` + +#### Exceptions / Errors +- No explicit exceptions thrown or caught. + +#### Concurrency +- No synchronization; mutable state is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..44551ab6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,54 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:54:56Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> A configuration‑driven AI‑powered source‑code analysis and generation framework that evaluates file‑selection rules, extracts deterministic language facts, and orchestrates model‑based code generation. + +#### Purpose +- Provide a Maven‑plugin‑friendly configuration bean for AI‑based source‑morphing. +- Evaluate file‑selection conditions and handle oversized files. +- Extract deterministic language facts via regex counters. +- Supply AI generation parameters for various providers. + +#### Responsibilities +- **Configuration aggregation** – `SrcMorphConfiguration` holds all runtime options. +- **Condition evaluation** – `AiConditionEvaluator` validates and matches `AiCondition` trees. +- **Fact extraction** – `AiFactExtractor` builds fact blocks from regex counters. +- **Oversize handling** – `AiOversizeStrategy` defines policies for files beyond context limits. +- **Condition grouping** – `AiConditionGroup` stores child conditions for logical combinators. + +#### Key units +- `SrcMorphConfiguration` – mutable bean for Maven/JSON/YAML binding. +- `AiConditionEvaluator` – stateless validator/matcher for `AiCondition` trees. +- `AiFactExtractor` – static utility for regex‑based fact counting. +- `AiOversizeStrategy` – enum with `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`. +- `AiConditionGroup` – holds a defensive‑copy list of child `AiCondition`s. + +#### Data flow +1. **Configuration**: `SrcMorphConfiguration` is populated from Maven/JSON/YAML. +2. **File selection**: `AiConditionEvaluator` traverses `AiCondition` trees (possibly nested via `AiConditionGroup`) to decide if a file should be processed. +3. **Oversize decision**: `AiOversizeStrategy.fromConfig` selects a policy for files exceeding the model’s context window. +4. **Fact extraction**: `AiFactExtractor.factsBlock` consumes a list of `AiFactCounter`s to produce a facts block appended to the prompt. +5. **Generation**: `AiGenerationConfig` supplies model, sampling, and runtime options to the AI provider. + +#### Dependencies +- **Internal**: `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, `AiSourceExcludeFilter`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`. +- **External**: `java.time.Instant`, `java.time.format.DateTimeParseException`, `java.util.regex.*`, `org.jspecify.annotations.Nullable`, Lombok `@ToString`. + +#### Cross-cutting +- Defensive copying in `AiConditionGroup.setConditions`. +- Stateless, thread‑safe utilities (`AiFactExtractor`, `AiConditionEvaluator`). +- Validation logic throws `IllegalArgumentException` for malformed configurations. +- Enum `AiOversizeStrategy` provides a single source of truth for oversize policies. +- Configuration beans (`SrcMorphConfiguration`, `AiGenerationConfig`) expose getters/setters for Maven binding and default values for all options. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..2af0e044 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,61 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:55:06Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A framework that orchestrates AI‑driven source‑code analysis, generation, and provider abstraction for Maven‑based projects. + +#### Purpose +- Supply a configuration‑driven AI source‑morphing engine. +- Abstract multiple LLM back‑ends (local llama.cpp, OpenAI‑compatible APIs, mock) for text generation. +- Provide utilities for request construction, response parsing, and performance metrics. + +#### Responsibilities +- **Configuration & rule evaluation** – `SrcMorphConfiguration`, `AiConditionEvaluator`, `AiFactExtractor`, `AiOversizeStrategy`. +- **Provider abstraction & factory** – `AiGenerationProvider`, `AiGenerationProviderFactory`, concrete providers (`MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`). +- **Request/response handling** – `OpenAiCompatibleProviderSupport`, `AiCompletionParser`, `AiGenerationTimings`. +- **Local model orchestration** – `LlamaCppJniConfig`, `LlamaCppJniAiGenerationProvider`. +- **Utility & cross‑cutting** – defensive copying, stateless utilities, error handling, timing extraction. + +#### Key units +- `SrcMorphConfiguration` – mutable bean for Maven/JSON/YAML binding. +- `AiConditionEvaluator` – stateless validator/matcher for `AiCondition` trees. +- `AiFactExtractor` – static regex‑based fact counter. +- `AiOversizeStrategy` – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`). +- `AiGenerationProvider` – interface for `generate`, `generateWithTimings`, `close`. +- `AiGenerationProviderFactory` – resolves provider key and constructs provider. +- `LlamaCppJniConfig` – immutable builder for llama.cpp JNI parameters. +- `LlamaCppJniAiGenerationProvider` – lazy‑loads llama.cpp model, parses chat, returns timings. +- `OpenAiCompatibleProviderSupport` – builds JSON payload, resolves endpoint, parses `ChatResponse`, computes `AiGenerationTimings`. +- `AiCompletionParser` – strips Gemma‑4 thinking blocks from completions. +- `AiGenerationTimings` – DTO for generated text and performance metrics. + +#### Data flow +1. **Configuration** – `SrcMorphConfiguration` is populated from Maven/JSON/YAML. +2. **File selection** – `AiConditionEvaluator` traverses `AiCondition` trees to decide processing. +3. **Oversize handling** – `AiOversizeStrategy` selects policy for files beyond context limits. +4. **Fact extraction** – `AiFactExtractor` produces a facts block for the prompt. +5. **Provider resolution** – `AiGenerationProviderFactory` creates the appropriate provider. +6. **Generation request** – client calls `generate`/`generateWithTimings` with `AiGenerationRequest`. +7. **Provider execution** – builds request (via `OpenAiCompatibleProviderSupport` or llama.cpp chat template), sends to backend. +8. **Response parsing** – provider parses JSON, extracts text, optionally parses timings. +9. **Cleaning** – `AiCompletionParser` removes internal reasoning blocks. +10. **Result** – `AiGenerationTimings` returned to caller. + +#### Dependencies +- **Internal** – `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, `AiSourceExcludeFilter`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`, `AiPromptSupport`, `Java8CompatibilityHelper`, `ChatResponseParser`. +- **External** – `java.time`, `java.util.regex`, `org.jspecify.annotations.Nullable`, Lombok `@ToString`, `net.ladenthin.llama` (model, parameters, JSON parsing), `com.fasterxml.jackson` (JSON), `java.net.URL`, `java.io.IOException`. + +#### Cross-cutting +- Defensive copying in `AiConditionGroup.setConditions`. +- Stateless, thread‑safe utilities (`AiFactExtractor`, `AiConditionEvaluator`). +- Immutable configuration (`LlamaCppJniConfig`, provider support classes). +- Centralized error handling: `IllegalArgumentException` for malformed configs, `IOException` for HTTP/response issues. +- Timing metrics unified via `AiGenerationTimings`; local provider parses native timings, remote provider derives from `ChatResponse.usage`. +- Configuration lookup uses `Java8CompatibilityHelper.isBlank` for string validation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..2743ef2e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,55 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:52:27Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Strips a leading Gemma‑4 thinking block from LLM completion text, returning only the model’s final answer. + +#### Purpose +- Removes internal reasoning from Gemma‑4 responses before persisting. +- Validates presence of closing marker, throws `IOException` if missing. + +#### Type +- `public class AiCompletionParser` + - Modifiers: public + - Annotations: `@ToString` + - Supertypes: none + - Constants: + - `public static final String THINKING_BLOCK_START_MARKER` + - `public static final String THINKING_BLOCK_END_MARKER` + +#### Input +- `parseCompletion(String response)` + - `response`: raw LLM completion text, may be `null`. + +#### Output +- `parseCompletion` returns a non‑null `String` containing the trimmed answer text. +- Throws `IOException` if a start marker is present but no end marker is found. + +#### Core logic +- If `response` is `null`, return `""`. +- Trim `response` to `trimmed`. +- If `trimmed` does not start with `THINKING_BLOCK_START_MARKER`, return `trimmed`. +- Extract substring after the start marker into `thinking`. +- Find first occurrence of `THINKING_BLOCK_END_MARKER` in `thinking` as `thinkingEnd`. +- If `thinkingEnd < 0`, throw `IOException` with message indicating token budget exhaustion. +- Return substring of `thinking` after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` -> no-op constructor +- `String parseCompletion(String response) throws IOException` -> clean answer text + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` when a start marker is present but the end marker is missing, with a detailed message including response length. + +#### Concurrency +- No concurrency constructs; class is stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..c3db9642 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,54 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:52:29Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides an interface for AI text generation backends, exposing generation and optional timing metrics. + +#### Purpose +- Declares contract for AI backends that generate text from a request. +- Supplies default timing wrapper for calibration. + +#### Type +- `public interface AiGenerationProvider extends AutoCloseable` + - Methods: `String generate(AiGenerationRequest) throws IOException`, `AiGenerationTimings generateWithTimings(AiGenerationRequest) throws IOException`, `void close() throws IOException`. + - Default implementation of `generateWithTimings` returns `AiGenerationTimings(generate(request), 0, 0, 0.0d, 0, 0.0d)`. + - Default `close` does nothing. + +#### Input +- `AiGenerationRequest request` parameter to `generate` and `generateWithTimings`. +- `AiGenerationRequest` contains prompt key, source file, source text, current header. + +#### Output +- `generate`: non‑null `String` (may be blank). +- `generateWithTimings`: `AiGenerationTimings` containing generated text and timing metrics (rates default to 0). +- `close`: no output. + +#### Core logic +- `generate` is abstract; implementation must produce text. +- `generateWithTimings`: + 1. Calls `generate(request)`. + 2. Wraps result in `AiGenerationTimings` with zeroed timing fields. +- `close` is a no‑op default. + +#### Public API +- `generate(AiGenerationRequest) -> String` – produce text for request. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – produce text with timing. +- `close() -> void` – release resources. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.document.AiGenerationTimings` + +#### Exceptions / Errors +- `generate` and `generateWithTimings` declare `throws IOException`. +- No explicit null checks; contract guarantees non‑null return. + +#### Concurrency +- No thread‑safety guarantees; implementations may manage their own synchronization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..62f44fbe --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,70 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:52:43Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Instantiates AI generation providers based on a provider key or model configuration. + +#### Purpose +- Selects an `AiGenerationProvider` implementation by name or model configuration. +- Provides default mock provider when no key is supplied. + +#### Type +- `public class AiGenerationProviderFactory` + - Modifiers: public, final (implicit), @ToString + - Supertype: java.lang.Object + - Fields: + - `private final Java8CompatibilityHelper compatibilityHelper` – instance of helper for blank checks. + - Methods: + - `public AiGenerationProviderFactory()` – no‑op constructor. + - `public static @Nullable String effectiveProvider(String runProvider, String modelProvider)` – returns provider key. + - `public AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` – factory method. + +#### Input +- `create` parameters: + - `providerName` – run’s provider key (may be null/blank). + - `llamaConfig` – model configuration providing `provider()` method. + - `promptSupport` – lookup support for prompts. +- `effectiveProvider` parameters: `runProvider`, `modelProvider`. + +#### Output +- `create` returns an instance of `AiGenerationProvider` (one of `MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`). +- `effectiveProvider` returns a trimmed provider key or null. + +#### Core logic +- `effectiveProvider`: + - If `modelProvider` is null or empty after trim, return `runProvider`; else return trimmed `modelProvider`. +- `create`: + - Compute `effective` via `effectiveProvider`. + - If `effective` is null or blank (checked by `compatibilityHelper.isBlank`), return new `MockAiGenerationProvider`. + - Switch on `effective`: + - `PROVIDER_MOCK` → `new MockAiGenerationProvider()`. + - `PROVIDER_LLAMACPP_JNI` → `new LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)`. + - `PROVIDER_OPENAI_COMPATIBLE` → `new OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)`. + - default → throw `IllegalArgumentException("Unsupported AI provider: " + effective)`. + +#### Public API +- `AiGenerationProviderFactory()` → constructs factory. +- `static @Nullable String effectiveProvider(String runProvider, String modelProvider)` → resolves provider key. +- `AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` → creates provider instance. + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.provider.MockAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.OpenAiCompatibleAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniConfig` + +#### Exceptions / Errors +- `create` throws `IllegalArgumentException` when provider key is unrecognised. + +#### Concurrency +- No explicit concurrency constructs; factory is stateless except for a single helper instance. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..8d6153de --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,92 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:52:48Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides local, llama.cpp‑backed AI text generation with lazy GGUF loading, prompt rendering, and detailed timing extraction. + +#### Purpose +- Supplies AI generation via llama.cpp JNI binding. +- Lazily loads GGUF model on first request. +- Parses chat responses and extracts timings. + +#### Type +- `final class LlamaCppJniAiGenerationProvider` – implements `AiGenerationProvider`, `AutoCloseable`; extends `Object`. + - Modifiers: `final`. + - Annotations: `@ToString`. + - Supertypes: `AiGenerationProvider`, `AutoCloseable`. +- Fields: + - `private final LlamaCppJniConfig config` – configuration holder. + - `@ToString.Exclude private @Nullable LlamaModel model` – native handle, lazily initialized. + - `private final AiPromptSupport promptSupport` – prompt lookup. + - `@ToString.Exclude private final LlamaCppJniProviderSupport support` – helper for prompt and inference parameters. + - `private final AiCompletionParser completionParser` – parses completion text. + - `private final ChatResponseParser chatResponseParser` – parses full chat JSON. + - `private final Java8CompatibilityHelper compatibilityHelper` – string utilities. + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate(AiGenerationRequest request)` / `generateWithTimings(AiGenerationRequest request)` accept `AiGenerationRequest`. +- `model()` builds `ModelParameters` from `config` and `support.buildChatTemplateKwargs()`. + +#### Output +- `generate` returns `String` completion. +- `generateWithTimings` returns `AiGenerationTimings` with text, prompt tokens, cache tokens, prompt/sec, predicted tokens, predicted/sec. +- `close()` releases native `LlamaModel` if loaded. + +#### Core logic +- `model()`: + 1. If `model` null, create `ModelParameters`: + - Set model path, context size, threads, reasoning format, chat template kwargs. + - Conditionally enable SWA full, cache reuse, GPU layers, CPU MoE/FFN layers, KV unified per slot, lazy mode, flash attention, cache type K/V, batch sizes, main GPU, devices. + 2. Instantiate `LlamaModel` with parameters; cache in `model`. +- `generate(request)`: + 1. Call `chatResponse(request)` → `ChatResponse`. + 2. `support.warnOnTruncatedAnswer(request, response)`. + 3. `support.logPromptCacheReuse(request, response)`. + 4. Return `completionParser.parseCompletion(response.getFirstContent())`. +- `chatResponse(request)`: + - `chatResponseParser.parseResponse(model().chatComplete(support.buildInferenceParameters(request)))`. +- `generateWithTimings(request)`: + 1. Obtain `ChatResponse` via `chatResponse(request)`. + 2. Extract `text`, `Timings`. + 3. If `timings` null, return zeroed `AiGenerationTimings`. + 4. Else construct `AiGenerationTimings` with promptN, cacheN, promptPerSecond, predictedN, predictedPerSecond. +- `close()`: + - If `model` not null, call `model.close()`. + +#### Public API +- `generate(AiGenerationRequest request) -> String` – produce completion text. +- `generateWithTimings(AiGenerationRequest request) -> AiGenerationTimings` – produce completion with metrics. +- `close() -> void` – release native resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.args.FlashAttn` +- `net.ladenthin.llama.args.ReasoningFormat` +- `net.ladenthin.llama.json.ChatResponseParser` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.ChatResponse` +- `net.ladenthin.llama.value.Timings` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `java.io.IOException` +- `java.util.Map` +- `java.util.Objects` + +#### Exceptions / Errors +- Constructor throws `NullPointerException` if `config` or `promptSupport` null. +- `generate` declares `IOException` (though underlying chat path throws unchecked). +- `generateWithTimings` no checked exceptions. +- `close` no exceptions. + +#### Concurrency +- No explicit synchronization; `model` is lazily initialized without double‑checked locking; assumes single‑threaded or external synchronization. +- `close()` may be called concurrently; native `close()` is idempotent. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..b38a990b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,139 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:52:59Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds an immutable configuration for the llama.cpp JNI provider, exposing all model‑level and runtime knobs. + +#### Purpose +- Holds 37 configuration knobs for llama.cpp JNI execution. +- Provides a fluent builder that defaults to `AiGenerationConfig.DEFAULT_*` values. + +#### Type +- `final class LlamaCppJniConfig` (class, final). + - Supertypes: none. + - Annotations: `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. +- `public static final class Builder` (class, final). + - Annotations: none. + - Supertypes: none. + +#### Input +- `Builder` constructor: `String modelPath` (non‑null). +- Builder setters: 36 optional parameters (int, float, boolean, `@Nullable Boolean`, `String`, `List`). +- `build()` consumes the populated `Builder`. + +#### Output +- `LlamaCppJniConfig` immutable instance with 37 fields. +- Getter methods return primitive values, `String`, `List` (unmodifiable), or `@Nullable Boolean`. +- `stopStrings()` and `drySequenceBreakers()` return unmodifiable lists. + +#### Core logic +- `private LlamaCppJniConfig(Builder)` copies each field from the builder. +- `builder(String)` creates a new `Builder` with the required `modelPath`. +- Each `Builder` setter assigns the argument to its field and returns `this`. +- `Builder.build()` returns `new LlamaCppJniConfig(this)`. + +#### Public API +- `LlamaCppJniConfig.builder(String) -> Builder` – create builder. +- `LlamaCppJniConfig.modelPath() -> String` – model file path. +- `LlamaCppJniConfig.contextSize() -> int` – context window. +- `LlamaCppJniConfig.maxOutputTokens() -> int` – max output. +- `LlamaCppJniConfig.temperature() -> float` – sampling temperature. +- `LlamaCppJniConfig.threads() -> int` – CPU threads. +- `LlamaCppJniConfig.topP() -> float` – nucleus threshold. +- `LlamaCppJniConfig.topK() -> int` – top‑k limit. +- `LlamaCppJniConfig.minP() -> float` – min‑p threshold. +- `LlamaCppJniConfig.topNSigma() -> float` – top‑n‑sigma threshold. +- `LlamaCppJniConfig.repeatPenalty() -> float` – repetition penalty. +- `LlamaCppJniConfig.chatTemplateEnableThinking() -> @Nullable Boolean` – chat‑template flag. +- `LlamaCppJniConfig.cachePrompt() -> boolean` – prompt caching. +- `LlamaCppJniConfig.swaFull() -> boolean` – full‑size SWA cache. +- `LlamaCppJniConfig.cacheReuse() -> int` – KV prefix reuse size. +- `LlamaCppJniConfig.gpuLayers() -> int` – GPU layers. +- `LlamaCppJniConfig.seed() -> int` – RNG seed. +- `LlamaCppJniConfig.cpuMoeLayers() -> int` – CPU MoE layers. +- `LlamaCppJniConfig.cpuFfnLayers() -> int` – CPU FFN layers. +- `LlamaCppJniConfig.kvUnifiedPerSlot() -> int` – KV unified cap. +- `LlamaCppJniConfig.lazyMode() -> String` – tensor‑read laziness. +- `LlamaCppJniConfig.repeatLastN() -> int` – repeat‑penalty window. +- `LlamaCppJniConfig.cacheTypeK() -> String` – KV cache type K. +- `LlamaCppJniConfig.cacheTypeV() -> String` – KV cache type V. +- `LlamaCppJniConfig.flashAttn() -> boolean` – Flash Attention. +- `LlamaCppJniConfig.batchSize() -> int` – logical batch size. +- `LlamaCppJniConfig.ubatchSize() -> int` – physical batch size. +- `LlamaCppJniConfig.threadsBatch() -> int` – batch thread count. +- `LlamaCppJniConfig.mainGpu() -> int` – primary GPU index. +- `LlamaCppJniConfig.devices() -> String` – device list. +- `LlamaCppJniConfig.provider() -> String` – AI provider. +- `LlamaCppJniConfig.remoteModel() -> String` – remote model ID. +- `LlamaCppJniConfig.baseUrl() -> String` – OpenAI‑compatible base URL. +- `LlamaCppJniConfig.apiKeyEnv() -> String` – API key env var. +- `LlamaCppJniConfig.reasoningEffort() -> String` – reasoning effort. +- `LlamaCppJniConfig.reasoningBudgetTokens() -> int` – reasoning budget. +- `LlamaCppJniConfig.dryMultiplier() -> float` – DRY multiplier. +- `LlamaCppJniConfig.dryBase() -> float` – DRY base. +- `LlamaCppJniConfig.dryAllowedLength() -> int` – DRY allowed length. +- `LlamaCppJniConfig.dryPenaltyLastN() -> int` – DRY penalty window. +- `LlamaCppJniConfig.drySequenceBreakers() -> List` – DRY breakers. +- `LlamaCppJniConfig.stopStrings() -> List` – stop strings. +- `Builder.contextSize(int) -> Builder` – set context size. +- `Builder.maxOutputTokens(int) -> Builder` – set max output. +- `Builder.temperature(float) -> Builder` – set temperature. +- `Builder.threads(int) -> Builder` – set threads. +- `Builder.topP(float) -> Builder` – set top‑p. +- `Builder.topK(int) -> Builder` – set top‑k. +- `Builder.minP(float) -> Builder` – set min‑p. +- `Builder.topNSigma(float) -> Builder` – set top‑n‑sigma. +- `Builder.repeatPenalty(float) -> Builder` – set repeat penalty. +- `Builder.chatTemplateEnableThinking(@Nullable Boolean) -> Builder` – set chat‑template flag. +- `Builder.cachePrompt(boolean) -> Builder` – set cache prompt. +- `Builder.swaFull(boolean) -> Builder` – set SWA full. +- `Builder.cacheReuse(int) -> Builder` – set cache reuse. +- `Builder.gpuLayers(int) -> Builder` – set GPU layers. +- `Builder.seed(int) -> Builder` – set seed. +- `Builder.cpuMoeLayers(int) -> Builder` – set CPU MoE layers. +- `Builder.cpuFfnLayers(int) -> Builder` – set CPU FFN layers. +- `Builder.kvUnifiedPerSlot(int) -> Builder` – set KV unified cap. +- `Builder.lazyMode(String) -> Builder` – set lazy mode. +- `Builder.repeatLastN(int) -> Builder` – set repeat last‑N. +- `Builder.cacheTypeK(String) -> Builder` – set cache type K. +- `Builder.cacheTypeV(String) -> Builder` – set cache type V. +- `Builder.flashAttn(boolean) -> Builder` – set flash attention. +- `Builder.batchSize(int) -> Builder` – set batch size. +- `Builder.ubatchSize(int) -> Builder` – set ubatch size. +- `Builder.threadsBatch(int) -> Builder` – set threads batch. +- `Builder.mainGpu(int) -> Builder` – set main GPU. +- `Builder.devices(String) -> Builder` – set devices. +- `Builder.provider(String) -> Builder` – set provider. +- `Builder.remoteModel(String) -> Builder` – set remote model. +- `Builder.baseUrl(String) -> Builder` – set base URL. +- `Builder.apiKeyEnv(String) -> Builder` – set API key env. +- `Builder.reasoningEffort(String) -> Builder` – set reasoning effort. +- `Builder.reasoningBudgetTokens(int) -> Builder` – set reasoning budget. +- `Builder.dryMultiplier(float) -> Builder` – set DRY multiplier. +- `Builder.dryBase(float) -> Builder` – set DRY base. +- `Builder.dryAllowedLength(int) -> Builder` – set DRY allowed length. +- `Builder.dryPenaltyLastN(int) -> Builder` – set DRY penalty window. +- `Builder.drySequenceBreakers(List) -> Builder` – set DRY breakers. +- `Builder.stopStrings(List) -> Builder` – set stop strings. +- `Builder.build() -> LlamaCppJniConfig` – create immutable config. + +#### Dependencies +- `net.ladenthin.srcmorph.config.AiGenerationConfig` – default values. +- `net.ladenthin.srcmorph.support.ConvertToRecord` – annotation. +- `org.jspecify.annotations.Nullable` – nullable annotation. +- `java.util.Collections`, `java.util.List`, `java.util.Objects`. +- Lombok annotations: `@EqualsAndHashCode`, `@ToString`. + +#### Exceptions / Errors +- `builder(String)` throws `NullPointerException` if `modelPath` is `null`. +- `Builder` setters accept any value; no validation beyond null checks for `String` parameters that may be `null` to restore defaults. + +#### Concurrency +- `Builder` is not thread‑safe; intended single‑thread usage. +- `LlamaCppJniConfig` is immutable and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..55c304c8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,99 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:53:41Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds the request payload, endpoint, API‑key handling, and response parsing for an OpenAI‑compatible chat‑completion provider. + +#### Purpose +- Construct JSON body for chat‑completion requests. +- Resolve endpoint URL and validate scheme. +- Retrieve and secure API key. +- Interpret HTTP status and error bodies. +- Compute generation timings from response. + +#### Type +- `final class OpenAiCompatibleProviderSupport` (class, final) + - Extends `Object`. + - Annotations: `@ToString`. + - Fields: + - `static final String CHAT_COMPLETIONS_PATH` – endpoint suffix. + - `static final int ERROR_BODY_EXCERPT` – error body length. + - `private static final int HTTP_OK_FIRST` – 200. + - `private static final int HTTP_OK_END` – 300. + - `static final String HTTP_SCHEME` – `"http://"` + - `static final String HTTPS_SCHEME` – `"https://"` + - `private static final String LOOPBACK_HOST_NAME` – `"localhost"` + - `private static final Pattern IPV4_LOOPBACK` – regex for `127.*.*.*` + - `private static final String IPV6_LOOPBACK` – `"[::1]"` + - `private static final String ELLIPSIS` – `"..."` + - `private static final ObjectMapper MAPPER` – Jackson mapper. + - `private final LlamaCppJniConfig config` – model config. + - `private final AiPromptSupport promptSupport` – prompt definitions (`@ToString.Exclude`). + - `private final Function environment` – env lookup (`@ToString.Exclude`). + - `private final Java8CompatibilityHelper compatibilityHelper` – helper for blank checks. + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, `Function environment`. +- `requestBody(AiGenerationRequest)` – request object. +- `endpoint()` – uses `config.baseUrl()`. +- `apiKey()` – uses `config.apiKeyEnv()` and `environment`. +- `apiKeyFor(String endpoint)` – uses `apiKey()` and `endpoint`. +- `isLoopbackHost(String host)` – host string. +- `isSuccess(int status)` – status code. +- `errorMessage(String endpoint, int status, String body)` – endpoint, status, body. +- `timings(String text, ChatResponse response, double seconds)` – text, response, seconds. + +#### Output +- `requestBody` returns JSON string. +- `endpoint` returns full URL string. +- `apiKey` returns trimmed key or `null`. +- `apiKeyFor` returns key or `null`; throws `IOException` on insecure HTTP to non‑loopback. +- `isLoopbackHost` returns boolean. +- `isSuccess` returns boolean. +- `errorMessage` returns formatted message string. +- `timings` returns `AiGenerationTimings` instance. + +#### Core logic +- **requestBody**: builds `ObjectNode` with `model`, `messages`, `max_tokens`, `temperature`, `top_p`, optional `top_k`, `min_p`, `repetition_penalty`, optional `seed`, optional `stop` array, optional `reasoning.effort`, `stream=false`; serialises with `MAPPER`. +- **endpoint**: trims `config.baseUrl()`, validates `http://` or `https://`, removes trailing slashes, appends `CHAT_COMPLETIONS_PATH`. +- **apiKey**: if `config.apiKeyEnv()` blank → `null`; else lookup via `environment`; if null or blank → `null`; else return trimmed key. +- **apiKeyFor**: if key absent or endpoint not `http://` → return key; else parse host from `endpoint`; if not loopback → throw `IOException`; else return key. +- **isLoopbackHost**: checks host equals `"localhost"` or matches IPv4 loopback regex or equals `"[::1]"`. +- **isSuccess**: status in [200,300). +- **errorMessage**: truncates body to `ERROR_BODY_EXCERPT` + ellipsis if longer; formats `"endpoint answered HTTP status: excerpt"`. +- **timings**: extracts `usage` from `ChatResponse`; computes `completionTokens`, `decodeRate = completionTokens / seconds` (or 0 if seconds ≤0); constructs `AiGenerationTimings(text, promptTokens, cachedTokens, 0.0, completionTokens, decodeRate)`. + +#### Public API +- `String requestBody(AiGenerationRequest request) -> String` – build request JSON. +- `String endpoint() -> String` – compute endpoint URL. +- `@Nullable String apiKey() -> String` – get API key. +- `@Nullable String apiKeyFor(String endpoint) -> String` – secure key for endpoint. +- `static boolean isLoopbackHost(String host) -> boolean` – host check. +- `static boolean isSuccess(int status) -> boolean` – status check. +- `static String errorMessage(String endpoint, int status, String body) -> String` – error formatting. +- `static AiGenerationTimings timings(String text, ChatResponse response, double seconds) -> AiGenerationTimings` – compute timings. + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper`, `ArrayNode`, `ObjectNode`. +- `java.io.IOException`, `java.net.URL`. +- `java.util.List`, `java.util.Objects`, `java.util.function.Function`, `java.util.regex.Pattern`. +- `lombok.ToString`, `lombok.ToString.Exclude`. +- `net.ladenthin.llama.value.ChatResponse`, `net.ladenthin.llama.value.Usage`. +- `net.ladenthin.srcmorph.document.AiGenerationRequest`. +- `net.ladenthin.srcmorph.prompt.AiPromptSupport`. +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper`. +- `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `IllegalArgumentException` in `endpoint()` if baseUrl not http(s). +- `IOException` in `apiKeyFor()` if key present and endpoint is plain http to non‑loopback host or URL parsing fails. +- `IOException` in `requestBody()` if JSON serialization fails. + +#### Concurrency +- No explicit synchronization; all fields are immutable after construction. Thread‑safe by design. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..64cf3339 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,58 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:55:01Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> A modular AI generation framework that abstracts multiple back‑ends (local llama.cpp, OpenAI‑compatible APIs, and a mock provider) and supplies utilities for request construction, response parsing, and timing metrics. + +#### Purpose +- Provide a unified interface for generating text from LLMs. +- Support local and remote providers with configurable runtime knobs. +- Strip internal reasoning from responses and expose clean answers. + +#### Responsibilities +- **Provider abstraction** – `AiGenerationProvider` interface and concrete implementations (`MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`). +- **Factory orchestration** – `AiGenerationProviderFactory` resolves provider keys and constructs the appropriate provider. +- **Configuration** – `LlamaCppJniConfig` holds 37 tunable parameters for llama.cpp execution. +- **Request/response handling** – `OpenAiCompatibleProviderSupport` builds JSON payloads, resolves endpoints, secures API keys, and parses chat responses. +- **Response cleaning** – `AiCompletionParser` removes Gemma‑4 thinking blocks from raw completions. +- **Timing extraction** – providers expose `AiGenerationTimings` with prompt/cache tokens and throughput metrics. + +#### Key units +- `AiGenerationProvider` – contract for `generate`, `generateWithTimings`, `close`. +- `AiGenerationProviderFactory` – resolves provider key, creates provider instance. +- `LlamaCppJniConfig` – immutable config builder for llama.cpp JNI. +- `LlamaCppJniAiGenerationProvider` – lazy‑load llama.cpp model, parse chat, return timings. +- `OpenAiCompatibleProviderSupport` – builds request body, endpoint, API key, parses `ChatResponse`, computes `AiGenerationTimings`. +- `AiCompletionParser` – strips Gemma‑4 thinking block, validates markers. +- `AiGenerationTimings` – DTO for generated text and performance metrics. + +#### Data flow +1. **Factory** receives provider key, config, and prompt support → creates provider. +2. **Client** calls `generate`/`generateWithTimings` with `AiGenerationRequest`. +3. **Provider** builds request (via `OpenAiCompatibleProviderSupport` or llama.cpp chat template), sends to backend. +4. **Backend** returns chat JSON → provider parses with `ChatResponseParser`. +5. **Provider** extracts text, optionally parses timings, and returns `AiGenerationTimings`. +6. **Parser** (`AiCompletionParser`) cleans raw completion before persistence. + +#### Dependencies +- **Internal**: `AiPromptSupport`, `Java8CompatibilityHelper`, `MockAiGenerationProvider`, `LlamaCppJniProviderSupport`, `ChatResponseParser`. +- **External**: `net.ladenthin.llama` (model, parameters, JSON parsing), `com.fasterxml.jackson` (JSON), `java.net.URL`, `java.io.IOException`. +- **Configuration**: `LlamaCppJniConfig` (model path, threads, GPU layers, cache settings, OpenAI base URL, API key env). + +#### Cross-cutting +- **Immutability**: `LlamaCppJniConfig` and support classes are immutable; builders are single‑threaded. +- **Error handling**: `AiCompletionParser` throws `IOException` for malformed responses; provider factory throws `IllegalArgumentException` for unknown keys; `OpenAiCompatibleProviderSupport` throws `IOException` for insecure HTTP or missing keys. +- **Timing metrics**: All providers expose `AiGenerationTimings`; local provider parses native `Timings`, remote provider derives from `ChatResponse.usage`. +- **Configuration lookup**: `Java8CompatibilityHelper.isBlank` used for string validation across the package. +- **Thread safety**: Providers are stateless except for lazy model initialization; no explicit synchronization, but designed for single‑threaded or externally synchronized use. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..220a4e29 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,49 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:54:32Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Computes a 256‑bin histogram of a byte stream in two OpenCL kernel passes. + +#### Purpose +- Builds a byte histogram for image or generic byte data. +- Splits work into two passes: local partial histograms then global reduction. + +#### Type +- OpenCL C kernels (`__kernel` functions) in file `histogram.cl`. + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms to `partial`. +- `histogram_reduce`: writes final histogram to `histogram`. + +#### Core logic +- **histogram_partial** + 1. Zero local bin array in parallel (`local_bins`). + 2. Iterate over input bytes in strides of global size, atomically increment local bin for each byte. + 3. Copy local bins to global `partial` at offset `group_id * BINS`. +- **histogram_reduce** + 1. Each work‑item handles one bin (`bin = get_global_id(0)`). + 2. Sum corresponding bin across all partial histograms (`partial[g * BINS + bin]`). + 3. Store sum in global `histogram[bin]`. + +#### Public API +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – compute per‑group partial histograms. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – aggregate partials into final histogram. + +#### Constants and configuration +- `#define BINS 256` – number of histogram bins. + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- None; kernels exit early if `bin >= BINS` in `histogram_reduce`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..a73c83ff --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,37 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:55:11Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes a 256‑bin histogram of a byte stream using two OpenCL kernel passes. + +#### Purpose +- Build a byte histogram for image or generic byte data. +- Split work into local partial histograms and a global reduction. + +#### Responsibilities +- **Partial histogram generation** – `histogram_partial` kernel accumulates per‑group local bins. +- **Global reduction** – `histogram_reduce` kernel aggregates partials into the final 256‑bin histogram. + +#### Key units +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram kernel. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – reduction kernel producing final histogram. +- `#define BINS 256` – constant defining histogram size. + +#### Data flow +1. **Input**: byte stream (`input`) and its length. +2. `histogram_partial` writes per‑group partial histograms to `partial`. +3. `histogram_reduce` reads `partial`, sums across groups, writes final histogram to `histogram`. + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Cross-cutting +- Atomic increments for thread‑safe bin updates. +- Local memory usage for per‑group partials. +- Barrier synchronization to ensure local bins are fully populated before copying to global memory. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..59d9eaa1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,45 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:55:25Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides GPU‑accelerated byte‑histogram computation, a lock‑free power‑of‑two ring buffer for byte streams, and small utilities for backup rotation and sales reporting. + +#### Purpose +- Deliver high‑performance byte histogram generation via OpenCL kernels. +- Offer a lightweight, single‑producer/single‑consumer ring buffer for byte data. +- Supply command‑line tools for directory backup rotation and CSV‑based sales analytics. + +#### Responsibilities +- **GPU Histogram** – split byte stream into local partial histograms and reduce to a global 256‑bin result. +- **Ring Buffer** – allocate, write, read, and query a power‑of‑two circular buffer without locks. +- **Utilities** – create timestamped `.tar.gz` archives with retention, parse CSV orders, aggregate monthly/region revenue. + +#### Key units +- **OpenCL kernels**: `histogram_partial`, `histogram_reduce`; constant `BINS = 256`. +- **Ring buffer API**: `ringbuf_t`, `ringbuf_status_t`, `ringbuf_init`, `ringbuf_free`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space`. +- **Scripts**: `rotate_backups.sh`, `sales_report.py` (functions `parse_orders`, `revenue_by_month_and_region`, `main`). + +#### Data flow +1. **Histogram**: input byte array → `histogram_partial` writes per‑group partials → `histogram_reduce` aggregates → final 256‑bin histogram. +2. **Ring buffer**: `ringbuf_init` sets up buffer → `ringbuf_write` copies data (wrap‑around if needed) → `ringbuf_read` retrieves data → status queries report used/free space. +3. **Utilities**: `rotate_backups.sh` archives source → deletes old archives → `sales_report.py` reads CSVs → aggregates revenue → prints tab‑separated report. + +#### Dependencies +- **OpenCL**: built‑in functions (`get_local_id`, `atomic_inc`, etc.). +- **C standard library**: ``, ``, ``, ``. +- **Shell utilities**: `tar`, `date`, `du`, `ls`, `rm`, `mkdir`, `mv`. +- **Python modules**: `argparse`, `csv`, `collections`, `dataclasses`, `datetime`, `decimal`. + +#### Cross‑cutting +- Power‑of‑two capacity enforcement and modulo arithmetic for ring buffer wrap‑around. +- Atomic increments and barriers for thread‑safe histogram updates. +- Consistent error handling: status enums in C, `ValueError` in Python, `set -euo pipefail` in Bash. +- Single‑producer/single‑consumer model for the ring buffer; no locks required. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..c3a9cb91 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,47 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:55:15Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> A lock‑free, power‑of‑two sized circular buffer for byte streams, exposing a minimal API for allocation, read/write, and space queries. + +#### Purpose +- Provide a single‑producer/single‑consumer byte ring buffer. +- Enforce power‑of‑two capacity and efficient wrap‑around. + +#### Responsibilities +- **Buffer lifecycle**: allocation, deallocation, and capacity validation. +- **Data movement**: contiguous or split copy for read/write with wrap‑around. +- **Space accounting**: used bytes and free space calculation. + +#### Key units +- `ringbuf_t` – struct holding buffer pointer, capacity, head, tail indices. +- `ringbuf_status_t` enum – `RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`. +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – allocate and initialize. +- `ringbuf_free(ringbuf_t *rb)` – release memory. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `ringbuf_free_space(const ringbuf_t *rb)` – bytes available for writing. + +#### Data flow +1. **Initialization**: `ringbuf_init` validates `capacity` (non‑zero, power‑of‑two), allocates buffer, sets `head = tail = 0`. +2. **Write**: `ringbuf_write` copies up to `len` bytes from source into buffer, possibly in two chunks if wrap‑around occurs, updates `head`. +3. **Read**: `ringbuf_read` copies up to `len` bytes from buffer to destination, possibly in two chunks, updates `tail`. +4. **Query**: `ringbuf_used` and `ringbuf_free_space` compute values via modulo arithmetic on `head` and `tail`. + +#### Dependencies +- Standard C headers: ``, ``, ``, ``. +- Internal: `ringbuf.h` declares types and API; `ringbuf.c` implements them. + +#### Cross-cutting +- **Power‑of‑two enforcement**: `is_power_of_two` helper ensures capacity validity. +- **Modulo arithmetic**: `(index & (capacity - 1))` for wrap‑around. +- **Error handling**: `ringbuf_init` returns specific status codes for invalid capacity or allocation failure; other functions return actual byte counts. +- **Thread model**: intended for single‑producer/single‑consumer use; no locks required. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..b26a2a9f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,59 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:54:33Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> A circular buffer implementation that enforces power‑of‑two capacity and provides read/write with wrap‑around. + +#### Purpose +- Implements a fixed‑size ring buffer for byte streams. +- Provides allocation, deallocation, and space tracking. + +#### Type +- C source file (`ringbuf.c`) implementing functions declared in `ringbuf.h`. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity value. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_free` releases allocated memory. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates memory, initializes indices. +- `ringbuf_free` frees memory and resets fields. +- `ringbuf_used` computes used bytes via modulo arithmetic. +- `ringbuf_free_space` calculates available space. +- `ringbuf_write` copies data in up to two contiguous chunks, updates head. +- `ringbuf_read` copies data in up to two contiguous chunks, updates tail. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – allocate and set up buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free buffer memory. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – bytes available for writing. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write data into buffer. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read data from buffer. + +#### Constants and configuration +- None defined in this file. + +#### Dependencies +- `` – `malloc`, `free`. +- `` – `memcpy`. +- `"ringbuf.h"` – type and status definitions. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity not power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..653abe8f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,58 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:54:37Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Provides a fixed‑size byte ring buffer for single‑producer/single‑consumer use. + +#### Purpose +- Implements a lock‑free circular buffer. +- Supports byte‑level read/write with capacity checks. + +#### Type +- Header file (`ringbuf.h`) in C. +- Declares `ringbuf_t` struct, `ringbuf_status_t` enum, and public API functions. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- `ringbuf_write` and `ringbuf_read` return number of bytes actually transferred. +- `ringbuf_free` releases allocated memory. + +#### Core logic +- `ringbuf_init` validates capacity (non‑zero, power of two), allocates `capacity` bytes, sets `head` and `tail` to 0. +- `ringbuf_write` copies up to `len` bytes from `src` to buffer, wrapping at `capacity`, updates `head`. +- `ringbuf_read` copies up to `len` bytes from buffer to `dst`, wrapping at `capacity`, updates `tail`. +- `ringbuf_used` returns `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space` returns `(capacity - 1) - ringbuf_used`. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free resources. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – available space. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- `` for `size_t`. +- `` for `uint8_t`. +- Standard C library functions for memory allocation (`malloc`, `free`). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..623ed62b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,40 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:55:21Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> A small utility package that backs up directories and generates monthly sales reports from CSV order exports. + +#### Purpose +- Automate creation and pruning of compressed directory backups. +- Aggregate and report revenue by month and region from order CSV files. + +#### Responsibilities +- **Backup Management** – create timestamped `.tar.gz` archives, enforce retention policy. +- **Sales Reporting** – parse CSV orders, filter by currency, aggregate revenue, output tab‑separated report. + +#### Key units +- `rotate_backups.sh` – Bash script that validates arguments, builds archive names, creates archives with `tar`, and removes old backups. +- `sales_report.py` – Python module exposing: + - `parse_orders(path, currency)` – yields `Order` dataclass instances. + - `revenue_by_month_and_region(orders)` – returns `Dict[(YYYY‑MM, region), Decimal]`. + - `main(argv)` – CLI entry point handling arguments and printing the report. + +#### Data flow +1. **Backup**: `rotate_backups.sh` receives source and target directories, creates a compressed archive, then lists existing archives to delete those beyond the keep count. +2. **Reporting**: `sales_report.py` reads each CSV file, filters rows by currency, converts dates and amounts, aggregates totals per month/region, then prints rows that meet the minimum revenue threshold. + +#### Dependencies +- **Shell**: `tar`, `date`, `du`, `ls`, `rm`, `mkdir`, `mv`. +- **Python**: `argparse`, `csv`, `collections.defaultdict`, `dataclasses`, `datetime`, `decimal`. + +#### Cross-cutting +- Both utilities enforce strict error handling (`set -euo pipefail` in Bash; explicit `ValueError` checks in Python). +- Input validation: positive integer for keep count; required CSV columns; valid currency and amount parsing. +- Output conventions: Bash prints status messages; Python prints tab‑separated report lines. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..c47a9ce8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,57 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:54:42Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Creates a dated, compressed backup of a directory and prunes older archives, keeping only the newest N. + +#### Purpose +- Generates a timestamped `.tar.gz` backup of `SOURCE_DIR` into `BACKUP_DIR`. +- Deletes older backups beyond the specified `KEEP` count. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- `$1` → `SOURCE_DIR` (required). +- `$2` → `BACKUP_DIR` (required). +- `$3` → `KEEP` (optional, defaults to `7`). +- No external options or environment variables. + +#### Output +- Creates file `"$BACKUP_DIR/${name}_.tar.gz"`. +- Prints creation and removal messages. +- Exit status `0` on success, `2` on invalid arguments or missing directory. + +#### Core logic +- Validate `KEEP` is a positive integer. +- Ensure `SOURCE_DIR` exists; create `BACKUP_DIR` if missing. +- Build archive name with UTC timestamp. +- Create temporary archive `"$tmp"`, then rename to final. +- List existing archives sorted newest first. +- Remove archives beyond the first `KEEP` entries. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR`=`"${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR`=`"${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP`=`"${3:-7}"` +- `name`=`"$(basename "$SOURCE_DIR")"` +- `archive`=`"$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp`=`"$archive.partial"` + +#### Dependencies +- External commands: `tar`, `date`, `du`, `ls`, `rm`, `mkdir`, `mv`. + +#### Errors and exit codes +- `exit 2` if `KEEP` not a positive integer. +- `exit 2` if `SOURCE_DIR` does not exist. +- `trap` ensures temporary file `"$tmp"` is removed on exit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..c864ffb6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,59 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:54:52Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Generates a monthly sales report from CSV order exports, aggregating revenue by month and region for a specified currency. + +#### Purpose +- Produce revenue totals per month and region from order CSV files. +- Filter by currency and minimum revenue threshold. + +#### Type +- Python script (`.py`). + +#### Input +- Positional arguments: list of CSV file paths (`csv_files`). +- Optional arguments: + - `--currency`: target currency (default `EUR`). + - `--min-revenue`: minimum revenue to display (default `0`). +- CSV columns required: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints tab‑separated lines: `monthregionrevenue currency`. +- Exits with code `0` on success, `1` if no orders found. + +#### Core logic +- `parse_orders(path, currency)`: + - Open CSV, validate required columns. + - Skip rows with non‑matching currency. + - Convert `order_date` to `date`, `amount` to `Decimal`. + - Yield `Order` dataclass instances. +- `revenue_by_month_and_region(orders)`: + - Aggregate amounts into a `defaultdict(Decimal)` keyed by `(YYYY-MM, region)`. + - Return sorted dictionary of totals. +- `main(argv)`: + - Parse CLI arguments. + - Collect orders from all files. + - If none, error message and exit `1`. + - Iterate sorted totals, print rows meeting `min_revenue`. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` – read and filter orders. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` – aggregate totals. +- `main(argv=None) -> int` – command‑line entry point. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")`. + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` if CSV missing required columns or contains invalid data. +- `ValueError` propagated from `parse_orders` for malformed rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..da6cda60 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,56 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:55:57Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A unified AI‑driven source‑code transformation engine with GPU‑accelerated utilities and a robust SQL persistence layer for library, shop, and warehouse domains. + +#### Purpose +- Orchestrate AI‑based code analysis, generation, and provider abstraction for Maven projects. +- Offer high‑performance byte‑histogram and ring‑buffer utilities for data processing. +- Persist and enforce business rules for library lending, e‑commerce orders, and warehouse inventory with audit and reporting. + +#### Responsibilities +- **AI Engine** – configuration, rule evaluation, provider abstraction, request/response handling, local model orchestration, utilities. +- **GPU & Buffer Utilities** – OpenCL byte‑histogram, lock‑free ring buffer, backup rotation, sales reporting. +- **SQL Domain Logic** – library loan lifecycle, shop order processing, warehouse stock sync, audit trails, reporting views. + +#### Key units +- **Java** + - `SrcMorphConfiguration`, `AiConditionEvaluator`, `AiOversizeStrategy`, `AiGenerationProviderFactory`, `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport`, `AiCompletionParser`, `AiGenerationTimings`. +- **Other (C/CLI/Python)** + - OpenCL kernels `histogram_partial`, `histogram_reduce`; ring buffer API (`ringbuf_init`, `ringbuf_write`, `ringbuf_read`); scripts `rotate_backups.sh`, `sales_report.py`. +- **SQL** + - Library tables (`author`, `book`, `member`, `loan`, `loan_audit`, `book_copy`), procedures (`fn_checkout_book`, `sp_return_book`, `fn_late_fee`), trigger `trg_loan_audit`, views (`overdue_loans`, `popular_books`). + - Shop tables (`product`, `customer_order`, `order_item`), procedure `add_order_item`. + - Warehouse tables (`StockLevel`, `SupplierFeed`, `SyncLog`), procedure `usp_SyncStock`. + +#### Data flow +1. **AI Engine** + - Load `SrcMorphConfiguration` → evaluate `AiCondition` trees → apply `AiOversizeStrategy` → extract facts → resolve provider via `AiGenerationProviderFactory` → generate text → parse and clean response → return `AiGenerationTimings`. +2. **GPU Utilities** + - Input byte stream → `histogram_partial` → `histogram_reduce` → 256‑bin histogram. + - Ring buffer: init → write → read → status queries. + - Scripts: archive directories → rotate backups; parse CSV → aggregate revenue → report. +3. **SQL Layer** + - Library: checkout → insert loan → audit trigger; return → update loan → audit trigger; late fee calculation; reporting views. + - Shop: add order item → lock product → update stock & order total. + - Warehouse: sync stock → aggregate feed → merge into `StockLevel` → log sync. + +#### Dependencies +- **Java** – Lombok, Jackson, OpenCL JNI (`net.ladenthin.llama`), Java 8 utilities, regex, annotations. +- **C/CLI** – OpenCL runtime, standard C libraries, shell utilities (`tar`, `date`, etc.). +- **Python** – argparse, csv, collections, dataclasses, datetime, decimal. +- **SQL** – PostgreSQL/MySQL/SQL Server built‑ins, PL/pgSQL, InnoDB, system functions. + +#### Cross-cutting +- Immutable configuration objects, defensive copying, stateless utilities, centralized error handling (`IllegalArgumentException`, `IOException`), unified timing metrics (`AiGenerationTimings`). +- Thread‑safe GPU kernels (atomic increments, barriers), lock‑free ring buffer (single‑producer/single‑consumer). +- Audit trails (`loan_audit`, `SyncLog`), concurrency controls (`SELECT … FOR UPDATE`, transaction blocks), constraints and indexes for data integrity and performance. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..83d9d414 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 1328F3D4 +- D: 2026-11-04T11:46:43Z +- T: 2026-11-04T11:56:01Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard project is an AI‑driven source‑code transformation engine that orchestrates analysis, generation, and provider abstraction for Maven‑based Java projects, leveraging a configuration‑driven framework to evaluate file‑selection rules and extract deterministic language facts. It integrates a modular AI generation provider layer that supports local llama.cpp, OpenAI‑compatible APIs, and a mock backend, while also offering GPU‑accelerated utilities such as a 256‑bin byte‑histogram kernel and a lock‑free power‑of‑two ring buffer for efficient byte stream handling. The system persists its transformations and domain data in a robust SQL layer, comprising PostgreSQL schemas for library management, MySQL for e‑commerce shop operations, and warehouse inventory, all backed by stored procedures that enforce audit, concurrency, and reporting requirements. Utility scripts provide backup rotation and monthly sales reporting, tying together the AI, GPU, and database components into a cohesive code‑generation and analytics platform. + +#### Packages +- java/config — A configuration‑driven AI‑powered source‑code analysis and generation framework that evaluates file‑selection rules, extracts deterministic language facts, and orchestrates model‑based code generation. +- java — A framework that orchestrates AI‑driven source‑code analysis, generation, and provider abstraction for Maven‑based projects. +- java/provider — A modular AI generation framework that abstracts multiple back‑ends (local llama.cpp, OpenAI‑compatible APIs, and a mock provider) and supplies utilities for request construction, response parsing, and timing metrics. +- other/kernels — Computes a 256‑bin histogram of a byte stream using two OpenCL kernel passes. +- other — Provides GPU‑accelerated byte‑histogram computation, a lock‑free power‑of‑two ring buffer for byte streams, and small utilities for backup rotation and sales reporting. +- other/ringbuf — A lock‑free, power‑of‑two sized circular buffer for byte streams, exposing a minimal API for allocation, read/write, and space queries. +- other/scripts — A small utility package that backs up directories and generates monthly sales reports from CSV order exports. +- . — A unified AI‑driven source‑code transformation engine with GPU‑accelerated utilities and a robust SQL persistence layer for library, shop, and warehouse domains. +- sql/library — A PostgreSQL‑based library management system that stores catalog, member, and loan data, supports checkout/return operations, and provides reporting views for overdue loans and popular books. +- sql — A set of relational schemas and stored procedures that manage library lending, e‑commerce orders, and warehouse inventory, each with audit, concurrency, and reporting support. +- sql/shop — A MySQL schema and stored procedure that manage a web shop’s product catalog, customer orders, and order line items, ensuring stock reservation and accurate order totals. +- sql/warehouse — Keeps the warehouse inventory in sync with nightly supplier feeds, logging each update. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..af86db9f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,74 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:53:49Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Defines the core tables and indexes for a PostgreSQL lending library system, modeling authors, books, members, and loan transactions. + +#### Purpose +- Store library catalog and member data. +- Track book loans and availability. + +#### Type +- Table: `author`, `book`, `member`, `loan`. +- Index: `idx_book_author`, `idx_loan_member`, `idx_loan_open`. +- PostgreSQL dialect. + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author(author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book(book_id)` + - `member_id BIGINT NOT NULL REFERENCES member(member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` + +- **Indexes** + - `idx_book_author ON book(author_id)` + - `idx_loan_member ON loan(member_id)` + - `idx_loan_open ON loan(due_on) WHERE returned_on IS NULL` + +#### Reads +- `author` (via foreign key in `book`). +- `book` (via foreign key in `loan`). +- `member` (via foreign key in `loan`). + +#### Writes +- `author`: INSERT, UPDATE, DELETE. +- `book`: INSERT, UPDATE, DELETE. +- `member`: INSERT, UPDATE, DELETE. +- `loan`: INSERT, UPDATE, DELETE. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- `author`, `book`, `member`, `loan` tables referenced by foreign keys and indexes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..dd27944c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,59 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:53:52Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> A set of reporting views for a library system, summarizing overdue loans, member loan statistics, and popular books. + +#### Purpose +- Provide read‑only reports on loan status and book popularity. +- Enable quick access to overdue loan details, member loan summaries, and recent popular books. + +#### Type +- PostgreSQL views and materialized view. +- `CREATE VIEW overdue_loans`, `CREATE VIEW member_loan_stats`, `CREATE MATERIALIZED VIEW popular_books`. +- `CREATE UNIQUE INDEX idx_popular_books_id` on `popular_books`. + +#### Schema +- **overdue_loans** + - `loan_id` integer + - `member_id` integer + - `email` text + - `title` text + - `due_on` date + - `days_overdue` integer +- **member_loan_stats** + - `member_id` integer + - `full_name` text + - `loans_total` bigint + - `loans_open` bigint + - `last_loan_on` timestamp +- **popular_books** + - `book_id` integer + - `title` text + - `author_name` text + - `times_loaned` bigint + - Unique index `idx_popular_books_id` on `(book_id)`. + +#### Reads +- `overdue_loans`: reads from `loan`, `member`, `book`. +- `member_loan_stats`: reads from `member`, `loan`. +- `popular_books`: reads from `loan`, `book`, `author`. + +#### Writes +- None (views are read‑only). + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. +- Views: none. +- Index: `idx_popular_books_id` on `popular_books`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..fbd584a9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,67 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:53:53Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Provides checkout, return, late‑fee calculation, and audit trail for a library system. + +#### Purpose +- Implements core lending operations: checkout, return, late fee, and audit logging. +- Enforces business rules: blocked members, available copies, and overdue fees. + +#### Type +- Table: `loan_audit` (PostgreSQL). +- Function: `fn_checkout_book` (plpgsql), `fn_late_fee` (sql), `trg_loan_audit_fn` (plpgsql trigger function). +- Procedure: `sp_return_book` (plpgsql). +- Trigger: `trg_loan_audit` (AFTER INSERT/UPDATE OF `returned_on` on `loan`). + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member` (`member_id`, `is_blocked`) – in `fn_checkout_book`. +- `book` (`book_id`, `copies_free`) – in `fn_checkout_book` and `sp_return_book`. +- `loan` (`loan_id`, `returned_on`, `book_id`) – in `sp_return_book` and `trg_loan_audit_fn`. + +#### Writes +- `loan_audit`: 1 row per checkout or return (triggered by `trg_loan_audit`). +- `book`: decrement `copies_free` on checkout; increment on return. +- `loan`: insert new loan in `fn_checkout_book`; update `returned_on` in `sp_return_book`. + +#### Relationships +- `loan_audit.loan_id -> loan.loan_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Reject if member blocked. + - Decrement `book.copies_free`; error if none. + - Insert into `loan` with `due_on = CURRENT_DATE + p_days`; return new `loan_id`. + +- **sp_return_book(p_loan_id)** + - Update `loan.returned_on = CURRENT_DATE`; capture `book_id`. + - If no row updated, error (unknown or already returned). + - Increment `book.copies_free` for that `book_id`. + +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Multiply by 50 cents, cap at 2000 cents. + +- **trg_loan_audit_fn()** + - On INSERT: log `CHECKOUT`. + - On UPDATE where `returned_on` changes from NULL to non‑NULL: log `RETURN`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Functions: `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `trg_loan_audit_fn`. +- Trigger: `trg_loan_audit`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..dc257e29 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,74 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:54:06Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Migrates the library schema to version 2: adds branches, creates a book‑copy table per branch, moves copy data, and updates member and loan tables. + +#### Purpose +- Introduce branch hierarchy and per‑branch book copies. +- Replace per‑book copy counters with a dedicated `book_copy` table. +- Update member and loan tables to reference branches and copies. + +#### Type +- PostgreSQL migration script (DDL). + +#### Schema +- **branch** + - `branch_id SMALLSERIAL PRIMARY KEY` + - `name VARCHAR(100) NOT NULL UNIQUE` + - `city VARCHAR(100) NOT NULL` + - Index: `idx_branch_name` (implicit from UNIQUE on `name`) + +- **book_copy** + - `copy_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book(book_id)` + - `branch_id SMALLINT NOT NULL REFERENCES branch(branch_id)` + - `barcode VARCHAR(32) NOT NULL UNIQUE` + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE','ON_LOAN','LOST'))` + - Index: `idx_book_copy_book` on `book_id` + +- **loan** (altered) + - Added column `copy_id BIGINT REFERENCES book_copy(copy_id)` + +- **member** (altered) + - Renamed column `joined_on` → `member_since` + - Added column `home_branch_id SMALLINT REFERENCES branch(branch_id)` + - Updated existing rows: `home_branch_id = 1` where NULL + +- **book** (altered) + - Dropped constraint `book_free_le_total` + - Dropped columns `copies_free`, `copies_total` + +#### Reads +- `book.book_id`, `book.isbn`, `book.copies_free`, `book.copies_total` (in `INSERT INTO book_copy` SELECT) +- `branch.branch_id` (implicit via foreign key) +- `loan` and `member` tables (for ALTER operations) + +#### Writes +- `branch`: 1 row inserted (`Main`, `Springfield`) +- `book_copy`: + - Family: 1 INSERT statement inserting `b.copies_total` rows per book + - Total rows: sum of `copies_total` across all books (exact count not specified) +- `member`: 1 UPDATE statement setting `home_branch_id = 1` where NULL +- `loan`: 1 ALTER TABLE adding column (no data written) +- `book`: 1 ALTER TABLE dropping columns and constraint + +#### Relationships +- `book_copy.book_id → book.book_id` +- `book_copy.branch_id → branch.branch_id` +- `loan.copy_id → book_copy.copy_id` +- `member.home_branch_id → branch.branch_id` + +#### Dependencies +- Existing tables: `book`, `loan`, `member` +- New table: `branch`, `book_copy` +- Existing constraint: `book_free_le_total` (removed) +- Foreign key references to `book`, `branch`, `book_copy` + +--- diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..f2260210 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,62 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:54:14Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Seed data for a PostgreSQL library system: authors, books, members, and loan records. + +#### Purpose +- Populate the `author`, `book`, `member`, and `loan` tables with initial test data. + +#### Type +- PostgreSQL data‑insertion script (DDL not present). + +#### Schema +- **author** + - `author_id` integer PK + - `full_name` text + - `birth_year` integer + - `country_code` char(2) +- **book** + - `book_id` integer PK + - `isbn` text + - `title` text + - `author_id` integer FK → `author.author_id` + - `published_year` integer + - `copies_total` integer + - `copies_free` integer +- **member** + - `member_id` integer PK + - `email` text + - `full_name` text + - `joined_on` date + - `is_blocked` boolean +- **loan** + - `loan_id` integer PK + - `book_id` integer FK → `book.book_id` + - `member_id` integer FK → `member.member_id` + - `loaned_on` date + - `due_on` date + - `returned_on` date (nullable) + +#### Reads +- None (only INSERT statements). + +#### Writes +- `author`: 15 rows +- `book`: 150 rows +- `member`: 50 rows +- `loan`: 150 rows + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- Tables referenced: `author`, `book`, `member`, `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..c81a6946 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,62 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:55:28Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL‑based library management system that stores catalog, member, and loan data, supports checkout/return operations, and provides reporting views for overdue loans and popular books. + +#### Purpose +- Persist library catalog, member, and loan information. +- Enforce lending rules and audit changes. +- Offer read‑only reporting on loan status and book popularity. + +#### Responsibilities +- **Data Modeling** – tables for authors, books, members, loans, and audit logs; indexes for performance. +- **Business Logic** – checkout, return, late‑fee calculation, and audit triggers. +- **Reporting** – views for overdue loans, member loan statistics, and popular books. +- **Schema Evolution** – migration to version 2 adding branches and per‑copy tracking. + +#### Key units +- `author`, `book`, `member`, `loan` tables – core entities. +- `loan_audit` table – audit trail for checkout/return actions. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee` – core routines. +- `trg_loan_audit` trigger – logs audit rows on loan changes. +- `overdue_loans`, `member_loan_stats`, `popular_books` views – reporting layers. +- `branch`, `book_copy` tables – added in migration v2 for branch and copy granularity. + +#### Data flow +1. **Checkout** (`fn_checkout_book`) + - Validates member and book availability. + - Decrements `copies_free` (or reserves a `book_copy`). + - Inserts a new `loan` row and triggers `loan_audit` with `CHECKOUT`. + +2. **Return** (`sp_return_book`) + - Updates `loan.returned_on`. + - Increments `copies_free` (or marks `book_copy` AVAILABLE). + - Trigger logs `RETURN` in `loan_audit`. + +3. **Late fee** (`fn_late_fee`) + - Computes overdue days and caps fee; used by application logic. + +4. **Reporting** + - Views join `loan`, `member`, `book`, and `author` to expose overdue counts, member loan summaries, and most‑loaned books. + +#### Dependencies +- Internal: `member`, `book`, `loan`, `author`, `loan_audit`, `branch`, `book_copy`. +- External: PostgreSQL built‑in functions (`now()`, `CURRENT_DATE`), PL/pgSQL, SQL. +- Migration script relies on existing `book`, `loan`, `member` tables before adding `branch` and `book_copy`. + +#### Cross-cutting +- **Constraints & Checks** – enforce data integrity (e.g., `copies_free <= copies_total`, `due_on > loaned_on`, status enums). +- **Indexes** – `idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_book_copy_book`, `idx_popular_books_id`. +- **Audit Trail** – `loan_audit` and trigger provide immutable change history for loans. +- **Branch & Copy Model** – migration replaces per‑book copy counters with a dedicated `book_copy` table, enabling per‑branch inventory tracking. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..315c9217 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,57 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:55:47Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A set of relational schemas and stored procedures that manage library lending, e‑commerce orders, and warehouse inventory, each with audit, concurrency, and reporting support. + +#### Purpose +- Persist and enforce business rules for library loans, shop orders, and warehouse stock. +- Provide transactional routines that maintain data integrity and audit trails. +- Expose read‑only reporting views for overdue loans, popular books, and order totals. + +#### Responsibilities +- **Library** – catalog, member, loan lifecycle, audit, and reporting. +- **Shop** – product catalog, order processing, stock reservation, and total calculation. +- **Warehouse** – nightly supplier feed ingestion, inventory aggregation, and sync logging. + +#### Key units +- **Library** + - Tables: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. + - Functions/Procedures: `fn_checkout_book`, `sp_return_book`, `fn_late_fee`. + - Trigger: `trg_loan_audit`. + - Views: `overdue_loans`, `member_loan_stats`, `popular_books`. +- **Shop** + - Tables: `product`, `customer_order`, `order_item`. + - Procedure: `add_order_item(p_order_id, p_sku, p_qty)`. +- **Warehouse** + - Tables: `StockLevel`, `SupplierFeed`, `SyncLog`. + - Procedure: `usp_SyncStock(@Since)`. + +#### Data flow +1. **Library** + - `fn_checkout_book` validates availability → inserts `loan` → trigger logs `CHECKOUT`. + - `sp_return_book` updates `loan.returned_on` → trigger logs `RETURN`. + - `fn_late_fee` calculates overdue charges for application use. + - Views aggregate loan data for reporting. +2. **Shop** + - `add_order_item` locks product row, validates stock, inserts/updates `order_item`, decrements `product.stock`, and recomputes `customer_order.total_cents`. +3. **Warehouse** + - `usp_SyncStock` aggregates `SupplierFeed` rows, merges into `StockLevel`, and records metrics in `SyncLog`. + +#### Dependencies +- **Internal** – cross‑package tables referenced by triggers, procedures, and views (`author`, `book`, `member`, `loan`, `product`, `customer_order`, `order_item`, `StockLevel`, `SupplierFeed`, `SyncLog`). +- **External** – PostgreSQL built‑ins (`now()`, `CURRENT_DATE`), PL/pgSQL, MySQL 8 InnoDB, SQL Server system functions (`SYSUTCDATETIME()`, `ERROR_MESSAGE()`). + +#### Cross-cutting +- **Audit & immutability** – `loan_audit` and `SyncLog` provide change history. +- **Concurrency control** – `SELECT … FOR UPDATE` in shop, transaction blocks in warehouse, and trigger‑based logging in library. +- **Constraints & indexes** – enforce data integrity and performance across all schemas. +- **Reporting layers** – read‑only views expose aggregated insights without affecting transactional logic. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..8d58ccc3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,72 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:54:18Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> A MySQL schema for a web shop that stores products, customer orders, and order items, and a stored procedure to add items to an order while reserving stock and updating totals. + +#### Purpose +- Stores product catalog, orders, and line items. +- Provides a procedure to add an item to an order, reserve stock, and recalculate the order total. + +#### Type +- **Tables**: `product`, `customer_order`, `order_item`. +- **Procedure**: `add_order_item`. +- Dialect: MySQL 8. + +#### Schema +- **product** + - `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `sku VARCHAR(40) NOT NULL` UNIQUE `uk_product_sku` + - `name VARCHAR(200) NOT NULL` + - `price_cents INT UNSIGNED NOT NULL` + - `stock INT NOT NULL DEFAULT 0` + - Engine: InnoDB, charset utf8mb4 + +- **customer_order** + - `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `customer_id BIGINT UNSIGNED NOT NULL` + - `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW'` + - `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` + - `total_cents INT UNSIGNED NOT NULL DEFAULT 0` + - Index `idx_order_customer` on `(customer_id, created_at)` + +- **order_item** + - `order_id BIGINT UNSIGNED NOT NULL` + - `product_id INT UNSIGNED NOT NULL` + - `quantity SMALLINT UNSIGNED NOT NULL` + - `unit_price_cents INT UNSIGNED NOT NULL` + - PK `(order_id, product_id)` + - FK `fk_item_order` references `customer_order(order_id)` ON DELETE CASCADE + - FK `fk_item_product` references `product(product_id)` + +#### Reads +- `product` (SELECT for SKU and stock). +- `order_item` (SELECT SUM for total calculation). + +#### Writes +- `order_item`: INSERT 1 row (or UPDATE if duplicate). +- `product`: UPDATE 1 row (stock decrement). +- `customer_order`: UPDATE 1 row (total_cents recalculation). + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (FK `fk_item_order`). +- `order_item.product_id -> product.product_id` (FK `fk_item_product`). + +#### Routine logic +- **Parameters**: `p_order_id BIGINT UNSIGNED`, `p_sku VARCHAR(40)`, `p_qty SMALLINT UNSIGNED`. +- **Steps**: + 1. SELECT `product_id`, `price_cents` into local vars where `sku = p_sku` and `stock >= p_qty` FOR UPDATE. + 2. If no product found, SIGNAL error. + 3. INSERT into `order_item`; on duplicate key, increment `quantity`. + 4. UPDATE `product` stock by subtracting `p_qty`. + 5. Recalculate `customer_order.total_cents` as SUM of `quantity * unit_price_cents` for the order. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item`. +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..d8a85128 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,43 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:55:39Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> A MySQL schema and stored procedure that manage a web shop’s product catalog, customer orders, and order line items, ensuring stock reservation and accurate order totals. + +#### Purpose +- Persist product catalog, orders, and order items. +- Provide a transactional routine to add items to an order, reserve stock, and update the order total. + +#### Responsibilities +- **Data persistence**: tables for `product`, `customer_order`, `order_item`. +- **Business logic**: stored procedure `add_order_item` that validates stock, inserts/updates line items, decrements inventory, and recalculates order totals. + +#### Key units +- **Tables** + - `product`: product catalog with SKU, price, and stock. + - `customer_order`: order header with status and total. + - `order_item`: line items linking orders to products. +- **Procedure** + - `add_order_item(p_order_id BIGINT UNSIGNED, p_sku VARCHAR(40), p_qty SMALLINT UNSIGNED)`: transactional routine for adding an item to an order. + +#### Data flow +1. Caller supplies order ID, product SKU, and quantity. +2. Procedure selects product ID and price with `FOR UPDATE` to lock stock. +3. If product exists and stock sufficient, inserts or updates `order_item`. +4. Decrements `product.stock` by the quantity. +5. Recalculates `customer_order.total_cents` as the sum of all line items for that order. + +#### Dependencies +- **Internal**: `product`, `customer_order`, `order_item` tables. +- **External**: None; relies solely on MySQL 8 features (InnoDB, ENUM, SIGNAL). + +#### Cross-cutting +- **Referential integrity**: foreign keys `fk_item_order` and `fk_item_product` enforce consistency. +- **Concurrency control**: `SELECT … FOR UPDATE` ensures atomic stock reservation. +- **Error handling**: procedure signals an error if the SKU is not found or stock is insufficient. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..55896c40 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,47 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:55:40Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Keeps the warehouse inventory in sync with nightly supplier feeds, logging each update. + +#### Purpose +- Aggregate supplier stock data and update the warehouse `StockLevel` table. +- Record sync metrics and errors in `SyncLog`. + +#### Responsibilities +- **Data ingestion** – read `SupplierFeed` rows since a given timestamp. +- **Data transformation** – aggregate quantities by `WarehouseId` and `Sku`. +- **Data persistence** – merge aggregates into `StockLevel` (update or insert). +- **Audit & error handling** – log start time, row counts, and any error messages. + +#### Key units +- **dbo.StockLevel** – warehouse inventory table (`WarehouseId`, `Sku`, `OnHand`, `UpdatedAt`). +- **dbo.SupplierFeed** – raw supplier feed rows (`WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`). +- **dbo.SyncLog** – audit table (`SyncLogId`, `StartedAt`, `RowsInserted`, `RowsUpdated`, `ErrorMessage`). +- **dbo.usp_SyncStock** – T‑SQL procedure that orchestrates the sync. + +#### Data flow +1. `usp_SyncStock(@Since)` starts a transaction and records `@Started`. +2. Supplier rows with `ReceivedAt >= @Since` are aggregated into a source table. +3. `MERGE` the source into `StockLevel`: + - `WHEN MATCHED` → `OnHand += Quantity`, `UpdatedAt = SYSUTCDATETIME()`. + - `WHEN NOT MATCHED BY TARGET` → insert new row. +4. Capture `$action` counts into `@Changes`. +5. Insert a row into `SyncLog` with `StartedAt`, `RowsInserted`, `RowsUpdated`, and any `ErrorMessage`. +6. Commit or rollback on error. + +#### Dependencies +- Internal tables: `StockLevel`, `SupplierFeed`, `SyncLog`. +- SQL Server system functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. +- Transaction control (`BEGIN TRANSACTION`, `COMMIT`, `ROLLBACK`). + +#### Cross-cutting +- **Merge logic** – single `MERGE` statement handles both updates and inserts. +- **Audit pattern** – consistent logging of start time and row counts. +- **Error handling** – transaction rollback and error message capture in `SyncLog`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..5942d472 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run1/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,77 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:54:26Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Synchronises nightly stock levels from a supplier feed into the warehouse inventory. + +#### Purpose +- Updates `dbo.StockLevel` with aggregated supplier quantities. +- Records sync statistics in `dbo.SyncLog`. + +#### Type +- Table: `dbo.StockLevel` +- Table: `dbo.SupplierFeed` +- Table: `dbo.SyncLog` +- Procedure: `dbo.usp_SyncStock` (T‑SQL) + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL CONSTRAINT DF_StockLevel_OnHand DEFAULT (0)` + - `UpdatedAt DATETIME2(0) NOT NULL CONSTRAINT DF_StockLevel_UpdatedAt DEFAULT (SYSUTCDATETIME())` + - PK: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL CONSTRAINT PK_SupplierFeed PRIMARY KEY` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL CONSTRAINT PK_SyncLog PRIMARY KEY` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + +#### Reads +- `dbo.SupplierFeed` (WHERE `ReceivedAt >= @Since`, GROUP BY `WarehouseId, Sku`) +- `dbo.StockLevel` (for merge matching) + +#### Writes +- `dbo.StockLevel` + - `UPDATE` on matched rows: `OnHand += source.Quantity`, `UpdatedAt = SYSUTCDATETIME()` + - `INSERT` on non‑matched rows: `WarehouseId, Sku, OnHand = source.Quantity` +- `dbo.SyncLog` + - `INSERT` once per sync: `StartedAt`, `RowsInserted`, `RowsUpdated` + - On error: `INSERT` with `ErrorMessage` + +#### Relationships +- `dbo.StockLevel (WarehouseId, Sku)` ↔ `dbo.SupplierFeed (WarehouseId, Sku)` (used in MERGE) + +#### Routine logic +- Parameters: `@Since DATETIME2(0)` +- Steps: + 1. Capture start time `@Started`. + 2. Aggregate supplier feed rows since `@Since` into `source` table. + 3. MERGE `source` into `dbo.StockLevel`: + - `WHEN MATCHED`: update `OnHand` and `UpdatedAt`. + - `WHEN NOT MATCHED BY TARGET`: insert new stock level. + - Capture `$action` into `@Changes`. + 4. Insert sync statistics into `dbo.SyncLog` from `@Changes`. + 5. Commit transaction; on error rollback and log error. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()` +- Transaction control: `BEGIN TRANSACTION`, `COMMIT`, `ROLLBACK` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/meta/gpt-6-luna.json new file mode 100644 index 00000000..88d09a11 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/meta/gpt-6-luna.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T11:56:04Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 203.1, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 80.0, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.4, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:00:51Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 86745, + "cachedPromptTokens": 86673, + "completionTokens": 20332, + "seconds": 202.4410654 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.01104, + "costUsd": 0.018234, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/meta/gpt-oss-20b.json new file mode 100644 index 00000000..5fdda70a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:00:52Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 136.1, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 85.7, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.3, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:04:36Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 88276, + "cachedPromptTokens": 24944, + "completionTokens": 18342, + "seconds": 135.493795 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.005033, + "costUsd": 0.003845, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..1643d92a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,70 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:56:05Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> File-condition evaluation lets the indexer select source files by extension, size, line count, modification time, and relative-path glob. + +#### Purpose +- Evaluates `AiCondition` trees against file facts in `AiFileContext`. +- Validates condition configuration and detects whether line counts are required. + +#### Type +- `public final class AiConditionEvaluator` — class; no supertypes declared. + +#### Input +- `AiConditionEvaluator()` takes no arguments. +- `matches(AiCondition condition, AiFileContext context)` consumes a condition tree and file name, size, line count, modification time, and relative path from `context`. +- `validate(AiCondition condition)` and `usesLines(AiCondition condition)` consume a condition tree. +- Reads condition branches and values through getters, including nullable group child lists. + +#### Output +- `matches(...)` returns whether the file satisfies the selected condition. +- `validate(...)` returns `void`; throws on invalid configuration. +- `usesLines(...)` returns whether a `lines` condition appears in the tree. +- No persistent state or resources are written; glob evaluation creates an `AiSourceExcludeFilter`. + +#### Core logic +- `matches` checks branches in order: `and`, `or`, `not`, `extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, `pathGlob`. + - `and`: recursively matches every child; null children list behaves as an empty list and matches. + - `or`: recursively matches until a child matches; null or empty children list does not match. + - `not`: negates recursive `matches`. + - `extensions`: `matchesExtension` checks whether `fileName` ends with any non-null extension. + - `size` and `lines`: calls `AiRangeCondition.contains` with `context.sizeBytes()` and `context.lineCount()`. + - `modifiedAfter` / `modifiedBefore`: compares `context.lastModifiedEpochMilli()` strictly greater / less than `parseEpochMilli(...)`. + - `pathGlob`: calls `globMatches(pathGlob, context.relativePath())`. + - If no branch is set, throws `IllegalStateException` using `ERROR_ONE_BRANCH`. +- `validate` requires `branchCount(condition) == 1`, then validates the selected branch: + - `and` / `or`: `validateGroup` requires at least one child and recursively validates each. + - `not`: recursively validates its child. + - `extensions`: rejects an empty list. + - `size` / `lines`: requires `AiRangeCondition.hasBound()`. + - Modification dates: parses with `parseEpochMilli`. + - `pathGlob`: rejects a trimmed blank string. +- `usesLines` returns true for a node with `getLines() != null`; otherwise searches `and`, `or`, or `not` recursively via `anyUsesLines`. +- `branchCount` counts non-null values among `and`, `or`, `not`, `extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, and `pathGlob`. +- `globMatches` builds `new AiSourceExcludeFilter(Collections.singletonList(glob))` and calls `.isExcluded(relativePath)`. +- `parseEpochMilli` uses `Instant.parse(isoInstant).toEpochMilli()`; converts `DateTimeParseException` to `IllegalArgumentException`. +- `ERROR_ONE_BRANCH` contains the invalid-node message prefix. + +#### Public API +- `AiConditionEvaluator()` — creates evaluator. +- `matches(AiCondition, AiFileContext) -> boolean` — tests file condition. +- `validate(AiCondition) -> void` — validates condition tree. +- `usesLines(AiCondition) -> boolean` — detects line-count conditions. + +#### Dependencies +- `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext` +- `AiSourceExcludeFilter` +- `Instant`, `DateTimeParseException`, `Collections`, `List` +- `Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for branch-count errors, empty combinators or extensions, unbounded ranges, invalid dates, and blank path globs. +- `parseEpochMilli` wraps `DateTimeParseException` in `IllegalArgumentException`. +- `matches` throws `IllegalStateException` if no branch is set; it assumes prior validation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..166bd586 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,47 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:56:15Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Groups child AI conditions so Maven configuration can supply them as the body of an `` or `` combinator. + +#### Purpose +- Stores the child `AiCondition` entries configured for a condition combinator. +- Uses a `conditions` field to support Maven’s collection-item XML binding. + +#### Type +- `public class AiConditionGroup` — class; no supertypes declared; annotated `@ToString` and `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`. +- Field: `private @Nullable List conditions`. + +#### Input +- `setConditions(Collection conditions)` accepts a nullable collection of child conditions. + +#### Output +- `getConditions()` returns the nullable child-condition list. +- `setConditions(...)` stores a defensive `ArrayList` copy, or `null`. + +#### Core logic +- `AiConditionGroup()` performs no initialization. +- `getConditions()` returns `conditions`. +- `setConditions(...)` assigns `new ArrayList<>(conditions)` when non-null; otherwise assigns `null`. + +#### Public API +- `AiConditionGroup()` — creates an empty group. +- `getConditions() -> @Nullable List` — returns child conditions. +- `setConditions(@Nullable Collection) -> void` — sets a defensive copy. + +#### Dependencies +- `AiCondition` +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No explicit exceptions or validation; null input clears the configured conditions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..ac7200a6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,63 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:56:19Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Produces exact whole-source counts for configured regex-based facts and formats them for inclusion with AI-generated summaries. + +#### Purpose +- `AiFactExtractor` builds a facts block from `AiFactCounter` labels and regex match counts. +- Validates fact-counter labels and regex patterns before use. + +#### Type +- `public final class AiFactExtractor` — class; no supertypes declared. +- `@Nullable` annotates nullable counter-list parameters. + +#### Input +- `factsBlock(List counters, String source)` — nullable counter list and full source text. +- `validate(List counters)` — nullable counter list. +- Reads each counter’s `getLabel()` and `getPattern()`. + +#### Output +- `factsBlock` returns `""` for null, empty, or entirely skipped counters; otherwise returns the formatted facts block ending in a blank line. +- `validate` returns no value; throws `IllegalArgumentException` for missing labels or patterns and invalid regexes. +- No I/O or mutable instance state. + +#### Core logic +- `factsBlock` returns `""` when `counters == null || counters.isEmpty()`. +- Iterates counters, skipping null counters and counters with null `getLabel()` or `getPattern()`. +- Appends each `label: count`, separated by `ENTRY_SEPARATOR`; counts use `countMatches(pattern, source)`. +- Returns `""` if no entries were appended; otherwise prefixes `FACTS_HEADER` and appends `FACTS_SUFFIX`. +- `validate` returns immediately for null counters; skips null entries. +- Throws `IllegalArgumentException` if `getLabel()` or `getPattern()` is null. +- Compiles each pattern with `Pattern.compile`; converts `PatternSyntaxException` to `IllegalArgumentException`, preserving the cause. +- `countMatches` compiles the pattern, repeatedly calls `Matcher.find()`, and counts non-overlapping matches, including zero-width matches. + +#### Public API +- `FACTS_HEADER: String` — facts block header. +- `LABEL_COUNT_SEPARATOR: String` — separates label and count. +- `ENTRY_SEPARATOR: String` — separates entries. +- `FACTS_SUFFIX: String` — separates facts from following body. +- `factsBlock(List, String) -> String` — builds exact facts block. +- `validate(List) -> void` — validates configured counters. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` +- `AiFactCounter` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for null label, null pattern, or invalid regex; invalid-regex errors wrap `PatternSyntaxException`. +- `factsBlock` skips null counters and counters with null labels or patterns. +- `countMatches` does not catch regex compilation errors. + +#### Concurrency +- Pure utility logic with no mutable instance state or I/O; thread safety depends on independent local regex matchers. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..7b4ea7be --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,106 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:56:27Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Configures model routing, prompt limits, sampling, hardware, caching, and stopping behavior for an AI generation step. + +#### Purpose +- Carries mutable per-model generation settings between Maven configuration and AI providers. +- Supplies defaults for inference, input trimming, provider selection, and calibration. + +#### Type +- `public class AiGenerationConfig` — class; annotated `@ToString`; no declared supertypes. +- Uses `@Nullable` for `modelPath`, `chatTemplateEnableThinking`, and `calibration`. + +#### Input +- Public no-argument constructor; initializes settings from `DEFAULT_*` constants. +- Setters accept model path, inference and sampling parameters, prompt limits, provider/API settings, hardware options, DRY options, stop strings, and optional `AiCalibration`. +- `setLazyMode`, `setCacheTypeK`, `setCacheTypeV`, `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, and `setApiKeyEnv` normalize `null` to defaults; list setters reset `null` to empty lists. + +#### Output +- Getters expose configuration values and optional model path, thinking mode, and calibration. +- `getDrySequenceBreakers()` and `getStopStrings()` return unmodifiable views. +- Setters mutate instance fields; Lombok-generated `toString()` supports diagnostics. + +#### Core logic +- Initializes inference defaults: context size `32768`, output tokens `128`, temperature `0.15f`, and CPU threads `Math.min(4, Runtime.getRuntime().availableProcessors())`. +- Sets prompt trimming defaults: `charsPerToken=4`, `maxInputChars=120000`, `warnOnTrim=true`; this class stores limits but does not calculate them. +- Sets sampling defaults: `topP=0.9f`, `topK=40`, `minP=0.0f`, `topNSigma=-1.0f`, `repeatPenalty=1.0f`, `repeatLastN=-1`. +- Sets inference and cache defaults, including `cachePrompt=true`, `swaFull=true`, `cacheReuse=256`, `flashAttn=false`, and unset sentinels for hardware and batch options. +- Sets provider defaults: empty `provider`, `remoteModel`, and `apiKeyEnv`; `baseUrl="https://openrouter.ai/api/v1"`. +- Sets reasoning defaults: `reasoningEffort="low"`, `reasoningBudgetTokens=-1`, nullable `chatTemplateEnableThinking`. +- Sets DRY defaults: disabled `dryMultiplier=0.0f`, `dryBase=1.75f`, `dryAllowedLength=2`, `dryPenaltyLastN=-1`; initializes `drySequenceBreakers` and `stopStrings` as empty `ArrayList`s. +- `setLazyMode`, `setCacheTypeK`, `setCacheTypeV`, and string routing setters replace `null` with the corresponding `DEFAULT_*`; `setDevices` does likewise. +- List getters wrap their current lists with `Collections.unmodifiableList`; list setters retain a supplied non-null list or allocate an empty `ArrayList`. +- Defines defaults for context/output sizing, sampling, prompt limits, caching, GPU/CPU offload, KV cache, batching, provider routing, reasoning, and DRY configuration. + +#### Public API +- `AiGenerationConfig()` -> constructor; applies defaults. +- Each property line gives getter / setter -> purpose: +- `getModelPath()` / `setModelPath(String)` -> GGUF model path. +- `getContextSize()` / `setContextSize(int)` -> context window. +- `getMaxOutputTokens()` / `setMaxOutputTokens(int)` -> output token limit. +- `getTemperature()` / `setTemperature(float)` -> sampling temperature. +- `getThreads()` / `setThreads(int)` -> inference thread count. +- `getCharsPerToken()` / `setCharsPerToken(int)` -> input token estimate. +- `getMaxInputChars()` / `setMaxInputChars(int)` -> prompt input character limit. +- `isWarnOnTrim()` / `setWarnOnTrim(boolean)` -> trim warning setting. +- `getTopP()` / `setTopP(float)` -> nucleus sampling threshold. +- `getTopK()` / `setTopK(int)` -> top-k limit. +- `getRepeatPenalty()` / `setRepeatPenalty(float)` -> repetition penalty. +- `getMinP()` / `setMinP(float)` -> min-p threshold. +- `getTopNSigma()` / `setTopNSigma(float)` -> top-n-sigma threshold. +- `getChatTemplateEnableThinking()` / `setChatTemplateEnableThinking(Boolean)` -> nullable thinking mode. +- `isCachePrompt()` / `setCachePrompt(boolean)` -> prompt-prefix caching. +- `isSwaFull()` / `setSwaFull(boolean)` -> full SWA KV cache. +- `getCacheReuse()` / `setCacheReuse(int)` -> KV prefix reuse chunk size. +- `getGpuLayers()` / `setGpuLayers(int)` -> GPU layer offload. +- `getCpuMoeLayers()` / `setCpuMoeLayers(int)` -> CPU MoE layers. +- `getSeed()` / `setSeed(int)` -> generation RNG seed. +- `getCpuFfnLayers()` / `setCpuFfnLayers(int)` -> CPU FFN layers. +- `getKvUnifiedPerSlot()` / `setKvUnifiedPerSlot(int)` -> per-slot KV context cap. +- `getLazyMode()` / `setLazyMode(String)` -> tensor-read laziness. +- `getRepeatLastN()` / `setRepeatLastN(int)` -> repetition penalty window. +- `getCacheTypeK()` / `setCacheTypeK(String)` -> K-cache data type. +- `getCacheTypeV()` / `setCacheTypeV(String)` -> V-cache data type. +- `isFlashAttn()` / `setFlashAttn(boolean)` -> Flash Attention setting. +- `getBatchSize()` / `setBatchSize(int)` -> logical batch size. +- `getUbatchSize()` / `setUbatchSize(int)` -> physical batch size. +- `getThreadsBatch()` / `setThreadsBatch(int)` -> prompt-processing threads. +- `getMainGpu()` / `setMainGpu(int)` -> primary GPU index. +- `getDevices()` / `setDevices(String)` -> selected backend devices. +- `getProvider()` / `setProvider(String)` -> per-model AI provider. +- `getRemoteModel()` / `setRemoteModel(String)` -> remote model identifier. +- `getBaseUrl()` / `setBaseUrl(String)` -> OpenAI-compatible API base URL. +- `getApiKeyEnv()` / `setApiKeyEnv(String)` -> API-key environment variable name. +- `getReasoningEffort()` / `setReasoningEffort(String)` -> reasoning effort kwarg. +- `getReasoningBudgetTokens()` / `setReasoningBudgetTokens(int)` -> reasoning token budget. +- `getDryMultiplier()` / `setDryMultiplier(float)` -> DRY repetition penalty multiplier. +- `getDryBase()` / `setDryBase(float)` -> DRY exponential base. +- `getDryAllowedLength()` / `setDryAllowedLength(int)` -> DRY unpenalized n-gram length. +- `getDryPenaltyLastN()` / `setDryPenaltyLastN(int)` -> DRY look-back window. +- `getDrySequenceBreakers()` / `setDrySequenceBreakers(List)` -> DRY sequence breakers. +- `getStopStrings()` / `setStopStrings(List)` -> generation stop strings. +- `getCalibration()` / `setCalibration(AiCalibration)` -> per-machine timing calibration. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `AiCalibration` +- `Runtime` + +#### Exceptions / Errors +- No explicit exceptions or validation checks. +- Nullable model path, thinking mode, and calibration; nullable list/string setter inputs are handled as described above. +- Setters generally store values without range validation. + +#### Concurrency +- Mutable JavaBean; no synchronization or thread-safety guarantees. +- List getters prevent mutation through the returned view, but setters can replace the backing list. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..a7842f95 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,50 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:56:50Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Configures how source files exceeding a routed model’s context window are handled: fail, sample, map-reduce, or emit a deterministic summary. + +#### Purpose +- Defines the `` strategy tokens and default for oversized source files. +- Parses configured tokens into an `AiOversizeStrategy`. + +#### Type +- `public enum AiOversizeStrategy` — enum; no explicit supertypes. +- Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`. +- `DEFAULT` — `public static final AiOversizeStrategy`. + +#### Input +- `fromConfig(@Nullable String value)` consumes a configured `` token; accepts `null` and blank strings. +- Constructor accepts a `String configValue`. + +#### Output +- `configValue()` returns the strategy’s config token. +- `fromConfig(...)` returns the matching strategy or `DEFAULT`. +- Stores each strategy’s token in private final field `configValue`. + +#### Core logic +- `fromConfig` returns `DEFAULT` when `value` is `null` or `value.trim().isEmpty()`. +- Iterates over `values()` and compares `strategy.configValue.equalsIgnoreCase(trimmed)`. +- Throws `IllegalArgumentException` for an unknown non-blank token. +- Token mappings: `FAIL` → `"fail"`, `SAMPLE` → `"sample"`, `MAP_REDUCE` → `"mapReduce"`, `DETERMINISTIC` → `"deterministic"`. + +#### Public API +- `configValue()` -> `String` — return config token. +- `fromConfig(String)` -> `AiOversizeStrategy` — parse config token. +- `DEFAULT: AiOversizeStrategy` — default strategy. +- `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` — strategy constants. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `fromConfig` throws `IllegalArgumentException` if a non-blank value matches no strategy; the error includes the original value. + +#### Concurrency +- Enum constants and `configValue` are immutable. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..a502b528 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,82 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:56:58Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Configures source indexing and AI-generated documentation, including file selection, model routing, inference settings, and output metadata. + +#### Purpose +- `SrcMorphConfiguration` is the mutable shared configuration for a `srcmorph` run, usable from Maven, future JSON/YAML binding, or Java callers. +- Holds source-selection rules, AI prompt/model/routing definitions, llama.cpp fallbacks, and generated-documentation metadata. + +#### Type +- `public class SrcMorphConfiguration` — class; no declared superclass or interfaces; annotated `@ToString`. +- Public static final constants: `DEFAULT_OUTPUT_DIRECTORY`, `DEFAULT_GENERATION_PROVIDER`, `DEFAULT_LLAMA_CONTEXT_SIZE`, `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS`, `DEFAULT_LLAMA_TEMPERATURE`, `DEFAULT_LLAMA_THREADS`, `DEFAULT_AI_VERSION`. +- Public no-argument constructor; mutable JavaBean fields and setters. + +#### Input +- Constructor takes no parameters. +- Setters accept project/output directories; force and plan-only flags; source subtree, exclude, and extension lists; file-size bounds; generation provider; prompt, model, field-generation, and fact-definition lists; model directory and llama model path; llama context, token, temperature, and thread settings; plugin/AI versions; and project name. +- Nullable inputs: `subtrees`, `excludes`, `fileExtensions`, `promptDefinitions`, `aiDefinitions`, `modelDirectory`, `fieldGenerations`, `factDefinitions`, `llamaModelPath`, and `projectName`. + +#### Output +- Getters expose the configured values; setters mutate the corresponding fields. +- Default values: output directory `src/site/ai`; provider `mock`; llama context size `2048`; max output tokens `128`; temperature `0.15f`; threads `AiGenerationConfig.DEFAULT_THREADS`; AI version `0.0.0`. +- Other fields default to Java defaults: `null`, `false`, or `0`; `pluginVersion` defaults to `""`. +- `@ToString` provides a generated string representation. + +#### Core logic +- Defines defaults for output location, generation provider, llama.cpp inference parameters, and AI summarisation version. +- Stores source-selection configuration: `baseDirectory`, `subtrees`, `excludes`, `fileExtensions`, `minFileSizeBytes`, and `maxFileSizeBytes`. +- Stores generation controls: `force`, `planOnly`, `generationProvider`, `promptDefinitions`, `aiDefinitions`, `fieldGenerations`, and `factDefinitions`. +- Stores model resolution and fallback settings: `modelDirectory`, `llamaModelPath`, `llamaContextSize`, `llamaMaxOutputTokens`, `llamaTemperature`, and `llamaThreads`. +- Stores output metadata: `pluginVersion`, `aiVersion`, and `projectName`. +- `DEFAULT_LLAMA_THREADS` delegates to `AiGenerationConfig.DEFAULT_THREADS`; other defaults are literals. +- Accessors assign and return fields directly; no processing or validation is shown. + +#### Public API +- `DEFAULT_OUTPUT_DIRECTORY: String`, `DEFAULT_GENERATION_PROVIDER: String`, `DEFAULT_LLAMA_CONTEXT_SIZE: int`, `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS: int`, `DEFAULT_LLAMA_TEMPERATURE: float`, `DEFAULT_LLAMA_THREADS: int`, `DEFAULT_AI_VERSION: String` — configuration defaults. +- `SrcMorphConfiguration()` — initializes default configuration. +- `getBaseDirectory()`/`setBaseDirectory(File)` -> project base directory. +- `getOutputDirectory()`/`setOutputDirectory(File)` -> generated file directory. +- `isForce()`/`setForce(boolean)` -> force regeneration. +- `getSubtrees()`/`setSubtrees(List)` -> source subtree scope. +- `getExcludes()`/`setExcludes(List)` -> excluded source globs. +- `getFileExtensions()`/`setFileExtensions(List)` -> indexed extensions. +- `getMinFileSizeBytes()`/`setMinFileSizeBytes(long)` -> exclusive lower size bound. +- `getMaxFileSizeBytes()`/`setMaxFileSizeBytes(long)` -> inclusive upper size bound. +- `isPlanOnly()`/`setPlanOnly(boolean)` -> planning-only execution. +- `getGenerationProvider()`/`setGenerationProvider(String)` -> AI provider name. +- `getPromptDefinitions()`/`setPromptDefinitions(List)` -> prompt templates. +- `getAiDefinitions()`/`setAiDefinitions(List)` -> model definitions. +- `getModelDirectory()`/`setModelDirectory(File)` -> relative model path base. +- `getFieldGenerations()`/`setFieldGenerations(List)` -> per-field routing rules. +- `getFactDefinitions()`/`setFactDefinitions(List)` -> reusable fact groups. +- `getLlamaModelPath()`/`setLlamaModelPath(String)` -> llama.cpp fallback model path. +- `getLlamaContextSize()`/`setLlamaContextSize(int)` -> fallback context window. +- `getLlamaMaxOutputTokens()`/`setLlamaMaxOutputTokens(int)` -> fallback output token limit. +- `getLlamaTemperature()`/`setLlamaTemperature(float)` -> fallback sampling temperature. +- `getLlamaThreads()`/`setLlamaThreads(int)` -> fallback inference thread count. +- `getPluginVersion()`/`setPluginVersion(String)` -> generated-file plugin version. +- `getAiVersion()`/`setAiVersion(String)` -> generated-file AI version. +- `getProjectName()`/`setProjectName(String)` -> aggregate index title. + +#### Dependencies +- `java.io.File`, `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `AiGenerationConfig`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No explicit exceptions, validation, or error handling. +- Nullable configuration values are annotated `@Nullable`. +- File-size documentation defines `minFileSizeBytes <= 0` as disabled and `maxFileSizeBytes <= 0` as unlimited. + +#### Concurrency +- Mutable fields; no synchronization or thread-safety guarantees shown. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/package.ai.md new file mode 100644 index 00000000..f85d8c00 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/config/package.ai.md @@ -0,0 +1,50 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:59:28Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> Defines source-file selection, AI generation settings, and factual metadata used to produce indexed source documentation. + +#### Purpose +- Centralizes `srcmorph` run configuration, including source scope, model routing, generation controls, and output metadata. +- Provides condition evaluation and fact-count formatting utilities for indexing and AI-generated summaries. + +#### Responsibilities +- **Source selection:** `AiConditionEvaluator` validates and evaluates nested conditions over file extension, size, line count, modification time, and relative-path glob; `AiConditionGroup` supports Maven binding of `` and `` child conditions. +- **Generation configuration:** `SrcMorphConfiguration` holds run-wide settings, while `AiGenerationConfig` carries per-model inference, sampling, provider, caching, hardware, reasoning, and stopping options. +- **Oversize handling:** `AiOversizeStrategy` parses the configured policy for files larger than a routed model’s context window. +- **Facts:** `AiFactExtractor` validates regex-based counters and formats whole-source match counts as a facts block. + +#### Key units +- `SrcMorphConfiguration` — stores source-selection rules, generation definitions, llama.cpp fallbacks, and generated-documentation metadata. +- `AiGenerationConfig` — mutable per-model settings with defaults for inference and provider behavior. +- `AiConditionEvaluator` — validates condition trees, detects line-count requirements, and tests conditions against `AiFileContext`. +- `AiConditionGroup` — stores a defensive copy of child conditions for configuration binding. +- `AiFactExtractor` — validates `AiFactCounter` definitions and formats their regex match counts. +- `AiOversizeStrategy` — represents `FAIL`, `SAMPLE`, `MAP_REDUCE`, or `DETERMINISTIC` handling policies. + +#### Data flow +- Source-file facts in `AiFileContext` are checked against validated `AiCondition` trees; path globs are evaluated through `AiSourceExcludeFilter`. +- Configured `AiFactCounter` patterns are matched against full source text and rendered as a labeled facts block. +- Maven or Java configuration populates `SrcMorphConfiguration` and per-model `AiGenerationConfig`; `AiOversizeStrategy.fromConfig` converts the configured oversize token to a strategy. + +#### Dependencies +- Configuration types: `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`. +- Condition evaluation types: `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, `AiSourceExcludeFilter`. +- Fact extraction type: `AiFactCounter`; Java regex and time APIs support counting and date parsing. +- Uses Java collections, `Nullable` annotations, and Lombok `@ToString`. + +#### Cross-cutting +- Configuration classes are mutable JavaBeans with no synchronization or thread-safety guarantees. +- `AiConditionEvaluator` and `AiFactExtractor` validate configuration explicitly; configuration holders generally store values without range validation. +- Nullable collection and string inputs are handled differently by type: condition groups preserve `null`, while several generation-setting setters substitute defaults or empty lists. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..24001eed --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,55 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:59:44Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Configures source analysis and turns selected source files into AI-generated documentation using local or OpenAI-compatible text-generation backends. + +#### Purpose +- Defines source-selection, generation, and metadata settings for indexed source documentation. +- Selects AI completion providers and supports response cleanup, timing, and lifecycle management. + +#### Responsibilities +- **Configuration and source selection:** `SrcMorphConfiguration`, `AiGenerationConfig`, condition evaluation, oversize policies, and fact-count formatting. +- **Provider selection and local inference:** provider contract and factory, mock fallback, and lazy llama.cpp model execution. +- **Remote generation support:** OpenAI-compatible chat-request construction, endpoint and API-key handling, error formatting, and timing metrics. +- **Completion normalization:** trims generated text and removes a leading Gemma-4 thinking block. + +#### Key units +- `SrcMorphConfiguration` — stores run-wide source rules, generation definitions, fallback settings, and documentation metadata. +- `AiGenerationConfig` — holds per-model inference, sampling, provider, caching, hardware, reasoning, and stopping settings. +- `AiConditionEvaluator` — validates and evaluates file conditions using `AiFileContext`. +- `AiFactExtractor` — validates fact-counter definitions and formats regex match counts from source text. +- `AiOversizeStrategy` — represents `FAIL`, `SAMPLE`, `MAP_REDUCE`, and `DETERMINISTIC` policies. +- `AiGenerationProvider` — defines completion generation, optional timing reporting, and close behavior. +- `AiGenerationProviderFactory` — resolves model-level or run-level provider settings and creates the selected backend. +- `LlamaCppJniAiGenerationProvider` — runs local llama.cpp inference and exposes generation timings. +- `LlamaCppJniConfig` — immutable local-generation settings constructed through a fluent builder. +- `OpenAiCompatibleProviderSupport` — prepares remote chat-completions requests and handles endpoint, API-key, error, and timing support. +- `AiCompletionParser` — trims completion text and removes a leading thinking block. + +#### Data flow +- Run and model settings populate `SrcMorphConfiguration` and `AiGenerationConfig`; source facts are checked against validated conditions, with path globs evaluated through `AiSourceExcludeFilter`. +- Fact-counter patterns match full source text and produce a labeled facts block. +- The provider factory selects a backend from the model provider key or run-level key, defaulting to mock when selection is absent or blank. +- Providers consume `AiGenerationRequest`: local inference uses `LlamaCppJniProviderSupport` and parses its response; remote support builds a chat request from configured options and prompt messages. +- Local completion text passes through `AiCompletionParser`; providers may also report generation timing metrics. + +#### Dependencies +- Configuration and domain types include `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`, `AiCondition`, `AiRangeCondition`, `AiFileContext`, and `AiFactCounter`. +- Provider collaboration includes `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, `ChatResponseParser`, and `LlamaCppJniProviderSupport`. +- Local inference uses `LlamaModel`, `ModelParameters`, `FlashAttn`, and `ReasoningFormat`; remote support uses Jackson JSON nodes and `ChatResponse` usage data. +- Java collections, regex and time APIs, `Java8CompatibilityHelper`, JSpecify `Nullable`, and Lombok annotations support configuration and provider code. + +#### Cross-cutting +- Configuration holders are generally mutable JavaBeans without synchronization; `LlamaCppJniConfig` is immutable, while its builder is mutable and not thread-safe. +- Condition and fact configuration receive explicit validation; most configuration holders do not validate ranges. +- Local model creation is lazy and cached, with no declared thread-safety guarantee; missing timing data yields zero metrics. +- OpenAI-compatible API keys are trimmed and are not sent to non-loopback hosts; endpoints must use HTTP or HTTPS. +- `AiGenerationProvider` extends `AutoCloseable`, with default no-op close and zero-valued timing behavior; an unclosed leading thinking block causes `AiCompletionParser` to throw `IOException`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..5768bef4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,47 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:57:10Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Removes leading model-internal reasoning from AI completion text before the answer is stored. + +#### Purpose +- `AiCompletionParser` cleans raw completion text by stripping a leading Gemma-4 thinking block while preserving markers that appear elsewhere in the answer. + +#### Type +- `AiCompletionParser` — public class; non-final; annotated `@ToString`. + +#### Input +- `parseCompletion(String response)` consumes raw model completion text; `response` may be `null`. +- Uses `THINKING_BLOCK_START_MARKER` and `THINKING_BLOCK_END_MARKER` to identify a leading thinking block. + +#### Output +- Returns trimmed answer text, never `null`; `null` input produces `""`. +- Throws `IOException` if a leading thinking block lacks its closing marker. + +#### Core logic +- `parseCompletion` returns `""` for `null`; otherwise assigns `response.trim()` to `trimmed`. +- If `trimmed` does not `startsWith(THINKING_BLOCK_START_MARKER)`, returns `trimmed` unchanged apart from trimming. +- For a leading block, removes the start marker with `substring`, then finds the first `THINKING_BLOCK_END_MARKER` using `indexOf`. +- If no closing marker is found, throws `IOException` with an actionable token-budget message and the raw response length. +- Otherwise returns the text after the first closing marker, trimmed; later marker text is preserved. +- `THINKING_BLOCK_START_MARKER` is `"<|channel>thought"`; `THINKING_BLOCK_END_MARKER` is `""`. + +#### Public API +- `AiCompletionParser()` — constructs parser. +- `THINKING_BLOCK_START_MARKER: String` — opening thinking token. +- `THINKING_BLOCK_END_MARKER: String` — closing thinking token. +- `parseCompletion(String response) -> String` — strips a leading thinking block. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `parseCompletion` throws `IOException` when a leading thinking block has no closing marker. +- Handles `null` input as an empty response. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..bab909a3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,46 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:57:16Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Generates text from an AI generation request and optionally reports model timing for calibration. + +#### Purpose +- Defines the pluggable backend contract for generating text from `AiGenerationRequest`. +- Provides default timing and resource-close behavior for providers that do not expose timings or need no cleanup. + +#### Type +- `public interface AiGenerationProvider` — interface; extends `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume a generation request containing a prompt key, source file, source text, and current header. + +#### Output +- `generate` returns generated text. +- `generateWithTimings` returns generated text and timing rates; the default reports zero timings. +- Default `close()` performs no action. + +#### Core logic +- `generateWithTimings` calls `generate(request)` and wraps its result in `AiGenerationTimings` with timing values `0, 0, 0.0d, 0, 0.0d`. +- Provider implementations supply `generate`; implementations with timing data may override `generateWithTimings`. +- Default `close()` is empty. + +#### Public API +- `generate(AiGenerationRequest request) -> String` — generate text. +- `generateWithTimings(AiGenerationRequest request) -> AiGenerationTimings` — generate text with timing data. +- `close() -> void` — release provider resources. + +#### Dependencies +- `AutoCloseable` +- `IOException` +- `AiGenerationRequest` +- `AiGenerationTimings` + +#### Exceptions / Errors +- `generate`, `generateWithTimings`, and `close` declare `IOException`. +- `generate` is documented to return non-null text, which may be blank. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..11e7fa99 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,64 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:57:20Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Selects the configured AI generation backend for a model, defaulting to deterministic mock generation when no provider is specified. + +#### Purpose +- Resolves a model-specific provider key over the run-level key and creates the matching AI generation provider. +- Defaults blank or absent provider configuration to `MockAiGenerationProvider`. + +#### Type +- `public class AiGenerationProviderFactory` — class; annotated `@ToString`. +- `@ToString` generates a `toString()` method. + +#### Input +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` — run provider key, model configuration, and prompt lookup support. +- `effectiveProvider(@Nullable String runProvider, @Nullable String modelProvider)` — nullable run and model provider keys. +- Private final field `compatibilityHelper`, initialized as `new Java8CompatibilityHelper()`. + +#### Output +- `create(...)` returns a newly created `AiGenerationProvider`. +- `effectiveProvider(...)` returns the trimmed model provider when nonblank; otherwise returns the run provider. +- `create(...)` constructs a mock, llama.cpp JNI, or OpenAI-compatible provider. + +#### Core logic +- `effectiveProvider` checks whether `modelProvider` is `null` or `modelProvider.trim().isEmpty()`: + - If so, returns `runProvider`. + - Otherwise, returns `modelProvider.trim()`. +- `create` calls `effectiveProvider(providerName, llamaConfig.provider())`. +- If the effective key is `null` or `compatibilityHelper.isBlank(effective)`, returns `new MockAiGenerationProvider()`. +- Switches on `effective`: + - `PROVIDER_MOCK` → `new MockAiGenerationProvider()`. + - `PROVIDER_LLAMACPP_JNI` → `new LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)`. + - `PROVIDER_OPENAI_COMPATIBLE` → `new OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)`. + - Otherwise throws `IllegalArgumentException("Unsupported AI provider: " + effective)`. + +#### Public API +- `AiGenerationProviderFactory()` → constructor; creates factory. +- `PROVIDER_MOCK: String` — mock provider key. +- `PROVIDER_LLAMACPP_JNI: String` — llama.cpp JNI provider key. +- `PROVIDER_OPENAI_COMPATIBLE: String` — OpenAI-compatible provider key. +- `effectiveProvider(String runProvider, String modelProvider) -> @Nullable String` — resolves model/run provider key. +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport) -> AiGenerationProvider` — creates configured provider. + +#### Dependencies +- `AiGenerationProvider` +- `MockAiGenerationProvider` +- `LlamaCppJniAiGenerationProvider` +- `OpenAiCompatibleAiGenerationProvider` +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `Java8CompatibilityHelper` +- Lombok `@ToString` +- JSpecify `@Nullable` + +#### Exceptions / Errors +- `create` throws `IllegalArgumentException` for an unsupported nonblank provider key. +- `effectiveProvider` accepts nullable keys; blank model keys fall back to the run key. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..c6216ddc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,64 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:57:27Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Generates local AI completions from GGUF models through llama.cpp, with configurable inference, GPU, and KV-cache behavior. + +#### Purpose +- Implements request-to-completion generation using a locally loaded GGUF model. +- Exposes model timing and KV-cache reuse metrics, and releases the native model handle on close. + +#### Type +- `public final class LlamaCppJniAiGenerationProvider` — class; implements `AiGenerationProvider`, `AutoCloseable`; annotated `@ToString`. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`; both required non-null. +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume generation requests. +- `LlamaCppJniProviderSupport` builds chat-template kwargs and inference parameters from configuration and prompts. +- Model setup reads `modelPath`, `contextSize`, `threads`, `swaFull`, `cacheReuse`, `gpuLayers`, `cpuMoeLayers`, `cpuFfnLayers`, `kvUnifiedPerSlot`, `lazyMode`, `flashAttn`, `cacheTypeK`, `cacheTypeV`, `batchSize`, `ubatchSize`, `threadsBatch`, `mainGpu`, and `devices`. + +#### Output +- `generate(...)` returns parsed completion text; may log truncation and prompt-cache reuse. +- `generateWithTimings(...)` returns `AiGenerationTimings` with text, prompt token count, cache token count, prompt throughput, predicted token count, and predicted throughput. +- Lazily creates and caches a `LlamaModel`; `close()` closes it if loaded. +- Lombok-generated `toString` excludes `model` and `support`. + +#### Core logic +- `model()` returns the cached `model` when present; otherwise: + - Gets `chatTemplateKwargs` from `support.buildChatTemplateKwargs()`. + - Builds `ModelParameters` with model path, context size, threads, `ReasoningFormat.AUTO`, and chat-template kwargs. + - Applies optional settings when their guards pass: SWA full, cache reuse, GPU layers, CPU MoE/FFN layers, unified KV slot budget, lazy mode, flash attention, K/V cache types, batch and ubatch sizes, batch threads, main GPU, and explicit devices. + - Converts lazy mode and cache types through `LlamaCppJniProviderSupport.lazyMode(...)` and `LlamaCppJniProviderSupport.cacheType(...)`. + - Creates `new LlamaModel(modelParameters)`, stores it in `model`, and returns it. +- `chatResponse(request)` calls `support.buildInferenceParameters(request)`, runs `model().chatComplete(...)`, and parses the full response with `chatResponseParser.parseResponse(...)`. +- `generate(request)` obtains the response, calls `support.warnOnTruncatedAnswer(...)` and `support.logPromptCacheReuse(...)`, then returns `completionParser.parseCompletion(response.getFirstContent())`. +- `generateWithTimings(request)` extracts response text and timings; missing timings yield zero counts and rates. Otherwise returns prompt/predicted counts and rates plus `timings.getCacheN()`. +- `close()` closes the cached model when non-null. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport)` — create provider with lazy model loading. +- `generate(AiGenerationRequest) -> String` — generate completion text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` — generate text and measured metrics. +- `close() -> void` — close loaded model. + +#### Dependencies +- `AiGenerationProvider`, `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport` +- `LlamaCppJniConfig`, `LlamaCppJniProviderSupport`, `AiCompletionParser` +- `LlamaModel`, `ModelParameters`, `FlashAttn`, `ReasoningFormat` +- `ChatResponseParser`, `ChatResponse`, `Timings` +- `Java8CompatibilityHelper`, `Objects`, `Map`, `IOException`, Lombok `ToString`, JSpecify `Nullable` + +#### Exceptions / Errors +- Constructor uses `Objects.requireNonNull` for `config` and `promptSupport`. +- `generate(...)` declares `IOException`. +- `generateWithTimings(...)` handles absent timings by returning zero metrics. +- `close()` only closes a model if one has been initialized. + +#### Concurrency +- Lazy initialization and cached `model` are unsynchronized; no thread-safety guarantee is declared. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..390e95e0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,134 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:57:36Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Configures llama.cpp and OpenAI-compatible model generation, including sampling, hardware, caching, reasoning, and stop controls. + +#### Purpose +- Defines immutable generation settings initialized from `AiGenerationConfig` defaults and customized through a fluent builder. +- Exposes record-style accessors for model, sampling, runtime, provider, and stop-sequence settings. + +#### Type +- `public final class LlamaCppJniConfig` — class; annotated `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`; private constructor accepts `Builder`. +- `public static final class Builder` — nested class; fluent mutable builder for `LlamaCppJniConfig`. + +#### Input +- `builder(String modelPath)` requires the GGUF model path; builder constructor rejects null. +- Builder setters accept generation limits, sampling controls, llama.cpp runtime and hardware options, provider/API settings, reasoning controls, and DRY/stop lists. +- Builder fields default to corresponding `AiGenerationConfig.DEFAULT_*` constants; list defaults are empty lists. +- `lazyMode`, `cacheTypeK`, `cacheTypeV`, `devices`, provider/API strings, and list setters replace null with defaults; `chatTemplateEnableThinking` remains nullable. + +#### Output +- `build()` produces an immutable `LlamaCppJniConfig` containing 41 configuration values. +- `drySequenceBreakers()` and `stopStrings()` return unmodifiable views of their lists. +- Lombok generates `equals`, `hashCode`, and `toString` over all fields. + +#### Core logic +- `builder(modelPath)` constructs a `Builder`; its constructor applies `Objects.requireNonNull(modelPath, "modelPath")`. +- `Builder` initializes 39 non-list options from `AiGenerationConfig.DEFAULT_*`; `drySequenceBreakers` and `stopStrings` start as empty lists. +- Each setter updates its corresponding builder field and returns `this`; nullable string/list setters restore defaults when passed null. +- `build()` calls `new LlamaCppJniConfig(this)`; the private constructor copies all 41 builder values without additional normalization. +- Configuration accessors return stored values; list accessors wrap stored lists with `Collections.unmodifiableList`. + +#### Public API +- `builder(String)` -> `Builder` — starts configuration with model path. +- `modelPath()` -> `String` — model file path. +- `contextSize()` -> `int` — context window. +- `maxOutputTokens()` -> `int` — output token limit. +- `temperature()` -> `float` — sampling temperature. +- `threads()` -> `int` — CPU thread count. +- `topP()` -> `float` — nucleus threshold. +- `topK()` -> `int` — top-k limit. +- `minP()` -> `float` — min-p threshold. +- `topNSigma()` -> `float` — top-n-sigma threshold. +- `repeatPenalty()` -> `float` — repetition penalty. +- `chatTemplateEnableThinking()` -> `@Nullable Boolean` — optional thinking mode. +- `cachePrompt()` -> `boolean` — prompt caching setting. +- `swaFull()` -> `boolean` — full SWA KV cache setting. +- `cacheReuse()` -> `int` — KV prefix-reuse chunk size. +- `gpuLayers()` -> `int` — GPU offload layers. +- `seed()` -> `int` — generation RNG seed. +- `cpuMoeLayers()` -> `int` — CPU MoE layers. +- `cpuFfnLayers()` -> `int` — CPU FFN layers. +- `kvUnifiedPerSlot()` -> `int` — per-slot KV context cap. +- `lazyMode()` -> `String` — tensor-read laziness. +- `repeatLastN()` -> `int` — repetition penalty window. +- `cacheTypeK()` -> `String` — K cache data type. +- `cacheTypeV()` -> `String` — V cache data type. +- `flashAttn()` -> `boolean` — Flash Attention setting. +- `batchSize()` -> `int` — logical batch size. +- `ubatchSize()` -> `int` — physical batch size. +- `threadsBatch()` -> `int` — batch processing threads. +- `mainGpu()` -> `int` — primary GPU index. +- `devices()` -> `String` — selected devices. +- `provider()` -> `String` — AI provider identifier. +- `remoteModel()` -> `String` — remote model identifier. +- `baseUrl()` -> `String` — OpenAI-compatible API base URL. +- `apiKeyEnv()` -> `String` — API-key environment variable name. +- `reasoningEffort()` -> `String` — reasoning effort setting. +- `reasoningBudgetTokens()` -> `int` — reasoning token budget. +- `dryMultiplier()` -> `float` — DRY multiplier. +- `dryBase()` -> `float` — DRY base. +- `dryAllowedLength()` -> `int` — DRY allowed length. +- `dryPenaltyLastN()` -> `int` — DRY penalty look-back. +- `drySequenceBreakers()` -> `List` — unmodifiable DRY breaker view. +- `stopStrings()` -> `List` — unmodifiable stop-string view. +- `Builder.contextSize(int)` -> `Builder` — sets context window. +- `Builder.maxOutputTokens(int)` -> `Builder` — sets output token limit. +- `Builder.temperature(float)` -> `Builder` — sets sampling temperature. +- `Builder.threads(int)` -> `Builder` — sets CPU threads. +- `Builder.topP(float)` -> `Builder` — sets nucleus threshold. +- `Builder.topK(int)` -> `Builder` — sets top-k limit. +- `Builder.minP(float)` -> `Builder` — sets min-p threshold. +- `Builder.topNSigma(float)` -> `Builder` — sets top-n-sigma threshold. +- `Builder.repeatPenalty(float)` -> `Builder` — sets repetition penalty. +- `Builder.chatTemplateEnableThinking(@Nullable Boolean)` -> `Builder` — sets optional thinking mode. +- `Builder.cachePrompt(boolean)` -> `Builder` — sets prompt caching. +- `Builder.swaFull(boolean)` -> `Builder` — sets full SWA cache. +- `Builder.cacheReuse(int)` -> `Builder` — sets KV reuse chunk size. +- `Builder.gpuLayers(int)` -> `Builder` — sets GPU offload layers. +- `Builder.seed(int)` -> `Builder` — sets RNG seed. +- `Builder.cpuMoeLayers(int)` -> `Builder` — sets CPU MoE layers. +- `Builder.cpuFfnLayers(int)` -> `Builder` — sets CPU FFN layers. +- `Builder.kvUnifiedPerSlot(int)` -> `Builder` — sets per-slot KV cap. +- `Builder.lazyMode(String)` -> `Builder` — sets tensor-read laziness. +- `Builder.repeatLastN(int)` -> `Builder` — sets repetition window. +- `Builder.cacheTypeK(String)` -> `Builder` — sets K cache type. +- `Builder.cacheTypeV(String)` -> `Builder` — sets V cache type. +- `Builder.flashAttn(boolean)` -> `Builder` — sets Flash Attention. +- `Builder.batchSize(int)` -> `Builder` — sets logical batch size. +- `Builder.ubatchSize(int)` -> `Builder` — sets physical batch size. +- `Builder.threadsBatch(int)` -> `Builder` — sets batch thread count. +- `Builder.mainGpu(int)` -> `Builder` — sets primary GPU. +- `Builder.devices(String)` -> `Builder` — sets device selection. +- `Builder.provider(String)` -> `Builder` — sets provider identifier. +- `Builder.remoteModel(String)` -> `Builder` — sets remote model. +- `Builder.baseUrl(String)` -> `Builder` — sets API base URL. +- `Builder.apiKeyEnv(String)` -> `Builder` — sets API-key environment variable. +- `Builder.reasoningEffort(String)` -> `Builder` — sets reasoning effort. +- `Builder.reasoningBudgetTokens(int)` -> `Builder` — sets reasoning budget. +- `Builder.dryMultiplier(float)` -> `Builder` — sets DRY multiplier. +- `Builder.dryBase(float)` -> `Builder` — sets DRY base. +- `Builder.dryAllowedLength(int)` -> `Builder` — sets DRY allowed length. +- `Builder.dryPenaltyLastN(int)` -> `Builder` — sets DRY look-back. +- `Builder.drySequenceBreakers(List)` -> `Builder` — sets DRY breakers. +- `Builder.stopStrings(List)` -> `Builder` — sets stop strings. +- `Builder.build()` -> `LlamaCppJniConfig` — creates immutable configuration. + +#### Dependencies +- `AiGenerationConfig`; `ConvertToRecord`; `Nullable`. +- `Collections`, `List`, `Objects`. +- Lombok `EqualsAndHashCode`, `ToString`. + +#### Exceptions / Errors +- `Objects.requireNonNull(modelPath, "modelPath")` throws `NullPointerException` for null model path. +- Nullable `chatTemplateEnableThinking` may remain null; string and list setters restore defaults on null. + +#### Concurrency +- `LlamaCppJniConfig` is immutable; builder is explicitly not thread-safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..86d14cd6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,64 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:57:52Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds OpenAI-compatible chat-completion requests, protects API keys from cleartext transmission to remote hosts, and converts responses and HTTP errors into generation results. + +#### Purpose +- `OpenAiCompatibleProviderSupport` supplies request construction, endpoint and API-key handling, HTTP status/error formatting, and response timing calculations for OpenAI-compatible generation. + +#### Type +- `final class OpenAiCompatibleProviderSupport` — final package-private class; no declared supertypes; annotated `@ToString`. + +#### Input +- Constructor takes `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, and `Function environment`; all are required via `Objects.requireNonNull`. +- `requestBody(AiGenerationRequest request)` reads prompt key, source file/text, and model/sampling settings from `config` and `request`. +- `endpoint()` reads `config.baseUrl()`. +- `apiKey()` reads `config.apiKeyEnv()` and uses `environment.apply(...)`. +- `apiKeyFor(String endpoint)` uses the endpoint URL and configured API-key environment name. +- `isLoopbackHost(String host)`, `isSuccess(int status)`, and `errorMessage(String endpoint, int status, String body)` consume their arguments directly. +- `timings(String text, ChatResponse response, double seconds)` reads usage counts from `response`. + +#### Output +- `requestBody(...)` returns serialized JSON; may throw `IOException`. +- `endpoint()` returns the chat-completions URL. +- `apiKey()` and `apiKeyFor(...)` return a trimmed key or `null`; `apiKeyFor(...)` may throw `IOException`. +- `isLoopbackHost(...)` and `isSuccess(...)` return booleans; `errorMessage(...)` returns a formatted message. +- `timings(...)` returns `AiGenerationTimings`; no fields are mutated and no resources are written. + +#### Core logic +- `requestBody(...)` creates JSON using `MAPPER`: adds non-blank `config.remoteModel()`, system and user messages from `promptSupport.systemPrompt(...)` and `promptSupport.userMessage(...)`, then sampling fields. + - Always includes `max_tokens`, `temperature`, `top_p`, `repetition_penalty`, and `"stream": false`. + - Adds `top_k` and `min_p` only when positive; `seed` only when non-negative; `stop` only when non-empty; `model` and `reasoning.effort` only when non-blank. +- `endpoint()` trims `config.baseUrl()`, requires the `HTTP_SCHEME` or `HTTPS_SCHEME` prefix, removes trailing slashes, and appends `CHAT_COMPLETIONS_PATH`. +- `apiKey()` returns `null` for a blank `config.apiKeyEnv()`, an unset environment value, or a blank value; otherwise returns the trimmed environment value. +- `apiKeyFor(...)` gets the key with `apiKey()`. HTTPS and no-key requests return it directly; for HTTP with a key, parses the host with `new URL(endpoint).getHost()` and requires `isLoopbackHost(host)`. +- `isLoopbackHost(...)` accepts exactly `localhost`, IPv4 literals matching `IPV4_LOOPBACK`, or `IPV6_LOOPBACK`. +- `isSuccess(...)` accepts statuses from `HTTP_OK_FIRST` inclusive to `HTTP_OK_END` exclusive. +- `errorMessage(...)` truncates bodies over `ERROR_BODY_EXCERPT` characters and appends `ELLIPSIS`; formats endpoint, status, and excerpt. +- `timings(...)` reads completion, prompt, and cached token counts from `response.getUsage()`. Decode rate is completion tokens divided by positive `seconds`, otherwise zero; prefill rate is zero. + +#### Public API +- No public or protected members; the class and its members are package-private. + +#### Dependencies +- Jackson: `ObjectMapper`, `ArrayNode`, `ObjectNode`. +- Java: `IOException`, `URL`, `List`, `Objects`, `Function`, `Pattern`. +- Lombok: `ToString`. +- Domain: `ChatResponse`, `Usage`, `AiGenerationRequest`, `AiPromptSupport`, `Java8CompatibilityHelper`, `LlamaCppJniConfig`, `AiGenerationTimings`. +- Annotation: `Nullable`. + +#### Exceptions / Errors +- Constructor rejects null `config`, `promptSupport`, or `environment` with `Objects.requireNonNull`. +- `requestBody(...)` propagates serialization `IOException`. +- `endpoint()` throws `IllegalArgumentException` for base URLs not starting with `http://` or `https://`. +- `apiKeyFor(...)` may propagate URL parsing `IOException`; throws `IOException` if a configured key would be sent over HTTP to a non-loopback host. + +#### Concurrency +- No synchronization or concurrency primitives; instance dependencies are final. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/package.ai.md new file mode 100644 index 00000000..8632dd3f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/java/provider/package.ai.md @@ -0,0 +1,56 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T11:59:36Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Generates and normalizes AI text completions through configurable local llama.cpp or OpenAI-compatible backends, with mock fallback and optional timing metrics. + +#### Purpose +- Defines provider selection, generation, completion cleanup, and lifecycle behavior for AI text generation. +- Centralizes model, sampling, runtime, hardware, API, reasoning, cache, and stop-sequence configuration. + +#### Responsibilities +- **Provider contract and selection:** `AiGenerationProvider` defines generation, optional timings, and close behavior; `AiGenerationProviderFactory` resolves model-level versus run-level provider keys and selects mock, llama.cpp JNI, or OpenAI-compatible implementations. +- **Local inference:** `LlamaCppJniAiGenerationProvider` lazily loads a GGUF model, applies configured inference and hardware options, parses completions, reports timing/cache metrics, and closes the native model. +- **Remote request support:** `OpenAiCompatibleProviderSupport` builds chat-completions JSON, normalizes endpoints, handles API-key retrieval and HTTP safety checks, formats errors, and derives timing metrics. +- **Configuration:** `LlamaCppJniConfig` provides immutable settings with a fluent builder, initialized from `AiGenerationConfig` defaults. +- **Completion cleanup:** `AiCompletionParser` trims responses and removes a leading Gemma-4 thinking block. + +#### Key units +- `AiGenerationProvider` — pluggable generation interface with default zero-valued timings and no-op close. +- `AiGenerationProviderFactory` — resolves provider configuration and instantiates mock, `LlamaCppJniAiGenerationProvider`, or OpenAI-compatible providers. +- `LlamaCppJniAiGenerationProvider` — executes local llama.cpp inference and exposes generation timings. +- `LlamaCppJniConfig` / `LlamaCppJniConfig.Builder` — store and fluently construct immutable generation configuration. +- `OpenAiCompatibleProviderSupport` — prepares remote chat requests and handles endpoint, API-key, error, and timing support. +- `AiCompletionParser` — strips a leading `<|channel>thought` block and returns trimmed completion text. + +#### Data flow +- `AiGenerationProviderFactory` selects a backend using the model provider key when nonblank, otherwise the run-level key; absent or blank selection defaults to mock generation. +- Providers receive `AiGenerationRequest`; the local provider builds inference parameters through `LlamaCppJniProviderSupport`, runs `chatComplete`, parses the response, and returns completion text or timing metrics. +- OpenAI-compatible support combines configured model and sampling options with system and user messages from `AiPromptSupport` to form a chat-completions request; response usage and elapsed seconds feed timing calculations. +- Local completion text passes through `AiCompletionParser`, which preserves ordinary text and removes only a leading thinking block. + +#### Dependencies +- Internal domain types: `AiGenerationRequest`, `AiGenerationTimings`, `AiPromptSupport`, `AiGenerationConfig`, `ChatResponseParser`, and `LlamaCppJniProviderSupport`. +- Provider implementations: `MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, and `OpenAiCompatibleAiGenerationProvider`. +- Local inference libraries: `LlamaModel`, `ModelParameters`, `FlashAttn`, and `ReasoningFormat`. +- Remote request support uses Jackson JSON nodes and `ChatResponse` usage data. +- Configuration and compatibility support use `Java8CompatibilityHelper`; annotations and generated methods include JSpecify `Nullable` and Lombok. + +#### Cross-cutting +- `AiGenerationProvider` extends `AutoCloseable`; default implementations may omit timing data and resource cleanup. +- `LlamaCppJniConfig` is immutable after construction; its builder is mutable and not thread-safe. +- Local model creation is lazy and cached, with no declared synchronization or thread-safety guarantee. +- Missing local timing data yields zero metrics; the default provider timing wrapper also reports zeros. +- OpenAI-compatible API keys are trimmed and are not sent over HTTP to non-loopback hosts; endpoint configuration must use HTTP or HTTPS. +- A leading thinking block without a closing marker causes `AiCompletionParser` to throw `IOException`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..8efd4310 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/kernels/histogram.cl.ai.md @@ -0,0 +1,43 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:58:55Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Counts occurrences of each byte value in an image or byte stream, producing a 256-bin histogram. + +#### Purpose +- Computes a byte-frequency histogram in two passes: work-group partial counts, then per-bin reduction. + +#### Type +- OpenCL C 1.2 kernel source. + +#### Input +- `histogram_partial`: `input` byte buffer and `length`; runtime-provided local memory `local_bins`. +- `histogram_reduce`: `partial` histogram buffer and `group_count`. + +#### Output +- `histogram_partial` writes one 256-counter histogram per work-group to `partial`. +- `histogram_reduce` writes the combined 256-bin counts to `histogram`. + +#### Core logic +- `histogram_partial` initializes local counters, distributes input indices across work-items using global IDs and strides, atomically counts each byte value, then writes local counts to the work-group’s partial-histogram region. +- `histogram_reduce` assigns one work-item to each bin, sums that bin across all partial histograms, and stores the result. + +#### Public API +- `histogram_partial(input, length, partial, local_bins) -> void` — count work-group byte frequencies. +- `histogram_reduce(partial, group_count, histogram) -> void` — combine partial histograms. + +#### Constants and configuration +- `BINS = 256` — histogram bin count. + +#### Dependencies +- OpenCL built-ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `barrier`, `atomic_inc`. +- OpenCL types and flags: `uchar`, `uint`, `__global`, `__local`, `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- No explicit error handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/kernels/package.ai.md new file mode 100644 index 00000000..f43172fb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/kernels/package.ai.md @@ -0,0 +1,34 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:59:52Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes byte-frequency distributions for image data or other byte streams. + +#### Purpose +- Produces a 256-bin histogram using work-group partial counts followed by a reduction. + +#### Responsibilities +- Count byte values into per-work-group histograms using local memory and atomic increments. +- Combine partial histograms into final per-byte totals. + +#### Key units +- `histogram_partial` — counts input bytes into one 256-bin histogram per work-group. +- `histogram_reduce` — sums each bin across work-group histograms into the final histogram. +- `BINS` — constant defining the 256 histogram bins. + +#### Data flow +- `input` bytes and `length` feed `histogram_partial`, which writes partial histograms to `partial`; `histogram_reduce` combines them using `group_count` and writes `histogram`. + +#### Dependencies +- OpenCL C 1.2 built-ins for work-item and work-group indexing, barriers, and atomic increments. +- OpenCL types, address spaces, and `CLK_LOCAL_MEM_FENCE`. + +#### Cross-cutting +- Uses a two-pass parallel pattern: local work-group counting, then per-bin reduction. +- Uses local memory and `atomic_inc` for concurrent bin updates; no explicit error handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..fd032a5c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,48 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:00:05Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides byte-stream processing and storage alongside command-line utilities for backup retention and regional sales reporting. + +#### Purpose +- Compute byte-frequency histograms and manage bounded FIFO byte buffers. +- Support directory backup rotation and monthly, regional order-revenue reporting. + +#### Responsibilities +- **Byte analysis (`kernels/`):** Count byte values in parallel with work-group histograms, then reduce partial counts. +- **Byte transfer (`ringbuf/`):** Allocate and manage power-of-two-capacity FIFO storage with wrapped reads and writes. +- **Operational and sales utilities (`scripts/`):** Create retained compressed backups; parse currency-filtered order CSVs and report monthly regional revenue. + +#### Key units +- `histogram_partial`, `histogram_reduce`, `BINS` — build per-work-group byte counts and combine them into 256-bin totals. +- `ringbuf_t`, `ringbuf_status_t` — represent ring-buffer state and initialization outcomes. +- `ringbuf_init`, `ringbuf_free`, `ringbuf_write`, `ringbuf_read` — manage buffer lifecycle and transfer bytes. +- `ringbuf_used`, `ringbuf_free_space` — report buffer occupancy and writable capacity. +- `rotate_backups.sh` — create timestamped compressed archives and prune older matching backups. +- `Order`, `parse_orders`, `revenue_by_month_and_region`, `main` — validate and filter order data, aggregate revenue, and run the report CLI. + +#### Data flow +- **Histogram:** Input bytes and length → work-group partial histograms → per-bin reduction → final histogram. +- **Ring buffer:** Initialize storage → write available bytes and read stored bytes with boundary wrapping → query used and free space. +- **Backups:** Source directory → timestamped `.tar.gz` archive → newest-first archive listing → prune beyond the retention count. +- **Sales:** CSV files → validated, currency-filtered `Order` records → monthly regional totals → threshold-filtered tab-separated output. + +#### Dependencies +- `kernels/` relies on OpenCL C 1.2 work-item/work-group operations, local memory, barriers, and atomic increments. +- `ringbuf/` uses its `ringbuf.h` types and status codes, standard allocation and copy functions, and `` / ``. +- `scripts/rotate_backups.sh` uses Bash and system utilities including `tar`, `date`, `mkdir`, `mv`, `du`, `ls`, and `rm`. +- `scripts/sales_report.py` uses Python standard-library CLI, CSV, date, decimal, and aggregation facilities. + +#### Cross-cutting +- Histogram computation uses a two-pass parallel pattern with local-memory atomic updates; no explicit error handling is summarized. +- Ring-buffer capacity must be a nonzero power of two; one slot is reserved to distinguish full from empty, and the API describes single-producer/single-consumer use. +- Backup execution enables strict Bash error handling and removes partial archives via an exit trap. +- Sales CSV parsing raises `ValueError` for missing columns or invalid dates and amounts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/ringbuf/package.ai.md new file mode 100644 index 00000000..1beeb2f8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/ringbuf/package.ai.md @@ -0,0 +1,41 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:59:56Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides bounded FIFO storage for transferring byte streams between a single producer and a single consumer. + +#### Purpose +- Allocate, manage, and query a fixed-capacity byte ring buffer. +- Preserve FIFO order while wrapping reads and writes at the buffer boundary. + +#### Responsibilities +- **Buffer lifecycle:** validate power-of-two capacity, allocate storage, and free/reset buffer state. +- **Byte transfer and capacity tracking:** write into available space, read stored data, and report used or free bytes. + +#### Key units +- `ringbuf_t` — stores byte data, capacity, and volatile `head` and `tail` indices. +- `ringbuf_status_t` — initialization status type with `RINGBUF_OK`, `RINGBUF_EINVAL`, and `RINGBUF_ENOMEM`. +- `ringbuf_init`, `ringbuf_free` — initialize and release ring-buffer storage. +- `ringbuf_write`, `ringbuf_read` — transfer bytes into and out of the buffer. +- `ringbuf_used`, `ringbuf_free_space` — report occupied and writable byte counts. + +#### Data flow +- `ringbuf_init` validates capacity and allocates storage; `ringbuf_write` copies available input bytes into the ring, and `ringbuf_read` copies stored bytes to the destination. +- Transfers wrap across the storage boundary; query functions report occupancy and remaining space. +- One slot is reserved to distinguish full from empty, so usable capacity is `capacity - 1`. + +#### Dependencies +- `ringbuf.c` uses `ringbuf.h` for buffer types and status codes, and standard-library `malloc`, `free`, and `memcpy`. +- `ringbuf.h` uses `` and `` for `size_t` and `uint8_t`. + +#### Cross-cutting +- Capacity must be nonzero and a power of two; index wrapping uses a capacity mask. +- The API describes a single-producer/single-consumer buffer with producer-owned `head` and consumer-owned `tail`. +- Initialization reports invalid capacity with `RINGBUF_EINVAL` and allocation failure with `RINGBUF_ENOMEM`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..a374f4d8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,61 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:58:59Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Stores and retrieves byte streams in a bounded circular buffer, preserving FIFO order while wrapping reads and writes across the buffer boundary. + +#### Purpose +- Implements byte-oriented ring-buffer allocation, capacity tracking, writes, reads, and cleanup. +- Reserves one slot to distinguish full from empty; usable capacity is `capacity - 1`. + +#### Type +- C implementation file; exports ring-buffer functions declared in `ringbuf.h`. +- Uses `ringbuf_t` and `ringbuf_status_t` from `ringbuf.h`. + +#### Input +- `ringbuf_init`: buffer pointer `rb`, requested `capacity`. +- `ringbuf_write`: buffer `rb`, source bytes `src`, requested length `len`. +- `ringbuf_read`: buffer `rb`, destination `dst`, requested length `len`. +- `ringbuf_used`, `ringbuf_free_space`, `ringbuf_free`: buffer pointer `rb`. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`; allocates `rb->data` and initializes buffer state on success. +- `ringbuf_write` and `ringbuf_read` return the number of bytes transferred, limited by available space or data. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. +- `ringbuf_free` releases storage and resets buffer fields. + +#### Core logic +- `ringbuf_init` accepts only nonzero power-of-two capacities; allocates `capacity` bytes and sets `head` and `tail` to zero. +- Tracks occupancy with `(head - tail) & (capacity - 1)`; free space is `capacity - 1 - used`. +- `ringbuf_write` copies up to available space in at most two chunks, wrapping from the array end to index zero; advances `head` with a capacity mask. +- `ringbuf_read` copies up to available data in at most two chunks, wrapping as needed; advances `tail` with a capacity mask. +- `ringbuf_free` frees storage and zeros `data`, `capacity`, `head`, and `tail`. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — allocate and initialize buffer. +- `ringbuf_free(ringbuf_t *rb) -> void` — release and reset buffer. +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report occupied bytes. +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report writable bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — append bytes. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — consume bytes. +- Internal helpers: `is_power_of_two`, `min_size`. + +#### Constants and configuration +- `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`, `RINGBUF_OK` — initialization status codes; values are defined outside this file. +- No configuration or environment variables. + +#### Dependencies +- `"ringbuf.h"` — ring-buffer types and status codes. +- ``: `malloc`, `free`. +- ``: `memcpy`. +- `size_t`, `uint8_t`. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` for zero or non-power-of-two capacity. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..8668a020 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,57 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:59:06Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Provides a fixed-capacity byte queue for transferring data between one producer and one consumer. + +#### Purpose +- Declares the `ringbuf_t` API for initializing, writing, reading, and querying a byte ring buffer. +- Uses one unused slot to distinguish full from empty, so usable capacity is `capacity - 1` bytes. + +#### Type +- C header with C++ linkage guards; declares `ringbuf_t` and `ringbuf_status_t`. +- `ringbuf_t`: byte storage pointer, capacity, and volatile producer-owned `head` and consumer-owned `tail` indices. +- Capacity must be a power of two. + +#### Input +- Initialization: `ringbuf_t *rb`, `size_t capacity`. +- Write: `ringbuf_t *rb`, source bytes `const uint8_t *src`, and requested `size_t len`. +- Read: `ringbuf_t *rb`, destination bytes `uint8_t *dst`, and requested `size_t len`. +- Queries: `const ringbuf_t *rb`. + +#### Output +- `ringbuf_init` returns a `ringbuf_status_t`; the other declared operations return `size_t`. +- `ringbuf_write` and `ringbuf_read` return the number of bytes actually copied. +- Declares `ringbuf_free` to release buffer resources. + +#### Core logic +- Specifies a fixed-capacity, single-producer/single-consumer byte buffer. +- Reserves one slot; capacity must be nonzero and a power of two. +- Declares operations to copy up to a requested length and query used or free space; implementation is not present in this header. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — initialize buffer +- `ringbuf_free(ringbuf_t *rb) -> void` — release buffer +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — copy bytes in +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — copy bytes out +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report bytes stored +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report writable bytes + +#### Constants and configuration +- `RINGBUF_H`: include guard. +- `RINGBUF_OK = 0`: successful status. +- `RINGBUF_EINVAL = -1`: zero or non-power-of-two capacity. +- `RINGBUF_ENOMEM = -2`: allocation failure. + +#### Dependencies +- Standard headers: ``, ``. +- Uses `size_t` and `uint8_t`. + +#### Exceptions / Errors +- `ringbuf_init` declares `RINGBUF_EINVAL` for invalid capacity and `RINGBUF_ENOMEM` for allocation failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/scripts/package.ai.md new file mode 100644 index 00000000..93c70b28 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/scripts/package.ai.md @@ -0,0 +1,39 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:00:00Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides command-line utilities for retaining compressed directory backups and reporting order revenue by month and region. + +#### Purpose +- Create timestamped, compressed backups while pruning archives beyond a retention limit. +- Aggregate order CSV data into currency-filtered monthly regional revenue totals. + +#### Responsibilities +- **Backup rotation (`rotate_backups.sh`):** Validate source and retention count, archive a directory, and remove older matching archives. +- **Sales reporting (`sales_report.py`):** Parse order CSVs, aggregate matching-currency sales, and print totals meeting a revenue threshold. + +#### Key units +- `rotate_backups.sh` — Bash command accepting source directory, backup directory, and optional archive count. +- `Order` — frozen record containing an order date, region, and decimal amount. +- `parse_orders(path, currency)` — validate CSV headers and yield matching-currency orders. +- `revenue_by_month_and_region(orders)` — aggregate amounts by month and region. +- `main(argv=None)` — parse report options and run the sales-report workflow. + +#### Data flow +- **Backups:** Source directory → timestamped `.tar.gz` archive → newest-first archive listing → removal of entries beyond `KEEP`. +- **Sales:** CSV files → validated, currency-filtered `Order` records → monthly regional totals → threshold-filtered, tab-separated output. + +#### Dependencies +- **Backups:** Bash and system utilities including `tar`, `date`, `mkdir`, `mv`, `du`, `ls`, and `rm`. +- **Sales reporting:** Python standard library modules for CLI parsing, CSV reading, dates, decimal arithmetic, and aggregation. + +#### Cross-cutting +- Both scripts are command-line tools with positional inputs; sales reporting also accepts `--currency` and `--min-revenue`. +- Backup execution uses strict Bash error settings and an exit trap to remove partial archives; CSV parsing raises `ValueError` for missing columns or invalid date/amount values. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..282c03ff --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,60 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:59:12Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Creates timestamped compressed archives of a source directory and prunes older archives in the backup directory. + +#### Purpose +- Back up one directory and retain only the newest requested number of its archives. +- Run directly with source and backup directory arguments. + +#### Type +- Bash; `set -euo pipefail`. + +#### Input +- Positional `$1` → `SOURCE_DIR`; required source directory. +- Positional `$2` → `BACKUP_DIR`; required destination directory. +- Positional `$3` → `KEEP`; optional archive count, default `7`; must be a positive integer. +- Reads the contents of `SOURCE_DIR` for archiving and matching archives in `BACKUP_DIR` for pruning. +- No options or environment variables read. + +#### Output +- Creates `BACKUP_DIR` if needed. +- Writes a gzip-compressed tar archive named `${name}_YYYYMMDDTHHMMSSZ.tar.gz` in `BACKUP_DIR`. +- Removes older matching archives beyond the newest `KEEP`. +- Prints the created archive and its human-readable size, then prints each removed archive. + +#### Core logic +- Require `SOURCE_DIR` and `BACKUP_DIR`; set `KEEP` to the supplied value or `7`. +- Reject a non-positive-integer `KEEP` or a nonexistent `SOURCE_DIR` with an error and exit status `2`. +- Create `BACKUP_DIR`; derive the source basename and a UTC timestamped archive path. +- Register an `EXIT` trap to remove the `.partial` archive. +- Create the tarball from the source directory’s parent, move the completed temporary archive into place, and print its size. +- List matching archives newest first; delete and report entries after the first `KEEP`. + +#### Constants and configuration +- `SOURCE_DIR="${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR="${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP="${3:-7}"` +- `name="$(basename "$SOURCE_DIR")"` +- `archive="$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp="$archive.partial"` +- `archives` — populated by `mapfile` from the newest-first archive listing. +- `old` — each archive selected for removal. + +#### Dependencies +- External commands: `basename`, `date`, `mkdir`, `tar`, `mv`, `du`, `cut`, `ls`, `rm`, `dirname`. +- Bash built-ins: `mapfile`, `echo`, `[[ ... ]]`. +- Archive pattern: `"$BACKUP_DIR/${name}"_*.tar.gz`. + +#### Errors and exit codes +- Exit `2` if `KEEP` is not a positive integer or `SOURCE_DIR` is not a directory. +- Missing required positional arguments trigger parameter-expansion errors and a nonzero exit. +- `set -e` exits on an unhandled command failure; `set -u` treats unset variables as errors; `pipefail` propagates pipeline failures. +- `EXIT` trap removes `tmp` with `rm -f`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..2a8ac68b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/other/scripts/sales_report.py.ai.md @@ -0,0 +1,53 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:59:22Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Summarizes order CSV exports as monthly revenue totals by region for a selected currency. + +#### Purpose +- Reads one or more order CSV files and aggregates matching-currency sales by month and region. +- Prints totals meeting a minimum revenue threshold. + +#### Type +- Python command-line script; defines frozen `Order` dataclass. + +#### Input +- Positional `csv_files`: one or more CSV paths; each must contain `order_date`, `region`, `amount`, and `currency`. +- `--currency`: currency to include; defaults to `EUR`. +- `--min-revenue`: minimum total to print; parsed as `Decimal`, defaults to `Decimal("0")`. +- CSV fields: ISO-formatted `order_date`, `region`, decimal `amount`, and `currency`. + +#### Output +- Prints tab-separated month, region, and revenue formatted to two decimal places with the selected currency. +- Writes `no orders found` to stderr and returns status `1` when no matching orders exist; otherwise returns `0`. + +#### Core logic +- `parse_orders` validates required CSV headers, skips rows in other currencies, and yields `Order` records with parsed dates, stripped regions, and decimal amounts. +- `revenue_by_month_and_region` sums amounts by `(YYYY-MM, region)` and returns totals sorted by key. +- `main` collects orders across input files, reports an empty result, or prints totals at or above the threshold. + +#### Public API +- `Order(order_date, region, amount) -> Order` — immutable parsed order. +- `parse_orders(path, currency) -> iterator[Order]` — yields matching-currency orders. +- `revenue_by_month_and_region(orders) -> dict` — aggregates monthly regional revenue. +- `main(argv=None) -> int` — parses CLI arguments and runs report. +- Entry point: `sys.exit(main())`. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")`. +- `--currency`: default `EUR`. +- `--min-revenue`: default `Decimal("0")`. + +#### Dependencies +- Standard library: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. +- Uses `open`, `csv.DictReader`, `date.fromisoformat`, `Decimal`, `enumerate`, `print`, and `sys.exit`. + +#### Exceptions / Errors +- `parse_orders` raises `ValueError` for missing required columns or invalid date/amount values; row errors include the file path and line number. +- File-opening and CSV-reading errors are not caught. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..6c8eb5d9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/package.ai.md @@ -0,0 +1,53 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:00:38Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> Supports AI-generated source documentation alongside byte-processing utilities, backup and sales reporting, and library, shop, and warehouse data workflows. + +#### Purpose +- Configure AI source-documentation generation with local or OpenAI-compatible providers. +- Provide operational utilities and SQL models/routines for byte handling, backup rotation, sales reporting, lending, order fulfillment, and inventory synchronization. + +#### Responsibilities +- **AI documentation (`java/`):** Configure source selection and generation, validate conditions and fact counters, choose inference providers, and normalize completions. +- **Byte utilities (`other/kernels/`, `other/ringbuf/`):** Compute byte histograms in parallel and provide bounded FIFO byte storage. +- **Operational scripts (`other/scripts/`):** Rotate compressed backups and aggregate currency-filtered orders into monthly regional revenue reports. +- **Relational workflows (`sql/`):** Manage library catalog and lending, shop orders and stock reservation, and supplier-driven warehouse inventory updates with reporting and audit logs. + +#### Key units +- `SrcMorphConfiguration`, `AiGenerationConfig` — hold run-wide source rules and per-model generation settings. +- `AiConditionEvaluator`, `AiFactExtractor`, `AiOversizeStrategy` — evaluate source conditions, format fact counts, and represent oversized-input policies. +- `AiGenerationProvider`, `AiGenerationProviderFactory`, `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport` — define, select, and support local or remote generation backends. +- `histogram_partial`, `histogram_reduce`, `BINS` — produce and combine 256-bin byte-frequency counts. +- `ringbuf_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read` — represent and operate a bounded FIFO byte buffer. +- `rotate_backups.sh` — create timestamped compressed backups and enforce retention. +- `parse_orders`, `revenue_by_month_and_region` — parse order CSV data and aggregate monthly regional revenue. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `loan_audit` — implement lending operations, fee calculation, and event auditing. +- `add_order_item(p_order_id, p_sku, p_qty)` — validate stock, update order lines and inventory, and recalculate order totals. +- `dbo.usp_SyncStock(@Since DATETIME2(0))` — merge recent supplier quantities into stock levels and log synchronization outcomes. + +#### Data flow +- **AI generation:** Run and model configuration guide source-condition checks and fact formatting; the provider factory selects a backend, which consumes an `AiGenerationRequest` and returns completion text and optional timings. +- **Byte processing:** Input bytes yield work-group partial histograms that are reduced into final counts; ring-buffer clients initialize storage, transfer bytes with wraparound, and query occupancy. +- **Scripts:** A source directory becomes a timestamped archive that is pruned to the retention limit; CSV rows become validated, currency-filtered orders, monthly regional totals, and threshold-filtered output. +- **Database workflows:** Library routines update lending state and feed audits and reports; shop item insertion validates and reserves stock before recalculating totals; warehouse synchronization aggregates supplier rows, merges stock, and logs success or failure. + +#### Dependencies +- AI generation uses domain types such as `AiPromptDefinition`, `AiModelDefinition`, `AiGenerationRequest`, and `AiFileContext`; local inference integrates llama.cpp support, while remote requests use Jackson JSON and chat-response data. +- OpenCL C work-group operations support histogram kernels; the ring buffer uses standard C allocation and copy facilities. +- Backup rotation uses Bash and system utilities; the sales report uses Python standard-library CSV, date, decimal, and aggregation facilities. +- PostgreSQL library and shop objects use related catalog, lending, order, and product tables; SQL Server warehouse synchronization uses `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. + +#### Cross-cutting +- AI configuration is generally mutable; local model creation is lazy and cached, while provider lifecycle uses `AutoCloseable`. +- The ring buffer requires power-of-two capacity, reserves one slot to distinguish full from empty, and describes single-producer/single-consumer use. +- Database constraints enforce relationships; shop updates lock product rows, and warehouse synchronization uses a transaction with rollback and error logging. +- Input validation is domain-specific: AI conditions and fact definitions are validated, sales parsing raises `ValueError` for invalid data, and lending and shop routines report operational failures. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..c1860a3a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 80DB301A +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:00:48Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project combines Java source analysis and documentation generation, with configurable file selection and metadata feeding AI completions from local llama.cpp or OpenAI-compatible backends. Its SQL workflows cover library lending, shop order fulfillment, and warehouse inventory synchronization. Separate byte-stream utilities include frequency analysis and bounded FIFO storage, alongside command-line tools for backup retention and regional sales reporting. + +#### Packages +- java/config — Defines source-file selection, AI generation settings, and factual metadata used to produce indexed source documentation. +- java — Configures source analysis and turns selected source files into AI-generated documentation using local or OpenAI-compatible text-generation backends. +- java/provider — Generates and normalizes AI text completions through configurable local llama.cpp or OpenAI-compatible backends, with mock fallback and optional timing metrics. +- other/kernels — Computes byte-frequency distributions for image data or other byte streams. +- other — Provides byte-stream processing and storage alongside command-line utilities for backup retention and regional sales reporting. +- other/ringbuf — Provides bounded FIFO storage for transferring byte streams between a single producer and a single consumer. +- other/scripts — Provides command-line utilities for retaining compressed directory backups and reporting order revenue by month and region. +- . — Supports AI-generated source documentation alongside byte-processing utilities, backup and sales reporting, and library, shop, and warehouse data workflows. +- sql/library — Manages library catalog and lending operations, including member checkout and returns, inventory, overdue reporting, fees, and loan auditing. +- sql — Provides SQL-backed workflows for library lending, shop order fulfillment, and warehouse inventory synchronization. +- sql/shop — Maintains a shop catalog and customer orders, including order-line creation, inventory reservation, and order-total calculation. +- sql/warehouse — Applies recent supplier-feed quantities to warehouse inventory by SKU and records each synchronization outcome. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..357fc325 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/01_schema.sql.ai.md @@ -0,0 +1,56 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:58:03Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Models library authors, catalog books and copies, registered members, and book loans with due-date and return tracking. + +#### Purpose +- Defines the core lending-library schema and indexes for author and member loan lookups, including open loans by due date. + +#### Type +- Tables; indexes — PostgreSQL. + +#### Schema +- `author` + - `author_id BIGSERIAL` — primary key. + - `full_name VARCHAR(200) NOT NULL`. + - `birth_year SMALLINT` — CHECK `birth_year BETWEEN 1000 AND 2100`. + - `country_code CHAR(2)`. +- `book` + - `book_id BIGSERIAL` — primary key. + - `isbn VARCHAR(17) NOT NULL UNIQUE`. + - `title VARCHAR(300) NOT NULL`. + - `author_id BIGINT NOT NULL` — FK to `author.author_id`. + - `published_year SMALLINT`. + - `copies_total INTEGER NOT NULL DEFAULT 1` — CHECK `copies_total >= 0`. + - `copies_free INTEGER NOT NULL DEFAULT 1` — CHECK `copies_free >= 0`. + - `book_free_le_total` — CHECK `copies_free <= copies_total`. +- `member` + - `member_id BIGSERIAL` — primary key. + - `email VARCHAR(254) NOT NULL UNIQUE`. + - `full_name VARCHAR(200) NOT NULL`. + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE`. + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE`. +- `loan` + - `loan_id BIGSERIAL` — primary key. + - `book_id BIGINT NOT NULL` — FK to `book.book_id`. + - `member_id BIGINT NOT NULL` — FK to `member.member_id`, `ON DELETE CASCADE`. + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE`. + - `due_on DATE NOT NULL`. + - `returned_on DATE`. + - `loan_due_after_loan` — CHECK `due_on > loaned_on`. +- Indexes: + - `idx_book_author` on `book(author_id)`. + - `idx_loan_member` on `loan(member_id)`. + - `idx_loan_open` on `loan(due_on)` WHERE `returned_on IS NULL`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (`ON DELETE CASCADE`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..304dae85 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/02_views.sql.ai.md @@ -0,0 +1,39 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:58:09Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Provides lending-library reports for overdue loans, member borrowing activity, and recently popular books. + +#### Purpose +- `overdue_loans` identifies unreturned loans past their due dates. +- `member_loan_stats` summarizes member borrowing; `popular_books` ranks books loaned in the past year. + +#### Type +- PostgreSQL views: `overdue_loans`, `member_loan_stats` +- PostgreSQL materialized view: `popular_books` +- PostgreSQL index: `idx_popular_books_id` + +#### Schema +- `overdue_loans`: `loan_id` (from `loan.loan_id`); `member_id` (from `member.member_id`); `email` (from `member.email`); `title` (from `book.title`); `due_on` (from `loan.due_on`); `days_overdue` (`CURRENT_DATE - loan.due_on`). +- `member_loan_stats`: `member_id` (from `member.member_id`); `full_name` (from `member.full_name`); `loans_total` (`COUNT(l.loan_id)`); `loans_open` (filtered count where `returned_on IS NULL`); `last_loan_on` (`MAX(l.loaned_on)`). +- `popular_books`: `book_id` (from `book.book_id`); `title` (from `book.title`); `author_name` (from `author.full_name`); `times_loaned` (`COUNT(*)`). +- Index `idx_popular_books_id` on `popular_books (book_id)`; unique, default method. + +#### Reads +- `overdue_loans`: `loan.loan_id`, `loan.member_id`, `loan.book_id`, `loan.due_on`, `loan.returned_on`; `member.member_id`, `member.email`; `book.book_id`, `book.title`. +- `member_loan_stats`: `member.member_id`, `member.full_name`; `loan.member_id`, `loan.loan_id`, `loan.returned_on`, `loan.loaned_on`. +- `popular_books`: `loan.book_id`, `loan.loaned_on`; `book.book_id`, `book.title`, `book.author_id`; `author.author_id`, `author.full_name`. + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..ad56d942 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/03_routines.sql.ai.md @@ -0,0 +1,50 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:58:17Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Implements library checkout and return workflows, calculates overdue fees, and records loan checkout/return events for auditing. + +#### Purpose +- Enforce member blocking and copy availability during checkout; restore copy availability on return. +- Calculate capped late fees and maintain a loan action audit trail. + +#### Type +- PostgreSQL: table `loan_audit`; functions `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn`; procedure `sp_return_book`; trigger `trg_loan_audit`. + +#### Schema +- `loan_audit`: + - `audit_id BIGSERIAL` — primary key; unnamed constraint. + - `loan_id BIGINT NOT NULL`. + - `action VARCHAR(10) NOT NULL` — unnamed CHECK: `action IN ('CHECKOUT', 'RETURN')`. + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()`. + +#### Reads +- `fn_checkout_book`: `member.member_id`, `member.is_blocked`; `book.book_id`, `book.copies_free`. +- `sp_return_book`: `loan.loan_id`, `loan.returned_on`, `loan.book_id`. +- `fn_late_fee`: parameters `p_due_on`, `p_returned_on`; reads `CURRENT_DATE`. +- `trg_loan_audit_fn`: trigger row fields `NEW.loan_id`, `NEW.returned_on`, `OLD.returned_on`; reads `TG_OP`. + +#### Writes +- `fn_checkout_book`: updates `book.copies_free`; inserts one row per successful call into `loan` columns `book_id`, `member_id`, `due_on`; reads returned `loan_id`. +- `sp_return_book`: updates `loan.returned_on`; updates `book.copies_free`. +- `trg_loan_audit_fn`: inserts one `loan_audit` row per qualifying trigger event, setting `loan_id` and `action` to `CHECKOUT` for inserts or `RETURN` when `returned_on` changes from NULL to non-NULL. +- `trg_loan_audit`: fires after `INSERT` or `UPDATE OF returned_on` on `loan`. + +#### Relationships +- `loan.loan_id -> loan_audit.loan_id` — audit records copy the loan identifier; no foreign key declared. + +#### Routine logic +- `fn_checkout_book(p_member_id BIGINT, p_book_id BIGINT, p_days INTEGER DEFAULT 21) RETURNS BIGINT`: raises an exception for blocked members or unavailable copies; decrements free copies, creates a loan due `p_days` from today, and returns its `loan_id`. +- `sp_return_book(p_loan_id BIGINT)`: marks an unreturned loan returned today; raises an exception if unknown or already returned; increments the associated book’s free-copy count. +- `fn_late_fee(p_due_on DATE, p_returned_on DATE) RETURNS INTEGER`: immutable SQL function; computes 50 cents per overdue day, using today when return date is NULL, with a zero floor and 2000-cent cap. +- `trg_loan_audit_fn() RETURNS TRIGGER`: records checkout on loan insertion and return when `returned_on` transitions from NULL to non-NULL; returns `NEW`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Trigger function: `trg_loan_audit_fn`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..5e6af9a8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,56 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:58:27Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Adds branch-based copy tracking to a lending library, assigns existing copies to the main branch, and replaces book-level copy counters with copy-level inventory. + +#### Purpose +- Introduces library branches and individual book copies with barcode and availability status. +- Links loans and members to copies and branches; removes per-book copy counters. + +#### Type +- PostgreSQL migration; creates tables `branch`, `book_copy` and index `idx_book_copy_book`. + +#### Schema +- `branch` + - `branch_id SMALLSERIAL` — primary key. + - `name VARCHAR(100) NOT NULL UNIQUE`. + - `city VARCHAR(100) NOT NULL`. +- `book_copy` + - `copy_id BIGSERIAL` — primary key. + - `book_id BIGINT NOT NULL` — FK to `book.book_id`. + - `branch_id SMALLINT NOT NULL` — FK to `branch.branch_id`. + - `barcode VARCHAR(32) NOT NULL UNIQUE`. + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE', 'ON_LOAN', 'LOST'))`. +- `loan`: adds `copy_id BIGINT` — FK to `book_copy.copy_id`. +- `member`: renames `joined_on` to `member_since`; adds `home_branch_id SMALLINT` — FK to `branch.branch_id`. +- `book`: drops constraint `book_free_le_total` and columns `copies_free`, `copies_total`. +- Index `idx_book_copy_book` on `book_copy (book_id)`; method not specified. + +#### Reads +- `book`: `book_id`, `isbn`, `copies_total`, `copies_free` — used to generate copy rows and determine initial status. +- `member`: `home_branch_id` — read by the `IS NULL` filter during update. + +#### Writes +- `branch`: 1 row inserted (`Main`, `Springfield`). +- `book_copy`: 1 `INSERT ... SELECT` populates one row per generated copy; exact row count depends on `book.copies_total`. +- `loan`: adds `copy_id`. +- `member`: renames `joined_on`; adds `home_branch_id`; updates `home_branch_id` to `1` where null. +- `book`: drops `book_free_le_total`, `copies_free`, and `copies_total`. +- Creates index `idx_book_copy_book`. + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` +- Copy-generation query: `book.book_id`; branch assignment uses `branch.branch_id = 1`. + +#### Dependencies +- Tables: `book`, `loan`, `member`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..17fdf755 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,32 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:58:34Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Seeds a lending-library database with catalog, author, member, and loan records for development and testing. + +#### Purpose +- Populate author, book, member, and loan data in one transaction. +- Insert records with explicit IDs and generated date offsets. + +#### Type +- PostgreSQL DML transaction. + +#### Writes +- `author`: 15 rows; IDs 1–15; columns `author_id`, `full_name`, `birth_year`, `country_code`. +- `book`: 110 rows; IDs 1–110; columns `book_id`, `isbn`, `title`, `author_id`, `published_year`, `copies_total`, `copies_free`. +- `member`: 50 rows; IDs 1–50; columns `member_id`, `email`, `full_name`, `joined_on`, `is_blocked`. +- `loan`: 150 rows; IDs 1–150; columns `loan_id`, `book_id`, `member_id`, `loaned_on`, `due_on`, `returned_on`; some `returned_on` values are `NULL`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- Tables: `author`, `book`, `member`, `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/package.ai.md new file mode 100644 index 00000000..32bbc654 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/library/package.ai.md @@ -0,0 +1,56 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:00:12Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> Manages library catalog and lending operations, including member checkout and returns, inventory, overdue reporting, fees, and loan auditing. + +#### Purpose +- Defines and populates the PostgreSQL data model for authors, books, members, loans, branches, and individual copies. +- Supports checkout and return workflows, operational reporting, and development/test data. + +#### Responsibilities +- **Catalog and lending schema:** `author`, `book`, `member`, and `loan` tables, with keys, validation constraints, and lookup indexes. +- **Inventory evolution:** migration adds `branch` and barcode-tracked `book_copy` records, links loans to copies and members to home branches, and replaces book-level copy counters. +- **Checkout, returns, and auditing:** routines validate checkout eligibility, record returns, calculate late fees, and audit checkout and return events. +- **Lending reports:** views identify overdue loans, aggregate member activity, and rank books loaned in the prior year. +- **Seed data:** transaction populates authors, books, members, and loans for development and testing. + +#### Key units +- `author`, `book`, `member`, `loan` — core catalog, member, and lending tables. +- `branch`, `book_copy` — branch directory and copy-level inventory introduced by `04_migration_v2.sql`. +- `overdue_loans` — lists unreturned loans past their due dates with member and book details. +- `member_loan_stats` — summarizes each member’s total and open loans and most recent loan date. +- `popular_books` — materialized ranking of books loaned in the past year. +- `fn_checkout_book` — checks member and copy availability, creates a loan, and returns its ID. +- `sp_return_book` — marks an open loan returned and restores book-level availability. +- `fn_late_fee` — computes overdue charges at 50 cents per day, with a zero floor and 2000-cent cap. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — store and record checkout and return events. + +#### Data flow +- Seed records populate authors, books, members, and loans; book-author and loan-member/book foreign keys connect the catalog and lending records. +- `fn_checkout_book` checks member blocking and available copies, decrements `book.copies_free`, inserts a loan, and returns its ID; the loan trigger records checkout. +- `sp_return_book` marks an open loan returned, restores `book.copies_free`, and the trigger records the return transition. +- `fn_late_fee` uses due and return dates, or the current date for an open loan, to calculate a capped fee. +- Reporting views derive overdue loans and member activity from `loan`, `member`, and `book`; `popular_books` aggregates recent loan activity with book and author details. +- The migration generates `book_copy` rows from existing book copy totals, assigns them to the main branch, and adds copy and home-branch references. + +#### Dependencies +- PostgreSQL tables `author`, `book`, `member`, and `loan` underpin routines and reports. +- `book_copy` references `book` and `branch`; migrated `loan.copy_id` references `book_copy`, and `member.home_branch_id` references `branch`. +- `loan_audit` stores loan identifiers and actions but has no declared foreign key to `loan`. + +#### Cross-cutting +- Primary keys, foreign keys, uniqueness and CHECK constraints enforce identity, relationships, and valid values; indexes support author, member-loan, open-loan, popular-book, and copy lookups. +- Checkout and return routines raise exceptions for blocked or unavailable checkout, unknown loans, and already-returned loans. +- `trg_loan_audit` fires after loan insertion or `returned_on` updates; it records checkout inserts and NULL-to-non-NULL return transitions. +- `fn_late_fee` is an immutable SQL function; other routines and the reporting views are PostgreSQL objects. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/package.ai.md new file mode 100644 index 00000000..6898887f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/package.ai.md @@ -0,0 +1,47 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:00:31Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> Provides SQL-backed workflows for library lending, shop order fulfillment, and warehouse inventory synchronization. + +#### Purpose +- Defines relational data models and operational routines for catalog and lending, product orders, and supplier-fed stock. +- Supports transactional updates, reporting, and outcome auditing or logging across these domains. + +#### Responsibilities +- **Library catalog and lending:** Store authors, books, members, branches, copies, and loans; handle checkout, returns, late fees, auditing, and lending reports. +- **Shop orders and inventory:** Maintain products, customer orders, and order lines; add requested items while reserving stock and recalculating order totals. +- **Warehouse synchronization:** Aggregate recent supplier quantities by warehouse and SKU, update stock levels, and log synchronization results or errors. + +#### Key units +- `author`, `book`, `member`, `loan` — core library catalog and lending tables; `branch` and `book_copy` extend lending to branch-based, copy-level inventory. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee` — library checkout, return, and overdue-fee routines. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — record checkout and return events. +- `overdue_loans`, `member_loan_stats`, `popular_books` — library views and materialized ranking for lending reports. +- `product`, `customer_order`, `order_item` — shop catalog and inventory, order header, and order-line tables. +- `add_order_item(p_order_id, p_sku, p_qty)` — validates stock, updates order lines and product stock, and recalculates the order total. +- `dbo.usp_SyncStock(@Since DATETIME2(0))` — aggregates supplier feed quantities, merges stock changes, and logs synchronization outcomes. +- `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog` — warehouse input, inventory, and synchronization-log tables. + +#### Data flow +- Library seed data populates catalog, members, and loans; checkout and return routines update loan and availability state, while triggers audit transitions and reporting objects derive lending summaries. +- Shop `add_order_item` locks the matching product, validates SKU and stock, inserts or increments an order line, decrements stock, then recalculates the order total. +- Warehouse `usp_SyncStock` filters supplier rows by `@Since`, aggregates quantity by warehouse and SKU, merges changes into stock, counts insert/update actions, and logs success; on failure it rolls back, logs the error, and rethrows. + +#### Dependencies +- Library routines and reports operate on PostgreSQL catalog and lending tables; migrated `book_copy` references `book` and `branch`, while loans and members gain copy and home-branch references. +- Shop `order_item` references `customer_order` with cascade deletion and `product`; `add_order_item` coordinates updates across those tables. +- Warehouse `dbo.usp_SyncStock` depends on SQL Server `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`; its `@Changes` table variable captures merge actions. + +#### Cross-cutting +- Relational constraints, keys, and indexes enforce identity and relationships across catalog, order, and inventory records. +- Operational routines validate eligibility and availability, using SQL exceptions for library and shop failures. +- Updates use transactional safeguards: the shop locks the product row with `FOR UPDATE`; warehouse synchronization runs in a transaction and rolls back on error. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..31b657d6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,68 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:58:38Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Models shop products, customer orders, and order lines, with a procedure that adds items, reserves inventory, and recalculates order totals. + +#### Purpose +- Stores product catalog and stock, customer orders, and per-product order lines. +- `add_order_item` adds or increments an order line while updating stock and the order total. + +#### Type +- MySQL 8 tables: `product`, `customer_order`, `order_item`; procedure: `add_order_item`. +- Enum `customer_order.status`: `NEW`, `PAID`, `SHIPPED`, `CANCELLED`. + +#### Schema +- `product` + - `product_id INT UNSIGNED` — NOT NULL, AUTO_INCREMENT, PRIMARY KEY. + - `sku VARCHAR(40)` — NOT NULL, UNIQUE KEY `uk_product_sku`. + - `name VARCHAR(200)` — NOT NULL. + - `price_cents INT UNSIGNED` — NOT NULL. + - `stock INT` — NOT NULL, DEFAULT `0`. + - Index `PRIMARY` on `product(product_id)`. + - Index `uk_product_sku` on `product(sku)`, unique. +- `customer_order` + - `order_id BIGINT UNSIGNED` — NOT NULL, AUTO_INCREMENT, PRIMARY KEY. + - `customer_id BIGINT UNSIGNED` — NOT NULL. + - `status ENUM('NEW', 'PAID', 'SHIPPED', 'CANCELLED')` — NOT NULL, DEFAULT `'NEW'`. + - `created_at DATETIME` — NOT NULL, DEFAULT `CURRENT_TIMESTAMP`. + - `total_cents INT UNSIGNED` — NOT NULL, DEFAULT `0`. + - Index `PRIMARY` on `customer_order(order_id)`. + - Index `idx_order_customer` on `customer_order(customer_id, created_at)`. +- `order_item` + - `order_id BIGINT UNSIGNED` — NOT NULL, part of PRIMARY KEY; FK `fk_item_order` references `customer_order(order_id)`, ON DELETE CASCADE. + - `product_id INT UNSIGNED` — NOT NULL, part of PRIMARY KEY; FK `fk_item_product` references `product(product_id)`. + - `quantity SMALLINT UNSIGNED` — NOT NULL. + - `unit_price_cents INT UNSIGNED` — NOT NULL. + - Index `PRIMARY` on `order_item(order_id, product_id)`. + +#### Reads +- `product`: `product_id`, `price_cents`, `sku`, `stock` (selection and stock eligibility check in `add_order_item`). +- `order_item`: `quantity`, `unit_price_cents`, `order_id` (total calculation). + +#### Writes +- `order_item`: `order_id`, `product_id`, `quantity`, `unit_price_cents` — INSERT; duplicate key increments `quantity`. +- `product`: `stock` — UPDATE, subtracts requested quantity. +- `customer_order`: `total_cents` — UPDATE, recalculates from its order lines. + +#### Relationships +- `order_item.order_id -> customer_order.order_id` — FK `fk_item_order`; cascade delete. +- `order_item.product_id -> product.product_id` — FK `fk_item_product`. +- `add_order_item` matches `product.sku` to `p_sku` and uses the resulting `product.product_id` for the order line and stock update. +- `add_order_item` uses `p_order_id` with `order_item.order_id` and `customer_order.order_id`. + +#### Routine logic +- `add_order_item(IN p_order_id BIGINT UNSIGNED, IN p_sku VARCHAR(40), IN p_qty SMALLINT UNSIGNED)` + - Locks the matching product row with `FOR UPDATE`, requiring `stock >= p_qty`; retrieves product ID and price. + - Signals SQLSTATE `45000` with message `unknown SKU or not enough stock` if no eligible product is found. + - Inserts an order line or increments its existing quantity. + - Decrements product stock and updates the order total to the sum of line quantities times unit prices. + +#### Dependencies +- Tables: `product`, `order_item`, `customer_order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/shop/package.ai.md new file mode 100644 index 00000000..8d4e97c8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/shop/package.ai.md @@ -0,0 +1,40 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:00:20Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Maintains a shop catalog and customer orders, including order-line creation, inventory reservation, and order-total calculation. + +#### Purpose +- Stores products and stock, customer orders and statuses, and per-product order lines. +- Provides `add_order_item` to add or increase a line while reducing stock and recalculating the order total. + +#### Responsibilities +- **Catalog and inventory:** `product` records SKU, name, price, and stock; SKU is unique. +- **Order storage:** `customer_order` tracks customer, status, creation time, and total; statuses are `NEW`, `PAID`, `SHIPPED`, and `CANCELLED`. +- **Order lines and updates:** `order_item` links orders to products, stores quantity and unit price, and cascades deletion when its order is deleted. +- **Order-item routine:** `add_order_item` validates SKU and available stock, inserts or increments a line, decrements stock, and updates the order total. + +#### Key units +- `product` — product catalog and inventory table keyed by `product_id`. +- `customer_order` — customer order header and status/total table keyed by `order_id`. +- `order_item` — order-to-product line table keyed by `(order_id, product_id)`. +- `add_order_item(p_order_id, p_sku, p_qty)` — adds requested quantity to an order after checking product eligibility and stock. + +#### Data flow +- `add_order_item` finds a `product` by SKU, locks the matching row, and checks that stock covers the requested quantity. +- On success, it inserts an `order_item` or increments its existing quantity, then subtracts the requested quantity from `product.stock`. +- It recalculates `customer_order.total_cents` from the order’s line quantities and unit prices; an unknown SKU or insufficient stock signals SQLSTATE `45000`. + +#### Dependencies +- `order_item.order_id` references `customer_order.order_id` with cascade delete; `order_item.product_id` references `product.product_id`. +- `add_order_item` coordinates reads and writes across `product`, `order_item`, and `customer_order`. + +#### Cross-cutting +- Uses primary keys, foreign keys, SKU uniqueness, and an `(order_id, product_id)` composite key to enforce identity and relationships. +- The routine uses `FOR UPDATE` for the matching product row and reports eligibility failures through a SQL exception. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/warehouse/package.ai.md new file mode 100644 index 00000000..c8b038cd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/warehouse/package.ai.md @@ -0,0 +1,38 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:00:26Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Applies recent supplier-feed quantities to warehouse inventory by SKU and records each synchronization outcome. + +#### Purpose +- Maintain `dbo.StockLevel` from supplier quantities received since a specified timestamp. +- Record inserted/updated row counts or synchronization errors in `dbo.SyncLog`. + +#### Responsibilities +- Aggregate `dbo.SupplierFeed` quantities by warehouse and SKU, filtered by `@Since`. +- Insert new stock rows or add aggregated quantities to existing rows, refreshing `UpdatedAt`. +- Log successful synchronization counts and capture failures. + +#### Key units +- `dbo.usp_SyncStock(@Since DATETIME2(0))` — transactional stock synchronization and outcome logging. +- `dbo.StockLevel` — inventory keyed by `(WarehouseId, Sku)`, with `OnHand` and `UpdatedAt`. +- `dbo.SupplierFeed` — timestamped supplier quantities by warehouse and SKU. +- `dbo.SyncLog` — synchronization start time, insert/update counts, and optional error message. + +#### Data flow +- Read recent feed rows → group and sum `Quantity` by `(WarehouseId, Sku)` → `MERGE` into `dbo.StockLevel` → count insert/update actions → write success record to `dbo.SyncLog`. +- On failure, roll back any active transaction, log `ERROR_MESSAGE()` with zero counts, and rethrow. + +#### Dependencies +- SQL Server tables `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. +- `@Changes` table variable captures `MERGE` actions for insert/update counts. + +#### Cross-cutting +- Uses a transaction for the merge and success logging; rolls back on error. +- Captures synchronization start time in UTC and refreshes `UpdatedAt` for matched stock rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..b2a5ca8e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,58 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T11:58:47Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Aggregates recent supplier-feed quantities by warehouse and SKU, updates warehouse stock levels, and records synchronization counts or errors. + +#### Purpose +- Synchronizes `dbo.StockLevel` from supplier quantities received since a supplied timestamp. +- Logs inserted and updated stock-row counts, or the error when synchronization fails. + +#### Type +- SQL Server (T-SQL); tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`; procedure: `dbo.usp_SyncStock`. + +#### Schema +- `dbo.StockLevel` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT (0)`; default constraint `DF_StockLevel_OnHand` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())`; default constraint `DF_StockLevel_UpdatedAt` + - Primary key constraint `PK_StockLevel` on `(WarehouseId, Sku)` +- `dbo.SupplierFeed` + - `FeedRowId BIGINT IDENTITY(1, 1) NOT NULL`; primary key constraint `PK_SupplierFeed` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` +- `dbo.SyncLog` + - `SyncLogId INT IDENTITY(1, 1) NOT NULL`; primary key constraint `PK_SyncLog` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + +#### Reads +- `dbo.SupplierFeed`: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`; filters on `ReceivedAt >= @Since`, groups by `WarehouseId`, `Sku`, and sums `Quantity`. +- `dbo.StockLevel`: `WarehouseId`, `Sku` for matching; `OnHand` for matched-row updates. +- `@Changes`: `MergeAction` for counting merge inserts and updates. + +#### Writes +- `dbo.StockLevel`: `MERGE` inserts unmatched `(WarehouseId, Sku)` rows with summed `Quantity` as `OnHand`; updates matched `OnHand` by adding summed `Quantity` and refreshes `UpdatedAt`. +- `dbo.SyncLog`: inserts one outcome row on success with `StartedAt`, `RowsInserted`, and `RowsUpdated`; inserts one error row on failure with zero counts and `ErrorMessage`. +- `@Changes`: receives each `MERGE` action via `OUTPUT`. + +#### Relationships +- `dbo.StockLevel.WarehouseId -> source.WarehouseId` and `dbo.StockLevel.Sku -> source.Sku` (MERGE match; source aggregates `dbo.SupplierFeed` by warehouse and SKU). + +#### Routine logic +- `dbo.usp_SyncStock(@Since DATETIME2(0))` + - Captures UTC start time and initializes a merge-action table variable. + - Within a transaction, merges grouped feed quantities received since `@Since` into stock levels. + - Logs counts of inserted and updated rows, then commits. + - On error, rolls back any active transaction, logs `ERROR_MESSAGE()`, and rethrows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..153c8b17 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,100 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:00:52Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Evaluates and validates file‑selection conditions against file metadata, determining matches and required line counting. + +#### Purpose +- Evaluate `AiCondition` trees against `AiFileContext`. +- Validate condition trees for correct structure and bounds. +- Detect if any condition requires line counting. + +#### Type +- `public final class AiConditionEvaluator` + - extends `Object` + - no generics + - annotations: none + - fields: `private static final String ERROR_ONE_BRANCH` + - constructor: `public AiConditionEvaluator()` (no-op) + +#### Input +- `matches(AiCondition, AiFileContext)` – condition tree, file context. +- `validate(AiCondition)` – condition tree. +- `usesLines(AiCondition)` – condition tree. +- `anyUsesLines(List)` – optional list of child conditions. +- `validateGroup(AiConditionGroup, String)` – group and label. +- `branchCount(AiCondition)` – condition node. +- `matchesExtension(List, String)` – extensions list, file name. +- `globMatches(String, String)` – glob pattern, relative path. +- `parseEpochMilli(String)` – ISO‑8601 instant string. + +#### Output +- `matches` returns `boolean` indicating file match. +- `validate` throws `IllegalArgumentException` on misconfiguration. +- `usesLines` returns `boolean`. +- `anyUsesLines` returns `boolean`. +- `validateGroup` throws `IllegalArgumentException` on empty group. +- `branchCount` returns `int`. +- `matchesExtension` returns `boolean`. +- `globMatches` returns `boolean`. +- `parseEpochMilli` returns `long` epoch milliseconds. + +#### Core logic +- `matches`: + - If `and` group present, recursively `matches` all children; return `true` if all true. + - If `or` group present, recursively `matches` any child; return `true` if any true. + - If `not` present, return negated `matches` of child. + - If `extensions` present, call `matchesExtension`. + - If `size` present, call `size.contains(context.sizeBytes())`. + - If `lines` present, call `lines.contains(context.lineCount())`. + - If `modifiedAfter` present, compare `context.lastModifiedEpochMilli()` > parsed epoch. + - If `modifiedBefore` present, compare `<` parsed epoch. + - If `pathGlob` present, call `globMatches`. + - Else throw `IllegalStateException(ERROR_ONE_BRANCH + condition)`. + +- `validate`: + - Ensure `branchCount(condition) == 1`; else throw `IllegalArgumentException`. + - For each possible branch: + - ``/``: call `validateGroup`. + - ``: recursively `validate`. + - ``: non‑empty list. + - ``/``: must have bound (`hasBound()`). + - ``/``: parse epoch. + - ``: non‑blank after trim. + +- `usesLines`: + - If `lines` present, return `true`. + - Else recurse into `and`, `or`, `not` groups via `anyUsesLines`. + +- `anyUsesLines`: iterate children; return `true` if any child `usesLines`. + +- `validateGroup`: ensure at least one child; recursively `validate` each child. + +- `branchCount`: count non‑null branch/leaf fields (`and`, `or`, `not`, `extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, `pathGlob`). + +- `matchesExtension`: iterate extensions; return `true` if any non‑null extension matches file name suffix. + +- `globMatches`: instantiate `AiSourceExcludeFilter` with single glob; call `isExcluded(relativePath)`. + +- `parseEpochMilli`: `Instant.parse(isoInstant).toEpochMilli()`; on `DateTimeParseException` throw `IllegalArgumentException` with message. + +#### Public API +- `matches(AiCondition, AiFileContext) -> boolean` – check file matches condition. +- `validate(AiCondition) -> void` – validate condition tree. +- `usesLines(AiCondition) -> boolean` – detect line‑count requirement. + +#### Dependencies +- `java.time.Instant`, `java.time.format.DateTimeParseException`, `java.util.Collections`, `java.util.List`, `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`, `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `IllegalStateException` in `matches` when node has no branch. +- `IllegalArgumentException` in `validate`, `validateGroup`, `branchCount` checks, and `parseEpochMilli` on invalid ISO‑8601. + +#### Concurrency +- No explicit synchronization or threading; all methods are stateless and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..6bbc0c00 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,55 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:00:58Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> A container for child AI conditions used by `` / `` combinators in the AI configuration. + +#### Purpose +- Holds a list of `AiCondition` objects for logical combinators. +- Provides defensive copying when setting the list. + +#### Type +- `public class AiConditionGroup` + - Modifiers: public, final (implicitly), no superclass. + - Annotations: `@ToString`, `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`. + - Field: `private @Nullable List conditions`. + - Constructor: `public AiConditionGroup()` (no-op). + - Methods: + - `public @Nullable List getConditions()` – returns the list or `null`. + - `public void setConditions(final @Nullable Collection conditions)` – copies into a new `ArrayList` or sets to `null`. + +#### Input +- `setConditions` receives a `Collection` (nullable). +- Constructor receives no parameters. + +#### Output +- `getConditions` returns the internal `List` or `null`. +- `setConditions` mutates the private `conditions` field. + +#### Core logic +- `setConditions`: + - If `conditions` argument is non‑null, create `new ArrayList<>(conditions)` and assign to `this.conditions`. + - Else assign `null` to `this.conditions`. + +#### Public API +- `getConditions() -> List` – retrieve child conditions. +- `setConditions(Collection) -> void` – set child conditions. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List`. +- `lombok.ToString`. +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.config.AiCondition`. + +#### Exceptions / Errors +- No checked exceptions thrown. +- Defensive copying prevents external mutation of the internal list. + +#### Concurrency +- No synchronization; class is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..0aa1a409 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,63 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:01:01Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Computes deterministic, language‑agnostic fact counts from source text using regex counters. + +#### Purpose +- Provides exact, whole‑file fact counts for AI summaries. +- Validates fact counter configurations. + +#### Type +- `public final class AiFactExtractor` – utility class, no instances. + +#### Input +- `factsBlock(List counters, String source)` – list of counters, source text. +- `validate(List counters)` – list of counters. +- `countMatches(String pattern, String source)` – regex pattern, source text. + +#### Output +- `factsBlock` returns a formatted facts block string or empty string. +- `validate` throws `IllegalArgumentException` on invalid counters. +- `countMatches` returns integer match count. + +#### Core logic +- `factsBlock`: + - Skip null counters or those with null label/pattern. + - Append `ENTRY_SEPARATOR` between entries. + - Append `label + LABEL_COUNT_SEPARATOR + countMatches(pattern, source)`. + - Prepend `FACTS_HEADER`, append `FACTS_SUFFIX` if any entries. +- `validate`: + - For each counter, check non‑null label and pattern. + - Compile pattern with `Pattern.compile`; catch `PatternSyntaxException` and wrap in `IllegalArgumentException`. +- `countMatches`: + - Compile pattern, create `Matcher`, iterate `matcher.find()` counting matches. + +#### Public API +- `factsBlock(List counters, String source) -> String` – build facts block. +- `validate(List counters) -> void` – validate counters. +- `FACTS_HEADER: String` – header prefix. +- `LABEL_COUNT_SEPARATOR: String` – label‑count separator. +- `ENTRY_SEPARATOR: String` – entry separator. +- `FACTS_SUFFIX: String` – suffix after facts block. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiFactCounter` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `validate` for missing label/pattern or invalid regex. +- `PatternSyntaxException` caught and rethrown as `IllegalArgumentException`. + +#### Concurrency +- Stateless, thread‑safe; no shared mutable state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..b904f6dc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,147 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:01:04Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> A mutable JavaBean that holds all AI‑generation parameters for a single model run, used by the Maven plugin to configure the chosen AI provider. + +#### Purpose +- Stores configuration for a single AI generation step (model path, sampling, retry, prompt limits, stop strings). +- Exposes getters/setters for Maven plugin binding and provider code. + +#### Type +- `public class AiGenerationConfig` + - Modifiers: `public` + - Annotations: `@ToString`, `@SuppressWarnings({"NullAway.Init","initialization.fields.uninitialized"})` + - Fields: 73 (including 2 lists, 1 calibration, 71 primitive/boxed fields). + - No supertype. + +#### Input +- Constructor: no-arg, no-op. +- Setter methods for each field (e.g., `setModelPath`, `setContextSize`, `setTemperature`, …). +- `setDrySequenceBreakers(List)`, `setStopStrings(List)` accept `null` to reset. +- `setCalibration(AiCalibration)`. + +#### Output +- Getter methods return current field values. +- `getDrySequenceBreakers()` and `getStopStrings()` return unmodifiable lists. +- `toString()` (via Lombok) prints all fields for diagnostics. + +#### Core logic +- Default constants define sensible values for all parameters (e.g., `DEFAULT_CONTEXT_SIZE = 32768`, `DEFAULT_TEMPERATURE = 0.15f`, `DEFAULT_THREADS = Math.min(4, Runtime.getRuntime().availableProcessors())`). +- Setters perform minimal validation: + - `setLazyMode` replaces `null` with `DEFAULT_LAZY_MODE`. + - `setCacheTypeK/V` replace `null` with `DEFAULT_CACHE_TYPE_K/V`. + - `setDevices` replaces `null` with `DEFAULT_DEVICES`. + - `setProvider`, `setRemoteModel`, `setBaseUrl`, `setApiKeyEnv` replace `null` with their respective defaults. +- No additional computation or side effects. + +#### Public API +- `String getModelPath() -> model file path` +- `void setModelPath(String)` +- `int getContextSize() -> context window` +- `void setContextSize(int)` +- `int getMaxOutputTokens() -> max output tokens` +- `void setMaxOutputTokens(int)` +- `float getTemperature() -> sampling temperature` +- `void setTemperature(float)` +- `int getThreads() -> CPU threads` +- `void setThreads(int)` +- `int getCharsPerToken() -> chars/token ratio` +- `void setCharsPerToken(int)` +- `int getMaxInputChars() -> max input chars` +- `void setMaxInputChars(int)` +- `boolean isWarnOnTrim() -> trim warning flag` +- `void setWarnOnTrim(boolean)` +- `float getTopP() -> nucleus threshold` +- `void setTopP(float)` +- `int getTopK() -> top-k limit` +- `void setTopK(int)` +- `float getMinP() -> min-p threshold` +- `void setMinP(float)` +- `float getTopNSigma() -> top-n-sigma threshold` +- `void setTopNSigma(float)` +- `float getRepeatPenalty() -> repetition penalty` +- `void setRepeatPenalty(float)` +- `Boolean getChatTemplateEnableThinking() -> chat‑template flag` +- `void setChatTemplateEnableThinking(Boolean)` +- `boolean isCachePrompt() -> prompt‑caching flag` +- `boolean isSwaFull() -> full‑SWA flag` +- `void setSwaFull(boolean)` +- `int getCacheReuse() -> prefix‑reuse chunk size` +- `void setCacheReuse(int)` +- `int getGpuLayers() -> GPU offload layers` +- `void setGpuLayers(int)` +- `int getCpuMoeLayers() -> CPU MoE layers` +- `void setCpuMoeLayers(int)` +- `int getSeed() -> RNG seed` +- `void setSeed(int)` +- `int getCpuFfnLayers() -> CPU FFN layers` +- `void setCpuFfnLayers(int)` +- `int getKvUnifiedPerSlot() -> KV cap` +- `void setKvUnifiedPerSlot(int)` +- `String getLazyMode() -> tensor‑read laziness` +- `void setLazyMode(String)` +- `int getRepeatLastN() -> repeat‑penalty window` +- `void setRepeatLastN(int)` +- `String getCacheTypeK() -> KV‑K type` +- `void setCacheTypeK(String)` +- `String getCacheTypeV() -> KV‑V type` +- `void setCacheTypeV(String)` +- `boolean isFlashAttn() -> Flash‑Attention flag` +- `void setFlashAttn(boolean)` +- `int getBatchSize() -> logical batch size` +- `void setBatchSize(int)` +- `int getUbatchSize() -> physical batch size` +- `void setUbatchSize(int)` +- `int getThreadsBatch() -> batch thread count` +- `void setThreadsBatch(int)` +- `int getMainGpu() -> primary GPU index` +- `void setMainGpu(int)` +- `String getDevices() -> device list` +- `void setDevices(String)` +- `String getProvider() -> AI provider` +- `void setProvider(String)` +- `String getRemoteModel() -> remote model id` +- `void setRemoteModel(String)` +- `String getBaseUrl() -> API base URL` +- `void setBaseUrl(String)` +- `String getApiKeyEnv() -> API key env var` +- `void setApiKeyEnv(String)` +- `String getReasoningEffort() -> reasoning effort` +- `void setReasoningEffort(String)` +- `int getReasoningBudgetTokens() -> reasoning budget` +- `void setReasoningBudgetTokens(int)` +- `float getDryMultiplier() -> DRY multiplier` +- `void setDryMultiplier(float)` +- `float getDryBase() -> DRY base` +- `void setDryBase(float)` +- `int getDryAllowedLength() -> DRY allowed length` +- `void setDryAllowedLength(int)` +- `int getDryPenaltyLastN() -> DRY penalty window` +- `void setDryPenaltyLastN(int)` +- `List getDrySequenceBreakers() -> DRY breakers` +- `void setDrySequenceBreakers(List)` +- `List getStopStrings() -> stop strings` +- `void setStopStrings(List)` +- `AiCalibration getCalibration() -> calibration` +- `void setCalibration(AiCalibration)` + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCalibration` (used as calibration type) + +#### Exceptions / Errors +- No explicit exceptions thrown. +- Null handling: setters replace `null` with defaults; getters may return `null` for optional fields (`modelPath`, `chatTemplateEnableThinking`, `calibration`). + +#### Concurrency +- No synchronization; intended for single‑threaded configuration use. +- Immutable lists returned via `Collections.unmodifiableList`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..fdaeaaf0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,55 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:01:15Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Defines how oversized source files are handled during routing. + +#### Purpose +- Provides strategies for processing source files that exceed the model’s context window. +- Parses configuration tokens into enum values. + +#### Type +- `public enum AiOversizeStrategy` + - Modifiers: `public` + - Supertypes: `java.lang.Enum` + - Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` + - Field: `private final String configValue` + - Constructor: `AiOversizeStrategy(String configValue)` + - Methods: `public String configValue()`, `public static AiOversizeStrategy fromConfig(String value)` + - Static field: `public static final AiOversizeStrategy DEFAULT = FAIL` + +#### Input +- Constructor parameter: `String configValue` (strategy token) +- `fromConfig` parameter: `@Nullable String value` (config token) + +#### Output +- `configValue()` returns the strategy’s token string. +- `fromConfig` returns an `AiOversizeStrategy` or throws `IllegalArgumentException` for unknown tokens. + +#### Core logic +- `fromConfig` + 1. If `value` is `null` → return `DEFAULT`. + 2. Trim `value`; if empty → return `DEFAULT`. + 3. Iterate over `values()`; compare `strategy.configValue` with `trimmed` case‑insensitively. + 4. Return matching strategy. + 5. If none match → throw `IllegalArgumentException` with message listing valid tokens. + +#### Public API +- `configValue() -> String` – returns the config token for the strategy. +- `fromConfig(String) -> AiOversizeStrategy` – parses a config token into a strategy. +- `DEFAULT: AiOversizeStrategy` – default strategy (FAIL). + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `fromConfig` when token is non‑blank and unrecognized. + +#### Concurrency +- None. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..6a931908 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,94 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:01:19Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Holds all configuration parameters for a srcmorph run, bindable from Maven, JSON/YAML, or code. + +#### Purpose +- Stores mutable JavaBean configuration for AI‑powered source generation. +- Provides defaults and exposes getters/setters for every parameter. + +#### Type +- `public class SrcMorphConfiguration` + - Modifiers: public, final (implicitly), mutable JavaBean. + - Extends: none. + - Annotations: `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`, `@ToString`. + - Fields (23): `baseDirectory`, `outputDirectory`, `force`, `subtrees`, `excludes`, `fileExtensions`, `minFileSizeBytes`, `maxFileSizeBytes`, `planOnly`, `generationProvider`, `promptDefinitions`, `aiDefinitions`, `modelDirectory`, `fieldGenerations`, `factDefinitions`, `llamaModelPath`, `llamaContextSize`, `llamaMaxOutputTokens`, `llamaTemperature`, `llamaThreads`, `pluginVersion`, `aiVersion`, `projectName`. + - Constants (9): `DEFAULT_OUTPUT_DIRECTORY`, `DEFAULT_GENERATION_PROVIDER`, `DEFAULT_LLAMA_CONTEXT_SIZE`, `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS`, `DEFAULT_LLAMA_TEMPERATURE`, `DEFAULT_LLAMA_THREADS`, `DEFAULT_AI_VERSION`. + +#### Input +- Constructor: no parameters. +- Setter parameters: `File`, `boolean`, `List`, `long`, `String`, `List`, `List`, `File`, `List`, `List`, `String`, `int`, `float`. +- Nullable annotations on list and file fields. + +#### Output +- Getter return types: `File`, `boolean`, `List`, `long`, `String`, `List`, `List`, `File`, `List`, `List`, `String`, `int`, `float`. +- No side effects beyond field mutation. + +#### Core logic +- No algorithmic logic; only property accessors. +- Constructor performs no initialization beyond defaults. + +#### Public API +- `SrcMorphConfiguration()` -> new config instance. +- `File getBaseDirectory()` -> base dir. +- `void setBaseDirectory(File)` -> set base dir. +- `File getOutputDirectory()` -> output dir. +- `void setOutputDirectory(File)` -> set output dir. +- `boolean isForce()` -> force flag. +- `void setForce(boolean)` -> set force. +- `List getSubtrees()` -> subtrees. +- `void setSubtrees(List)` -> set subtrees. +- `List getExcludes()` -> excludes. +- `void setExcludes(List)` -> set excludes. +- `List getFileExtensions()` -> file extensions. +- `void setFileExtensions(List)` -> set extensions. +- `long getMinFileSizeBytes()` -> min size. +- `void setMinFileSizeBytes(long)` -> set min size. +- `long getMaxFileSizeBytes()` -> max size. +- `void setMaxFileSizeBytes(long)` -> set max size. +- `boolean isPlanOnly()` -> plan‑only flag. +- `void setPlanOnly(boolean)` -> set plan‑only. +- `String getGenerationProvider()` -> provider name. +- `void setGenerationProvider(String)` -> set provider. +- `List getPromptDefinitions()` -> prompt defs. +- `void setPromptDefinitions(List)` -> set prompt defs. +- `List getAiDefinitions()` -> model defs. +- `void setAiDefinitions(List)` -> set model defs. +- `File getModelDirectory()` -> model dir. +- `void setModelDirectory(File)` -> set model dir. +- `List getFieldGenerations()` -> field gen rules. +- `void setFieldGenerations(List)` -> set field gen rules. +- `List getFactDefinitions()` -> fact groups. +- `void setFactDefinitions(List)` -> set fact groups. +- `String getLlamaModelPath()` -> llama model path. +- `void setLlamaModelPath(String)` -> set llama model path. +- `int getLlamaContextSize()` -> llama context size. +- `void setLlamaContextSize(int)` -> set llama context size. +- `int getLlamaMaxOutputTokens()` -> llama max tokens. +- `void setLlamaMaxOutputTokens(int)` -> set llama max tokens. +- `float getLlamaTemperature()` -> llama temperature. +- `void setLlamaTemperature(float)` -> set llama temperature. +- `int getLlamaThreads()` -> llama thread count. +- `void setLlamaThreads(int)` -> set llama threads. +- `String getPluginVersion()` -> plugin version. +- `void setPluginVersion(String)` -> set plugin version. +- `String getAiVersion()` -> AI logic version. +- `void setAiVersion(String)` -> set AI version. +- `String getProjectName()` -> project title. +- `void setProjectName(String)` -> set project title. + +#### Dependencies +- `java.io.File`, `java.util.List`, `lombok.ToString`, `net.ladenthin.srcmorph.prompt.AiPromptDefinition`, `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- No explicit exceptions thrown or caught. + +#### Concurrency +- No synchronization; mutable state is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..a2f1abc6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,57 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:03:09Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> A configuration‑driven framework for AI‑powered source‑code generation, routing, and fact extraction within a Maven‑based build pipeline. + +#### Purpose +- Centralizes AI generation settings, file‑selection logic, and fact extraction for source‑code transformation. +- Provides runtime decision‑making for oversized files and condition validation. + +#### Responsibilities +- **Configuration Management** – `SrcMorphConfiguration` and `AiGenerationConfig` expose mutable JavaBeans for Maven, JSON/YAML, or programmatic use. +- **Condition Evaluation** – `AiConditionEvaluator` validates and matches `AiCondition` trees against file metadata. +- **Fact Extraction** – `AiFactExtractor` computes deterministic regex‑based fact counts for AI prompts. +- **Oversize Handling** – `AiOversizeStrategy` defines strategies for files exceeding the model context window. + +#### Key units +- `SrcMorphConfiguration` – holds all run‑time parameters (directories, providers, prompts, models, etc.). +- `AiGenerationConfig` – mutable bean for a single AI generation step (model path, sampling, retry, stop strings, etc.). +- `AiConditionEvaluator` – stateless validator and matcher for `AiCondition` trees. +- `AiConditionGroup` – container for child conditions used by ``/`` combinators. +- `AiFactExtractor` – utility for building fact blocks from `AiFactCounter` configurations. +- `AiOversizeStrategy` – enum mapping config tokens to handling strategies (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`). + +#### Data flow +1. **Configuration**: `SrcMorphConfiguration` is populated (Maven plugin, JSON/YAML, or code). +2. **Condition Setup**: `AiCondition` trees are defined within the configuration. +3. **File Selection**: `AiConditionEvaluator` receives a file’s `AiFileContext` and evaluates the tree to decide inclusion and whether line counting is needed. +4. **Oversize Decision**: If a file exceeds the context window, `AiOversizeStrategy` determines the handling path. +5. **Fact Extraction**: `AiFactExtractor` processes source text with configured `AiFactCounter`s to produce a facts block for AI prompts. +6. **Generation**: `AiGenerationConfig` supplies the AI provider with prompt, model, and runtime parameters for the actual generation step. + +#### Dependencies +- **Internal**: `AiCondition`, `AiConditionGroup`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiSourceExcludeFilter`. +- **External**: `java.time`, `java.util`, `java.util.regex`, `org.jspecify.annotations`, Lombok (`@ToString`), Maven plugin APIs. + +#### Cross‑cutting +- Defensive copying in `AiConditionGroup` and `SrcMorphConfiguration` to prevent external mutation. +- Thread‑safe stateless utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Consistent null handling: setters replace `null` with defaults; getters may return `null` for optional fields. +- Error handling: `IllegalArgumentException` for misconfiguration; `IllegalStateException` for unsupported condition nodes. +- Configuration tokens parsed case‑insensitively (`AiOversizeStrategy.fromConfig`). + +#### Notes +- The package is designed for build‑time source transformation; all components are pure JavaBeans or stateless utilities. +- No external concurrency primitives; intended for single‑threaded configuration and evaluation phases. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..39083e4b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,63 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:03:19Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A Maven‑based framework that configures, evaluates, and drives AI‑powered source‑code generation and transformation, supporting multiple back‑ends and runtime decision‑making for file selection and context handling. + +#### Purpose +- Centralize AI generation settings and runtime decision logic for source‑code transformation. +- Abstract multiple AI back‑ends (mock, llama.cpp JNI, OpenAI‑compatible) into a unified provider API. + +#### Responsibilities +- **Configuration Management** – `SrcMorphConfiguration` and `AiGenerationConfig` expose mutable beans for Maven, JSON/YAML, or programmatic use. +- **Condition Evaluation & Fact Extraction** – `AiConditionEvaluator`, `AiConditionGroup`, `AiFactExtractor`, and related counters compute deterministic facts and decide file inclusion. +- **Oversize Handling** – `AiOversizeStrategy` selects how to process files exceeding the model context window. +- **Provider Abstraction** – `AiGenerationProvider`, `AiGenerationProviderFactory`, and concrete providers (`LlamaCppJniAiGenerationProvider`, OpenAI‑compatible support) generate text from prompts. +- **Request & Timing Support** – `AiPromptSupport`, `AiCompletionParser`, and `AiGenerationTimings` manage prompt rendering, post‑processing, and metric collection. + +#### Key units +- `SrcMorphConfiguration` – runtime parameters (directories, providers, prompts, models, etc.). +- `AiGenerationConfig` – per‑step AI generation settings (model path, sampling, retry, stop strings). +- `AiConditionEvaluator` – stateless validator/matcher for `AiCondition` trees. +- `AiFactExtractor` – builds fact blocks from `AiFactCounter` configurations. +- `AiOversizeStrategy` – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`). +- `AiGenerationProvider` – interface for text generation. +- `AiGenerationProviderFactory` – resolves provider key and constructs provider. +- `LlamaCppJniAiGenerationProvider` – local GGUF inference via llama.cpp JNI. +- `OpenAiCompatibleProviderSupport` – helper for OpenAI‑compatible HTTP calls. +- `AiCompletionParser` – strips internal thinking blocks from completions. +- `AiGenerationTimings` – holds generated text and timing metrics. + +#### Data flow +1. **Configuration** – `SrcMorphConfiguration` is populated (Maven plugin, JSON/YAML, or code). +2. **Condition Setup** – `AiCondition` trees are defined within the configuration. +3. **File Selection** – `AiConditionEvaluator` receives a file’s `AiFileContext` and evaluates the tree to decide inclusion and whether line counting is needed. +4. **Oversize Decision** – If a file exceeds the context window, `AiOversizeStrategy` determines the handling path. +5. **Fact Extraction** – `AiFactExtractor` processes source text with configured `AiFactCounter`s to produce a facts block for AI prompts. +6. **Request Creation** – Client builds an `AiGenerationRequest` (prompt key, source file/text, header). +7. **Provider Selection** – `AiGenerationProviderFactory.effectiveProvider` resolves the key; `create` returns the chosen provider. +8. **Generation** – Provider’s `generate` or `generateWithTimings` is invoked: + - **llama.cpp**: lazy model load → inference → JSON parse → optional timing extraction. + - **OpenAI‑compatible**: build JSON body → HTTP call → parse response → timing extraction. +9. **Post‑processing** – `AiCompletionParser` removes internal thinking blocks if present. +10. **Result** – `AiGenerationTimings` (or plain text) returned to caller. + +#### Dependencies +- **Internal** – `AiCondition`, `AiConditionGroup`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiSourceExcludeFilter`, `AiPromptSupport`, `Java8CompatibilityHelper`, `AiGenerationRequest`. +- **External** – `java.time`, `java.util`, `java.util.regex`, `org.jspecify.annotations`, Lombok (`@ToString`), Maven plugin APIs, `net.ladenthin.llama` (model, parameters, JSON parser), Jackson `ObjectMapper`. + +#### Cross‑cutting +- Defensive copying in `AiConditionGroup` and `SrcMorphConfiguration`. +- Stateless, thread‑safe utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Immutable configuration builders (`LlamaCppJniConfig`). +- Lazy initialization of llama.cpp model (not thread‑safe; external coordination required). +- Consistent null handling and error reporting (`IllegalArgumentException`, `IllegalStateException`, `IOException`). +- Environment‑based credential lookup for OpenAI‑compatible provider. +- Logging of truncated answers and prompt‑cache reuse. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..8b226fcd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,59 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:01:28Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Strips a Gemma‑4 model’s internal “thinking” block from a raw LLM completion so only the final answer is stored. + +#### Purpose +- Removes leading Gemma‑4 thinking block from model output. +- Validates presence of closing marker; throws `IOException` if missing. +- Returns trimmed answer text. + +#### Type +- `public class AiCompletionParser` + - Modifiers: public + - Annotations: `@ToString` + - Supertypes: none + - Fields: + - `public static final String THINKING_BLOCK_START_MARKER` + - `public static final String THINKING_BLOCK_END_MARKER` + - Methods: + - `public AiCompletionParser()` – no‑op constructor + - `public String parseCompletion(final String response) throws IOException` + +#### Input +- `parseCompletion(String response)` + - `response`: raw completion text, may be `null`. + +#### Output +- `parseCompletion` returns a non‑null `String` containing the cleaned answer. +- Throws `IOException` if a start marker is present but no end marker is found. + +#### Core logic +- If `response` is `null`, return `""`. +- Trim `response` to `trimmed`. +- If `trimmed` does not start with `THINKING_BLOCK_START_MARKER`, return `trimmed`. +- Compute `thinking` as substring after the start marker. +- Find `thinkingEnd` as index of `THINKING_BLOCK_END_MARKER` in `thinking`. +- If `thinkingEnd < 0`, throw `IOException` with message indicating token budget exhaustion. +- Return substring of `thinking` after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` – constructs a parser instance. +- `String parseCompletion(String response) throws IOException` – cleans a raw LLM completion. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` when a start marker is found but the end marker is missing, indicating token budget exhaustion. + +#### Concurrency +- No concurrency constructs; class is stateless and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..46c56c0f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,52 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:01:32Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides a pluggable AI backend for generating text from an `AiGenerationRequest`. + +#### Purpose +- Supplies AI text generation for source‑code morphing. +- Supports default and timed generation. + +#### Type +- `public interface AiGenerationProvider extends AutoCloseable` + - Methods: `generate(AiGenerationRequest)`, `generateWithTimings(AiGenerationRequest)`, `close()`. + - Default `generateWithTimings` returns `AiGenerationTimings` with zero rates. + +#### Input +- `generate(AiGenerationRequest request)` receives: + - `AiGenerationRequest` containing prompt key, source file, source text, current header. +- `generateWithTimings(AiGenerationRequest request)` receives same request. + +#### Output +- `generate` returns `String` (never `null`, may be blank). +- `generateWithTimings` returns `AiGenerationTimings` (generated text + timing data). +- `close` performs no action by default. + +#### Core logic +- `generate` is abstract; implementations provide text generation. +- `generateWithTimings`: + 1. Calls `generate(request)`. + 2. Wraps result in `AiGenerationTimings` with all timing fields set to zero. +- `close` is a no‑op default. + +#### Public API +- `generate(AiGenerationRequest) -> String` – generate text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – generate text with timings. +- `close() -> void` – close provider. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` + +#### Exceptions / Errors +- `generate` and `generateWithTimings` declare `throws IOException`. + +#### Concurrency +- No explicit concurrency handling; interface is stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..c20d2279 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,65 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:01:34Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Creates an AI generation provider instance based on a provider key or model configuration. + +#### Purpose +- Instantiates an `AiGenerationProvider` implementation. +- Resolves the effective provider key from run or model configuration. + +#### Type +- `public class AiGenerationProviderFactory` + - Modifiers: public, @ToString + - Supertypes: none + - Fields: + - `private final Java8CompatibilityHelper compatibilityHelper` – helper for blank checks + - Methods: + - `public AiGenerationProviderFactory()` – no‑op constructor + - `public static @Nullable String effectiveProvider(String runProvider, String modelProvider)` – resolves provider key + - `public AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` – factory method + +#### Input +- `providerName` (String) – run‑level provider key, may be null or blank +- `llamaConfig` (LlamaCppJniConfig) – model configuration, provides `provider()` +- `promptSupport` (AiPromptSupport) – lookup support for prompts + +#### Output +- Returns an instance of `AiGenerationProvider` (Mock, LlamaCppJni, or OpenAiCompatible). +- Throws `IllegalArgumentException` if provider key unrecognised. + +#### Core logic +- Call `effectiveProvider(providerName, llamaConfig.provider())` to get `effective`. +- If `effective` is null or blank (`compatibilityHelper.isBlank`), return `new MockAiGenerationProvider()`. +- Switch on `effective`: + - `PROVIDER_MOCK` → `new MockAiGenerationProvider()` + - `PROVIDER_LLAMACPP_JNI` → `new LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)` + - `PROVIDER_OPENAI_COMPATIBLE` → `new OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)` + - default → `throw new IllegalArgumentException("Unsupported AI provider: " + effective)` + +#### Public API +- `effectiveProvider(String, String) -> String?` – resolves provider key +- `create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider` – creates provider instance + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.provider.MockAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.OpenAiCompatibleAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniConfig` + +#### Exceptions / Errors +- `IllegalArgumentException` when provider key not in {mock, llamacpp-jni, openai-compatible}. + +#### Concurrency +- No explicit synchronization; class is stateless except for a single helper instance. +- Thread‑safe by default. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..b85cb9c3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,80 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:01:39Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides local GGUF model inference via llama.cpp, exposing AI generation and timing APIs. + +#### Purpose +- Loads a GGUF model lazily and runs chat completions. +- Parses responses into plain text or detailed timings. +- Manages model lifecycle and configuration. + +#### Type +- `final class LlamaCppJniAiGenerationProvider` – implements `AiGenerationProvider`, `AutoCloseable`. + - Extends `Object`. + - Annotations: `@ToString`. + - Fields: + - `private final LlamaCppJniConfig config` – configuration. + - `@ToString.Exclude private @Nullable LlamaModel model` – native handle, lazy. + - `private final AiPromptSupport promptSupport` – prompt rendering. + - `@ToString.Exclude private final LlamaCppJniProviderSupport support` – helper. + - `private final AiCompletionParser completionParser` – parses text. + - `private final ChatResponseParser chatResponseParser` – parses JSON. + - `private final Java8CompatibilityHelper compatibilityHelper` – helper. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate(AiGenerationRequest)` / `generateWithTimings(AiGenerationRequest)` – request contains prompt, parameters. +- `model()` builds `ModelParameters` from `config` and `support.buildChatTemplateKwargs()`. + +#### Output +- `generate` returns `String` completion. +- `generateWithTimings` returns `AiGenerationTimings` (text, promptN, cacheN, promptPerSecond, predictedN, predictedPerSecond). +- `close` releases native `LlamaModel`. + +#### Core logic +- **Lazy model load** (`model()`): + 1. If `model` null, build `ModelParameters` with: + - `modelPath`, `ctxSize`, `threads`, `reasoningFormat`, `chatTemplateKwargs`. + - Optional flags: `swaFull`, `cacheReuse`, `gpuLayers`, `cpuMoeLayers`, `cpuFfnLayers`, `kvUnifiedPerSlot`, `lazyMode`, `flashAttn`, `cacheTypeK/V`, `batchSize`, `ubatchSize`, `threadsBatch`, `mainGpu`, `devices`. + 2. Instantiate `LlamaModel` and cache it. +- **Chat completion** (`chatResponse`): + 1. Call `support.buildInferenceParameters(request)` to get inference params. + 2. Invoke `model().chatComplete(params)` → JSON. + 3. Parse with `chatResponseParser.parseResponse`. +- **Generate** (`generate`): + 1. Call `chatResponse(request)`. + 2. Warn on truncated answer via `support.warnOnTruncatedAnswer`. + 3. Log prompt cache reuse via `support.logPromptCacheReuse`. + 4. Return parsed completion text. +- **Generate with timings** (`generateWithTimings`): + 1. Call `chatResponse(request)`. + 2. Extract `text` and `Timings`. + 3. If `Timings` null, return zeroed metrics. + 4. Return `AiGenerationTimings` with prompt/cache/predicted metrics. +- **Close** (`close`): + 1. If `model` not null, call `model.close()`. + +#### Public API +- `generate(AiGenerationRequest) -> String` – produce completion. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – produce completion with metrics. +- `close() -> void` – release native resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.args.*`, `net.ladenthin.llama.json.ChatResponseParser`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.*`, `net.ladenthin.srcmorph.document.AiGenerationRequest`, `net.ladenthin.srcmorph.prompt.AiPromptSupport`, `net.ladenthin.srcmorph.support.Java8CompatibilityHelper`, `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- Constructor throws `NullPointerException` if `config` or `promptSupport` null. +- `generate` declares `IOException` (though underlying chat path throws unchecked). +- `generateWithTimings` no checked exceptions. +- `close` safe even if model null. + +#### Concurrency +- No explicit synchronization; assumes single-threaded or external coordination. +- Lazy initialization of `model` is not thread-safe; concurrent calls may load multiple instances. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..65e71e1b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,102 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:01:56Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds an immutable configuration for llama.cpp JNI provider, exposing all runtime knobs and defaults for model loading, sampling, caching, GPU usage, and API integration. + +#### Purpose +- Holds 37 configuration parameters for llama.cpp JNI provider. +- Provides fluent builder with defaults from `AiGenerationConfig`. +- Exposes read‑only accessors for all fields. + +#### Type +- `final class LlamaCppJniConfig` (class, final) + - Extends `Object`. + - Annotations: `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. + - 37 private final fields: `String modelPath`, `int contextSize`, `int maxOutputTokens`, `float temperature`, `int threads`, `float topP`, `int topK`, `float minP`, `float topNSigma`, `float repeatPenalty`, `@Nullable Boolean chatTemplateEnableThinking`, `boolean cachePrompt`, `boolean swaFull`, `int cacheReuse`, `int gpuLayers`, `int seed`, `int cpuMoeLayers`, `int cpuFfnLayers`, `int kvUnifiedPerSlot`, `String lazyMode`, `int repeatLastN`, `String cacheTypeK`, `String cacheTypeV`, `boolean flashAttn`, `int batchSize`, `int ubatchSize`, `int threadsBatch`, `int mainGpu`, `String devices`, `String provider`, `String remoteModel`, `String baseUrl`, `String apiKeyEnv`, `String reasoningEffort`, `int reasoningBudgetTokens`, `float dryMultiplier`, `float dryBase`, `int dryAllowedLength`, `int dryPenaltyLastN`, `List drySequenceBreakers`, `List stopStrings`. +- `public static final class Builder` (class, final) + - Fields: same names as above, initialized to `AiGenerationConfig.DEFAULT_*` or `modelPath`. + - Constructor: `Builder(String modelPath)` (private). + - Setter methods: `contextSize(int)`, `maxOutputTokens(int)`, `temperature(float)`, `threads(int)`, `topP(float)`, `topK(int)`, `minP(float)`, `topNSigma(float)`, `repeatPenalty(float)`, `chatTemplateEnableThinking(@Nullable Boolean)`, `cachePrompt(boolean)`, `swaFull(boolean)`, `cacheReuse(int)`, `gpuLayers(int)`, `seed(int)`, `cpuMoeLayers(int)`, `cpuFfnLayers(int)`, `kvUnifiedPerSlot(int)`, `lazyMode(String)`, `repeatLastN(int)`, `cacheTypeK(String)`, `cacheTypeV(String)`, `flashAttn(boolean)`, `batchSize(int)`, `ubatchSize(int)`, `threadsBatch(int)`, `mainGpu(int)`, `devices(String)`, `provider(String)`, `remoteModel(String)`, `baseUrl(String)`, `apiKeyEnv(String)`, `reasoningEffort(String)`, `reasoningBudgetTokens(int)`, `dryMultiplier(float)`, `dryBase(float)`, `dryAllowedLength(int)`, `dryPenaltyLastN(int)`, `drySequenceBreakers(List)`, `stopStrings(List)`. + - `build()` returns `LlamaCppJniConfig`. + +#### Input +- `builder(String modelPath)` requires non‑null `modelPath`. +- Builder setters accept primitive or reference values; `lazyMode`, `cacheTypeK`, `cacheTypeV`, `devices`, `provider`, `remoteModel`, `baseUrl`, `apiKeyEnv`, `reasoningEffort` treat `null` as default. +- `drySequenceBreakers` and `stopStrings` accept `null` as empty list. + +#### Output +- `LlamaCppJniConfig` instance with all fields set. +- Accessor methods return primitive or immutable copies; list getters return unmodifiable views. + +#### Core logic +- Constructor copies each builder field to its own field. +- `builder(String)` creates a new `Builder` with required `modelPath`. +- Each setter assigns the argument to the builder field and returns `this`. +- `build()` constructs a new `LlamaCppJniConfig` via the private constructor. + +#### Public API +- `static Builder builder(String) -> Builder` – start building. +- `String modelPath() -> model file path` +- `int contextSize() -> context window size` +- `int maxOutputTokens() -> maximum output tokens` +- `float temperature() -> sampling temperature` +- `int threads() -> CPU threads` +- `float topP() -> nucleus‑sampling threshold` +- `int topK() -> top‑k limit` +- `float minP() -> min‑p threshold` +- `float topNSigma() -> top‑n‑sigma threshold` +- `float repeatPenalty() -> repetition penalty` +- `@Nullable Boolean chatTemplateEnableThinking() -> chat‑template thinking flag` +- `boolean cachePrompt() -> prompt caching enabled` +- `boolean swaFull() -> full‑size SWA cache kept` +- `int cacheReuse() -> KV prefix‑reuse chunk size` +- `int gpuLayers() -> GPU layers offloaded` +- `int seed() -> RNG seed` +- `int cpuMoeLayers() -> CPU MoE layers` +- `int cpuFfnLayers() -> CPU FFN layers` +- `int kvUnifiedPerSlot() -> per‑slot KV cap` +- `String lazyMode() -> tensor‑read laziness` +- `int repeatLastN() -> repeat‑penalty window` +- `String cacheTypeK() -> KV cache type K` +- `String cacheTypeV() -> KV cache type V` +- `boolean flashAttn() -> Flash Attention enabled` +- `int batchSize() -> logical batch size` +- `int ubatchSize() -> physical batch size` +- `int threadsBatch() -> batch/prompt thread count` +- `int mainGpu() -> primary GPU index` +- `String devices() -> device selection` +- `String provider() -> AI provider` +- `String remoteModel() -> remote model id` +- `String baseUrl() -> OpenAI‑compatible base URL` +- `String apiKeyEnv() -> API key env var name` +- `String reasoningEffort() -> reasoning‑effort value` +- `int reasoningBudgetTokens() -> reasoning budget` +- `float dryMultiplier() -> DRY multiplier` +- `float dryBase() -> DRY base` +- `int dryAllowedLength() -> DRY allowed length` +- `int dryPenaltyLastN() -> DRY penalty window` +- `List drySequenceBreakers() -> unmodifiable list` +- `List stopStrings() -> unmodifiable list` + +#### Dependencies +- `net.ladenthin.srcmorph.config.AiGenerationConfig` for default constants. +- `net.ladenthin.srcmorph.support.ConvertToRecord`. +- `org.jspecify.annotations.Nullable`. +- `java.util.Collections`, `java.util.List`, `java.util.Objects`. +- Lombok annotations: `@EqualsAndHashCode`, `@ToString`. + +#### Exceptions / Errors +- `builder(String)` throws `NullPointerException` if `modelPath` is null. +- `Builder` constructor uses `Objects.requireNonNull` for `modelPath`. +- No other runtime exceptions. + +#### Concurrency +- Immutable `LlamaCppJniConfig` is thread‑safe. +- `Builder` is not thread‑safe; intended for single‑thread use. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..9b205463 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,123 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:02:07Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds JSON request bodies, validates endpoints, secures API keys, and interprets responses for an OpenAI‑compatible chat‑completion provider. + +#### Purpose +- Constructs request payloads for chat‑completion calls. +- Validates and normalizes endpoint URLs. +- Secures API key transmission to loopback hosts only. +- Parses success status and error messages. +- Calculates generation timings from response usage. + +#### Type +- `final class OpenAiCompatibleProviderSupport` + - extends `Object` + - annotations: `@ToString` + - fields: + - `static final String CHAT_COMPLETIONS_PATH` – endpoint suffix + - `static final int ERROR_BODY_EXCERPT` – error body limit + - `private static final int HTTP_OK_FIRST` – 200 + - `private static final int HTTP_OK_END` – 300 + - `static final String HTTP_SCHEME` – "http://" + - `static final String HTTPS_SCHEME` – "https://" + - `private static final String LOOPBACK_HOST_NAME` – "localhost" + - `private static final Pattern IPV4_LOOPBACK` – regex for 127.x.x.x + - `private static final String IPV6_LOOPBACK` – "[::1]" + - `private static final String ELLIPSIS` – "..." + - `private static final ObjectMapper MAPPER` – Jackson mapper + - `private final LlamaCppJniConfig config` – model config + - `private final AiPromptSupport promptSupport` – prompt definitions (`@ToString.Exclude`) + - `private final Function environment` – env lookup (`@ToString.Exclude`) + - `private final Java8CompatibilityHelper compatibilityHelper` – helper instance + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, `Function environment`. +- `requestBody(AiGenerationRequest request)` consumes `AiGenerationRequest` fields: `promptKey()`, `sourceFile()`, `sourceText()`. +- `endpoint()` reads `config.baseUrl()`. +- `apiKey()` reads `config.apiKeyEnv()`. +- `apiKeyFor(String endpoint)` reads `endpoint` and `config.apiKeyEnv()`. +- `isLoopbackHost(String host)` reads `host`. +- `isSuccess(int status)` reads `status`. +- `errorMessage(String endpoint, int status, String body)` reads all parameters. +- `timings(String text, ChatResponse response, double seconds)` reads `response.getUsage()`. + +#### Output +- `requestBody` returns JSON string. +- `endpoint` returns full URL string. +- `apiKey` returns trimmed key or `null`. +- `apiKeyFor` returns key or `null`; throws `IOException` on insecure endpoint. +- `isLoopbackHost` returns boolean. +- `isSuccess` returns boolean. +- `errorMessage` returns formatted string. +- `timings` returns `AiGenerationTimings` instance. + +#### Core logic +- `requestBody`: + - Create `ObjectNode` body. + - Add `model` if non‑blank. + - Add `messages` array with system and user messages from `promptSupport`. + - Set `max_tokens`, `temperature`, `top_p`. + - Conditionally add `top_k`, `min_p`, `seed`, `stop` array, `reasoning.effort`. + - Set `stream` to `false`. + - Serialize with `MAPPER`. +- `endpoint`: + - Trim `config.baseUrl()`. + - Validate starts with `http://` or `https://`. + - Strip trailing slashes. + - Append `CHAT_COMPLETIONS_PATH`. +- `apiKey`: + - Return `null` if `apiKeyEnv` blank. + - Lookup env var; return trimmed key or `null` if unset/blank. +- `apiKeyFor`: + - If key `null` or endpoint not `http://`, return key. + - Parse host from `endpoint`. + - If host not loopback (`isLoopbackHost`), throw `IOException`. + - Return key. +- `isLoopbackHost`: + - Return true if host equals `localhost`, matches `IPV4_LOOPBACK`, or equals `IPV6_LOOPBACK`. +- `isSuccess`: + - Return true if status in [200,300). +- `errorMessage`: + - Truncate body to `ERROR_BODY_EXCERPT` + `ELLIPSIS` if longer. + - Return formatted string with endpoint, status, excerpt. +- `timings`: + - Extract `completionTokens`, `promptTokens`, `cachedTokens` from `response.getUsage()`. + - Compute `decodeRate = completionTokens / seconds` if seconds > 0. + - Return new `AiGenerationTimings(text, promptTokens, cachedTokens, 0.0, completionTokens, decodeRate)`. + +#### Public API +- `String requestBody(AiGenerationRequest request) -> JSON body` +- `String endpoint() -> full URL` +- `@Nullable String apiKey() -> trimmed key or null` +- `@Nullable String apiKeyFor(String endpoint) -> key or null` +- `static boolean isLoopbackHost(String host) -> true if loopback` +- `static boolean isSuccess(int status) -> true if 2xx` +- `static String errorMessage(String endpoint, int status, String body) -> message` +- `static AiGenerationTimings timings(String text, ChatResponse response, double seconds) -> timings` + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper`, `ArrayNode`, `ObjectNode` +- `java.io.IOException`, `java.net.URL` +- `java.util.List`, `java.util.Objects`, `java.util.function.Function`, `java.util.regex.Pattern` +- `lombok.ToString` +- `net.ladenthin.llama.value.ChatResponse`, `Usage` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` in `endpoint()` if baseUrl not http(s). +- `IOException` in `apiKeyFor()` if plain http to non‑loopback host or URL parsing fails. +- `IOException` in `requestBody()` if JSON serialization fails. + +#### Concurrency +- No mutable shared state beyond final fields; thread‑safe. No synchronization or coroutines. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..14f257bb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,59 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:03:14Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> A modular AI‑generation framework that abstracts multiple back‑ends (mock, llama.cpp JNI, OpenAI‑compatible) and provides configuration, request parsing, and timing support for source‑code transformation tasks. + +#### Purpose +- Expose a unified `AiGenerationProvider` API for generating text from prompts. +- Offer pluggable back‑ends with lazy model loading and detailed timing metrics. +- Centralize configuration for llama.cpp and OpenAI‑compatible providers. + +#### Responsibilities +- **Provider abstraction** – `AiGenerationProvider` interface and factory (`AiGenerationProviderFactory`) select the concrete implementation. +- **Configuration** – `LlamaCppJniConfig` builds immutable runtime knobs for llama.cpp. +- **Request handling** – `AiPromptSupport` (not shown) supplies prompt templates; `AiCompletionParser` cleans raw completions. +- **OpenAI compatibility** – `OpenAiCompatibleProviderSupport` builds request bodies, validates endpoints, secures API keys, and extracts usage statistics. +- **Timing & metrics** – `AiGenerationTimings` (used by providers) captures prompt/cache/prediction counts and rates. + +#### Key units +- `AiGenerationProvider` – interface for text generation. +- `AiGenerationProviderFactory` – resolves provider key and constructs provider. +- `LlamaCppJniAiGenerationProvider` – local GGUF inference via llama.cpp JNI. +- `LlamaCppJniConfig` – immutable config builder for llama.cpp. +- `OpenAiCompatibleProviderSupport` – helper for OpenAI‑compatible HTTP calls. +- `AiCompletionParser` – strips Gemma‑4 thinking blocks from completions. +- `AiPromptSupport` – (external) prompt rendering support. +- `AiGenerationTimings` – data holder for generated text and timing metrics. + +#### Data flow +1. **Request creation** – client builds an `AiGenerationRequest` (prompt key, source file/text, header). +2. **Provider selection** – `AiGenerationProviderFactory.effectiveProvider` resolves the key; `create` returns the chosen provider. +3. **Generation** – provider’s `generate` or `generateWithTimings` is invoked: + - For llama.cpp: lazy model load → build inference params → native chat completion → parse JSON → optional timing extraction. + - For OpenAI‑compatible: `OpenAiCompatibleProviderSupport.requestBody` builds JSON → HTTP call → parse response → timing extraction. +4. **Post‑processing** – `AiCompletionParser` removes internal thinking blocks if present. +5. **Result** – `AiGenerationTimings` (or plain text) returned to caller. + +#### Dependencies +- **Internal** – `AiPromptSupport`, `Java8CompatibilityHelper`, `AiGenerationRequest`, `AiGenerationTimings`. +- **External** – `net.ladenthin.llama` (model, parameters, JSON parser), Jackson `ObjectMapper`, `org.jspecify.annotations.Nullable`. +- **Configuration** – `LlamaCppJniConfig` supplies all knobs; `AiGenerationConfig` provides defaults. + +#### Cross-cutting +- **Immutability** – `LlamaCppJniConfig` is thread‑safe; builders are single‑threaded. +- **Error handling** – `IOException` for missing markers, endpoint validation, or JSON failures; `IllegalArgumentException` for unsupported provider keys. +- **Lazy initialization** – llama.cpp model is loaded on first request; not thread‑safe, so external coordination is required. +- **Logging & warnings** – providers log truncated answers and prompt‑cache reuse (implementation‑specific). +- **Environment lookup** – `OpenAiCompatibleProviderSupport` uses a `Function` to read API keys from the environment, ensuring secure handling of credentials. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..5684aa8f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,48 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:02:47Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Computes a 256‑bin histogram of a byte stream in two OpenCL kernel passes. + +#### Purpose +- Builds a byte histogram for image or generic byte data. +- Splits work into two passes: local partial histograms and global reduction. + +#### Type +- OpenCL C kernels (`__kernel` functions) in file `histogram.cl`. + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms to `partial`. +- `histogram_reduce`: writes final histogram to `histogram`. + +#### Core logic +- **histogram_partial** + 1. Zero local bins in parallel (`local_bins[b] = 0`). + 2. Iterate over input bytes in strides of global size, atomically increment local bin for each byte. + 3. Copy local bins to global `partial` array at offset `group_id * BINS`. +- **histogram_reduce** + 1. For each bin (one work‑item per bin), sum corresponding entries across all groups in `partial`. + 2. Store the sum in the final `histogram[bin]`. + +#### Public API +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – compute per‑group partial histogram. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – reduce partials into final histogram. + +#### Constants and configuration +- `#define BINS 256` – number of histogram bins. + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- None; kernels return early if `bin >= BINS` in `histogram_reduce`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..fc51d8a1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,35 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:03:25Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes a 256‑bin histogram of a byte stream using two OpenCL kernel passes. + +#### Purpose +- Build a byte histogram for image or generic byte data. +- Split work into local partial histograms and a global reduction. + +#### Responsibilities +- **Partial histogram generation**: per‑work‑group accumulation of byte counts. +- **Global reduction**: summing per‑group partials into the final 256‑bin histogram. + +#### Key units +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – computes per‑group partial histograms. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – reduces partials into the final histogram. +- Constant `BINS = 256` – number of histogram bins. + +#### Data flow +1. `histogram_partial` reads the input byte stream, atomically updates local bins, then writes each group’s local histogram to the global `partial` array. +2. `histogram_reduce` iterates over each bin, summing the corresponding entries across all groups in `partial`, and writes the totals to the final `histogram`. + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Cross-cutting +- Two‑pass design: local accumulation for memory locality, followed by a global reduction. +- Atomic operations and barriers ensure correct parallel updates within work‑groups. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..89cd7fd0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,45 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:04:03Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides a lightweight, lock‑free byte‑stream histogram pipeline and utilities for ring‑buffer handling and backup/reporting tasks. + +#### Purpose +- Compute 256‑bin histograms of byte streams on GPU. +- Offer a single‑producer/single‑consumer ring buffer in C. +- Automate directory backups and generate monthly sales reports. + +#### Responsibilities +- **GPU Histogram** – split work into local partial histograms and a global reduction pass. +- **Ring Buffer** – allocate, write, read, and query a power‑of‑two circular buffer without locks. +- **Backup & Reporting** – create timestamped tarballs with retention, parse CSV orders, aggregate revenue by month/region. + +#### Key units +- `histogram_partial`, `histogram_reduce` (OpenCL kernels) – build and reduce per‑group histograms. +- `ringbuf_t`, `ringbuf_status_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read` – C API for a lock‑free FIFO. +- `rotate_backups.sh` – Bash script for backup rotation. +- `sales_report.py` – Python module with `parse_orders`, `revenue_by_month_and_region`, `main`. + +#### Data flow +1. **Histogram** – `histogram_partial` reads input bytes → local bins → writes partials; `histogram_reduce` sums partials → final 256‑bin histogram. +2. **Ring Buffer** – `ringbuf_init` → `ringbuf_write` (producer) → `ringbuf_read` (consumer) → status queries → `ringbuf_free`. +3. **Backup/Report** – `rotate_backups.sh` creates `.tar.gz` → trims old archives; `sales_report.py` parses CSV → aggregates → prints report. + +#### Dependencies +- OpenCL built‑ins (`atomic_inc`, `barrier`, etc.) for histogram kernels. +- C standard library (`stddef.h`, `stdint.h`, `stdlib.h`, `string.h`) for ring buffer. +- Shell utilities (`tar`, `date`, `du`, `ls`, `rm`, `mv`, `basename`, `dirname`) for backup script. +- Python standard library (`argparse`, `csv`, `collections.defaultdict`, `dataclasses`, `datetime`, `decimal`) for reporting. + +#### Cross-cutting +- Power‑of‑two capacity enforcement and bit‑masking in ring buffer. +- Two‑pass design (local accumulation + global reduction) in histogram kernels. +- Consistent error codes (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`) and input validation across utilities. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..9751f405 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,49 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:03:28Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides a lock‑free, fixed‑size ring buffer for byte stream handling in C. + +#### Purpose +- Implements a single‑producer/single‑consumer FIFO buffer. +- Enables efficient wrap‑around using power‑of‑two capacity and bit masking. + +#### Responsibilities +- **Buffer management**: allocate, free, and maintain head/tail indices. +- **Data transfer**: write to and read from the circular buffer with wrap‑around support. +- **Space queries**: report used bytes and available free space. +- **Validation**: enforce power‑of‑two capacity and handle allocation errors. + +#### Key units +- `ringbuf_t` – struct holding buffer pointer, capacity, head, tail. +- `ringbuf_status_t` – enum (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `ringbuf_free(ringbuf_t *rb)` – deallocate resources. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – enqueue bytes. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – dequeue bytes. +- `ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `ringbuf_free_space(const ringbuf_t *rb)` – bytes available for writing. + +#### Data flow +1. **Initialization** – `ringbuf_init` validates capacity, allocates memory, sets indices to zero. +2. **Writing** – `ringbuf_write` copies up to `len` bytes, handling wrap‑around, updates head. +3. **Reading** – `ringbuf_read` copies up to `len` bytes, handling wrap‑around, updates tail. +4. **Status** – `ringbuf_used` and `ringbuf_free_space` compute values via modulo arithmetic. +5. **Cleanup** – `ringbuf_free` releases allocated memory. + +#### Dependencies +- Internal: `ringbuf.h` (declarations), `ringbuf.c` (implementation). +- Standard library: ``, ``, ``, ``. + +#### Cross-cutting +- **Power‑of‑two enforcement**: `is_power_of_two` helper ensures capacity validity. +- **Bit‑masking**: `(head - tail) & (capacity - 1)` for wrap‑around calculations. +- **Error handling**: consistent return codes (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- **Single‑producer/single‑consumer assumption**: no locking required, relies on atomic index updates. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..e88977ff --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,58 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:02:53Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Implements a fixed‑size ring buffer with power‑of‑two capacity, supporting write, read, and status queries. + +#### Purpose +- Provides FIFO buffer for byte streams. +- Ensures efficient wrap‑around using bit masking. + +#### Type +- C source file (`ringbuf.c`), implements functions declared in `ringbuf.h`. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates memory, sets indices to zero. +- `ringbuf_free` deallocates buffer and resets fields. +- `ringbuf_used` computes used bytes via modulo arithmetic. +- `ringbuf_free_space` derives free space from capacity and used bytes. +- `ringbuf_write` copies up to two contiguous chunks to handle wrap‑around. +- `ringbuf_read` copies from buffer similarly, updating tail. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free resources. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – available space. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write data. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read data. + +#### Constants and configuration +- None defined in this file. + +#### Dependencies +- `ringbuf.h` +- Standard library: `stdlib.h`, `string.h`. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity not power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` on allocation failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..01ecd75e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,59 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:02:57Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> A fixed‑size byte ring buffer for single‑producer/single‑consumer use. + +#### Purpose +- Provides a lock‑free circular buffer for byte streams. +- Supports initialization, deallocation, read/write, and space queries. + +#### Type +- Header (`ringbuf.h`) in C. +- Defines `ringbuf_t` struct, `ringbuf_status_t` enum, and public API functions. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity (must be power of two, >0). +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. + +#### Core logic +- `ringbuf_init`: validates capacity, allocates `capacity` bytes, sets head/tail to 0. +- `ringbuf_write`: copies up to `len` bytes from `src` into buffer, wrapping at capacity, updates head. +- `ringbuf_read`: copies up to `len` bytes from buffer into `dst`, wrapping at capacity, updates tail. +- `ringbuf_used`: computes `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space`: returns `capacity - 1 - ringbuf_used`. +- `ringbuf_free`: frees allocated data. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – deallocate buffer. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – available space. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- ``, `` for types. +- Uses `malloc`/`free` implicitly via implementation (not shown). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..5806d853 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,46 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:03:59Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> A small utility package that backs up directories and generates monthly sales reports from CSV exports. + +#### Purpose +- Automate creation and rotation of compressed directory backups. +- Produce revenue summaries by month and region from order CSV files. + +#### Responsibilities +- **Backup Management** – `rotate_backups.sh` handles timestamped tarball creation and retention policy. +- **Sales Reporting** – `sales_report.py` parses order CSVs, aggregates revenue, and outputs tabular reports. + +#### Key units +- **`rotate_backups.sh`** – Bash script that validates inputs, creates a `.tar.gz` archive, and deletes old backups beyond a keep count. +- **`sales_report.py`** – Python module exposing: + - `parse_orders(path, currency)` – yields `Order` dataclass instances from a CSV. + - `revenue_by_month_and_region(orders)` – aggregates revenue per `(YYYY‑MM, region)`. + - `main(argv=None)` – CLI entry point that orchestrates parsing, aggregation, and printing. + +#### Data flow +1. **Backup**: + - User supplies source and backup directories plus optional keep count. + - Script validates, creates a timestamped archive, then trims older archives. +2. **Reporting**: + - User supplies CSV files and optional currency/min‑revenue filters. + - `parse_orders` reads each file, filters by currency, converts dates and amounts. + - `revenue_by_month_and_region` sums amounts per month/region. + - `main` prints rows that meet the minimum revenue threshold. + +#### Dependencies +- **Shell**: `tar`, `date`, `du`, `ls`, `rm`, `mv`, `basename`, `dirname`. +- **Python**: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses`, `datetime`, `decimal`. + +#### Cross-cutting +- Both units enforce strict input validation and clear error handling. +- The backup script uses `set -euo pipefail` for safety; the Python script raises `ValueError` on malformed CSV data. +- Configuration is minimal: backup keep count defaults to 7; report currency defaults to EUR. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..e54b71a2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,58 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:03:02Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Creates a dated, compressed backup of a directory and retains only the most recent N archives. + +#### Purpose +- Generates a timestamped `.tar.gz` backup of `SOURCE_DIR` into `BACKUP_DIR`. +- Deletes older backups beyond the specified `KEEP` count. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- `$1` → `SOURCE_DIR` (required). +- `$2` → `BACKUP_DIR` (required). +- `$3` → `KEEP` (optional, defaults to `7`). +- No external options or environment variables. + +#### Output +- Creates file `"$BACKUP_DIR/${name}_.tar.gz"`. +- Prints creation and removal messages. +- Exit status `0` on success, `2` on invalid arguments or missing directory. + +#### Core logic +- Validate `KEEP` is a positive integer. +- Ensure `SOURCE_DIR` exists; create `BACKUP_DIR` if missing. +- Build archive name with UTC timestamp. +- Create temporary archive `"$tmp"`, then rename to final. +- List existing archives sorted newest first. +- Remove all but the first `KEEP` archives, echoing each removal. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR`=`"${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR`=`"${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP`=`"${3:-7}"` +- `name`=`"$(basename "$SOURCE_DIR")"` +- `archive`=`"$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp`=`"$archive.partial"` + +#### Dependencies +- External commands: `tar`, `date`, `du`, `ls`, `rm`, `mv`. +- Utilities: `basename`, `dirname`. + +#### Errors and exit codes +- `exit 2` if `KEEP` not a positive integer. +- `exit 2` if `SOURCE_DIR` does not exist. +- Trap on `EXIT` removes temporary file `"$tmp"`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..30ba39bc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,61 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:03:04Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Generates a monthly sales report from CSV order exports, aggregating revenue by month and region for a specified currency. + +#### Purpose +- Aggregate order amounts by month and region. +- Output revenue per month/region in a tabular format. + +#### Type +- Python script (`.py`). + +#### Input +- `csv_files`: list of CSV file paths (positional arguments). +- `--currency`: target currency code (default `EUR`). +- `--min-revenue`: minimum revenue threshold (default `0`). +- CSV rows must contain columns: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints lines: `monthregionrevenuecurrency`. +- Exits with code `0` on success, `1` if no orders found. + +#### Core logic +- `parse_orders(path, currency)`: + - Open CSV, validate required columns. + - Skip rows with non‑matching currency. + - Convert `order_date` to `date`, `amount` to `Decimal`. + - Yield `Order` dataclass instances. +- `revenue_by_month_and_region(orders)`: + - Sum amounts per `(YYYY-MM, region)` key using `defaultdict(Decimal)`. + - Return sorted dictionary of totals. +- `main(argv)`: + - Parse CLI arguments. + - Collect all orders from provided files. + - If none, print error and exit `1`. + - Iterate sorted totals; print entries meeting `min_revenue`. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` + Parses CSV, yields orders in specified currency. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` + Aggregates revenue by month and region. +- `main(argv=None) -> int` + CLI entry point; processes arguments, outputs report. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` if CSV missing required columns or contains invalid data. +- `ValueError` propagated from `parse_orders` for malformed rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..b1a9020b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,80 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:04:27Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A unified framework for AI‑driven source‑code transformation, coupled with low‑latency GPU analytics and a multi‑domain SQL data‑management suite. + +#### Purpose +- Centralize AI generation, evaluation, and provider abstraction for source‑code transformation. +- Offer GPU‑accelerated byte‑stream histograms and lock‑free ring buffers for high‑throughput analytics. +- Persist and enforce business rules across library, shop, and warehouse domains with audit and reporting. + +#### Responsibilities +- **AI Generation Engine** – configuration, condition evaluation, fact extraction, oversize handling, provider abstraction, prompt rendering, timing, and post‑processing. +- **GPU Analytics Pipeline** – two‑pass histogram kernels, reduction, and result aggregation. +- **Ring Buffer Utility** – lock‑free FIFO for single‑producer/single‑consumer scenarios. +- **Backup & Reporting** – automated tarball rotation and monthly sales reporting. +- **SQL Data Management** – library loan logic, shop order processing, warehouse stock synchronization, audit trails, and cross‑platform compatibility. + +#### Key units +- **Java** + - `SrcMorphConfiguration`, `AiGenerationConfig` – runtime settings. + - `AiConditionEvaluator`, `AiFactExtractor` – deterministic decision logic. + - `AiOversizeStrategy` – enum for context‑window handling. + - `AiGenerationProvider`, `AiGenerationProviderFactory` – provider abstraction. + - `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport` – concrete back‑ends. + - `AiCompletionParser`, `AiGenerationTimings` – post‑processing and metrics. +- **C / OpenCL** + - `histogram_partial`, `histogram_reduce` – GPU kernels. + - `ringbuf_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read` – lock‑free FIFO API. +- **Shell / Python** + - `rotate_backups.sh` – backup rotation script. + - `sales_report.py` – CSV parsing, revenue aggregation, CLI entry point. +- **SQL** + - Library tables (`author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`), views (`overdue_loans`, `member_loan_stats`, `popular_books`), functions (`fn_checkout_book`, `fn_late_fee`), procedures (`sp_return_book`), trigger (`trg_loan_audit`). + - Shop tables (`product`, `customer_order`, `order_item`), procedure (`add_order_item`). + - Warehouse tables (`dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`), procedure (`dbo.usp_SyncStock`). + +#### Data flow +1. **AI Engine** + - Load `SrcMorphConfiguration` → build `AiCondition` trees → evaluate files with `AiConditionEvaluator`. + - If oversized, `AiOversizeStrategy` decides path. + - Extract facts via `AiFactExtractor`. + - Build `AiGenerationRequest` → resolve provider with `AiGenerationProviderFactory`. + - Generate text (llama.cpp or OpenAI‑compatible) → parse completion → record timings → return result. +2. **GPU Histogram** + - `histogram_partial` processes byte stream → writes local bins → `histogram_reduce` aggregates → final 256‑bin histogram. +3. **Ring Buffer** + - Producer calls `ringbuf_write`; consumer calls `ringbuf_read`; status queried via `ringbuf_status_t`. +4. **Backup & Reporting** + - `rotate_backups.sh` creates timestamped tarballs, removes old ones. + - `sales_report.py` reads CSV orders → aggregates revenue by month/region → outputs report. +5. **SQL Domains** + - Library: `fn_checkout_book` → `loan` insert, `book.copies_free` decrement, audit log. + - Shop: `add_order_item` → stock check, `order_item` insert/update, `product.stock` decrement, `customer_order.total_cents` recompute. + - Warehouse: `usp_SyncStock` → merge `SupplierFeed` into `StockLevel`, log in `SyncLog`. + +#### Dependencies +- **Java** – Lombok, Jackson, Maven plugin APIs, `net.ladenthin.llama` (model, parameters, JSON parser), Java 8+ utilities. +- **C / OpenCL** – OpenCL built‑ins, standard C libraries. +- **Shell / Python** – Unix utilities (`tar`, `date`, `du`, etc.), Python stdlib (`argparse`, `csv`, `datetime`, `decimal`). +- **SQL** – PostgreSQL, MySQL 8, SQL Server 2022; system functions (`SYSUTCDATETIME()`, `ERROR_MESSAGE()`). +- **External Services** – OpenAI‑compatible HTTP endpoints, environment‑based credentials. + +#### Cross‑cutting +- Defensive copying and immutability in configuration objects. +- Stateless, thread‑safe utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Lazy, non‑thread‑safe model loading for llama.cpp; external coordination required. +- Consistent error handling (`IllegalArgumentException`, `IllegalStateException`, `IOException`, SQL exceptions). +- Ring buffer uses power‑of‑two capacity and bit‑masking; provides clear error codes. +- Histogram kernels employ two‑pass accumulation and global reduction. +- Audit trails (`loan_audit`, `SyncLog`) capture every state change across domains. +- Concurrency controls via row‑level locks and `SELECT … FOR UPDATE` in SQL. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..7b52bc38 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 1D7D7144 +- D: 2026-11-04T11:56:04Z +- T: 2026-11-04T12:04:34Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard framework orchestrates AI‑driven source‑code transformation through a Maven‑based pipeline that routes requests to modular back‑ends such as OpenAI‑compatible services, llama.cpp JNI, or mock providers, while a configuration‑driven engine selects files and manages context. It couples this generation engine with a low‑latency GPU analytics subsystem that computes 256‑bin histograms of byte streams via OpenCL kernels and a lock‑free C ring buffer, enabling efficient data‑flow and backup/reporting utilities. The same project also bundles a cross‑platform SQL data‑management suite: a PostgreSQL library system, a MySQL shop module for order line items and inventory reservation, and a warehouse sync component that processes nightly supplier feeds, all sharing audit trails and business logic. Together, these subsystems provide a unified platform for AI‑powered code generation, real‑time analytics, and robust data‑management. + +#### Packages +- java/config — A configuration‑driven framework for AI‑powered source‑code generation, routing, and fact extraction within a Maven‑based build pipeline. +- java — A Maven‑based framework that configures, evaluates, and drives AI‑powered source‑code generation and transformation, supporting multiple back‑ends and runtime decision‑making for file selection and context handling. +- java/provider — A modular AI‑generation framework that abstracts multiple back‑ends (mock, llama.cpp JNI, OpenAI‑compatible) and provides configuration, request parsing, and timing support for source‑code transformation tasks. +- other/kernels — Computes a 256‑bin histogram of a byte stream using two OpenCL kernel passes. +- other — Provides a lightweight, lock‑free byte‑stream histogram pipeline and utilities for ring‑buffer handling and backup/reporting tasks. +- other/ringbuf — Provides a lock‑free, fixed‑size ring buffer for byte stream handling in C. +- other/scripts — A small utility package that backs up directories and generates monthly sales reports from CSV exports. +- . — A unified framework for AI‑driven source‑code transformation, coupled with low‑latency GPU analytics and a multi‑domain SQL data‑management suite. +- sql/library — A PostgreSQL‑based library management system that stores catalog, member, and loan data, enforces business rules, and provides reporting and audit capabilities. +- sql — A cross‑platform data‑management suite that handles library cataloging, e‑commerce order processing, and warehouse inventory synchronization, all built around SQL‑centric business logic and audit trails. +- sql/shop — A MySQL package that manages order line items, reserves inventory, and keeps order totals accurate. +- sql/warehouse — Keeps the warehouse inventory in sync with nightly supplier feeds and records each sync run. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..2b1d4b5c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,73 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:02:19Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Defines the core tables and indexes for a library system, tracking authors, books, members, and loans. + +#### Purpose +- Store library catalog and member data. +- Record book loans and enforce business rules. + +#### Type +- PostgreSQL schema objects: tables, indexes. + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author (author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `member_id BIGINT NOT NULL REFERENCES member (member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` + +Indexes +- `idx_book_author ON book (author_id)` +- `idx_loan_member ON loan (member_id)` +- `idx_loan_open ON loan (due_on) WHERE returned_on IS NULL` + +#### Reads +- `author` (author_id) +- `book` (author_id, book_id) +- `member` (member_id) +- `loan` (book_id, member_id, due_on, returned_on) + +#### Writes +- `author`: INSERT (1 row per author) +- `book`: INSERT (1 row per book) +- `member`: INSERT (1 row per member) +- `loan`: INSERT (1 row per loan) + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (ON DELETE CASCADE) + +#### Dependencies +- `author`, `book`, `member`, `loan` tables referenced by foreign keys and indexes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..edc5d761 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,71 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:02:22Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Provides reporting views for a library system: overdue loans, member loan statistics, and popular books. + +#### Purpose +- Exposes aggregated loan data for reporting. +- Highlights overdue loans, member activity, and recent popular books. + +#### Type +- PostgreSQL views and materialized view. +- Index: `idx_popular_books_id` on `popular_books`. + +#### Schema +**View `overdue_loans`** +- `loan_id` integer +- `member_id` integer +- `email` text +- `title` text +- `due_on` date +- `days_overdue` integer +- *No primary key; read‑only.* + +**View `member_loan_stats`** +- `member_id` integer +- `full_name` text +- `loans_total` bigint +- `loans_open` bigint +- `last_loan_on` timestamp +- *No primary key; read‑only.* + +**Materialized View `popular_books`** +- `book_id` integer +- `title` text +- `author_name` text +- `times_loaned` bigint +- *No primary key; read‑only.* + +**Index `idx_popular_books_id`** +- Table: `popular_books` +- Columns: `book_id` +- Method: default (B‑tree) + +#### Reads +- `loan` (`loan_id`, `member_id`, `book_id`, `due_on`, `returned_on`, `loaned_on`) +- `member` (`member_id`, `email`, `full_name`) +- `book` (`book_id`, `title`, `author_id`) +- `author` (`author_id`, `full_name`) + +#### Writes +- None (views and materialized view are read‑only). + +#### Relationships +- `overdue_loans`: `loan.member_id -> member.member_id`, `loan.book_id -> book.book_id` +- `member_loan_stats`: `loan.member_id -> member.member_id` +- `popular_books`: `loan.book_id -> book.book_id`, `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author` +- Views: none +- Functions: none +- Sequences: none + +--- diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..a29bc422 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,69 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:02:25Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Manages book lending, returns, late fees, and audit trail for a library system. + +#### Purpose +- Handles checkout and return operations for library books. +- Calculates late fees. +- Records audit events for loan actions. + +#### Type +- Table: `loan_audit` +- Function: `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn` +- Procedure: `sp_return_book` +- Trigger: `trg_loan_audit` +- Dialect: PostgreSQL, PL/pgSQL + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member` (`member_id`, `is_blocked`) – check blocked status. +- `book` (`book_id`, `copies_free`) – verify and decrement free copies. +- `loan` (`loan_id`, `returned_on`, `book_id`) – update return status. +- `loan` (`loan_id`, `returned_on`) – trigger audit on update. + +#### Writes +- `book` – decrement `copies_free` on checkout; increment on return. +- `loan` – insert new loan record; update `returned_on` on return. +- `loan_audit` – insert audit rows for checkout and return actions. + +#### Relationships +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Verify member not blocked. + - Decrement `copies_free` if available; error if none. + - Insert loan with `due_on = CURRENT_DATE + p_days`; return new `loan_id`. + +- **sp_return_book(p_loan_id)** + - Update loan `returned_on = CURRENT_DATE`; capture `book_id`. + - If no row updated, raise exception. + - Increment `copies_free` for the returned book. + +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Multiply by 50, cap at 2000. + +- **trg_loan_audit_fn()** + - On INSERT: log `CHECKOUT`. + - On UPDATE where `returned_on` changes from NULL to non‑NULL: log `RETURN`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit` +- Functions: `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn` +- Trigger: `trg_loan_audit` on `loan` table. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..b156cddf --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,63 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:02:29Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Migrates the library schema to version 2: adds branches, relocates book copies to a new table, updates member and loan tables, and removes per‑book copy counters. + +#### Purpose +- Introduce branch hierarchy and per‑branch book copies. +- Update member and loan records to reference branches and copies. +- Remove legacy copy counters from the book table. + +#### Type +- PostgreSQL migration script (DDL). + +#### Schema +- **branch** + - `branch_id SMALLSERIAL PRIMARY KEY` + - `name VARCHAR(100) NOT NULL UNIQUE` + - `city VARCHAR(100) NOT NULL` +- **book_copy** + - `copy_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `branch_id SMALLINT NOT NULL REFERENCES branch (branch_id)` + - `barcode VARCHAR(32) NOT NULL UNIQUE` + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE', 'ON_LOAN', 'LOST'))` + - Index: `idx_book_copy_book` on `book_copy (book_id)` + +#### Reads +- `book` (SELECT book_id, isbn, copies_total, copies_free) +- `member` (UPDATE member SET home_branch_id = 1 WHERE home_branch_id IS NULL) + +#### Writes +- `branch`: 1 row (`INSERT INTO branch VALUES ('Main', 'Springfield')`) +- `book_copy`: 1 × `copies_total` rows per book (family: one INSERT per book, total rows = sum of `copies_total`) +- `loan`: adds column `copy_id` (no data written) +- `member`: renames column, adds `home_branch_id`, updates 1 row per member with NULL `home_branch_id` +- `book`: drops constraints and columns (no data written) + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- Existing tables: `book`, `loan`, `member` +- New table: `branch`, `book_copy` +- Index: `idx_book_copy_book` on `book_copy` + +#### Routine logic +- Create `branch` table and insert the main branch. +- Create `book_copy` table with foreign keys to `book` and `branch`. +- Populate `book_copy` by generating a row for each copy of every book, assigning the main branch (id 1) and barcode derived from ISBN and copy number; status set to AVAILABLE if the copy number is within `copies_free`, otherwise ON_LOAN. +- Alter `loan` to reference `book_copy`. +- Rename `member.joined_on` to `member_since` and add `home_branch_id` referencing `branch`; set default to main branch for existing members. +- Remove legacy copy counters from `book` and drop related constraint. +- Create index on `book_copy.book_id` for efficient lookups. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..eb218994 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,32 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:02:36Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Seed data for a library system: authors, books, members, and loan records. + +#### Purpose +- Populate the `author`, `book`, `member`, and `loan` tables with initial data for testing or demo purposes. + +#### Type +- SQL script (PostgreSQL). +- No tables, views, or functions are created; only `INSERT` statements. + +#### Writes +- `author`: 15 rows +- `book`: 150 rows +- `member`: 50 rows +- `loan`: 150 rows + +#### Relationships +- `book.author_id` → `author.author_id` +- `loan.book_id` → `book.book_id` +- `loan.member_id` → `member.member_id` + +#### Dependencies +- Tables referenced: `author`, `book`, `member`, `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..d8750173 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,53 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:04:07Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL‑based library management system that stores catalog, member, and loan data, enforces business rules, and provides reporting and audit capabilities. + +#### Purpose +- Persist library catalog, member, and loan information. +- Enforce loan rules and track book availability. +- Offer reporting views and audit trails for operations. + +#### Responsibilities +- **Data Model** – tables `author`, `book`, `member`, `loan`; indexes and constraints enforce referential integrity and business rules. +- **Reporting** – read‑only views `overdue_loans`, `member_loan_stats`, and materialized view `popular_books` expose aggregated loan data. +- **Business Logic** – functions `fn_checkout_book`, `fn_late_fee`, procedure `sp_return_book`, and trigger `trg_loan_audit` manage checkout, return, late fee calculation, and audit logging. +- **Migration** – script `04_migration_v2.sql` introduces branch hierarchy, per‑branch book copies, and removes legacy copy counters. +- **Seeding** – `05_seed_data.sql` populates initial authors, books, members, and loans for demo/testing. + +#### Key units +- **Tables**: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. +- **Views**: `overdue_loans`, `member_loan_stats`, `popular_books`. +- **Functions**: `fn_checkout_book(p_member_id, p_book_id, p_days)`, `fn_late_fee(p_due_on, p_returned_on)`. +- **Procedure**: `sp_return_book(p_loan_id)`. +- **Trigger**: `trg_loan_audit` on `loan`; handler `trg_loan_audit_fn`. + +#### Data flow +1. **Checkout** – `fn_checkout_book` validates member, decrements `book.copies_free`, inserts a `loan` row, and logs a `CHECKOUT` audit. +2. **Return** – `sp_return_book` updates `loan.returned_on`, increments `book.copies_free`, and the trigger logs a `RETURN` audit. +3. **Late fee** – `fn_late_fee` calculates fee based on `due_on` and `returned_on`. +4. **Reporting** – views join `loan`, `member`, `book`, and `author` to expose overdue loans, member statistics, and popular books. +5. **Migration** – `04_migration_v2.sql` creates `branch` and `book_copy`, populates copies, updates `loan` to reference copies, and adjusts `member` home branch. + +#### Dependencies +- Internal: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. +- External: PostgreSQL core, PL/pgSQL runtime. +- Indexes: `idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_popular_books_id`, `idx_book_copy_book`. + +#### Cross-cutting +- **Constraints**: foreign keys, uniqueness, check constraints (e.g., `copies_free <= copies_total`, `due_on > loaned_on`). +- **Audit Trail**: `loan_audit` records every checkout and return with timestamp. +- **Error handling**: functions raise exceptions when members are blocked or no copies are available. +- **Concurrency**: updates to `copies_free` and loan inserts rely on row‑level locking inherent to PostgreSQL. +- **Configuration**: migration script sets default branch and barcode generation logic. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..4b961b2e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,56 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:04:22Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A cross‑platform data‑management suite that handles library cataloging, e‑commerce order processing, and warehouse inventory synchronization, all built around SQL‑centric business logic and audit trails. + +#### Purpose +- Persist and enforce business rules for library loans, shop orders, and warehouse stock. +- Provide reporting, audit, and synchronization capabilities across the three domains. + +#### Responsibilities +- **Library** – catalog, member, loan persistence; checkout/return logic; overdue and popularity reporting; audit trail. +- **Shop** – order item CRUD, stock reservation, order total recalculation, and status management. +- **Warehouse** – nightly supplier feed ingestion, stock level updates, and sync run logging. + +#### Key units +- **Library** + - Tables: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. + - Views: `overdue_loans`, `member_loan_stats`, `popular_books`. + - Functions/Procedures: `fn_checkout_book`, `fn_late_fee`, `sp_return_book`. + - Trigger: `trg_loan_audit` on `loan`. +- **Shop** + - Tables: `product`, `customer_order`, `order_item`. + - Procedure: `add_order_item(p_order_id, p_sku, p_qty)`. +- **Warehouse** + - Tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. + - Procedure: `dbo.usp_SyncStock(@Since DATETIME2)`. + +#### Data flow +1. **Library** + - `fn_checkout_book` validates member, decrements `book.copies_free`, inserts `loan`, logs `CHECKOUT`. + - `sp_return_book` updates `loan.returned_on`, increments `book.copies_free`, trigger logs `RETURN`. + - Views aggregate loan data for reporting. +2. **Shop** + - `add_order_item` locks `product`, checks stock, inserts/updates `order_item`, decrements `product.stock`, recomputes `customer_order.total_cents`. +3. **Warehouse** + - `usp_SyncStock` aggregates `SupplierFeed` since `@Since`, merges into `StockLevel` (increment or insert), logs counts and errors in `SyncLog`. + +#### Dependencies +- **Internal** – shared tables (`author`, `book`, `product`, `customer_order`, `order_item`, `StockLevel`, `SyncLog`). +- **External** – PostgreSQL (PL/pgSQL), MySQL 8, SQL Server 2022, system functions (`SYSUTCDATETIME()`, `ERROR_MESSAGE()`). + +#### Cross‑cutting +- **Audit** – `loan_audit` and `SyncLog` capture every state change. +- **Constraints & Checks** – referential integrity, uniqueness, business rule checks (`copies_free <= copies_total`, `due_on > loaned_on`). +- **Error Handling** – PL/pgSQL exceptions, MySQL `SIGNAL`, T‑SQL `TRY…CATCH`. +- **Concurrency** – row‑level locking (`SELECT … FOR UPDATE`, PostgreSQL row locks) ensures consistent stock/loan counts. +- **Configuration** – migration scripts set default branches, barcode logic, and initial seed data. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..70f3cf75 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,69 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:02:39Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Adds an item to an existing order, reserves product stock, and updates the order total. + +#### Purpose +- Insert or update an order line item. +- Reserve product stock. +- Recalculate the order total. + +#### Type +- Table: `product`, `customer_order`, `order_item`. +- Procedure: `add_order_item` (MySQL 8). + +#### Schema +- **product** + - `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `sku VARCHAR(40) NOT NULL` UNIQUE `uk_product_sku` + - `name VARCHAR(200) NOT NULL` + - `price_cents INT UNSIGNED NOT NULL` + - `stock INT NOT NULL DEFAULT 0` +- **customer_order** + - `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `customer_id BIGINT UNSIGNED NOT NULL` + - `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW' + - `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` + - `total_cents INT UNSIGNED NOT NULL DEFAULT 0` + - Index `idx_order_customer` on `(customer_id, created_at)` +- **order_item** + - `order_id BIGINT UNSIGNED NOT NULL` + - `product_id INT UNSIGNED NOT NULL` + - `quantity SMALLINT UNSIGNED NOT NULL` + - `unit_price_cents INT UNSIGNED NOT NULL` + - PK `(order_id, product_id)` + - FK `fk_item_order` references `customer_order(order_id)` ON DELETE CASCADE + - FK `fk_item_product` references `product(product_id)` + +#### Reads +- `product` (sku, stock, price_cents) – SELECT FOR UPDATE. +- `order_item` (order_id, quantity, unit_price_cents) – subquery for total. +- `customer_order` (order_id) – subquery for total. + +#### Writes +- `order_item` – 1 INSERT (or UPDATE via ON DUPLICATE KEY). +- `product` – 1 UPDATE (stock decrement). +- `customer_order` – 1 UPDATE (total_cents recalculation). + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (FK `fk_item_order`). +- `order_item.product_id -> product.product_id` (FK `fk_item_product`). + +#### Routine logic +- Parameters: `p_order_id`, `p_sku`, `p_qty`. +- Lookup `product_id` and `price_cents` where `sku` matches and `stock >= p_qty`; lock row. +- If not found, SIGNAL error. +- INSERT into `order_item`; if duplicate, increment `quantity`. +- UPDATE `product.stock` subtracting `p_qty`. +- Recalculate `customer_order.total_cents` as sum of `quantity * unit_price_cents` for the order. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item`. +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..da01264a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,46 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:04:12Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> A MySQL package that manages order line items, reserves inventory, and keeps order totals accurate. + +#### Purpose +- Persist order items and update related order totals. +- Reserve product stock when items are added. + +#### Responsibilities +- **Order Item Management** – insert or update line items in `order_item`. +- **Stock Reservation** – decrement `product.stock` upon item addition. +- **Order Total Recalculation** – recompute `customer_order.total_cents` after changes. + +#### Key units +- **Tables** + - `product` – holds SKU, price, and stock. + - `customer_order` – tracks order status and total. + - `order_item` – links orders to products with quantity and unit price. +- **Procedure** + - `add_order_item(p_order_id, p_sku, p_qty)` – core routine for adding items, locking product rows, updating stock, inserting/updating order items, and recalculating totals. + +#### Data flow +1. `add_order_item` receives order ID, SKU, and quantity. +2. Locks the matching `product` row (`SELECT … FOR UPDATE`). +3. Validates stock availability; signals error if insufficient. +4. Inserts or updates `order_item` (using `ON DUPLICATE KEY`). +5. Decrements `product.stock` by the quantity. +6. Recalculates `customer_order.total_cents` from all items of the order. + +#### Dependencies +- Internal tables: `product`, `customer_order`, `order_item`. +- No external functions or sequences; relies on MySQL 8 transactional guarantees. + +#### Cross-cutting +- Uses `SELECT … FOR UPDATE` for row‑level locking. +- Error handling via `SIGNAL`. +- All monetary values stored in cents (`INT UNSIGNED`). +- Enumerated order status (`NEW`, `PAID`, `SHIPPED`, `CANCELLED`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..59bdddce --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,46 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:04:15Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Keeps the warehouse inventory in sync with nightly supplier feeds and records each sync run. + +#### Purpose +- Aggregate supplier feed quantities into the warehouse stock table. +- Persist a log of each sync operation. + +#### Responsibilities +- **Data ingestion**: read `dbo.SupplierFeed` rows since a given timestamp. +- **Inventory update**: merge aggregated quantities into `dbo.StockLevel`. +- **Audit trail**: insert a record into `dbo.SyncLog` with counts and any error message. + +#### Key units +- **`dbo.StockLevel`** – stores current on‑hand quantity per `(WarehouseId, Sku)`. +- **`dbo.SupplierFeed`** – raw nightly feed rows with `Quantity` and `ReceivedAt`. +- **`dbo.SyncLog`** – audit table for each sync run (`StartedAt`, `RowsInserted`, `RowsUpdated`, `ErrorMessage`). +- **`dbo.usp_SyncStock(@Since DATETIME2)`** – T‑SQL procedure that performs the merge and logging. + +#### Data flow +1. Caller supplies `@Since` timestamp. +2. Procedure records `@Started` and begins a transaction. +3. Aggregates `SupplierFeed` rows (`WarehouseId, Sku, SUM(Quantity)`) filtered by `@Since`. +4. `MERGE` into `StockLevel`: + - `WHEN MATCHED`: increment `OnHand`, update `UpdatedAt`. + - `WHEN NOT MATCHED BY TARGET`: insert new row. +5. Capture counts of inserted/updated rows. +6. Insert a `SyncLog` row with those counts and `@Started`. +7. Commit transaction; on error, rollback, log error, rethrow. + +#### Dependencies +- Internal tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. +- SQL Server system functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. + +#### Cross-cutting +- Transactional integrity: all changes to `StockLevel` and `SyncLog` occur within a single transaction. +- Error handling: rollback on exception, log error message in `SyncLog`. +- Timestamp handling: uses UTC (`SYSUTCDATETIME()`) for consistency across feeds. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..cea00f71 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run2/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,78 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:02:43Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Synchronises nightly stock levels from a supplier feed into the warehouse inventory and records the operation outcome. + +#### Purpose +- Updates `dbo.StockLevel` with aggregated supplier feed quantities. +- Logs each sync run in `dbo.SyncLog`. + +#### Type +- **Table**: `dbo.StockLevel` (PostgreSQL? actually SQL Server T‑SQL) +- **Table**: `dbo.SupplierFeed` +- **Table**: `dbo.SyncLog` +- **Procedure**: `dbo.usp_SyncStock` (T‑SQL) + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT (0)` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())` + - **PK**: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + - **PK**: `PK_SupplierFeed (FeedRowId)` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + - **PK**: `PK_SyncLog (SyncLogId)` + +#### Reads +- `dbo.SupplierFeed` – `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt` (filtered by `@Since`). +- `dbo.StockLevel` – `WarehouseId`, `Sku`, `OnHand` (for merge match). + +#### Writes +- `dbo.StockLevel` + - `INSERT`: one row per distinct `(WarehouseId, Sku)` not present. + - `UPDATE`: one row per matched `(WarehouseId, Sku)`; `OnHand` incremented, `UpdatedAt` set. +- `dbo.SyncLog` + - `INSERT`: one row per sync run; counts of inserted and updated rows derived from merge output. + +#### Relationships +- None (no foreign keys defined). + +#### Routine logic (`dbo.usp_SyncStock`) +- Parameters: `@Since DATETIME2(0)` +- Steps: + 1. Capture start time `@Started`. + 2. Begin transaction. + 3. `MERGE` `dbo.StockLevel` with aggregated `dbo.SupplierFeed` rows (`WarehouseId, Sku, SUM(Quantity)`). + - `WHEN MATCHED`: update `OnHand` and `UpdatedAt`. + - `WHEN NOT MATCHED BY TARGET`: insert new stock level. + - Capture merge action (`INSERT`/`UPDATE`) into table variable `@Changes`. + 4. Insert a log row into `dbo.SyncLog` with counts of inserted and updated rows. + 5. Commit transaction. + 6. On error: rollback, insert error log row, rethrow. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/meta/gpt-6-luna.json new file mode 100644 index 00000000..af0a46c7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/meta/gpt-6-luna.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:04:37Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 180.4, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 82.6, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.9, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:09:03Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 86745, + "cachedPromptTokens": 86673, + "completionTokens": 20003, + "seconds": 179.7649477 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.010875, + "costUsd": 0.018036, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/meta/gpt-oss-20b.json new file mode 100644 index 00000000..1487ecce --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:09:03Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 138.7, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 66.1, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.7, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:12:31Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 88281, + "cachedPromptTokens": 70550, + "completionTokens": 18420, + "seconds": 138.0999816 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.005043, + "costUsd": 0.002783, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..8be1338a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,71 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:04:37Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Filters files against nested AI conditions on extensions, size, line count, modification time, and relative-path globs. + +#### Purpose +- Evaluates `AiCondition` trees against `AiFileContext` file facts. +- Validates condition configuration and detects whether a tree requires line counts. + +#### Type +- `public final class AiConditionEvaluator` — class; no explicit supertypes. + +#### Input +- `AiConditionEvaluator()` — no parameters. +- `matches(AiCondition condition, AiFileContext context)` — condition tree and file facts. +- `validate(AiCondition condition)` — condition tree. +- `usesLines(AiCondition condition)` — condition tree. + +#### Output +- `matches` returns whether the file satisfies the condition; `validate` and `usesLines` return no state. +- `validate` may throw `IllegalArgumentException` for invalid conditions. +- No fields or resources are mutated or written. + +#### Core logic +- `matches` checks node branches in order: `and`, `or`, `not`, `extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, `pathGlob`. + - `and` recursively requires all children to match; a null child list yields `true`. + - `or` recursively accepts any matching child; a null child list yields `false`. + - `not` negates recursive matching. + - `extensions` calls `matchesExtension(extensions, context.fileName())`, accepting a non-null suffix match. + - `size` and `lines` call `AiRangeCondition.contains` with `context.sizeBytes()` and `context.lineCount()`. + - `modifiedAfter` and `modifiedBefore` compare `context.lastModifiedEpochMilli()` strictly against `parseEpochMilli`. + - `pathGlob` calls `globMatches(pathGlob, context.relativePath())`. + - No recognized branch throws `IllegalStateException` with `ERROR_ONE_BRANCH`. +- `validate` requires `branchCount(condition) == 1`, then validates the selected branch: + - `and`/`or`: `validateGroup` requires at least one child and recursively calls `validate`. + - `not`: recursively calls `validate`. + - `extensions`: rejects an empty list. + - `size`/`lines`: require `AiRangeCondition.hasBound()`. + - Modification dates: parsed by `parseEpochMilli`. + - `pathGlob`: rejects blank strings. +- `usesLines` checks the node’s `lines` branch, then recursively traverses `and`, `or`, or `not`; `anyUsesLines` returns false for a null child list and otherwise tests each child. +- `branchCount` counts non-null values from `getAnd`, `getOr`, `getNot`, `getExtensions`, `getSize`, `getLines`, `getModifiedAfter`, `getModifiedBefore`, and `getPathGlob`. +- `globMatches` constructs `new AiSourceExcludeFilter(Collections.singletonList(glob))` and calls `isExcluded(relativePath)`. +- `parseEpochMilli` parses `Instant.parse(isoInstant).toEpochMilli()`; converts `DateTimeParseException` to `IllegalArgumentException`. + +#### Public API +- `AiConditionEvaluator()` — creates evaluator. +- `matches(AiCondition, AiFileContext) -> boolean` — tests file condition. +- `validate(AiCondition) -> void` — validates condition tree. +- `usesLines(AiCondition) -> boolean` — detects line-count conditions. + +#### Dependencies +- `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext` +- `AiSourceExcludeFilter` +- `Instant`, `DateTimeParseException`, `Collections`, `List` +- `@Nullable` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for nodes with other than one branch, empty combinators, empty extensions, unbounded size/line ranges, invalid ISO-8601 instants, or blank path globs. +- `matches` throws `IllegalStateException` if no branch is set; documented to assume prior validation. +- `parseEpochMilli` wraps `DateTimeParseException` in `IllegalArgumentException`. + +#### Concurrency +- No synchronization or concurrency mechanisms; evaluator declares no mutable instance state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..0980de8c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,49 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:04:47Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Groups child AI conditions for Maven-configured `` and `` condition combinators. + +#### Purpose +- Provides the child-condition collection used as the body of `AiCondition` combinators. +- Uses a `conditions` field so Maven binds child entries as `…`. + +#### Type +- `public class AiConditionGroup` — class; annotated `@ToString`; no declared supertypes. + +#### Input +- `setConditions(Collection conditions)` accepts a nullable collection of child conditions. + +#### Output +- `getConditions()` returns the nullable child-condition list. +- `setConditions(...)` stores a defensive `ArrayList` copy, or `null` when passed `null`. + +#### Core logic +- `conditions` is a nullable `List`. +- `setConditions(...)` copies non-null input with `new ArrayList<>(conditions)`; otherwise assigns `null`. +- The no-argument constructor performs no initialization. + +#### Public API +- `AiConditionGroup()` -> constructor; creates an empty group. +- `getConditions()` -> `@Nullable List`; returns child conditions. +- `setConditions(Collection)` -> `void`; replaces child conditions with a defensive copy. + +#### Dependencies +- `AiCondition` +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No explicit exception handling or precondition checks. + +#### Concurrency +- No synchronization or other concurrency controls. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..fa6f72aa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,59 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:04:51Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Produces exact whole-source counts for configured regex-based code facts, formatted for inclusion alongside an AI-generated summary. + +#### Purpose +- Builds a deterministic facts block from `AiFactCounter` labels and regex patterns. +- Validates configured counters and regexes before use. + +#### Type +- `public final class AiFactExtractor` — utility class; no supertypes declared. + +#### Input +- `factsBlock(List counters, String source)` — nullable counter list and full source text. +- `validate(List counters)` — nullable counter list. + +#### Output +- `factsBlock(...)` returns `""` when no counters are reportable; otherwise returns the facts header, `label: count` entries, and trailing blank line. +- `validate(...)` returns no value; rejects counters with missing labels or patterns, and invalid regexes. + +#### Core logic +- `factsBlock` returns `""` when `counters` is `null` or empty. +- Iterates counters, skipping `null` counters and counters with `null` labels or patterns. +- Appends each label and `countMatches(counter.getPattern(), source)`, separating entries with `ENTRY_SEPARATOR`. +- Returns `""` if no entries were appended; otherwise prefixes `FACTS_HEADER` and appends `FACTS_SUFFIX`. +- `validate` returns for a `null` list; skips `null` counters, checks `getLabel()` and `getPattern()`, then compiles each pattern with `Pattern.compile`. +- Private `countMatches(pattern, source)` uses `Pattern.compile(pattern).matcher(source)` and counts each non-overlapping `matcher.find()` result, including zero-width matches. +- Formatting constants: `FACTS_HEADER`, `LABEL_COUNT_SEPARATOR`, `ENTRY_SEPARATOR`, `FACTS_SUFFIX`. + +#### Public API +- `FACTS_HEADER: String` — exact-facts line prefix. +- `LABEL_COUNT_SEPARATOR: String` — separates label and count. +- `ENTRY_SEPARATOR: String` — separates entries. +- `FACTS_SUFFIX: String` — separates facts from following body. +- `factsBlock(List, String) -> String` — formats whole-source fact counts. +- `validate(List) -> void` — validates counter labels and regexes. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` +- `AiFactCounter` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` when a counter has a `null` label or pattern, or when its pattern is invalid; invalid-regex errors retain the `PatternSyntaxException` as cause. +- `factsBlock` skips counters with `null` labels or patterns. +- `countMatches` compiles patterns during counting; invalid patterns can throw `PatternSyntaxException`. + +#### Concurrency +- Pure utility logic with no I/O or mutable shared state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..5be756c7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,104 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:04:57Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Stores per-model AI generation settings for prompt limits, sampling, inference hardware, provider routing, and output controls. + +#### Purpose +- Carries mutable generation parameters from Maven configuration to AI providers. +- Supplies defaults for model inference, prompt trimming, sampling, provider routing, and calibration. + +#### Type +- `public class AiGenerationConfig` — class; annotated `@ToString` and `@SuppressWarnings`; no declared supertypes. +- `AiCalibration` — referenced nullable calibration type; not declared in this file. + +#### Input +- No-argument constructor; initializes instance fields from defaults. +- Setter parameters configure model path, context and output limits, sampling, threading, prompt caching, GPU/device settings, provider and remote API options, reasoning and DRY controls, stop strings, and calibration. +- `setModelPath`, `setChatTemplateEnableThinking`, and `setCalibration` accept nullable values. Several string setters reset null to defaults; list setters reset null to empty lists. +- `DEFAULT_THREADS` reads `Runtime.getRuntime().availableProcessors()`. + +#### Output +- Getter methods expose configured values; list getters return unmodifiable views. +- Setters mutate configuration fields. Null list inputs become new empty lists; selected nullable strings become their default values. +- Lombok `@ToString` generates a string representation of instance fields; equals/hashCode are not generated. + +#### Core logic +- Initializes inference and prompt settings from constants, including context size, output tokens, thread count, input character limits, and sampling defaults. +- Defines defaults for llama.cpp execution: prompt caching, SWA/cache reuse, GPU and CPU layer selection, KV settings, attention, batching, devices, and seeds. +- Defines provider defaults: empty per-model provider override, empty remote model ID, OpenRouter base URL, and empty API-key environment-variable name. +- Defines reasoning and repetition controls, including chat-template thinking mode, reasoning effort/budget, and DRY sampling parameters. +- `setLazyMode`, `setCacheTypeK`, `setCacheTypeV`, `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, and `setApiKeyEnv` substitute defaults for null inputs. +- `getDrySequenceBreakers()` and `getStopStrings()` wrap their backing lists with `Collections.unmodifiableList`; setters replace the backing list or reset it to an empty `ArrayList`. +- `DEFAULT_THREADS` is `Math.min(4, Runtime.getRuntime().availableProcessors())`; `DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING` is null to represent an unset tri-state. + +#### Public API +- `AiGenerationConfig()` → constructor; initializes defaults. +- Public constants: `DEFAULT_CONTEXT_SIZE`, `DEFAULT_MAX_OUTPUT_TOKENS`, `DEFAULT_TEMPERATURE`, `DEFAULT_THREADS`, `DEFAULT_MAX_INPUT_CHARS`, `DEFAULT_CHARS_PER_TOKEN`, `DEFAULT_SAFETY_MARGIN_CHARS`, `DEFAULT_WARN_ON_TRIM`, `DEFAULT_TOP_P`, `DEFAULT_TOP_K`, `DEFAULT_MIN_P`, `DEFAULT_TOP_N_SIGMA`, `DEFAULT_REPEAT_PENALTY`, `DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING`, `DEFAULT_CACHE_PROMPT`, `DEFAULT_REASONING_EFFORT`, `DEFAULT_REASONING_BUDGET_TOKENS`, `DEFAULT_SWA_FULL`, `DEFAULT_CACHE_REUSE`, `DEFAULT_GPU_LAYERS`, `DEFAULT_SEED`, `DEFAULT_CPU_MOE_LAYERS`, `DEFAULT_CPU_FFN_LAYERS`, `DEFAULT_KV_UNIFIED_PER_SLOT`, `DEFAULT_LAZY_MODE`, `DEFAULT_REPEAT_LAST_N`, `DEFAULT_CACHE_TYPE_K`, `DEFAULT_CACHE_TYPE_V`, `DEFAULT_FLASH_ATTN`, `DEFAULT_BATCH_SIZE`, `DEFAULT_UBATCH_SIZE`, `DEFAULT_THREADS_BATCH`, `DEFAULT_MAIN_GPU`, `DEFAULT_DEVICES`, `DEFAULT_PROVIDER`, `DEFAULT_REMOTE_MODEL`, `DEFAULT_BASE_URL`, `DEFAULT_API_KEY_ENV`, `DEFAULT_DRY_MULTIPLIER`, `DEFAULT_DRY_BASE`, `DEFAULT_DRY_ALLOWED_LENGTH`, `DEFAULT_DRY_PENALTY_LAST_N`. +- `getModelPath()` / `setModelPath(String)` → `String` / `void`; model file path. +- `getContextSize()` / `setContextSize(int)` → `int` / `void`; context window. +- `getMaxOutputTokens()` / `setMaxOutputTokens(int)` → `int` / `void`; output token limit. +- `getTemperature()` / `setTemperature(float)` → `float` / `void`; sampling temperature. +- `getThreads()` / `setThreads(int)` → `int` / `void`; inference thread count. +- `getCharsPerToken()` / `setCharsPerToken(int)` → `int` / `void`; automatic input sizing ratio. +- `getMaxInputChars()` / `setMaxInputChars(int)` → `int` / `void`; prompt source character limit. +- `isWarnOnTrim()` / `setWarnOnTrim(boolean)` → `boolean` / `void`; trim warning toggle. +- `getTopP()` / `setTopP(float)` → `float` / `void`; nucleus-sampling threshold. +- `getTopK()` / `setTopK(int)` → `int` / `void`; top-k sampling limit. +- `getRepeatPenalty()` / `setRepeatPenalty(float)` → `float` / `void`; repetition penalty. +- `getMinP()` / `setMinP(float)` → `float` / `void`; min-p threshold. +- `getTopNSigma()` / `setTopNSigma(float)` → `float` / `void`; top-n-sigma threshold. +- `getChatTemplateEnableThinking()` / `setChatTemplateEnableThinking(Boolean)` → `@Nullable Boolean` / `void`; nullable thinking-mode override. +- `isCachePrompt()` / `setCachePrompt(boolean)` → `boolean` / `void`; prompt-prefix caching toggle. +- `isSwaFull()` / `setSwaFull(boolean)` → `boolean` / `void`; full SWA KV cache toggle. +- `getCacheReuse()` / `setCacheReuse(int)` → `int` / `void`; KV prefix-reuse chunk size. +- `getGpuLayers()` / `setGpuLayers(int)` → `int` / `void`; GPU offload layer count. +- `getCpuMoeLayers()` / `setCpuMoeLayers(int)` → `int` / `void`; CPU MoE layer count. +- `getSeed()` / `setSeed(int)` → `int` / `void`; generation RNG seed. +- `getCpuFfnLayers()` / `setCpuFfnLayers(int)` → `int` / `void`; CPU FFN layer count. +- `getKvUnifiedPerSlot()` / `setKvUnifiedPerSlot(int)` → `int` / `void`; per-slot KV context cap. +- `getLazyMode()` / `setLazyMode(String)` → `String` / `void`; tensor-read laziness. +- `getRepeatLastN()` / `setRepeatLastN(int)` → `int` / `void`; repetition-penalty window. +- `getCacheTypeK()` / `setCacheTypeK(String)` → `String` / `void`; K-cache data type. +- `getCacheTypeV()` / `setCacheTypeV(String)` → `String` / `void`; V-cache data type. +- `isFlashAttn()` / `setFlashAttn(boolean)` → `boolean` / `void`; Flash Attention toggle. +- `getBatchSize()` / `setBatchSize(int)` → `int` / `void`; logical batch size. +- `getUbatchSize()` / `setUbatchSize(int)` → `int` / `void`; physical batch size. +- `getThreadsBatch()` / `setThreadsBatch(int)` → `int` / `void`; prompt-processing thread count. +- `getMainGpu()` / `setMainGpu(int)` → `int` / `void`; primary GPU index. +- `getDevices()` / `setDevices(String)` → `String` / `void`; backend device selection. +- `getProvider()` / `setProvider(String)` → `String` / `void`; model-specific provider override. +- `getRemoteModel()` / `setRemoteModel(String)` → `String` / `void`; remote API model ID. +- `getBaseUrl()` / `setBaseUrl(String)` → `String` / `void`; OpenAI-compatible API base URL. +- `getApiKeyEnv()` / `setApiKeyEnv(String)` → `String` / `void`; API-key environment variable name. +- `getReasoningEffort()` / `setReasoningEffort(String)` → `String` / `void`; reasoning-effort level. +- `getReasoningBudgetTokens()` / `setReasoningBudgetTokens(int)` → `int` / `void`; reasoning token budget. +- `getDryMultiplier()` / `setDryMultiplier(float)` → `float` / `void`; DRY sampling multiplier. +- `getDryBase()` / `setDryBase(float)` → `float` / `void`; DRY penalty growth base. +- `getDryAllowedLength()` / `setDryAllowedLength(int)` → `int` / `void`; DRY unpenalized n-gram length. +- `getDryPenaltyLastN()` / `setDryPenaltyLastN(int)` → `int` / `void`; DRY look-back window. +- `getDrySequenceBreakers()` / `setDrySequenceBreakers(List)` → `List` / `void`; DRY sequence breakers. +- `getStopStrings()` / `setStopStrings(List)` → `List` / `void`; generation stop strings. +- `getCalibration()` / `setCalibration(AiCalibration)` → `@Nullable AiCalibration` / `void`; optional timing calibration. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `AiCalibration` +- `Runtime` + +#### Exceptions / Errors +- Nullable annotations mark `modelPath`, `chatTemplateEnableThinking`, and `calibration`; nullable list setters clear their lists. +- `setLazyMode`, `setCacheTypeK`, `setCacheTypeV`, `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, and `setApiKeyEnv` normalize null to defaults. +- Other setters do not validate values; downstream consumers may reject invalid configuration. + +#### Concurrency +- Mutable JavaBean state is not synchronized or documented as thread-safe. +- List getters are unmodifiable views of mutable backing lists; they are not snapshots. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..e0229010 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,50 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:05:16Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Routing rules can choose how oversized source files are handled, from aborting or sampling to chunked summarization or deterministic output. + +#### Purpose +- Defines the strategies and configuration tokens for handling source files larger than a routed model’s context window. +- Parses the `` setting, defaulting to `FAIL`. + +#### Type +- `AiOversizeStrategy` — public enum. + - Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`. + - Notable annotation: `@Nullable` on `fromConfig`’s parameter. + +#### Input +- Enum constructor receives a `String configValue` for each strategy. +- `fromConfig(String value)` accepts a nullable configuration value. + +#### Output +- `configValue()` returns the strategy’s configuration token. +- `fromConfig(String)` returns the matching strategy; null or blank input returns `DEFAULT`. + +#### Core logic +- `DEFAULT` is `FAIL`. +- `configValue()` returns the instance’s `configValue`. +- `fromConfig` returns `DEFAULT` for null or trimmed-empty input. +- Otherwise, iterates over `values()` and compares each `strategy.configValue` to the trimmed input using `equalsIgnoreCase`. +- Throws `IllegalArgumentException` when no strategy matches. + +#### Public API +- `FAIL` — abort oversized-file processing. +- `SAMPLE` — use a trimmed head sample. +- `MAP_REDUCE` — summarize chunks and combine summaries. +- `DETERMINISTIC` — emit model-free output. +- `DEFAULT: AiOversizeStrategy` — default strategy. +- `configValue()` -> `String` — return config token. +- `fromConfig(String)` -> `AiOversizeStrategy` — parse config token. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `fromConfig` throws `IllegalArgumentException` for non-blank unknown values. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..ae47333e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,88 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:05:21Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Configures source indexing, AI field generation, model routing, and metadata for a `srcmorph` run. + +#### Purpose +- Provides the shared mutable configuration for binding `srcmorph` run parameters from Maven, future JSON/YAML inputs, or Java callers. +- Defines defaults and JavaBean accessors for source selection, AI providers and models, generation behavior, and output metadata. + +#### Type +- `public class SrcMorphConfiguration` — class; no explicit superclass or interfaces; annotated `@ToString`. +- No type parameters. + +#### Input +- `SrcMorphConfiguration()` takes no arguments. +- Setters accept project and output directories; source filters and file-size bounds; generation provider, prompt/model/rule/fact definitions; llama.cpp fallback parameters; and project/version metadata. +- Nullable inputs: `subtrees`, `excludes`, `fileExtensions`, `promptDefinitions`, `aiDefinitions`, `modelDirectory`, `fieldGenerations`, `factDefinitions`, `llamaModelPath`, and `projectName`. + +#### Output +- Getters expose all 23 configuration fields. +- Setters mutate the corresponding fields. +- Defaults: `outputDirectory` = `src/site/ai`; `generationProvider` = `mock`; llama.cpp context size = `2048`, max output tokens = `128`, temperature = `0.15f`, threads = `AiGenerationConfig.DEFAULT_THREADS`; `aiVersion` = `0.0.0`; `pluginVersion` = empty string. +- `force`, `planOnly`, and numeric file-size bounds default to Java zero values; `baseDirectory` is unset. +- Lombok `@ToString` generates a string representation. + +#### Core logic +- Acts as a mutable JavaBean; the constructor performs no work. +- Stores source scope and filtering in `baseDirectory`, `subtrees`, `excludes`, `fileExtensions`, `minFileSizeBytes`, and `maxFileSizeBytes`. +- Stores generation behavior and routing in `force`, `planOnly`, `generationProvider`, `promptDefinitions`, `aiDefinitions`, `fieldGenerations`, and `factDefinitions`. +- Stores model lookup and llama.cpp fallback settings in `modelDirectory`, `llamaModelPath`, `llamaContextSize`, `llamaMaxOutputTokens`, `llamaTemperature`, and `llamaThreads`. +- Stores generated-output metadata in `pluginVersion`, `aiVersion`, and `projectName`. +- `modelDirectory` is the configured base for relative model paths; absolute paths remain usable. `llamaModelPath` and llama.cpp fallback parameters apply when `fieldGenerations` is empty. +- Does not contain Maven lifecycle skip flags; an engine using this configuration executes when asked. + +#### Public API +- `DEFAULT_OUTPUT_DIRECTORY: String` — default output path. +- `DEFAULT_GENERATION_PROVIDER: String` — default provider name. +- `DEFAULT_LLAMA_CONTEXT_SIZE: int` — default llama.cpp context size. +- `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS: int` — default output-token limit. +- `DEFAULT_LLAMA_TEMPERATURE: float` — default sampling temperature. +- `DEFAULT_LLAMA_THREADS: int` — default CPU thread count. +- `DEFAULT_AI_VERSION: String` — default AI logic version. +- `SrcMorphConfiguration()` — creates configuration with defaults. +- `getBaseDirectory()` / `setBaseDirectory(File)` -> project base directory. +- `getOutputDirectory()` / `setOutputDirectory(File)` -> generated-file directory. +- `isForce()` / `setForce(boolean)` -> regenerate existing AI fields. +- `getSubtrees()` / `setSubtrees(List)` -> source subdirectory scope. +- `getExcludes()` / `setExcludes(List)` -> excluded source-file globs. +- `getFileExtensions()` / `setFileExtensions(List)` -> indexed extensions. +- `getMinFileSizeBytes()` / `setMinFileSizeBytes(long)` -> exclusive lower size bound. +- `getMaxFileSizeBytes()` / `setMaxFileSizeBytes(long)` -> inclusive upper size bound. +- `isPlanOnly()` / `setPlanOnly(boolean)` -> stop after routing plan. +- `getGenerationProvider()` / `setGenerationProvider(String)` -> default AI provider. +- `getPromptDefinitions()` / `setPromptDefinitions(List)` -> prompt templates. +- `getAiDefinitions()` / `setAiDefinitions(List)` -> model definitions. +- `getModelDirectory()` / `setModelDirectory(File)` -> base for relative model paths. +- `getFieldGenerations()` / `setFieldGenerations(List)` -> per-field routing rules. +- `getFactDefinitions()` / `setFactDefinitions(List)` -> reusable fact groups. +- `getLlamaModelPath()` / `setLlamaModelPath(String)` -> llama.cpp fallback model path. +- `getLlamaContextSize()` / `setLlamaContextSize(int)` -> llama.cpp context window. +- `getLlamaMaxOutputTokens()` / `setLlamaMaxOutputTokens(int)` -> llama.cpp output-token limit. +- `getLlamaTemperature()` / `setLlamaTemperature(float)` -> llama.cpp sampling temperature. +- `getLlamaThreads()` / `setLlamaThreads(int)` -> llama.cpp CPU thread count. +- `getPluginVersion()` / `setPluginVersion(String)` -> generated-file plugin version. +- `getAiVersion()` / `setAiVersion(String)` -> generated-file AI logic version. +- `getProjectName()` / `setProjectName(String)` -> aggregate-project title. + +#### Dependencies +- `java.io.File`, `java.util.List` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition` (same package) +- `AiGenerationConfig.DEFAULT_THREADS` +- Lombok `ToString` +- JSpecify `Nullable` + +#### Exceptions / Errors +- No explicit exception handling, thrown exceptions, or validation checks. +- Nullable fields and parameters are marked with `@Nullable`; `baseDirectory` and several reference fields are otherwise uninitialized until configured. + +#### Concurrency +- Mutable, unsynchronized JavaBean; no thread-safety guarantees. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/package.ai.md new file mode 100644 index 00000000..24ea72f4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/config/package.ai.md @@ -0,0 +1,48 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:07:38Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> Defines source-selection rules, code-fact extraction, and AI generation settings used to configure source analysis and oversized-file handling. + +#### Purpose +- Provides JavaBean configuration for `srcmorph` source scope, AI providers and models, field-generation routing, and output metadata. +- Supplies condition evaluation, regex-based fact formatting, and strategy parsing for AI generation workflows. + +#### Responsibilities +- **Source selection:** Validate and evaluate nested `AiCondition` rules against file extensions, size, line count, modification time, and relative-path globs; represent ``/`` child conditions with `AiConditionGroup`. +- **Generation configuration:** Store provider, model, sampling, inference hardware, prompt limits, and output controls in `AiGenerationConfig`; configure run-level source filters, routing definitions, fallback settings, and metadata in `SrcMorphConfiguration`. +- **Facts and oversized files:** Validate regex fact counters and format whole-source counts with `AiFactExtractor`; define and parse oversized-file strategies with `AiOversizeStrategy`. + +#### Key units +- `SrcMorphConfiguration` — run-level JavaBean for source scope, generation routing, llama.cpp fallback parameters, and output metadata. +- `AiGenerationConfig` — per-model inference, sampling, provider, prompt, and output settings with defaults. +- `AiConditionEvaluator` — validates `AiCondition` trees and matches them against `AiFileContext` facts. +- `AiConditionGroup` — holds child `AiCondition` entries for Maven-bound combinators. +- `AiFactExtractor` — validates `AiFactCounter` regexes and formats their source-match counts. +- `AiOversizeStrategy` — defines `FAIL`, `SAMPLE`, `MAP_REDUCE`, and `DETERMINISTIC` configuration tokens. + +#### Data flow +- `SrcMorphConfiguration` supplies source filters and generation definitions; `AiConditionEvaluator` applies condition trees to per-file facts. +- `AiFactExtractor` takes configured counters and source text, then returns a formatted facts block. +- `AiOversizeStrategy.fromConfig` maps a nullable configuration token to a strategy, defaulting to `FAIL`. + +#### Dependencies +- Condition evaluation uses `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, and `AiSourceExcludeFilter`. +- Run configuration references `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, and `AiGenerationConfig.DEFAULT_THREADS`. +- Fact extraction uses `AiFactCounter` and Java regex APIs; time conditions use `Instant`. + +#### Cross-cutting +- Configuration types are mutable, unsynchronized JavaBeans; `AiGenerationConfig` initializes inference defaults and exposes unmodifiable views of its list settings. +- `AiConditionEvaluator` and `AiFactExtractor` are stateless utilities; condition validation and fact-counter validation reject malformed configuration. +- Nullable settings and null normalization are explicit in configuration APIs; `AiOversizeStrategy.fromConfig` accepts null or blank values as the default. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..cae3774c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,52 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:07:53Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Configures source-aware AI documentation generation and routes completion requests through local, remote, or mock model providers. + +#### Purpose +- Defines source-selection, generation, and oversized-file configuration alongside AI completion-provider support. +- Evaluates per-file conditions and facts, then supplies configured requests to selectable inference backends. + +#### Responsibilities +- **Source scope and generation settings:** Configure source filters, model and prompt definitions, generation options, routing, fallback parameters, and output metadata. +- **Conditions and facts:** Validate and evaluate nested file-selection conditions; validate regex counters and format source-match counts. +- **Provider selection and inference:** Resolve model- or run-level provider choices, support local llama.cpp and OpenAI-compatible generation, and provide a mock backend. +- **Completion handling:** Normalize generated text by removing a leading Gemma-4 reasoning block, and expose token and throughput metrics where available. + +#### Key units +- `SrcMorphConfiguration` — run-level configuration for source scope, generation routing, fallback parameters, and output metadata. +- `AiGenerationConfig` — per-model provider, inference, sampling, prompt, and output settings with defaults. +- `AiConditionEvaluator` and `AiConditionGroup` — validate and match nested source-selection conditions. +- `AiFactExtractor` — validate configured regex counters and format whole-source match counts. +- `AiOversizeStrategy` — represents `FAIL`, `SAMPLE`, `MAP_REDUCE`, and `DETERMINISTIC` handling choices. +- `AiGenerationProvider` — backend contract for completion generation, timing metrics, and cleanup. +- `AiGenerationProviderFactory` — selects and constructs a backend using model- or run-level provider keys. +- `LlamaCppJniConfig` — immutable provider settings assembled through a fluent builder. +- `LlamaCppJniAiGenerationProvider` — lazily initializes local JNI model inference and reports available timings. +- `OpenAiCompatibleProviderSupport` — builds chat-completion requests and handles endpoint, API-key, HTTP-error, and timing support. +- `AiCompletionParser` — trims completions and strips a leading reasoning block, rejecting an unterminated one. + +#### Data flow +- `SrcMorphConfiguration` provides source filters and generation definitions; `AiConditionEvaluator` matches condition trees against per-file facts. +- `AiFactExtractor` applies configured counters to source text and returns a formatted facts block. +- `AiGenerationProviderFactory` resolves the provider key and creates a backend using `LlamaCppJniConfig` and `AiPromptSupport`. +- Backends consume `AiGenerationRequest`; generated completions are normalized, with text and available token or throughput metrics returned. + +#### Dependencies +- Configuration references `AiCondition`, `AiRangeCondition`, `AiFileContext`, `AiSourceExcludeFilter`, prompt/model definitions, field-generation settings, and fact definitions. +- Provider workflows use `AiGenerationRequest`, `AiPromptSupport`, `AiGenerationTimings`, and `AiGenerationConfig`; factory implementations include mock, llama.cpp JNI, and OpenAI-compatible providers. +- External integrations include the `net.ladenthin:llama` JNI binding and Jackson JSON support; shared utilities include `Java8CompatibilityHelper`. + +#### Cross-cutting +- Configuration types are mutable, unsynchronized JavaBeans; `AiConditionEvaluator` and `AiFactExtractor` are stateless utilities that reject malformed configuration. +- Provider generation and resource failures use `IOException`; provider interface timing defaults are zero-valued and `close()` is a no-op. +- Local model initialization and closure are unsynchronized; the llama.cpp builder is not thread-safe and does not defensively copy supplied lists. +- OpenAI-compatible API keys are restricted to HTTPS or loopback HTTP destinations; nullable and blank oversize-strategy values default to `FAIL`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..40354497 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,49 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:05:32Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Removes leading Gemma-4 reasoning blocks from model completions so only the answer is stored, while preserving marker text that appears elsewhere. + +#### Purpose +- `AiCompletionParser` cleans raw LLM completion text before it is stored in an AI index file. +- Detects an unfinished leading thinking block and reports token-budget exhaustion instead of returning incomplete reasoning. + +#### Type +- `public class AiCompletionParser` — class; non-final and subclassable; annotated `@ToString`. + +#### Input +- `parseCompletion(final String response)` accepts raw completion text; `null` is allowed. +- Uses the `THINKING_BLOCK_START_MARKER` and `THINKING_BLOCK_END_MARKER` constants. + +#### Output +- Returns a non-null `String`: trimmed response, or trimmed answer text after a leading thinking block. +- Throws `IOException` if a leading thinking block has no closing marker. + +#### Core logic +- `parseCompletion` returns `""` for `null`; otherwise trims `response` into `trimmed`. +- If `trimmed` does not start with `THINKING_BLOCK_START_MARKER`, returns `trimmed` unchanged apart from trimming; markers within the text remain. +- For a leading block, removes the start marker with `substring`, then finds the first `THINKING_BLOCK_END_MARKER` using `indexOf`. +- If no end marker is found, throws `IOException` with an actionable message to increase `maxOutputTokens`, including `response.length()`. +- Otherwise returns the trimmed substring after the first end marker. +- `THINKING_BLOCK_START_MARKER` is `"<|channel>thought"`; `THINKING_BLOCK_END_MARKER` is `""`. + +#### Public API +- `AiCompletionParser()` — constructs parser. +- `parseCompletion(String) -> String` — strips a leading thinking block. +- `THINKING_BLOCK_START_MARKER: String` — opening token. +- `THINKING_BLOCK_END_MARKER: String` — closing token. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` +- `String` + +#### Exceptions / Errors +- `IOException` when a leading thinking block is unterminated; message identifies the missing marker and recommends increasing `maxOutputTokens`. +- `null` input is handled as an empty response. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..801abc48 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,45 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:05:37Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Generates text from source-aware requests through interchangeable AI backends, optionally reporting model timing for calibration. + +#### Purpose +- Defines the provider contract for generating text from `AiGenerationRequest`. +- Supplies default timing and close behavior for providers that do not expose timings or require cleanup. + +#### Type +- `AiGenerationProvider` — interface; extends `AutoCloseable`. + +#### Input +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume an `AiGenerationRequest` containing prompt key, source file, source text, and current header. + +#### Output +- `generate` returns generated text; documented as non-null, possibly blank. +- `generateWithTimings` returns `AiGenerationTimings`; the default uses generated text and zero rates/counts. +- `close` has no output or default side effects. + +#### Core logic +- Default `generateWithTimings(final AiGenerationRequest request)` calls `generate(request)` and constructs `new AiGenerationTimings(..., 0, 0, 0.0d, 0, 0.0d)`. +- Default `close()` does nothing; providers may override it. + +#### Public API +- `generate(AiGenerationRequest)` -> `String` — generate text using default sampling. +- `generateWithTimings(AiGenerationRequest)` -> `AiGenerationTimings` — generate text with timing data. +- `close()` -> `void` — release provider resources. + +#### Dependencies +- `java.io.IOException` +- `java.lang.AutoCloseable` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `AiGenerationTimings` + +#### Exceptions / Errors +- `generate`, `generateWithTimings`, and `close` declare `IOException` for provider failures. +- Generated text is documented as never `null`, but may be blank. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..1802170f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,62 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:05:41Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Selects the configured AI generation provider for a run, falling back to the model’s provider or a deterministic mock. + +#### Purpose +- Resolves run-level and model-level provider keys and creates the matching `AiGenerationProvider`. + +#### Type +- `public class AiGenerationProviderFactory` — class; annotated `@ToString`. + +#### Input +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` — run provider key, model configuration, and prompt lookup support. +- `effectiveProvider(String runProvider, String modelProvider)` — nullable run and model provider keys. +- Private field `compatibilityHelper` — `Java8CompatibilityHelper` used to check blank provider names. + +#### Output +- `create(...)` returns a newly created `AiGenerationProvider`. +- `effectiveProvider(...)` returns the trimmed model provider when nonblank; otherwise returns the run provider. +- No fields are mutated. + +#### Core logic +- `effectiveProvider` prefers `modelProvider.trim()` when `modelProvider` is non-null and nonblank; otherwise returns `runProvider`. +- `create` resolves the key using `effectiveProvider(providerName, llamaConfig.provider())`. +- If the effective key is `null` or `compatibilityHelper.isBlank(effective)`, returns `MockAiGenerationProvider`. +- Switches on the effective key: + - `PROVIDER_MOCK` → `new MockAiGenerationProvider()`. + - `PROVIDER_LLAMACPP_JNI` → `new LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)`. + - `PROVIDER_OPENAI_COMPATIBLE` → `new OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)`. + - Otherwise throws `IllegalArgumentException`. + +#### Public API +- `AiGenerationProviderFactory()` — constructs factory. +- `PROVIDER_MOCK: String` — mock provider key. +- `PROVIDER_LLAMACPP_JNI: String` — llama.cpp JNI provider key. +- `PROVIDER_OPENAI_COMPATIBLE: String` — OpenAI-compatible provider key. +- `effectiveProvider(String runProvider, String modelProvider) -> @Nullable String` — resolves provider precedence. +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport) -> AiGenerationProvider` — creates selected provider. +- Lombok-generated `toString() -> String` — factory string representation. + +#### Dependencies +- `AiGenerationProvider` +- `MockAiGenerationProvider` +- `LlamaCppJniAiGenerationProvider` +- `OpenAiCompatibleAiGenerationProvider` +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `Java8CompatibilityHelper` +- `@Nullable` +- Lombok `@ToString` + +#### Exceptions / Errors +- `create(...)` throws `IllegalArgumentException` for unsupported nonblank provider keys. +- `effectiveProvider` accepts nullable inputs; returns `null` if neither specifies a provider. +- Blank provider keys fall back to the mock provider. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..2f4633d4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,60 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:05:48Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Generates local AI completions from GGUF models using llama.cpp, with configurable inference, cache reuse, and model-throughput reporting. + +#### Purpose +- Implements AI generation through the `net.ladenthin:llama` JNI binding, loading and caching a local GGUF model on first use. +- Converts chat responses into completion text or `AiGenerationTimings`, and closes the native model handle. + +#### Type +- `public final class LlamaCppJniAiGenerationProvider` — class; implements `AiGenerationProvider`, `AutoCloseable`; annotated `@ToString`. +- Lombok excludes `model` and `support` from generated `toString()`. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`; both required non-null. +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume generation requests. +- `model()` reads configuration for model path, context, threads, GPU/CPU placement, KV cache, attention, batching, devices, and lazy loading; obtains chat-template kwargs from `support`. +- Inference parameters are built from each request by `support.buildInferenceParameters(request)`. + +#### Output +- `generate(...)` returns parsed completion text. +- `generateWithTimings(...)` returns completion text with prompt/prediction token counts, cache tokens, and throughput; missing timings produce zero metrics. +- Lazily stores a `LlamaModel` in `model`; `close()` closes it if initialized. +- Emits support warnings for truncated answers and logs prompt-cache reuse. + +#### Core logic +- `model()` returns the cached model, or creates `ModelParameters` with `modelPath()`, `contextSize()`, `threads()`, `ReasoningFormat.AUTO`, and `support.buildChatTemplateKwargs()`. +- Applies configured options conditionally: `enableSwaFull()`, `setCacheReuse(...)`, GPU/CPU layer placement, unified KV budget, `lazyMode(...)`, flash attention, KV cache types, batch sizes, thread count, main GPU, and explicit devices. +- Creates `new LlamaModel(modelParameters)` and caches it in `model`. Initialization is lazy and unsynchronized. +- `chatResponse(request)` calls `model().chatComplete(support.buildInferenceParameters(request))` and parses the full result with `chatResponseParser.parseResponse(...)`. +- `generate(request)` warns via `support.warnOnTruncatedAnswer(...)`, logs via `support.logPromptCacheReuse(...)`, then parses `response.getFirstContent()` with `completionParser.parseCompletion(...)`. +- `generateWithTimings(request)` extracts first content and timings; if timings are absent, returns zero metrics; otherwise maps prompt count, cache count, prompt rate, predicted count, and predicted rate into `AiGenerationTimings`. +- `close()` closes the cached model when non-null. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport)` — initialize provider. +- `generate(AiGenerationRequest) -> String` — generate completion text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` — generate text and metrics. +- `close() -> void` — release native model. + +#### Dependencies +- `AiGenerationProvider`, `AutoCloseable`, `LlamaCppJniConfig`, `LlamaCppJniProviderSupport`, `AiGenerationRequest`, `AiPromptSupport`, `AiCompletionParser`, `AiGenerationTimings`. +- JNI binding: `LlamaModel`, `ModelParameters`, `FlashAttn`, `ReasoningFormat`, `ChatResponseParser`, `ChatResponse`, `Timings`. +- Utilities: `Objects`, `Map`, `IOException`, `Java8CompatibilityHelper`, Lombok `ToString`, JSpecify `Nullable`. + +#### Exceptions / Errors +- Constructor uses `Objects.requireNonNull` for `config` and `promptSupport`, with respective messages `"config"` and `"promptSupport"`. +- `generate(...)` declares `IOException`; `generateWithTimings(...)` does not. +- Configuration options are forwarded only under their stated guards; invalid backend/configuration combinations may fail during native model setup or inference. + +#### Concurrency +- Lazy `model` initialization and `close()` are unsynchronized; concurrent initialization or closure is not guarded. +- `model` is nullable and remains null until generation initializes it. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..55146b92 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,138 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:05:56Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Captures model, sampling, hardware, caching, and API-provider settings for AI text generation. + +#### Purpose +- Defines an immutable configuration for llama.cpp JNI generation and related OpenAI-compatible or mock providers. +- Provides a fluent builder initialized from `AiGenerationConfig` defaults. + +#### Type +- `public final class LlamaCppJniConfig` — class; annotated `@ConvertToRecord`, Lombok `@ToString`, `@EqualsAndHashCode`; no declared supertypes. +- `public static final class Builder` — class; nested in `LlamaCppJniConfig`; fluent mutable builder. + +#### Input +- `builder(String modelPath)` requires a non-null GGUF model path. +- Builder setters accept sampling and token limits, CPU/GPU and cache options, provider/API settings, reasoning and DRY parameters, and stop/sequence-breaker lists. +- Builder fields default to corresponding `AiGenerationConfig.DEFAULT_*` values; list defaults are empty lists. + +#### Output +- `build()` creates a `LlamaCppJniConfig` containing 41 configuration fields. +- Record-style accessors expose configuration values; list accessors return unmodifiable views. +- Lombok generates value-based `equals`, `hashCode`, and `toString`. + +#### Core logic +- `builder(String)` constructs a `Builder`; its private constructor applies `Objects.requireNonNull(modelPath, "modelPath")`. +- Builder setters update individual fields and return `this`; string setters for `lazyMode`, `cacheTypeK`, `cacheTypeV`, `devices`, `provider`, `remoteModel`, `baseUrl`, `apiKeyEnv`, and `reasoningEffort` replace `null` with the relevant `AiGenerationConfig.DEFAULT_*`. +- `drySequenceBreakers(List)` and `stopStrings(List)` replace `null` with empty lists. +- `build()` calls the private `LlamaCppJniConfig(Builder)` constructor, which copies every builder field without further normalization. +- `drySequenceBreakers()` and `stopStrings()` wrap their stored lists with `Collections.unmodifiableList`; the builder does not copy supplied non-null lists. +- `chatTemplateEnableThinking` is nullable; `null` represents an unset chat-template option. + +#### Public API +- `builder(String) -> Builder` — start configuration with required model path. +- `modelPath() -> String` — GGUF model path. +- `contextSize() -> int` — context window. +- `maxOutputTokens() -> int` — output token limit. +- `temperature() -> float` — sampling temperature. +- `threads() -> int` — CPU thread count. +- `topP() -> float` — nucleus threshold. +- `topK() -> int` — top-k limit. +- `minP() -> float` — min-p threshold. +- `topNSigma() -> float` — top-n-sigma threshold. +- `repeatPenalty() -> float` — repetition penalty. +- `chatTemplateEnableThinking() -> @Nullable Boolean` — optional thinking mode. +- `cachePrompt() -> boolean` — prompt caching. +- `swaFull() -> boolean` — full-size SWA KV cache. +- `cacheReuse() -> int` — KV prefix reuse chunk size. +- `gpuLayers() -> int` — GPU offload layer count. +- `seed() -> int` — generation RNG seed. +- `cpuMoeLayers() -> int` — CPU MoE layer count. +- `cpuFfnLayers() -> int` — CPU FFN layer count. +- `kvUnifiedPerSlot() -> int` — per-slot KV context cap. +- `lazyMode() -> String` — tensor-read laziness. +- `repeatLastN() -> int` — repetition window. +- `cacheTypeK() -> String` — K-cache data type. +- `cacheTypeV() -> String` — V-cache data type. +- `flashAttn() -> boolean` — Flash Attention setting. +- `batchSize() -> int` — logical batch size. +- `ubatchSize() -> int` — physical batch size. +- `threadsBatch() -> int` — batch-processing thread count. +- `mainGpu() -> int` — primary GPU index. +- `devices() -> String` — device selection. +- `provider() -> String` — provider identifier. +- `remoteModel() -> String` — remote model identifier. +- `baseUrl() -> String` — OpenAI-compatible API base URL. +- `apiKeyEnv() -> String` — API-key environment variable name. +- `reasoningEffort() -> String` — reasoning-effort value. +- `reasoningBudgetTokens() -> int` — reasoning token budget. +- `dryMultiplier() -> float` — DRY multiplier. +- `dryBase() -> float` — DRY base. +- `dryAllowedLength() -> int` — DRY allowed length. +- `dryPenaltyLastN() -> int` — DRY look-back window. +- `drySequenceBreakers() -> List` — unmodifiable DRY sequence breakers. +- `stopStrings() -> List` — unmodifiable stop strings. +- `Builder.contextSize(int) -> Builder` — set context window. +- `Builder.maxOutputTokens(int) -> Builder` — set output token limit. +- `Builder.temperature(float) -> Builder` — set temperature. +- `Builder.threads(int) -> Builder` — set CPU threads. +- `Builder.topP(float) -> Builder` — set nucleus threshold. +- `Builder.topK(int) -> Builder` — set top-k limit. +- `Builder.minP(float) -> Builder` — set min-p threshold. +- `Builder.topNSigma(float) -> Builder` — set top-n-sigma threshold. +- `Builder.repeatPenalty(float) -> Builder` — set repetition penalty. +- `Builder.chatTemplateEnableThinking(@Nullable Boolean) -> Builder` — set optional thinking mode. +- `Builder.cachePrompt(boolean) -> Builder` — set prompt caching. +- `Builder.swaFull(boolean) -> Builder` — set full-size SWA cache. +- `Builder.cacheReuse(int) -> Builder` — set KV prefix reuse size. +- `Builder.gpuLayers(int) -> Builder` — set GPU offload layers. +- `Builder.seed(int) -> Builder` — set generation seed. +- `Builder.cpuMoeLayers(int) -> Builder` — set CPU MoE layers. +- `Builder.cpuFfnLayers(int) -> Builder` — set CPU FFN layers. +- `Builder.kvUnifiedPerSlot(int) -> Builder` — set per-slot KV cap. +- `Builder.lazyMode(String) -> Builder` — set tensor-read laziness. +- `Builder.repeatLastN(int) -> Builder` — set repetition window. +- `Builder.cacheTypeK(String) -> Builder` — set K-cache type. +- `Builder.cacheTypeV(String) -> Builder` — set V-cache type. +- `Builder.flashAttn(boolean) -> Builder` — set Flash Attention. +- `Builder.batchSize(int) -> Builder` — set logical batch size. +- `Builder.ubatchSize(int) -> Builder` — set physical batch size. +- `Builder.threadsBatch(int) -> Builder` — set batch-processing threads. +- `Builder.mainGpu(int) -> Builder` — set primary GPU. +- `Builder.devices(String) -> Builder` — set device selection. +- `Builder.provider(String) -> Builder` — set provider identifier. +- `Builder.remoteModel(String) -> Builder` — set remote model identifier. +- `Builder.baseUrl(String) -> Builder` — set API base URL. +- `Builder.apiKeyEnv(String) -> Builder` — set API-key environment variable name. +- `Builder.reasoningEffort(String) -> Builder` — set reasoning effort. +- `Builder.reasoningBudgetTokens(int) -> Builder` — set reasoning token budget. +- `Builder.dryMultiplier(float) -> Builder` — set DRY multiplier. +- `Builder.dryBase(float) -> Builder` — set DRY base. +- `Builder.dryAllowedLength(int) -> Builder` — set DRY allowed length. +- `Builder.dryPenaltyLastN(int) -> Builder` — set DRY look-back window. +- `Builder.drySequenceBreakers(List) -> Builder` — set DRY sequence breakers. +- `Builder.stopStrings(List) -> Builder` — set stop strings. +- `Builder.build() -> LlamaCppJniConfig` — create immutable configuration. + +#### Dependencies +- `AiGenerationConfig` +- `ConvertToRecord` +- Lombok `EqualsAndHashCode`, `ToString` +- `Nullable` +- `Collections`, `List`, `Objects` + +#### Exceptions / Errors +- `Objects.requireNonNull` throws `NullPointerException` for a null `modelPath`. +- Nullable setters for specified strings restore defaults; nullable list setters use empty lists. +- No validation of numeric ranges or list contents. + +#### Concurrency +- `Builder` is explicitly not thread-safe. +- `LlamaCppJniConfig` fields are final; returned lists are unmodifiable views, though supplied builder lists are not defensively copied. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..832246e8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,68 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:06:11Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds OpenAI-compatible chat requests and safely handles endpoint selection, API-key transmission, HTTP errors, and generation timing for configured models. + +#### Purpose +- Provides network-independent request and response support for `OpenAiCompatibleAiGenerationProvider`. +- Builds chat-completions JSON, validates endpoints and API-key destinations, and calculates `AiGenerationTimings`. + +#### Type +- `final class OpenAiCompatibleProviderSupport` — final package-private class; annotated `@ToString`. + +#### Input +- Constructor: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, and `Function environment`. +- `requestBody(AiGenerationRequest request)` reads the request’s prompt key, source file, and source text; reads model, sampling, stop-string, and reasoning settings from `config`. +- `endpoint()` reads `config.baseUrl()`. +- `apiKey()` reads `config.apiKeyEnv()` and invokes `environment.apply(...)`. +- `apiKeyFor(String endpoint)` parses the endpoint host when a configured key would be sent over HTTP. +- `errorMessage(String endpoint, int status, String body)` consumes an error response body. +- `timings(String text, ChatResponse response, double seconds)` reads usage counts from `response`. + +#### Output +- `requestBody(...)` returns serialized JSON with system and user messages, sampling settings, and `stream: false`. +- `endpoint()` returns the normalized chat-completions URL. +- `apiKey()` and `apiKeyFor(...)` return a trimmed key or `null`. +- `errorMessage(...)` returns an endpoint/status/body-excerpt message. +- `timings(...)` returns `AiGenerationTimings`; decode rate is completion tokens per positive elapsed second, otherwise zero, and prefill rate is zero. +- No mutable instance state; static `MAPPER` is used for JSON construction and serialization. + +#### Core logic +- `requestBody(...)`: + - Adds `model` only when `config.remoteModel()` is not blank. + - Creates `messages` using `promptSupport.systemPrompt(request.promptKey())` and `promptSupport.userMessage(request.sourceFile(), request.sourceText())`. + - Always writes `max_tokens`, `temperature`, `top_p`, `repetition_penalty`, and `stream`. + - Adds `top_k` and `min_p` only when positive; `seed` only when nonnegative; `stop` only when nonempty; `reasoning.effort` only when nonblank. + - Serializes with `MAPPER.writeValueAsString(body)`. +- `endpoint()` trims `config.baseUrl()`, accepts only `HTTP_SCHEME` or `HTTPS_SCHEME`, strips trailing slashes, and appends `CHAT_COMPLETIONS_PATH`. +- `apiKey()` returns `null` if `config.apiKeyEnv()` is blank, the environment lookup is unset, or the value is blank; otherwise returns the trimmed value. +- `apiKeyFor(...)` allows a configured key over HTTPS; for HTTP, parses the host with `new URL(endpoint).getHost()` and requires `isLoopbackHost(host)`. +- `isLoopbackHost(String host)` accepts exact lowercase `localhost`, hosts matching `IPV4_LOOPBACK`, or exact `[::1]`. +- `isSuccess(int status)` checks `HTTP_OK_FIRST <= status < HTTP_OK_END` (200–299). +- `errorMessage(...)` truncates bodies longer than `ERROR_BODY_EXCERPT` (500 characters), appends `ELLIPSIS`, and formats endpoint, status, and excerpt. +- `timings(...)` reads completion, prompt, and cached token counts from `response.getUsage()` and constructs `AiGenerationTimings`. + +#### Dependencies +- `LlamaCppJniConfig`, `AiPromptSupport`, `AiGenerationRequest`, `AiGenerationTimings` +- `ChatResponse`, `Usage` +- Jackson: `ObjectMapper`, `ArrayNode`, `ObjectNode` +- `Java8CompatibilityHelper` +- Java: `IOException`, `URL`, `List`, `Objects`, `Function`, `Pattern` +- Lombok: `ToString`; JSpecify: `Nullable` + +#### Exceptions / Errors +- Constructor uses `Objects.requireNonNull` for `config`, `promptSupport`, and `environment`. +- `requestBody(...)` propagates `IOException` from JSON serialization. +- `endpoint()` throws `IllegalArgumentException` for non-HTTP(S) base URLs. +- `apiKeyFor(...)` propagates `IOException` for URL parsing failures and throws `IOException` if a configured key would be sent over HTTP to a non-loopback host. +- `timings(...)` assumes `response.getUsage()` is non-null. + +#### Concurrency +- No synchronization or concurrency primitives; instance dependencies are final. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/package.ai.md new file mode 100644 index 00000000..dcc17861 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/java/provider/package.ai.md @@ -0,0 +1,49 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:07:46Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Generates AI documentation completions from source-aware requests using selectable local llama.cpp, OpenAI-compatible, or mock backends. + +#### Purpose +- Defines provider selection, configuration, and generation support for AI completion workflows. +- Normalizes model output and exposes generation text plus optional token and throughput metrics. + +#### Responsibilities +- **Provider contract and selection:** `AiGenerationProvider` standardizes generation, timing, and cleanup; `AiGenerationProviderFactory` resolves run/model provider keys and creates the backend. +- **Local inference:** `LlamaCppJniAiGenerationProvider` lazily loads and configures a GGUF model, generates chat responses, reports timings, and closes native resources. +- **Remote request support:** `OpenAiCompatibleProviderSupport` builds chat-completions JSON, selects and validates endpoints and API-key transmission, formats HTTP errors, and computes timing metrics. +- **Configuration and output cleanup:** `LlamaCppJniConfig` captures sampling, model, hardware, cache, provider, and API settings; `AiCompletionParser` strips a leading Gemma-4 reasoning block and detects unterminated blocks. + +#### Key units +- `AiGenerationProvider` — backend interface with default zero-valued timing metrics and no-op `close()`. +- `AiGenerationProviderFactory` — prefers a nonblank model provider over the run provider, defaults blank selection to mock, and rejects unknown keys. +- `LlamaCppJniConfig` — immutable configuration with a fluent builder and defaults from `AiGenerationConfig`. +- `LlamaCppJniAiGenerationProvider` — local JNI inference provider with lazy model creation and optional prompt-cache and throughput reporting. +- `OpenAiCompatibleProviderSupport` — package-private helper for request serialization, endpoint and key safety, HTTP errors, and usage-based timings. +- `AiCompletionParser` — trims completions and removes only a leading `"<|channel>thought"` block through its closing marker. + +#### Data flow +- The factory resolves the provider key and constructs the selected backend from `LlamaCppJniConfig` and `AiPromptSupport`. +- Providers consume `AiGenerationRequest`; local inference builds backend parameters through prompt support, while OpenAI-compatible support creates system/user messages and serializes configured generation options. +- Generated text is parsed to remove leading reasoning content; provider timing paths return text alongside token counts and available throughput metrics. + +#### Dependencies +- Internal request and prompt types: `AiGenerationRequest`, `AiPromptSupport`, `AiGenerationTimings`, and `AiGenerationConfig`. +- Provider implementations referenced by the factory: `MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, and `OpenAiCompatibleAiGenerationProvider`. +- External integrations include the `net.ladenthin:llama` JNI binding and Jackson JSON nodes/serialization; shared utilities include `Java8CompatibilityHelper`. + +#### Cross-cutting +- Providers declare `IOException` for generation or resource failures; the completion parser uses it for an unterminated leading reasoning block. +- `LlamaCppJniConfig` centralizes inference, hardware, cache, and API settings; its builder is not thread-safe, and supplied list values are not defensively copied. +- Local model initialization and closure are unsynchronized; OpenAI-compatible API keys are restricted to HTTPS or loopback HTTP destinations. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..d8b2af47 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/kernels/histogram.cl.ai.md @@ -0,0 +1,45 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:07:04Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Counts occurrences of each byte value in an image or byte stream and produces a 256-bin histogram. + +#### Purpose +- Computes a byte-frequency histogram in two passes: per-work-group partial counts, then per-bin reduction. +- Supports counting byte values from 0 through 255. + +#### Type +- OpenCL C 1.2 kernel source. + +#### Input +- `histogram_partial(input, length, partial, local_bins)` reads `input` as `length` bytes and uses work-group local memory for bin counts. +- `histogram_reduce(partial, group_count, histogram)` reads `group_count` partial histograms. + +#### Output +- `histogram_partial` writes `BINS` counters per work-group to `partial`. +- `histogram_reduce` writes the final `BINS` counts to `histogram`. + +#### Core logic +- `histogram_partial` initializes local bins cooperatively, synchronizes the work-group, and distributes input indices across global work-items using a stride of `gsize`. +- Each work-item atomically increments the local bin for its input byte; after synchronization, work-items copy local counts to the group’s segment in `partial`. +- `histogram_reduce` assigns one work-item to each bin, sums that bin across all partial histograms, and writes the total; work-items with `bin >= BINS` return. + +#### Public API +- `histogram_partial(__global const uchar *input, const uint length, __global uint *partial, __local uint *local_bins) -> void` — count bytes per work-group. +- `histogram_reduce(__global const uint *partial, const uint group_count, __global uint *histogram) -> void` — combine partial counts per bin. + +#### Constants and configuration +- `BINS = 256`. + +#### Dependencies +- OpenCL built-ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `barrier`, `atomic_inc`. +- OpenCL flag: `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- No explicit error handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/kernels/package.ai.md new file mode 100644 index 00000000..7e126075 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/kernels/package.ai.md @@ -0,0 +1,31 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:08:01Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes frequency counts for all 256 byte values in image or byte-stream data. + +#### Purpose +- Produces a 256-bin byte histogram using per-work-group counts followed by a reduction. + +#### Responsibilities +- Count input bytes into local work-group histograms and combine partial counts into final totals. + +#### Key units +- `histogram_partial` — counts byte values per work-group and writes 256 counters per group to `partial`. +- `histogram_reduce` — sums each bin across partial histograms into the final `histogram`. +- `BINS` — fixed histogram size of 256. + +#### Data flow +- `input` bytes are counted into work-group-local bins, copied to `partial`, then reduced across groups into `histogram`. + +#### Dependencies +- OpenCL built-ins for work-item and group indexing, barriers, and local-memory atomic increments. + +#### Cross-cutting +- Uses OpenCL C 1.2, local-memory synchronization, and `atomic_inc`; no explicit error handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..cf593552 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,47 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:08:15Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides byte-data processing utilities, bounded stream buffering, backup rotation, and currency-based monthly revenue reporting. + +#### Purpose +- Groups low-level byte-processing components with operational backup and sales-reporting tools. +- Supports byte histogram computation, single-producer/single-consumer transfer, backup retention, and order-revenue aggregation. + +#### Responsibilities +- **Byte processing:** Compute 256-bin frequency counts from image or byte-stream input using partial work-group histograms and reduction. +- **Stream buffering:** Manage a fixed-capacity circular byte queue with partial reads and writes, occupancy queries, and lifecycle operations. +- **Operations and reporting:** Create timestamped compressed backups with retention pruning; parse order CSVs and report monthly regional revenue for a selected currency. + +#### Key units +- `histogram_partial`, `histogram_reduce`, `BINS` — count byte values per work group and reduce partial counts into a 256-bin histogram. +- `ringbuf_t`, `ringbuf_status_t` — represent circular buffer state and initialization outcomes. +- `ringbuf_init`, `ringbuf_free`, `ringbuf_used`, `ringbuf_free_space`, `ringbuf_write`, `ringbuf_read` — initialize, inspect, transfer data through, and release the ring buffer. +- `rotate_backups.sh` — create a compressed archive and prune older matching backups. +- `Order`, `parse_orders`, `revenue_by_month_and_region`, `main` — represent and parse currency-matched orders, aggregate revenue, and print report results. + +#### Data flow +- **Histogram:** Input bytes → work-group-local counts → partial histograms → reduced 256-bin totals. +- **Ring buffer:** Initialize power-of-two storage → write available bytes and read queued bytes with wraparound → query occupancy or release storage. +- **Backup:** Validate source and retention settings → create UTC-dated `.tar.gz` via a `.partial` path → finalize archive and prune older matches. +- **Sales report:** CSV paths and currency → validated matching orders → monthly regional totals → optional minimum-revenue filter → tab-separated output. + +#### Dependencies +- Histogram kernels use OpenCL C built-ins for work-item/group indexing, barriers, and local-memory atomic increments. +- Ring buffer API is declared by `ringbuf.h`; implementation uses standard C allocation, copying, and integer types. +- Backup rotation uses shell utilities including `tar`, `date`, `mkdir`, `mv`, `du`, `ls`, and `rm`. +- Sales reporting uses Python standard-library CSV, date, decimal, argument-parsing, and aggregation modules. + +#### Cross-cutting +- Ring buffer reserves one slot to distinguish full from empty, requires nonzero power-of-two capacity, and specifies single-producer/single-consumer ownership of `head` and `tail`. +- Backup rotation uses strict Bash mode and an `EXIT` trap to remove temporary archives on failure. +- Sales amounts use `Decimal`; invalid matching-row dates or amounts produce file- and line-specific `ValueError`s. +- The components use their respective platform conventions: OpenCL synchronization, C buffer status codes, and command-line failure handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/ringbuf/package.ai.md new file mode 100644 index 00000000..5ffadebc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/ringbuf/package.ai.md @@ -0,0 +1,41 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:08:05Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides bounded byte-stream buffering for single-producer/single-consumer transfer, accepting and returning data as space and queued bytes allow. + +#### Purpose +- Implements and declares a fixed-capacity circular byte buffer with partial reads and writes. +- Reserves one slot to distinguish full from empty, so usable capacity is `capacity - 1`. + +#### Responsibilities +- **Buffer lifecycle and status:** initialize storage, validate capacity, and free/reset buffer state. +- **Occupancy and transfer:** report used/free space and copy bytes into or out of the circular queue, including wraparound. + +#### Key units +- `ringbuf_t` — stores the byte array, capacity, and volatile `head` and `tail` indices. +- `ringbuf_status_t` — reports initialization status via `RINGBUF_OK`, `RINGBUF_EINVAL`, and `RINGBUF_ENOMEM`. +- `ringbuf_init`, `ringbuf_free` — allocate and initialize the buffer, or release and reset it. +- `ringbuf_used`, `ringbuf_free_space` — report queued bytes and writable capacity. +- `ringbuf_write`, `ringbuf_read` — enqueue or dequeue up to the requested number of bytes. +- `is_power_of_two`, `min_size` — internal validation and length-selection helpers. + +#### Data flow +- `ringbuf_init` accepts a nonzero power-of-two capacity and allocates storage; invalid capacity or allocation failure returns an error status. +- `ringbuf_write` copies up to available space from the source, while `ringbuf_read` copies up to the queued amount to the destination; both handle wraparound and return bytes transferred. +- Occupancy queries derive used bytes and available space from the circular indices; `ringbuf_free` releases storage and resets the fields. + +#### Dependencies +- `ringbuf.h` declares the API, structure, and status codes used by `ringbuf.c`. +- Standard C headers provide `size_t`, `uint8_t`, allocation, and copying facilities; the header supports C++ inclusion via `extern "C"`. + +#### Cross-cutting +- Capacity must be a nonzero power of two; index advancement uses a capacity mask. +- `head` is producer-owned and `tail` consumer-owned for single-producer/single-consumer use; no broader concurrency guarantee is stated. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..dacb7be7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,59 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:07:09Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Buffers byte streams in a fixed-capacity circular queue, accepting and returning as many bytes as available space or data permits. + +#### Purpose +- Implements ring-buffer initialization, cleanup, occupancy queries, and partial reads and writes. +- Uses one unused slot to distinguish full from empty. + +#### Type +- C implementation file; defines externally visible `ringbuf_*` functions and static helpers. + +#### Input +- `ringbuf_init`: destination `ringbuf_t *rb` and `size_t capacity`. +- `ringbuf_write`: buffer, source bytes `src`, and requested length `len`. +- `ringbuf_read`: buffer, destination bytes `dst`, and requested length `len`. +- Occupancy queries and cleanup take a ring-buffer pointer. + +#### Output +- Initialization returns a `ringbuf_status_t`; write and read return the number of bytes transferred. +- Maintains allocated `rb->data`, `rb->capacity`, and circular `rb->head` / `rb->tail` indices. +- `ringbuf_free` releases storage and resets buffer fields. + +#### Core logic +- `ringbuf_init` rejects capacities that are zero or not powers of two; allocates `capacity` bytes and initializes indices to zero. +- `ringbuf_used` computes occupancy as `(head - tail) & (capacity - 1)`; `ringbuf_free_space` reserves one slot, yielding `capacity - 1 - used`. +- `ringbuf_write` transfers at most the available space; copies across the array boundary in up to two chunks, then advances `head` with a capacity mask. +- `ringbuf_read` transfers at most the used bytes; copies across the array boundary in up to two chunks, then advances `tail` with a capacity mask. +- `ringbuf_free` frees storage and zeros the pointer, capacity, and indices. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — allocate and initialize buffer. +- `ringbuf_free(ringbuf_t *rb) -> void` — release and reset buffer. +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report queued bytes. +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report writable capacity. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — enqueue available bytes. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — dequeue available bytes. +- Internal helpers: `is_power_of_two`, `min_size`. + +#### Constants and configuration +- No named constants or configuration variables defined. +- `capacity` must be a nonzero power of two; usable capacity is `capacity - 1`. +- Status codes referenced: `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`, `RINGBUF_OK` (values not shown). + +#### Dependencies +- `"ringbuf.h"`: `ringbuf_t`, `ringbuf_status_t`, status codes, and `uint8_t`. +- ``: `malloc`, `free`. +- ``: `memcpy`. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` for zero or non-power-of-two capacity. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..819339a8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,57 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:07:16Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Provides fixed-capacity byte buffering between a single producer and single consumer, allowing each side to write or read available bytes without exceeding capacity. + +#### Purpose +- Declares the ring buffer API and data structure for storing and transferring bytes. +- Uses one unused slot to distinguish full from empty; usable capacity is `capacity - 1`. + +#### Type +- C header; declares `ringbuf_t` and `ringbuf_status_t`. +- `ringbuf_t` contains a byte-array pointer, capacity, and volatile producer-owned `head` and consumer-owned `tail` indices. + +#### Input +- `ringbuf_init`: buffer pointer and requested capacity. +- `ringbuf_write`: buffer, source byte array, and requested length. +- `ringbuf_read`: buffer, destination byte array, and requested length. +- `ringbuf_used` / `ringbuf_free_space`: buffer pointer. + +#### Output +- `ringbuf_init` returns a status; `ringbuf_write` and `ringbuf_read` return the number of bytes copied. +- Read/write operations update the buffer’s indices and byte storage; `ringbuf_free` releases buffer storage. +- `ringbuf_used` and `ringbuf_free_space` return occupancy and available space. + +#### Core logic +- Requires capacity to be a nonzero power of two; the ring buffer holds at most `capacity - 1` bytes. +- Exposes partial reads and writes: each copies up to the requested length and reports the actual byte count. +- Separates producer and consumer index ownership for single-producer/single-consumer use. + +#### Public API +- `ringbuf_init(ringbuf_t *rb, size_t capacity) -> ringbuf_status_t` — initialize buffer +- `ringbuf_free(ringbuf_t *rb) -> void` — release buffer resources +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len) -> size_t` — copy bytes into buffer +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len) -> size_t` — copy bytes out +- `ringbuf_used(const ringbuf_t *rb) -> size_t` — report occupied bytes +- `ringbuf_free_space(const ringbuf_t *rb) -> size_t` — report available bytes + +#### Constants and configuration +- `RINGBUF_OK = 0` — success. +- `RINGBUF_EINVAL = -1` — capacity is zero or not a power of two. +- `RINGBUF_ENOMEM = -2` — allocation failed. +- `RINGBUF_H` — include guard. + +#### Dependencies +- `` — `size_t`. +- `` — `uint8_t`. +- C++ compatibility via `extern "C"`. + +#### Exceptions / Errors +- Initialization reports invalid capacity with `RINGBUF_EINVAL` and allocation failure with `RINGBUF_ENOMEM`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/scripts/package.ai.md new file mode 100644 index 00000000..57103128 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/scripts/package.ai.md @@ -0,0 +1,40 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:08:10Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides operational tools for rotating dated backups and producing currency-specific monthly revenue reports from order exports. + +#### Purpose +- Create compressed directory backups with configurable retention. +- Aggregate order CSV data into monthly regional revenue totals for a selected currency. + +#### Responsibilities +- **Backup rotation:** Validate source and retention settings, create a timestamped gzip archive, and prune older archives for that source. +- **Sales reporting:** Validate CSV headers, select orders by currency, aggregate revenue by month and region, and apply an optional minimum-revenue threshold. + +#### Key units +- `rotate_backups.sh` — creates a `.tar.gz` archive using a temporary `.partial` path, then retains the newest configured number of matching archives. +- `Order` — immutable sales record containing `order_date`, `region`, and `amount`. +- `parse_orders(path, currency)` — yields valid orders matching the selected currency from a CSV file. +- `revenue_by_month_and_region(orders)` — returns sorted totals grouped by `YYYY-MM` and region. +- `main(argv=None)` — parses report options, gathers orders, and prints qualifying totals. + +#### Data flow +- Backup: source directory and backup destination → validated settings → UTC-dated archive → rename from partial path → prune older matching archives. +- Reporting: CSV paths and currency option → header and row validation → matching `Order` records → monthly regional totals → minimum-revenue filtering → tab-separated output. + +#### Dependencies +- Backup script uses shell utilities including `tar`, `date`, `mkdir`, `mv`, `du`, `ls`, and `rm`; reads source contents and matching archives in the destination. +- Sales report uses Python standard-library CSV, date, decimal, argument-parsing, and aggregation modules. + +#### Cross-cutting +- Both scripts are command-line tools with explicit inputs and status-based failure behavior. +- Backup failures use strict Bash mode and an `EXIT` trap to remove the temporary archive. +- Sales data uses `Decimal` for amounts; invalid matching-row dates or amounts raise file- and line-specific `ValueError`s. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..b309bb5f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,61 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:07:23Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Creates a dated compressed archive of a directory and prunes older archives to retain the requested number. + +#### Purpose +- Back up one source directory to a backup directory, retaining only the newest `KEEP` archives for that source. +- Run directly with source directory, backup directory, and optional retention count. + +#### Type +- Bash; `set -euo pipefail`. + +#### Input +- Positional argument 1 → `SOURCE_DIR`; required. +- Positional argument 2 → `BACKUP_DIR`; required. +- Positional argument 3 → `KEEP`; optional, defaults to `7`; must be a positive integer. +- Reads `SOURCE_DIR` and lists matching archives in `BACKUP_DIR`. + +#### Output +- Creates `BACKUP_DIR` if needed and writes a gzip-compressed tar archive named `_.tar.gz`. +- Removes older matching archives beyond the retention count. +- Prints created archive and its human-readable size; prints each removed archive. +- Exits with status `2` for missing required arguments, invalid `KEEP`, or a nonexistent `SOURCE_DIR`; strict-mode command failures also cause nonzero exit. + +#### Core logic +- Assigns positional arguments and validates `KEEP` against a positive-integer pattern. +- Checks that `SOURCE_DIR` exists as a directory; creates `BACKUP_DIR`. +- Builds an archive name from the source basename and UTC timestamp; sets a `.partial` temporary path and an `EXIT` trap to remove it. +- Runs `tar` from the source directory’s parent, then renames the partial archive to its final path. +- Prints the archive path and size. +- Lists matching archives newest-first and deletes entries after the first `KEEP`. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR="${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR="${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP="${3:-7}"` +- `name="$(basename "$SOURCE_DIR")"` +- `archive="$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp="$archive.partial"` +- `archives` populated by `mapfile -t` from the matching archive listing. +- `old` receives each archive selected for removal. + +#### Dependencies +- External commands: `basename`, `date`, `mkdir`, `tar`, `mv`, `du`, `cut`, `ls`, `rm`. +- Reads the source directory contents and matching `BACKUP_DIR/${name}_*.tar.gz` archives. + +#### Errors and exit codes +- Exit `2` if required positional arguments are absent, `KEEP` is not a positive integer, or `SOURCE_DIR` is not a directory. +- `set -e` exits on an unhandled failing command; `set -u` rejects unset variables; `set -o pipefail` propagates pipeline failures. +- `EXIT` trap removes the `.partial` archive path. +- No retries or timeouts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..5e4c222c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/other/scripts/sales_report.py.ai.md @@ -0,0 +1,58 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:07:31Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Aggregates order CSV exports into monthly revenue totals by region for a selected currency, with an optional minimum-revenue filter. + +#### Purpose +- Read one or more order CSV files and report qualifying monthly revenue by region. +- Skip orders in other currencies; reject files missing required columns or containing invalid matching-currency orders. + +#### Type +- Python command-line script. +- Frozen dataclass `Order`. + +#### Input +- Positional `csv_files`: one or more CSV paths. +- `--currency`: currency to include; default `EUR`. +- `--min-revenue`: minimum revenue to print; parsed as `Decimal`, default `Decimal("0")`. +- CSV columns: `order_date`, `region`, `amount`, `currency`; dates use ISO format. + +#### Output +- Prints tab-separated month, region, and revenue formatted to two decimal places with the selected currency. +- Prints `no orders found` to stderr and returns status `1` when no matching orders are found. +- Returns status `0` after reporting results, including when the minimum-revenue filter excludes all totals. + +#### Core logic +- `parse_orders` checks each CSV header for all `REQUIRED_COLUMNS`. +- Reads rows starting at line 2; skips rows whose currency differs from the requested currency. +- Converts matching rows to `Order`: ISO date, stripped region, and decimal amount. +- `revenue_by_month_and_region` sums amounts by `(YYYY-MM, region)` and returns totals in sorted key order. +- `main` collects orders from every input file, handles the empty-order case, filters totals by minimum revenue, and prints results. + +#### Public API +- `Order(order_date, region, amount) -> Order` — immutable order data. +- `parse_orders(path, currency) -> iterator[Order]` — yields matching-currency orders. +- `revenue_by_month_and_region(orders) -> dict` — totals revenue by month and region. +- `main(argv=None) -> int` — parses arguments and runs report. +- Entry point: `main()` via `sys.exit`. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` +- CLI `--currency`: default `EUR`. +- CLI `--min-revenue`: default `Decimal("0")`. + +#### Dependencies +- Standard library: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. +- Uses `open`, `csv.DictReader`, `date.fromisoformat`, `Decimal`, `enumerate`, `print`, and `sys.exit`. + +#### Exceptions / Errors +- `parse_orders` raises `ValueError` with the file path and missing column names when required headers are absent. +- Invalid matching-row dates or amounts raise a chained `ValueError` containing the file path and line number. +- File access and CSV parsing errors are not caught. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..40403185 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/package.ai.md @@ -0,0 +1,52 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:08:50Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> Supports AI-assisted source documentation alongside byte processing, operational reporting, and database workflows for circulation, order fulfillment, and inventory synchronization. + +#### Purpose +- Groups tools for configuring AI completion and source selection, processing byte data, rotating backups, reporting revenue, and managing business records. +- Covers library circulation, shop inventory and orders, and warehouse stock synchronization across PostgreSQL, MySQL, and SQL Server. + +#### Responsibilities +- **AI documentation and inference:** Configure source filters, conditions, facts, prompts, generation settings, and oversized-file strategies; route completion requests to mock, local llama.cpp, or OpenAI-compatible providers. +- **Byte and operational utilities:** Compute byte histograms, transfer bytes through a bounded ring buffer, rotate compressed backups, and aggregate monthly regional order revenue by currency. +- **Business database workflows:** Maintain library catalog and circulation records with auditing and reports; place shop order items while reserving stock; synchronize warehouse balances from supplier feeds and log outcomes. + +#### Key units +- `SrcMorphConfiguration`, `AiGenerationConfig` — hold source-selection, generation, provider, and output settings. +- `AiConditionEvaluator`, `AiFactExtractor` — match configured conditions and produce source facts from regex counters. +- `AiGenerationProviderFactory`, `AiGenerationProvider` — select a completion backend and define its generation contract. +- `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport`, `AiCompletionParser` — provide local or remote inference support and normalize completion text. +- `histogram_partial`, `histogram_reduce` — compute and combine byte-frequency counts. +- `ringbuf_t`, `ringbuf_write`, `ringbuf_read` — manage bounded circular byte storage and transfers. +- `rotate_backups.sh` — create timestamped compressed backups and prune older archives. +- `parse_orders`, `revenue_by_month_and_region` — parse currency-matched orders and aggregate monthly regional revenue. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `trg_loan_audit` — implement library circulation operations, fees, and audit recording. +- `add_order_item` — update a shop order line, reserve product stock, and recalculate the order total. +- `dbo.usp_SyncStock(@Since)` — merge supplier-feed quantities into warehouse stock and record synchronization outcomes. + +#### Data flow +- Source configuration and file facts feed condition evaluation and AI provider selection; providers generate completions that are normalized and returned with available timing metrics. +- Byte inputs become per-group histogram counts and then reduced totals; ring-buffer callers write and read queued bytes within fixed capacity. +- Backup rotation validates inputs, creates a temporary archive, finalizes it, and prunes older matching backups; sales reporting parses CSV orders into filtered monthly regional totals. +- Library checkout and return operations update circulation and inventory records and trigger audit events; shop item placement adjusts order lines, stock, and totals; warehouse synchronization aggregates eligible feed rows into stock balances and logs results. + +#### Dependencies +- AI generation uses `AiGenerationRequest`, `AiPromptSupport`, `AiGenerationTimings`, Jackson JSON support, and the llama.cpp JNI binding. +- Histogram processing uses OpenCL C; ring-buffer operations use standard C allocation and copying; backup rotation uses Bash utilities; revenue reporting uses Python standard-library modules. +- Library routines, views, and triggers use PostgreSQL catalog and circulation tables; shop procedures use MySQL order and product tables; SQL Server synchronization uses `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. + +#### Cross-cutting +- AI configuration uses mutable JavaBeans; condition and fact utilities reject malformed configuration, while provider generation and resource failures use `IOException`. +- The ring buffer uses power-of-two capacity, reserves one slot to distinguish full from empty, and specifies single-producer/single-consumer ownership of its indices. +- Inventory changes are coupled to circulation, order placement, and supplier synchronization; database domains enforce their own constraints and transaction or audit behavior. +- SQL implementations use distinct dialect-specific mechanisms: PostgreSQL routines and triggers, a MySQL locking procedure, and a SQL Server transactional merge with error logging. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..b5afdbcb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 20DC7536 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:00Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project combines source-aware AI documentation generation, configurable to use local llama.cpp, OpenAI-compatible, or mock providers, with SQL workflows for library circulation, shop order fulfillment, and warehouse stock synchronization. Its byte-processing utilities include byte-frequency counting and bounded single-producer/single-consumer buffering, while operational scripts handle backup rotation and currency-specific monthly revenue reports. + +#### Packages +- java/config — Defines source-selection rules, code-fact extraction, and AI generation settings used to configure source analysis and oversized-file handling. +- java — Configures source-aware AI documentation generation and routes completion requests through local, remote, or mock model providers. +- java/provider — Generates AI documentation completions from source-aware requests using selectable local llama.cpp, OpenAI-compatible, or mock backends. +- other/kernels — Computes frequency counts for all 256 byte values in image or byte-stream data. +- other — Provides byte-data processing utilities, bounded stream buffering, backup rotation, and currency-based monthly revenue reporting. +- other/ringbuf — Provides bounded byte-stream buffering for single-producer/single-consumer transfer, accepting and returning data as space and queued bytes allow. +- other/scripts — Provides operational tools for rotating dated backups and producing currency-specific monthly revenue reports from order exports. +- . — Supports AI-assisted source documentation alongside byte processing, operational reporting, and database workflows for circulation, order fulfillment, and inventory synchronization. +- sql/library — Supports library cataloguing and circulation by managing books, members, loans, returns, inventory, and borrowing reports. +- sql — Implements database workflows for library circulation, shop order fulfillment, and warehouse stock synchronization across three SQL systems. +- sql/shop — Stores shop products and customer orders, reserving inventory and recalculating order totals when items are added. +- sql/warehouse — Maintains warehouse stock levels by applying recent supplier-feed quantities and recording each synchronization’s outcome. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..a350fbf9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/01_schema.sql.ai.md @@ -0,0 +1,56 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:06:21Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Models authors, books, library members, and book loans, including inventory availability and loan deadlines. + +#### Purpose +- Defines the core lending-library schema for cataloguing books and authors, registering members, and tracking loans and returns. + +#### Type +- Tables and indexes; PostgreSQL. + +#### Schema +- `author` + - `author_id BIGSERIAL` — primary key. + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` +- `book` + - `book_id BIGSERIAL` — primary key. + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL` — foreign key to `author.author_id`. + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `book_free_le_total`: `CHECK (copies_free <= copies_total)` +- `member` + - `member_id BIGSERIAL` — primary key. + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` +- `loan` + - `loan_id BIGSERIAL` — primary key. + - `book_id BIGINT NOT NULL` — foreign key to `book.book_id`. + - `member_id BIGINT NOT NULL` — foreign key to `member.member_id`, `ON DELETE CASCADE`. + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `loan_due_after_loan`: `CHECK (due_on > loaned_on)` +- Indexes: + - `idx_book_author` on `book (author_id)`. + - `idx_loan_member` on `loan (member_id)`. + - `idx_loan_open` on `loan (due_on)`, partial condition `returned_on IS NULL`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (member deletion cascades to loans) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..469a4d93 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/02_views.sql.ai.md @@ -0,0 +1,40 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:06:27Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Provides lending reports for overdue loans, member borrowing activity, and frequently loaned books. + +#### Purpose +- Reports open loans past their due dates with member contact and book title. +- Aggregates member loan activity and identifies books loaned at least five times in the past year. + +#### Type +- PostgreSQL views: `overdue_loans`, `member_loan_stats`. +- PostgreSQL materialized view: `popular_books`. +- Index: `idx_popular_books_id`. + +#### Schema +- `overdue_loans`: `loan_id`, `member_id`, `email`, `title`, `due_on`, `days_overdue` (`CURRENT_DATE - due_on`). +- `member_loan_stats`: `member_id`, `full_name`, `loans_total`, `loans_open`, `last_loan_on`. +- `popular_books`: `book_id`, `title`, `author_name`, `times_loaned`. +- Unique index `idx_popular_books_id` on `popular_books (book_id)`. + +#### Reads +- `loan`: `loan_id`, `member_id`, `book_id`, `due_on`, `returned_on`, `loaned_on`. +- `member`: `member_id`, `email`, `full_name`. +- `book`: `book_id`, `title`, `author_id`. +- `author`: `author_id`, `full_name`. + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..47877c0a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/03_routines.sql.ai.md @@ -0,0 +1,51 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:06:31Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Manages library book checkout and return operations, calculates overdue fees, and records loan audit events. + +#### Purpose +- Checkout a free book to an unblocked member, return a loan and restore the copy, calculate late fees, and audit checkout/return events. +- Defines the `loan_audit` table used by the loan audit trigger. + +#### Type +- PostgreSQL: table `loan_audit`; functions `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn`; procedure `sp_return_book`; trigger `trg_loan_audit`. + +#### Schema +- `loan_audit`: + - `audit_id BIGSERIAL` — primary key; constraint name not declared. + - `loan_id BIGINT NOT NULL`. + - `action VARCHAR(10) NOT NULL` — unnamed CHECK constraint: `action IN ('CHECKOUT', 'RETURN')`. + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()`. + +#### Reads +- `member.member_id`, `member.is_blocked` — checkout blocked-member check. +- `book.book_id`, `book.copies_free` — checkout availability check. +- `loan.loan_id`, `loan.returned_on` — return eligibility; `loan.book_id` returned by update. +- Function inputs: `p_due_on`, `p_returned_on` in `fn_late_fee`. + +#### Writes +- `book.copies_free` — `fn_checkout_book` decrements; `sp_return_book` increments. +- `loan` — `fn_checkout_book` inserts `book_id`, `member_id`, `due_on`; `sp_return_book` sets `returned_on`. +- `loan_audit` — trigger function inserts `loan_id`, `action` (`CHECKOUT` on insert; `RETURN` when `returned_on` changes from NULL to non-NULL). + +#### Relationships +- `loan.book_id -> book.book_id` — checkout and return logic. +- `loan_audit.loan_id -> loan.loan_id` — audit records reference loans in trigger logic; no FK constraint declared. + +#### Routine logic +- `fn_checkout_book(p_member_id BIGINT, p_book_id BIGINT, p_days INTEGER DEFAULT 21) RETURNS BIGINT`: rejects blocked members; decrements available copies or raises an exception; inserts a loan with due date `CURRENT_DATE + p_days`; returns the new `loan_id`. +- `sp_return_book(p_loan_id BIGINT)`: sets `returned_on` to `CURRENT_DATE` for an unreturned loan; raises an exception for unknown/already-returned loans; restores the book’s free-copy count. +- `fn_late_fee(p_due_on DATE, p_returned_on DATE) RETURNS INTEGER`: immutable SQL function; computes overdue days using return date or `CURRENT_DATE`, floors at zero, charges 50 cents per day, capped at 2000 cents. +- `trg_loan_audit_fn() RETURNS TRIGGER`: inserts a `CHECKOUT` audit row for loan inserts and a `RETURN` audit row when a loan becomes returned; returns `NEW`. +- `trg_loan_audit`: row-level AFTER INSERT or UPDATE OF `returned_on` trigger on `loan`, executing `trg_loan_audit_fn`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Built-in function: `now()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..e000d552 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,56 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:06:39Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Adds branch-based inventory to the lending library, assigns existing book copies to the main branch, and replaces book-level copy counters with copy records. + +#### Purpose +- Introduces library branches and per-copy barcode, branch, and lending status. +- Migrates existing inventory and member branch data; retires `book.copies_free` and `book.copies_total`. + +#### Type +- PostgreSQL schema migration; creates tables `branch`, `book_copy` and index `idx_book_copy_book`. + +#### Schema +- `branch` + - `branch_id SMALLSERIAL` — primary key. + - `name VARCHAR(100) NOT NULL UNIQUE`. + - `city VARCHAR(100) NOT NULL`. +- `book_copy` + - `copy_id BIGSERIAL` — primary key. + - `book_id BIGINT NOT NULL` — FK to `book.book_id`. + - `branch_id SMALLINT NOT NULL` — FK to `branch.branch_id`. + - `barcode VARCHAR(32) NOT NULL UNIQUE`. + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE', 'ON_LOAN', 'LOST'))`. +- Alters `loan`: adds `copy_id BIGINT` referencing `book_copy.copy_id`. +- Alters `member`: renames `joined_on` to `member_since`; adds `home_branch_id SMALLINT` referencing `branch.branch_id`. +- Alters `book`: drops constraint `book_free_le_total` and columns `copies_free`, `copies_total`. +- Index `idx_book_copy_book`: on `book_copy (book_id)`. + +#### Reads +- `book`: `book_id`, `isbn`, `copies_total`, `copies_free` (copy migration query). +- `member`: `home_branch_id` (null check in update). + +#### Writes +- `branch`: 1 row (`Main`, `Springfield`). +- `book_copy`: one `INSERT ... SELECT`; data-dependent row count, generated from each book’s `copies_total`; assigns `AVAILABLE` when `g.n <= copies_free`, otherwise `ON_LOAN`. +- `member`: updates `home_branch_id` to `1` where null. +- `loan`: adds nullable `copy_id` column. +- `member`: renames `joined_on` to `member_since` and adds `home_branch_id`. +- `book`: drops `book_free_le_total`, `copies_free`, and `copies_total`. + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- Existing tables: `book`, `loan`, `member`. +- PostgreSQL function: `generate_series`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..1c8b9d40 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,32 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:06:46Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Seeds a lending library with author, book, member, and loan records for development or testing. + +#### Purpose +- Populate the library catalog, membership, and borrowing history with deterministic sample data. +- Insert all seed records within one transaction. + +#### Type +- DML script; PostgreSQL dialect. + +#### Writes +- `author`: 15 rows; one `INSERT` family, IDs 1–15; writes `author_id`, `full_name`, `birth_year`, `country_code`. +- `book`: 110 rows; one `INSERT` family, IDs 1–110; writes `book_id`, `isbn`, `title`, `author_id`, `published_year`, `copies_total`, `copies_free`. +- `member`: 50 rows; one `INSERT` family, IDs 1–50; writes `member_id`, `email`, `full_name`, `joined_on`, `is_blocked`. +- `loan`: 150 rows; one `INSERT` family, IDs 1–150; writes `loan_id`, `book_id`, `member_id`, `loaned_on`, `due_on`, `returned_on`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- Tables: `author`, `book`, `member`, `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/package.ai.md new file mode 100644 index 00000000..71cebdcd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/library/package.ai.md @@ -0,0 +1,54 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:08:22Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> Supports library cataloguing and circulation by managing books, members, loans, returns, inventory, and borrowing reports. + +#### Purpose +- Defines a PostgreSQL lending-library database, its operational checkout and return logic, and reporting views. +- Includes sample data and a migration from book-level copy counts to branch-based, individually tracked copies. + +#### Responsibilities +- **Core catalog and circulation schema:** `author`, `book`, `member`, and `loan` tables with relationships, constraints, and indexes. +- **Borrowing reports:** overdue loans, member loan activity, and popular books through views and a materialized view. +- **Loan operations and audit:** checkout, return, late-fee calculation, and trigger-based checkout/return audit records. +- **Inventory migration:** introduces `branch` and `book_copy`, migrates existing copy counts and member branch assignments, and removes book-level inventory counters. +- **Development and test fixtures:** seeds authors, books, members, and loans in a transaction. + +#### Key units +- `author`, `book`, `member`, `loan` — core catalog, membership, inventory-count, and borrowing records. +- `overdue_loans` — lists open loans past their due dates with member contact details and days overdue. +- `member_loan_stats` — aggregates total and open loans and most recent loan date per member. +- `popular_books` — materialized report of books loaned at least five times in the past year. +- `fn_checkout_book` — checks member eligibility and book availability, creates a loan, and returns its ID. +- `sp_return_book` — marks an open loan returned and restores its book’s free-copy count. +- `fn_late_fee` — calculates overdue charges at 50 cents per day, capped at 2000 cents. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — store and record checkout and return events. +- `branch`, `book_copy` — represent library locations and individually barcoded copies with lending status. + +#### Data flow +- `fn_checkout_book` validates the member and book, decrements available inventory, inserts a loan, and triggers a checkout audit record. +- `sp_return_book` updates an unreturned loan and restores inventory; the loan trigger records the return. +- `fn_late_fee` derives a charge from due and return dates, using the current date for an unreturned loan. +- Reporting views aggregate `loan`, `member`, `book`, and `author` records into overdue, member-activity, and popular-book outputs. +- The migration creates a main branch, converts existing book counts into `book_copy` rows, assigns unassigned members to the branch, and removes `book.copies_free` and `book.copies_total`. + +#### Dependencies +- Internal relations: `book` references `author`; `loan` references `book` and `member`; migrated `book_copy` references `book` and `branch`; `member.home_branch_id` references `branch`. +- Views read from `loan`, `member`, `book`, and `author`; routines read and update `member`, `book`, and `loan`, and write `loan_audit`. +- PostgreSQL built-ins include `CURRENT_DATE`, `now()`, and `generate_series`. + +#### Cross-cutting +- PostgreSQL constraints enforce identifiers, uniqueness, inventory bounds, valid loan dates, and allowed copy and audit statuses. +- Checkout rejects blocked members or unavailable copies; return rejects unknown or already-returned loans. +- Loan audit is handled by a row-level AFTER trigger on loan insertion and return-date updates. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/package.ai.md new file mode 100644 index 00000000..37f849f0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/package.ai.md @@ -0,0 +1,48 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:08:41Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> Implements database workflows for library circulation, shop order fulfillment, and warehouse stock synchronization across three SQL systems. + +#### Purpose +- Defines relational schemas and operational SQL for lending-library inventory, customer orders, and warehouse stock. +- Provides domain-specific routines, reporting, auditing, migrations, and synchronization logging. + +#### Responsibilities +- **Library catalog and circulation (PostgreSQL):** Manage authors, books, members, loans, branches, individually tracked copies, checkout and returns, late fees, audit events, and borrowing reports. +- **Shop catalog and order placement (MySQL):** Maintain products and stock, track customer orders and line items, and add items while reserving inventory and recalculating totals. +- **Warehouse inventory synchronization (SQL Server):** Aggregate recent supplier-feed quantities into stock balances and log synchronization results or errors. + +#### Key units +- `author`, `book`, `member`, `loan` — library catalog, membership, and borrowing records. +- `fn_checkout_book`, `sp_return_book`, `fn_late_fee` — validate checkout, process returns, and calculate overdue charges. +- `loan_audit`, `trg_loan_audit_fn`, `trg_loan_audit` — record loan checkout and return events. +- `overdue_loans`, `member_loan_stats`, `popular_books` — report overdue items, member activity, and frequently borrowed books. +- `branch`, `book_copy` — represent library locations and barcoded copies. +- `product`, `customer_order`, `order_item` — shop catalog, order, and order-line records. +- `add_order_item` — add or increment an order line, deduct stock, and recalculate the order total. +- `dbo.usp_SyncStock(@Since)` — merge aggregated supplier quantities into warehouse stock and log the outcome. +- `dbo.SupplierFeed`, `dbo.StockLevel`, `dbo.SyncLog` — provide incoming quantities, current balances, and synchronization records. + +#### Data flow +- **Library:** Checkout validates member eligibility and availability, creates a loan, and triggers an audit; return updates the loan and inventory and triggers a return audit. Reports aggregate loan, member, book, and author data. A migration converts book-level counts into branch-based copy records. +- **Shop:** `add_order_item` finds and locks an eligible product by SKU, inserts or increments its order line, reduces stock, and recomputes the order total; unavailable stock or an unknown SKU raises an error. +- **Warehouse:** `dbo.usp_SyncStock` groups eligible `dbo.SupplierFeed` quantities by warehouse and SKU, inserts or increments matching `dbo.StockLevel` rows, then logs affected-row counts; failures roll back when needed, log the error, and rethrow. + +#### Dependencies +- **Library:** PostgreSQL tables reference one another through book, member, branch, and copy relationships; views and routines use catalog and circulation data. Uses built-ins including `CURRENT_DATE`, `now()`, and `generate_series`. +- **Shop:** MySQL `order_item` references `customer_order` and `product`; `add_order_item` reads products and order lines and updates order lines, stock, and order totals. +- **Warehouse:** SQL Server `dbo.usp_SyncStock` uses `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`; feed-to-stock matching uses warehouse and SKU values without declared foreign keys. + +#### Cross-cutting +- Each domain enforces its own data integrity: library constraints cover dates, statuses, uniqueness, and inventory bounds; shop lines use a composite key and amounts are stored in cents; warehouse synchronization uses transactional error handling. +- Inventory changes are coupled to their operations: checkout and return update library availability, order placement reserves shop stock, and supplier synchronization adjusts warehouse balances. +- SQL dialects and mechanisms differ by domain: PostgreSQL functions, procedures, views, and triggers; a MySQL locking procedure; and a SQL Server transactional merge with action capture. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..7c262e0f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,69 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:06:50Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Models a web shop catalog and customer orders, with order-line placement that reserves inventory and recalculates order totals. + +#### Purpose +- Stores products, customer orders, and their line items. +- `add_order_item` adds or increments an order line, reduces product stock, and updates the order total. + +#### Type +- MySQL 8; tables: `product`, `customer_order`, `order_item`; procedure: `add_order_item`. +- `customer_order.status` enum: `NEW`, `PAID`, `SHIPPED`, `CANCELLED`. + +#### Schema +- `product` + - `product_id INT UNSIGNED` — primary key, `NOT NULL`, `AUTO_INCREMENT`. + - `sku VARCHAR(40)` — `NOT NULL`, unique key `uk_product_sku`. + - `name VARCHAR(200)` — `NOT NULL`. + - `price_cents INT UNSIGNED` — `NOT NULL`. + - `stock INT` — `NOT NULL`, `DEFAULT 0`. + - Index: `uk_product_sku` on `product(sku)`; unique. +- `customer_order` + - `order_id BIGINT UNSIGNED` — primary key, `NOT NULL`, `AUTO_INCREMENT`. + - `customer_id BIGINT UNSIGNED` — `NOT NULL`. + - `status ENUM('NEW', 'PAID', 'SHIPPED', 'CANCELLED')` — `NOT NULL`, `DEFAULT 'NEW'`. + - `created_at DATETIME` — `NOT NULL`, `DEFAULT CURRENT_TIMESTAMP`. + - `total_cents INT UNSIGNED` — `NOT NULL`, `DEFAULT 0`. + - Index: `idx_order_customer` on `customer_order(customer_id, created_at)`. +- `order_item` + - `order_id BIGINT UNSIGNED` — `NOT NULL`, part of primary key. + - `product_id INT UNSIGNED` — `NOT NULL`, part of primary key. + - `quantity SMALLINT UNSIGNED` — `NOT NULL`. + - `unit_price_cents INT UNSIGNED` — `NOT NULL`. + - Primary key: `(order_id, product_id)`. + - Constraint `fk_item_order`: foreign key `order_id` references `customer_order(order_id)`, `ON DELETE CASCADE`. + - Constraint `fk_item_product`: foreign key `product_id` references `product(product_id)`. + +#### Reads +- `product`: `product_id`, `price_cents`, `sku`, `stock`. +- `order_item`: `order_id`, `quantity`, `unit_price_cents`. +- Procedure inputs: `p_order_id`, `p_sku`, `p_qty`. + +#### Writes +- `order_item`: inserts one row; on duplicate key, increments `quantity`. +- `product`: updates `stock` by subtracting `p_qty`. +- `customer_order`: updates `total_cents` from the sum of order-line `quantity * unit_price_cents`. + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (`fk_item_order`; cascade delete). +- `order_item.product_id -> product.product_id` (`fk_item_product`). +- Procedure lookup: `product.sku` matches `p_sku`; selected `product_id` identifies the item and stock update target. +- Procedure total calculation: `order_item.order_id` matches `customer_order.order_id`. + +#### Routine logic +- `add_order_item(IN p_order_id BIGINT UNSIGNED, IN p_sku VARCHAR(40), IN p_qty SMALLINT UNSIGNED)` + - Locks a matching product row with `FOR UPDATE` when SKU matches and stock is at least `p_qty`. + - Signals SQLSTATE `45000` with message `unknown SKU or not enough stock` if no product is found. + - Inserts an order line using the selected product price; duplicate order/product lines have quantity incremented. + - Deducts `p_qty` from product stock and recalculates the order total. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/shop/package.ai.md new file mode 100644 index 00000000..a840267a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/shop/package.ai.md @@ -0,0 +1,39 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:08:30Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Stores shop products and customer orders, reserving inventory and recalculating order totals when items are added. + +#### Purpose +- Defines the MySQL schema for products, customer orders, and order lines. +- Provides `add_order_item` to add or increment an order line while reducing stock and updating the order total. + +#### Responsibilities +- **Catalog and inventory:** `product` stores SKU, name, price, and stock; `uk_product_sku` enforces unique SKUs. +- **Orders and line items:** `customer_order` tracks customer, status, creation time, and total; `order_item` stores product quantities and unit prices. +- **Order-item placement:** `add_order_item` looks up and locks an eligible product, writes or increments its order line, deducts stock, and recalculates the order total. + +#### Key units +- `product` — catalog record and inventory level keyed by `product_id`. +- `customer_order` — customer order with `NEW`, `PAID`, `SHIPPED`, or `CANCELLED` status. +- `order_item` — order/product line keyed by `(order_id, product_id)`, with quantity and unit price. +- `add_order_item` — procedure accepting `p_order_id`, `p_sku`, and `p_qty` to place an item on an order. + +#### Data flow +- `add_order_item` matches `p_sku` to `product.sku` and locks the row when stock is at least `p_qty`. +- If no eligible product is found, it signals SQLSTATE `45000` with `unknown SKU or not enough stock`. +- The procedure inserts an `order_item` at the selected product price, or increments the existing line quantity; it then subtracts `p_qty` from stock and recomputes `customer_order.total_cents` from its lines. + +#### Dependencies +- `order_item.order_id` references `customer_order.order_id` with cascade delete; `order_item.product_id` references `product.product_id`. +- The procedure reads `product` and `order_item`, and writes `order_item`, `product`, and `customer_order`. + +#### Cross-cutting +- Monetary values are stored in cents; order totals derive from line quantity multiplied by unit price. +- Product selection uses `FOR UPDATE`; order lines use a composite primary key to identify duplicate product entries per order. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/warehouse/package.ai.md new file mode 100644 index 00000000..c6c1fe0d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/warehouse/package.ai.md @@ -0,0 +1,39 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:08:35Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Maintains warehouse stock levels by applying recent supplier-feed quantities and recording each synchronization’s outcome. + +#### Purpose +- Aggregate eligible supplier receipts by warehouse and SKU, then add quantities to current on-hand stock. +- Log synchronization counts on success or the error on failure. + +#### Responsibilities +- **Stock synchronization:** Match aggregated supplier quantities to `dbo.StockLevel`, inserting new warehouse/SKU rows or increasing existing balances. +- **Execution logging:** Record inserted and updated row counts, or capture the failure message. + +#### Key units +- `dbo.usp_SyncStock(@Since)`: Aggregates feed rows received since the cutoff, merges them into stock, and logs the outcome. +- `dbo.StockLevel`: Stores on-hand quantities keyed by warehouse and SKU, with update timestamps. +- `dbo.SupplierFeed`: Supplies dated warehouse/SKU quantity records. +- `dbo.SyncLog`: Stores execution start time, affected-row counts, and optional error message. +- `@Changes`: Captures `$action` values for affected stock rows to calculate insert and update counts. + +#### Data flow +- `dbo.SupplierFeed` rows with `ReceivedAt >= @Since` are grouped by `WarehouseId` and `Sku`, and their quantities are summed. +- `dbo.usp_SyncStock` merges the aggregates into `dbo.StockLevel`: inserts unmatched keys and adds quantities to matched rows. +- Merge actions determine success log counts; failures roll back when needed, log the error with zero counts, and rethrow. + +#### Dependencies +- Internal tables: `dbo.SupplierFeed`, `dbo.StockLevel`, and `dbo.SyncLog`. +- Warehouse and SKU values link feed aggregates to stock rows through merge matching; these are not declared foreign keys. + +#### Cross-cutting +- Synchronization uses a transaction; errors trigger rollback when needed and are rethrown after logging. +- Start times and stock update timestamps use UTC time. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..251e516e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-6-luna/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,62 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:06:57Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Synchronizes warehouse on-hand quantities from recent supplier feed records and records the synchronization outcome. + +#### Purpose +- Aggregate supplier quantities received since a cutoff by warehouse and SKU, then add them to current stock. +- Log inserted and updated stock-row counts, or the error if synchronization fails. + +#### Type +- SQL Server (T-SQL): tables `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`; procedure `dbo.usp_SyncStock`. + +#### Schema +- `dbo.StockLevel` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT (0)`; default constraint `DF_StockLevel_OnHand` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())`; default constraint `DF_StockLevel_UpdatedAt` + - Primary key `PK_StockLevel (WarehouseId, Sku)` +- `dbo.SupplierFeed` + - `FeedRowId BIGINT IDENTITY(1, 1) NOT NULL`; primary key constraint `PK_SupplierFeed` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` +- `dbo.SyncLog` + - `SyncLogId INT IDENTITY(1, 1) NOT NULL`; primary key constraint `PK_SyncLog` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + +#### Reads +- `dbo.SupplierFeed`: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`; filters `ReceivedAt >= @Since`, groups by `WarehouseId`, `Sku`, and sums `Quantity`. +- `dbo.StockLevel`: `WarehouseId`, `Sku`, `OnHand` for merge matching and stock updates. + +#### Writes +- `dbo.StockLevel`: `MERGE` inserts unmatched warehouse/SKU groups and updates matched rows; updates `OnHand` by adding grouped quantity and refreshes `UpdatedAt`. +- `dbo.SyncLog`: one row per successful execution with inserted/updated counts; on failure, one row with zero counts and `ERROR_MESSAGE()`. +- `@Changes`: receives one `$action` value per affected `StockLevel` row. + +#### Relationships +- `dbo.StockLevel.WarehouseId -> dbo.SupplierFeed.WarehouseId` and `dbo.StockLevel.Sku -> dbo.SupplierFeed.Sku` (merge match; not declared foreign keys). + +#### Routine logic +- `dbo.usp_SyncStock(@Since DATETIME2(0))` + - Captures UTC start time; aggregates eligible supplier-feed rows by warehouse and SKU. + - In a transaction, merges aggregates into stock and records merge actions. + - Inserts counts of `INSERT` and `UPDATE` actions into `dbo.SyncLog`, then commits. + - On error, rolls back if needed, logs the error, and rethrows. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..5abc1fc0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,73 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:04Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Evaluates and validates file‑selection conditions against file metadata. + +#### Purpose +- Evaluates `AiCondition` trees against `AiFileContext`. +- Validates condition trees for correct structure and values. +- Detects if a condition tree requires line counting. + +#### Type +- `final class AiConditionEvaluator` + - extends `Object` + - no generics + - annotations: none + - imports: `java.time.Instant`, `java.time.format.DateTimeParseException`, `java.util.Collections`, `java.util.List`, `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`, `org.jspecify.annotations.Nullable` + +#### Input +- `matches(AiCondition, AiFileContext)` – condition tree, file context. +- `validate(AiCondition)` – condition tree. +- `usesLines(AiCondition)` – condition tree. +- `anyUsesLines(List)` – optional list of child conditions. +- `validateGroup(AiConditionGroup, String)` – group and label. +- `branchCount(AiCondition)` – condition node. +- `matchesExtension(List, String)` – extensions list, file name. +- `globMatches(String, String)` – glob pattern, relative path. +- `parseEpochMilli(String)` – ISO‑8601 instant string. + +#### Output +- `matches` returns `boolean` indicating file match. +- `validate` throws `IllegalArgumentException` on misconfiguration. +- `usesLines` returns `boolean`. +- `anyUsesLines` returns `boolean`. +- `validateGroup` throws `IllegalArgumentException` if group invalid. +- `branchCount` returns `int`. +- `matchesExtension` returns `boolean`. +- `globMatches` returns `boolean`. +- `parseEpochMilli` returns `long` epoch milliseconds. + +#### Core logic +- `matches`: recursively evaluates `and`, `or`, `not`, `extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, `pathGlob`; uses helper methods for each leaf. +- `validate`: ensures exactly one branch/leaf per node; validates each specific leaf type (non‑empty extensions, bounded size/lines, parseable dates, non‑blank glob); delegates group validation to `validateGroup`. +- `usesLines`: checks for `lines` leaf; recurses into `and`, `or`, `not` groups. +- `anyUsesLines`: iterates child list, returns true if any child uses lines. +- `validateGroup`: ensures group has at least one child; validates each child recursively. +- `branchCount`: counts non‑null branch/leaf fields in a node. +- `matchesExtension`: true if file name ends with any non‑null extension. +- `globMatches`: uses `AiSourceExcludeFilter` to test exclusion. +- `parseEpochMilli`: parses ISO‑8601 instant to epoch milliseconds; throws `IllegalArgumentException` on parse error. + +#### Public API +- `AiConditionEvaluator()` -> constructor, no parameters. +- `matches(AiCondition, AiFileContext) -> boolean` – evaluate condition. +- `validate(AiCondition) -> void` – validate tree. +- `usesLines(AiCondition) -> boolean` – check line usage. + +#### Dependencies +- `java.time.Instant`, `java.time.format.DateTimeParseException`, `java.util.Collections`, `java.util.List`, `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`, `org.jspecify.annotations.Nullable`, `net.ladenthin.srcmorph.config.AiCondition`, `net.ladenthin.srcmorph.config.AiConditionGroup`, `net.ladenthin.srcmorph.config.AiRangeCondition`, `net.ladenthin.srcmorph.config.AiFileContext`. + +#### Exceptions / Errors +- `IllegalStateException` in `matches` when node has no branch/leaf. +- `IllegalArgumentException` in `validate`, `validateGroup`, `branchCount` (via error messages). +- `IllegalArgumentException` in `parseEpochMilli` on invalid ISO‑8601 instant. + +#### Concurrency +- No explicit synchronization or concurrency constructs; all methods are stateless and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..9e8d74e2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,52 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:12Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Holds a list of child conditions for an AI combinator, enabling / logic in configuration. + +#### Purpose +- Stores child `AiCondition` objects for combinator elements. +- Provides defensive copying when setting the list. + +#### Type +- `public class AiConditionGroup` + - Modifiers: public, final (implicitly), no superclass. + - Field: `private @Nullable List conditions`. + - Constructor: `public AiConditionGroup()`. + - Methods: + - `public @Nullable List getConditions()`. + - `public void setConditions(final @Nullable Collection conditions)`. + +#### Input +- Constructor: none. +- `setConditions`: accepts a `Collection` (nullable). + +#### Output +- `getConditions`: returns the internal `List` or `null`. +- `setConditions`: assigns a defensive copy of the provided collection to `conditions`. + +#### Core logic +- `setConditions` checks if the argument is `null`; if not, creates a new `ArrayList<>(conditions)` and assigns it to the field. + +#### Public API +- `getConditions() -> List` – retrieve child conditions. +- `setConditions(Collection) -> void` – set child conditions. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List`. +- `lombok.ToString`. +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.config.AiCondition`. + +#### Exceptions / Errors +- No explicit exceptions thrown. +- Defensive copy prevents external mutation of internal list. + +#### Concurrency +- No synchronization; class is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..08638e44 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,75 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:14Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Computes deterministic, language‑agnostic fact counts from source text using regex counters. + +#### Purpose +- Generates a facts block summarizing exact counts of language constructs. +- Validates fact counter configurations. + +#### Type +- `final class AiFactExtractor` (class, final) + - No supertypes. + - Annotations: none. +- Constants: `FACTS_HEADER`, `LABEL_COUNT_SEPARATOR`, `ENTRY_SEPARATOR`, `FACTS_SUFFIX` (public static final String). +- Private constructor. + +#### Input +- `factsBlock(List counters, String source)` + - `counters`: nullable list of `AiFactCounter`. + - `source`: full source text. +- `validate(List counters)` + - `counters`: nullable list. +- `countMatches(String pattern, String source)` + - `pattern`: regex string. + - `source`: text to search. + +#### Output +- `factsBlock` returns a formatted facts string or empty string. +- `validate` throws `IllegalArgumentException` on invalid counters. +- `countMatches` returns integer match count. + +#### Core logic +- `factsBlock` + - If counters null/empty → return "". + - For each counter: skip if null, label or pattern null. + - Append `ENTRY_SEPARATOR` if sb not empty. + - Append `label + LABEL_COUNT_SEPARATOR + countMatches(pattern, source)`. + - After loop, if sb empty → return "". + - Return `FACTS_HEADER + sb + FACTS_SUFFIX`. +- `validate` + - If counters null → return. + - For each counter: skip if null. + - Throw `IllegalArgumentException` if label null. + - Throw if pattern null. + - Try `Pattern.compile(pattern)`; on `PatternSyntaxException` wrap and rethrow. +- `countMatches` + - Compile pattern, create matcher on source. + - Iterate `matcher.find()` counting matches. + - Return count. + +#### Public API +- `factsBlock(List counters, String source) -> String` – build facts block. +- `validate(List counters) -> void` – validate counters. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiFactCounter` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `validate` for missing label/pattern or invalid regex. +- `PatternSyntaxException` caught and wrapped in `IllegalArgumentException`. + +#### Concurrency +- All methods are static and stateless; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..41f6d2df --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,138 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:17Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> A mutable JavaBean that holds all AI‑generation parameters for a single model run, used by the Maven plugin to configure the chosen AI provider. + +#### Purpose +- Stores configuration for a single AI generation step (model path, sampling, retry, prompt limits, stop strings). +- Exposed to Maven plugin and AI provider implementations. + +#### Type +- `public class AiGenerationConfig` (class, public, mutable, Lombok `@ToString`). + +#### Input +- Constructor: no arguments (defaults applied). +- Setter methods for each field (e.g., `setModelPath`, `setContextSize`, `setTemperature`, …). +- `setDrySequenceBreakers(List)`, `setStopStrings(List)` accept `null` to reset. +- `setCalibration(AiCalibration)`. + +#### Output +- Getter methods return current values (e.g., `getModelPath`, `getContextSize`, `getTemperature`, …). +- `getDrySequenceBreakers()` and `getStopStrings()` return unmodifiable lists. +- No side‑effects beyond mutating internal state. + +#### Core logic +- All fields initialized to static defaults (e.g., `DEFAULT_CONTEXT_SIZE`, `DEFAULT_TEMPERATURE`). +- Setters assign values directly; some guard against `null` by resetting to defaults. +- No additional computation or validation beyond simple assignments. + +#### Public API +- `getModelPath() -> String?` – current model file path. +- `setModelPath(String?) -> void` – set model file path. +- `getContextSize() -> int` – context window size. +- `setContextSize(int) -> void` – set context size. +- `getMaxOutputTokens() -> int` – max output tokens. +- `setMaxOutputTokens(int) -> void` – set max output tokens. +- `getTemperature() -> float` – sampling temperature. +- `setTemperature(float) -> void` – set temperature. +- `getThreads() -> int` – CPU threads. +- `setThreads(int) -> void` – set threads. +- `getCharsPerToken() -> int` – chars per token ratio. +- `setCharsPerToken(int) -> void` – set ratio. +- `getMaxInputChars() -> int` – max input characters. +- `setMaxInputChars(int) -> void` – set max input chars. +- `isWarnOnTrim() -> boolean` – trim warning flag. +- `setWarnOnTrim(boolean) -> void` – set flag. +- `getTopP() -> float` – nucleus‑sampling threshold. +- `setTopP(float) -> void` – set threshold. +- `getTopK() -> int` – top‑k limit. +- `setTopK(int) -> void` – set limit. +- `getRepeatPenalty() -> float` – repetition penalty. +- `setRepeatPenalty(float) -> void` – set penalty. +- `getMinP() -> float` – min‑p threshold. +- `setMinP(float) -> void` – set threshold. +- `getTopNSigma() -> float` – top‑n‑sigma threshold. +- `setTopNSigma(float) -> void` – set threshold. +- `getChatTemplateEnableThinking() -> Boolean?` – chat‑template thinking mode. +- `setChatTemplateEnableThinking(Boolean?) -> void` – set mode. +- `isCachePrompt() -> boolean` – prompt‑caching flag. +- `setCachePrompt(boolean) -> void` – set flag. +- `isSwaFull() -> boolean` – full‑SWA flag. +- `setSwaFull(boolean) -> void` – set flag. +- `getCacheReuse() -> int` – KV prefix‑reuse chunk size. +- `setCacheReuse(int) -> void` – set size. +- `getGpuLayers() -> int` – GPU offload layers. +- `setGpuLayers(int) -> void` – set layers. +- `getCpuMoeLayers() -> int` – CPU MoE layers. +- `setCpuMoeLayers(int) -> void` – set layers. +- `getSeed() -> int` – RNG seed. +- `setSeed(int) -> void` – set seed. +- `getCpuFfnLayers() -> int` – CPU FFN layers. +- `setCpuFfnLayers(int) -> void` – set layers. +- `getKvUnifiedPerSlot() -> int` – unified KV context cap. +- `setKvUnifiedPerSlot(int) -> void` – set cap. +- `getLazyMode() -> String` – tensor‑read laziness. +- `setLazyMode(String?) -> void` – set mode. +- `getRepeatLastN() -> int` – repeat‑penalty window. +- `setRepeatLastN(int) -> void` – set window. +- `getCacheTypeK() -> String` – KV cache type K. +- `setCacheTypeK(String?) -> void` – set type. +- `getCacheTypeV() -> String` – KV cache type V. +- `setCacheTypeV(String?) -> void` – set type. +- `isFlashAttn() -> boolean` – Flash Attention flag. +- `setFlashAttn(boolean) -> void` – set flag. +- `getBatchSize() -> int` – logical batch size. +- `setBatchSize(int) -> void` – set size. +- `getUbatchSize() -> int` – physical batch size. +- `setUbatchSize(int) -> void` – set size. +- `getThreadsBatch() -> int` – batch thread count. +- `setThreadsBatch(int) -> void` – set count. +- `getMainGpu() -> int` – primary GPU index. +- `setMainGpu(int) -> void` – set index. +- `getDevices() -> String` – device list. +- `setDevices(String) -> void` – set list. +- `getProvider() -> String` – AI provider. +- `setProvider(String?) -> void` – set provider. +- `getRemoteModel() -> String` – remote model id. +- `setRemoteModel(String?) -> void` – set id. +- `getBaseUrl() -> String` – base URL. +- `setBaseUrl(String?) -> void` – set URL. +- `getApiKeyEnv() -> String` – API key environment variable name. +- `setApiKeyEnv(String?) -> void` – set name. +- `getReasoningEffort() -> String` – reasoning‑effort level. +- `setReasoningEffort(String) -> void` – set level. +- `getReasoningBudgetTokens() -> int` – reasoning budget. +- `setReasoningBudgetTokens(int) -> void` – set budget. +- `getDryMultiplier() -> float` – DRY multiplier. +- `setDryMultiplier(float) -> void` – set multiplier. +- `getDryBase() -> float` – DRY base. +- `setDryBase(float) -> void` – set base. +- `getDryAllowedLength() -> int` – DRY allowed length. +- `setDryAllowedLength(int) -> void` – set length. +- `getDryPenaltyLastN() -> int` – DRY penalty window. +- `setDryPenaltyLastN(int) -> void` – set window. +- `getDrySequenceBreakers() -> List` – unmodifiable breakers list. +- `setDrySequenceBreakers(List?) -> void` – set breakers. +- `getStopStrings() -> List` – unmodifiable stop strings list. +- `setStopStrings(List?) -> void` – set stop strings. +- `getCalibration() -> AiCalibration?` – per‑machine calibration. +- `setCalibration(AiCalibration?) -> void` – set calibration. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`. +- `lombok.ToString`. +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.config.AiCalibration` (used for calibration field). + +#### Exceptions / Errors +- No explicit exceptions thrown; setters accept `null` and reset to defaults. + +#### Concurrency +- No synchronization; intended for single‑threaded configuration usage. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..8f704e71 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,61 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:28Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Defines how oversized source files are handled during routing. + +#### Purpose +- Enumerates strategies for oversized source files. +- Provides parsing from configuration strings. + +#### Type +- `public enum AiOversizeStrategy` + - Modifiers: `public` + - Supertypes: `java.lang.Enum` + - Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` + - Static field: `public static final AiOversizeStrategy DEFAULT = FAIL` + - Instance field: `private final String configValue` + - Constructor: `AiOversizeStrategy(String configValue)` + - Methods: + - `public String configValue()` – returns token + - `public static AiOversizeStrategy fromConfig(@Nullable String value)` – parses token + +#### Input +- Constructor parameter: `String configValue` (strategy token) +- `fromConfig` parameter: `@Nullable String value` (config string) + +#### Output +- `configValue()` returns strategy token string. +- `fromConfig` returns matching `AiOversizeStrategy` or throws `IllegalArgumentException` for unknown values. + +#### Core logic +- `fromConfig`: + 1. If `value` is `null` → return `DEFAULT`. + 2. Trim `value`; if empty → return `DEFAULT`. + 3. Iterate `values()`; compare `strategy.configValue.equalsIgnoreCase(trimmed)`. + 4. Return matching strategy. + 5. If none match → throw `IllegalArgumentException` with message listing expected tokens. + +#### Public API +- `FAIL(String)` – enum constant, token `"fail"`. +- `SAMPLE(String)` – enum constant, token `"sample"`. +- `MAP_REDUCE(String)` – enum constant, token `"mapReduce"`. +- `DETERMINISTIC(String)` – enum constant, token `"deterministic"`. +- `DEFAULT: AiOversizeStrategy` – default strategy. +- `configValue() -> String` – get token. +- `fromConfig(@Nullable String) -> AiOversizeStrategy` – parse config. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `fromConfig` when value is non‑blank and unrecognized. + +#### Concurrency +- Immutable enum; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..fa7a2be9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,100 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:31Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> A mutable configuration bean that aggregates all parameters required for a srcmorph run, mirroring Maven plugin fields for future JSON/YAML binding. + +#### Purpose +- Holds runtime settings for AI‑powered source generation. +- Serves as a single source of truth for Maven, CLI, or programmatic use. + +#### Type +- `public class SrcMorphConfiguration` + - Modifiers: public, mutable JavaBean + - Supertypes: none + - Annotations: `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`, `@ToString` + - Fields: 23 (see below) + +#### Input +- Constructor: no parameters (defaults applied). +- Setter methods for each field: `baseDirectory`, `outputDirectory`, `force`, `subtrees`, `excludes`, `fileExtensions`, `minFileSizeBytes`, `maxFileSizeBytes`, `planOnly`, `generationProvider`, `promptDefinitions`, `aiDefinitions`, `modelDirectory`, `fieldGenerations`, `factDefinitions`, `llamaModelPath`, `llamaContextSize`, `llamaMaxOutputTokens`, `llamaTemperature`, `llamaThreads`, `pluginVersion`, `aiVersion`, `projectName`. +- Dependencies: none injected; all values set via setters. + +#### Output +- Getter methods expose current configuration values. +- No state mutation beyond setters; no external resources written. + +#### Core logic +- No algorithmic logic; the class solely stores and exposes configuration data. + +#### Public API +- `SrcMorphConfiguration()` → new config instance +- `File getBaseDirectory()` → base dir +- `void setBaseDirectory(File)` → set base dir +- `File getOutputDirectory()` → output dir +- `void setOutputDirectory(File)` → set output dir +- `boolean isForce()` → force flag +- `void setForce(boolean)` → set force flag +- `List getSubtrees()` → subtrees list +- `void setSubtrees(List)` → set subtrees +- `List getExcludes()` → excludes list +- `void setExcludes(List)` → set excludes +- `List getFileExtensions()` → file extensions +- `void setFileExtensions(List)` → set file extensions +- `long getMinFileSizeBytes()` → min file size +- `void setMinFileSizeBytes(long)` → set min file size +- `long getMaxFileSizeBytes()` → max file size +- `void setMaxFileSizeBytes(long)` → set max file size +- `boolean isPlanOnly()` → plan‑only flag +- `void setPlanOnly(boolean)` → set plan‑only flag +- `String getGenerationProvider()` → AI provider name +- `void setGenerationProvider(String)` → set provider +- `List getPromptDefinitions()` → prompt defs +- `void setPromptDefinitions(List)` → set prompt defs +- `List getAiDefinitions()` → AI model defs +- `void setAiDefinitions(List)` → set AI model defs +- `File getModelDirectory()` → model dir +- `void setModelDirectory(File)` → set model dir +- `List getFieldGenerations()` → field generation rules +- `void setFieldGenerations(List)` → set field generations +- `List getFactDefinitions()` → fact defs +- `void setFactDefinitions(List)` → set fact defs +- `String getLlamaModelPath()` → llama model path +- `void setLlamaModelPath(String)` → set llama model path +- `int getLlamaContextSize()` → llama context size +- `void setLlamaContextSize(int)` → set llama context size +- `int getLlamaMaxOutputTokens()` → llama max output tokens +- `void setLlamaMaxOutputTokens(int)` → set llama max output tokens +- `float getLlamaTemperature()` → llama temperature +- `void setLlamaTemperature(float)` → set llama temperature +- `int getLlamaThreads()` → llama thread count +- `void setLlamaThreads(int)` → set llama threads +- `String getPluginVersion()` → plugin version +- `void setPluginVersion(String)` → set plugin version +- `String getAiVersion()` → AI version +- `void setAiVersion(String)` → set AI version +- `String getProjectName()` → project title +- `void setProjectName(String)` → set project title + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiModelDefinition` +- `net.ladenthin.srcmorph.config.AiFieldGenerationConfig` +- `net.ladenthin.srcmorph.config.AiFactDefinition` +- `net.ladenthin.srcmorph.config.AiGenerationConfig` (for `DEFAULT_LLAMA_THREADS`) + +#### Exceptions / Errors +- No explicit exceptions thrown; all setters accept nullable values. + +#### Concurrency +- No synchronization; instances are intended for single‑threaded configuration building. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..6fbb3987 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,52 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:11:23Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> A configuration‑driven AI source‑generation framework that evaluates file‑selection rules, extracts deterministic language‑agnostic facts, and orchestrates model runs with fine‑grained tuning. + +#### Purpose +- Provide a unified, Maven‑friendly configuration for AI‑powered source code generation. +- Evaluate complex file‑selection conditions and handle oversized files. +- Generate deterministic fact blocks from source text for AI prompts. + +#### Responsibilities +- **Configuration Management** – `SrcMorphConfiguration`, `AiGenerationConfig`, `AiOversizeStrategy`. +- **Condition Evaluation** – `AiConditionEvaluator`, `AiConditionGroup`. +- **Fact Extraction** – `AiFactExtractor`. +- **Strategy Parsing** – `AiOversizeStrategy` enum. + +#### Key units +- **`SrcMorphConfiguration`** – mutable bean aggregating all runtime settings (directories, file filters, AI provider, model paths, prompt and fact definitions). +- **`AiGenerationConfig`** – JavaBean holding per‑generation parameters (model path, context size, temperature, retry logic, stop strings, DRY settings, GPU/CPU allocation, etc.). +- **`AiOversizeStrategy`** – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`) with `fromConfig` parsing and default `FAIL`. +- **`AiConditionEvaluator`** – stateless evaluator that recursively checks `AiCondition` trees against `AiFileContext`, validates structure, and flags line‑count usage. +- **`AiConditionGroup`** – defensive‑copy container for child `AiCondition` objects used in combinator nodes. +- **`AiFactExtractor`** – static utility that builds a facts block from a list of `AiFactCounter` regexes, validating patterns and counting matches. + +#### Data flow +1. **Configuration**: `SrcMorphConfiguration` is populated (via Maven plugin, CLI, or programmatically). +2. **Condition Setup**: `AiCondition` trees are defined in the configuration and passed to `AiConditionEvaluator`. +3. **File Selection**: For each source file, `AiConditionEvaluator.matches` decides inclusion; `usesLines` informs whether line counting is needed. +4. **Fact Extraction**: `AiFactExtractor.factsBlock` runs on selected files, producing a deterministic facts string. +5. **Generation**: `AiGenerationConfig` supplies model parameters to the AI provider, which consumes the facts block and other prompts to generate output. + +#### Dependencies +- **Internal**: `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`. +- **External**: `java.time`, `java.util`, `java.io`, `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`, `org.jspecify.annotations`, Lombok `@ToString`. + +#### Cross-cutting +- Defensive copying in `AiConditionGroup` prevents external mutation. +- Validation logic in `AiConditionEvaluator` and `AiFactExtractor` ensures configuration correctness before runtime. +- Thread‑safety: all evaluator and extractor methods are stateless; configuration beans are mutable but intended for single‑threaded setup. +- Error handling: `IllegalArgumentException` for misconfiguration; `IllegalStateException` for malformed condition trees. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..ec914ce5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,57 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:11:44Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A framework that configures, selects, and generates source‑code artifacts using AI models, with pluggable local or remote inference back‑ends. + +#### Purpose +- Centralize AI‑driven source‑generation configuration and orchestration. +- Provide a pluggable provider layer for local llama.cpp, OpenAI‑compatible APIs, or mocks. + +#### Responsibilities +- **Configuration & Validation** – `SrcMorphConfiguration`, `AiGenerationConfig`, `AiOversizeStrategy`, `AiConditionEvaluator`. +- **File Selection** – recursive condition trees (`AiCondition`, `AiConditionGroup`, `AiRangeCondition`) applied to `AiFileContext`. +- **Fact Extraction** – deterministic fact blocks via `AiFactExtractor` and regex counters. +- **Provider Abstraction** – `AiGenerationProvider`, factory, and concrete implementations (`LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport`, mock). +- **Request/Response Handling** – `AiPromptSupport`, `AiCompletionParser`, timing DTOs. + +#### Key units +- **`SrcMorphConfiguration`** – mutable bean aggregating directories, filters, provider key, model paths, prompt/fact definitions. +- **`AiGenerationConfig`** – immutable bean with model path, context size, temperature, retries, stop strings, GPU/CPU flags. +- **`AiOversizeStrategy`** – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`) with `fromConfig`. +- **`AiConditionEvaluator`** – stateless tree evaluator that flags line‑count usage. +- **`AiFactExtractor`** – builds deterministic fact strings from regex counters. +- **`AiGenerationProvider`** – interface for `generate` / `generateWithTimings`. +- **`AiGenerationProviderFactory`** – resolves provider key to concrete implementation. +- **`LlamaCppJniAiGenerationProvider`** – JNI wrapper for llama.cpp, lazy model loading, chat completion, timing extraction. +- **`OpenAiCompatibleProviderSupport`** – builds HTTP requests, validates URLs, handles API keys, parses responses. +- **`AiCompletionParser`** – strips Gemma‑4 thinking blocks from raw completions. +- **`AiGenerationTimings`** – DTO with text, token counts, cache usage, throughput. + +#### Data flow +1. **Setup** – `SrcMorphConfiguration` is populated (Maven plugin, CLI, or code). +2. **Condition & Fact** – `AiConditionEvaluator` filters files; `AiFactExtractor` produces a facts block. +3. **Provider Selection** – `AiGenerationProviderFactory` creates a provider based on the key in the configuration. +4. **Generation** – Client calls `generate` or `generateWithTimings` with an `AiGenerationRequest` (prompt + facts). +5. **Execution** – + *Local*: `LlamaCppJniAiGenerationProvider` invokes native chat completion, parses JSON, removes thinking blocks. + *Remote*: `OpenAiCompatibleProviderSupport` sends HTTP request, parses `ChatResponse`, builds timings. +6. **Result** – Text (and optional timings) returned to the caller for further processing or file emission. + +#### Dependencies +- **Internal** – `AiCondition`, `AiFileContext`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`. +- **External** – `java.time`, `java.util`, `java.io`, `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`, `org.jspecify.annotations`, Lombok `@ToString`, `net.ladenthin:llama` JNI, Jackson `ObjectMapper`. + +#### Cross-cutting +- Defensive copying in `AiConditionGroup`; stateless evaluators for thread safety. +- Validation throws `IllegalArgumentException`/`IllegalStateException` on misconfiguration. +- Immutability of provider configs and request/response DTOs. +- Timing support via `generateWithTimings`; includes prompt token counts, cache usage, throughput. +- Environment‑based API key handling; loopback URL checks for security. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..d4487026 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,55 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:39Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Strips a Gemma‑4 style “thinking block” from raw LLM completion text, returning only the model’s final answer. + +#### Purpose +- Removes internal reasoning from Gemma‑4 completions. +- Validates presence of closing marker; throws if truncated. + +#### Type +- `public class AiCompletionParser` + - Modifiers: public + - Annotations: `@ToString` + - Supertypes: none + - Constants: + - `public static final String THINKING_BLOCK_START_MARKER` + - `public static final String THINKING_BLOCK_END_MARKER` + +#### Input +- `parseCompletion(String response)` + - `response`: raw completion text, may be `null`. + +#### Output +- `parseCompletion` returns `String` (never `null`). +- Throws `IOException` if a start marker is present but no end marker. + +#### Core logic +- If `response` is `null` → return empty string. +- Trim `response` → `trimmed`. +- If `trimmed` does not start with `THINKING_BLOCK_START_MARKER` → return `trimmed`. +- Compute `thinking` = substring after start marker. +- Find `thinkingEnd` = index of `THINKING_BLOCK_END_MARKER` in `thinking`. +- If `thinkingEnd < 0` → throw `IOException` with message about token budget. +- Return substring after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` → constructor, no-op. +- `String parseCompletion(String response) throws IOException` → strip thinking block. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `IOException` when start marker present but end marker missing, with actionable message. + +#### Concurrency +- No concurrency constructs; class is stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..bc80a58f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,51 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:42Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides an interface for AI text generation backends, exposing generation and optional timing metrics. + +#### Purpose +- Declares contract for AI text generation providers. +- Supplies default timing wrapper for calibration. + +#### Type +- `public interface AiGenerationProvider extends AutoCloseable` + - Methods: `generate(AiGenerationRequest) -> String`, `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings`, `close()`. + - Default implementation of `generateWithTimings` delegates to `generate` and returns zeroed timings. + - Implements `AutoCloseable` with no-op `close()`. + +#### Input +- `generate(AiGenerationRequest request)` receives an `AiGenerationRequest` containing prompt key, source file, source text, and current header. +- `generateWithTimings(AiGenerationRequest request)` receives the same request. + +#### Output +- `generate` returns a non‑null `String` (may be blank). +- `generateWithTimings` returns an `AiGenerationTimings` with generated text and zeroed timing fields. +- `close` performs no action. + +#### Core logic +- `generateWithTimings`: + 1. Calls `generate(request)`. + 2. Constructs `new AiGenerationTimings(generatedText, 0, 0, 0.0d, 0, 0.0d)`. + +#### Public API +- `generate(AiGenerationRequest) -> String` – produce text for request. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – produce text with timing. +- `close() -> void` – close provider (no-op). + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.document.AiGenerationTimings` + +#### Exceptions / Errors +- `generate` and `generateWithTimings` declare `throws IOException` for provider failures. + +#### Concurrency +- No explicit concurrency handling; interface is stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..535a954d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,61 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:45Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Creates an AI generation provider instance based on a provider key or model configuration. + +#### Purpose +- Instantiates an `AiGenerationProvider` implementation. +- Resolves the effective provider key from run or model configuration. + +#### Type +- `public class AiGenerationProviderFactory` + - modifiers: public + - supertypes: none + - annotations: `@ToString` + - fields: `private final Java8CompatibilityHelper compatibilityHelper` + - constants: `public static final String PROVIDER_MOCK`, `PROVIDER_LLAMACPP_JNI`, `PROVIDER_OPENAI_COMPATIBLE` + - methods: `public AiGenerationProviderFactory()`, `public static @Nullable String effectiveProvider(String, String)`, `public AiGenerationProvider create(String, LlamaCppJniConfig, AiPromptSupport)` + +#### Input +- Constructor: none. +- `effectiveProvider`: `runProvider: String?`, `modelProvider: String?`. +- `create`: `providerName: String`, `llamaConfig: LlamaCppJniConfig`, `promptSupport: AiPromptSupport`. + +#### Output +- `effectiveProvider`: `String?` (trimmed model provider or run provider). +- `create`: `AiGenerationProvider` instance (Mock, LlamaCppJni, or OpenAiCompatible). + +#### Core logic +- `effectiveProvider`: return `modelProvider` trimmed if present; else `runProvider`. +- `create`: + 1. Compute `effective = effectiveProvider(providerName, llamaConfig.provider())`. + 2. If `effective` is null or blank → return `new MockAiGenerationProvider()`. + 3. Switch on `effective`: + - `PROVIDER_MOCK` → `new MockAiGenerationProvider()`. + - `PROVIDER_LLAMACPP_JNI` → `new LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)`. + - `PROVIDER_OPENAI_COMPATIBLE` → `new OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)`. + - default → throw `IllegalArgumentException("Unsupported AI provider: " + effective)`. + +#### Public API +- `AiGenerationProviderFactory()` → constructs factory. +- `static @Nullable String effectiveProvider(String, String)` → resolves provider key. +- `AiGenerationProvider create(String, LlamaCppJniConfig, AiPromptSupport)` → creates provider instance. + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `create` throws `IllegalArgumentException` for unsupported provider names. + +#### Concurrency +- No explicit concurrency constructs; instance field `compatibilityHelper` is immutable. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..92e35154 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,74 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:49Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides local AI text generation by loading a GGUF model via llama.cpp and exposing a prompt‑based completion API. + +#### Purpose +- Implements `AiGenerationProvider` using the `net.ladenthin:llama` JNI binding. +- Lazily loads a GGUF model and runs chat completions, returning plain text or detailed timings. + +#### Type +- `final class LlamaCppJniAiGenerationProvider` + *implements* `AiGenerationProvider`, `AutoCloseable` + *extends* none + *annotations*: `@ToString` (Lombok) + *fields* (private): + - `LlamaCppJniConfig config` – provider configuration + - `@Nullable LlamaModel model` – native model handle, lazily initialised + - `AiPromptSupport promptSupport` – prompt rendering helper + - `LlamaCppJniProviderSupport support` – shared logic for prompt and inference parameters + - `AiCompletionParser completionParser` – parses completion text + - `ChatResponseParser chatResponseParser` – parses full chat JSON + - `Java8CompatibilityHelper compatibilityHelper` – string utilities + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` consume `AiGenerationRequest`. +- `chatResponse(AiGenerationRequest request)` builds inference parameters via `support.buildInferenceParameters(request)`. + +#### Output +- `generate` returns `String` completion text. +- `generateWithTimings` returns `AiGenerationTimings` containing text, prompt token counts, cache usage, and throughput. +- `close` releases the native `LlamaModel` if loaded. + +#### Core logic +- `model()` lazily constructs `LlamaModel` with `ModelParameters` built from `config` and `support.buildChatTemplateKwargs()`. + - Sets model path, context size, threads, reasoning format, chat template kwargs. + - Conditionally enables SWA full cache, cache reuse, GPU layers, CPU MoE/FFN layers, KV unified per slot, lazy mode, flash attention, KV cache quantization, batch sizes, GPU selection, and device list. + - Instantiates `new LlamaModel(modelParameters)` and caches it. +- `generate(request)` + 1. Calls `chatResponse(request)` to obtain `ChatResponse`. + 2. `support.warnOnTruncatedAnswer(request, response)` and `support.logPromptCacheReuse(request, response)` for diagnostics. + 3. Parses first content via `completionParser.parseCompletion`. +- `chatResponse(request)` + - Calls `model().chatComplete(support.buildInferenceParameters(request))` and parses JSON with `chatResponseParser`. +- `generateWithTimings(request)` + 1. Obtains `ChatResponse` via `chatResponse`. + 2. Extracts text, timings, and constructs `AiGenerationTimings`. + 3. Handles missing timings by returning zeroed rates. +- `close()` invokes `current.close()` on the native model if present. + +#### Public API +- `generate(AiGenerationRequest request) -> String` – produce completion text. +- `generateWithTimings(AiGenerationRequest request) -> AiGenerationTimings` – produce completion text with metrics. +- `close() -> void` – release native resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.args.FlashAttn`, `net.ladenthin.llama.args.ReasoningFormat`, `net.ladenthin.llama.json.ChatResponseParser`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.ChatResponse`, `net.ladenthin.llama.value.Timings`, `net.ladenthin.srcmorph.document.AiGenerationRequest`, `net.ladenthin.srcmorph.prompt.AiPromptSupport`, `net.ladenthin.srcmorph.support.Java8CompatibilityHelper`, `org.jspecify.annotations.Nullable`, `lombok.ToString`. + +#### Exceptions / Errors +- Constructor throws `NullPointerException` if `config` or `promptSupport` is null. +- `generate` declares `IOException` (though underlying chat path throws unchecked). +- `generateWithTimings` does not throw checked exceptions. +- `close` handles null model gracefully. + +#### Concurrency +- No explicit synchronization; `model()` is not thread‑safe, but the provider is typically used single‑threaded or externally synchronized. +- Native `LlamaModel` handles its own thread safety. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..230664c0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,139 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:09:56Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds an immutable configuration for llama.cpp JNI provider, exposing all runtime knobs and defaults for model execution. + +#### Purpose +- Holds 37 configuration parameters for llama.cpp JNI provider. +- Provides fluent builder with defaults from `AiGenerationConfig`. + +#### Type +- `final class LlamaCppJniConfig` (class, final) + - Extends `Object`. + - Annotations: `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. + - Fields: 37 `private final` fields (see below). +- `public static final class Builder` (class, static, final) + - Fields: 37 mutable fields, initialized to `AiGenerationConfig.DEFAULT_*`. + - Methods: 37 setter methods, `build()`. + +#### Input +- `Builder` constructor: `String modelPath` (non‑null). +- Setter methods accept primitive or object types matching the corresponding field. +- `build()` consumes the populated `Builder`. + +#### Output +- `LlamaCppJniConfig` immutable instance with all fields set from the builder. +- Getter methods return primitive or object values; list getters return unmodifiable views. + +#### Core logic +- `LlamaCppJniConfig(Builder)` copies each builder field to the corresponding final field. +- `Builder` constructor stores `modelPath` after `Objects.requireNonNull`. +- Each setter assigns the argument to its field and returns `this`. +- `build()` creates a new `LlamaCppJniConfig(this)`. + +#### Public API +- `LlamaCppJniConfig.builder(String) -> Builder` – start builder with required model path. +- `modelPath() -> String` – model file path. +- `contextSize() -> int` – context window size. +- `maxOutputTokens() -> int` – max output tokens. +- `temperature() -> float` – sampling temperature. +- `threads() -> int` – CPU threads. +- `topP() -> float` – nucleus‑sampling threshold. +- `topK() -> int` – top‑k limit. +- `minP() -> float` – min‑p threshold. +- `topNSigma() -> float` – top‑n‑sigma threshold. +- `repeatPenalty() -> float` – repetition penalty. +- `chatTemplateEnableThinking() -> @Nullable Boolean` – chat‑template thinking flag. +- `cachePrompt() -> boolean` – prompt caching enabled. +- `swaFull() -> boolean` – full‑size SWA cache kept. +- `cacheReuse() -> int` – KV prefix‑reuse chunk size. +- `gpuLayers() -> int` – GPU layers offloaded. +- `seed() -> int` – RNG seed. +- `cpuMoeLayers() -> int` – CPU MoE layers. +- `cpuFfnLayers() -> int` – CPU FFN layers. +- `kvUnifiedPerSlot() -> int` – per‑slot unified KV cap. +- `lazyMode() -> String` – tensor‑read laziness. +- `repeatLastN() -> int` – repeat‑penalty window. +- `cacheTypeK() -> String` – KV‑cache data type for K. +- `cacheTypeV() -> String` – KV‑cache data type for V. +- `flashAttn() -> boolean` – Flash Attention enabled. +- `batchSize() -> int` – logical batch size. +- `ubatchSize() -> int` – physical batch size. +- `threadsBatch() -> int` – batch/prompt‑processing threads. +- `mainGpu() -> int` – primary GPU index. +- `devices() -> String` – device selection. +- `provider() -> String` – AI provider name. +- `remoteModel() -> String` – remote model ID. +- `baseUrl() -> String` – OpenAI‑compatible base URL. +- `apiKeyEnv() -> String` – environment variable for API key. +- `reasoningEffort() -> String` – reasoning‑effort value. +- `reasoningBudgetTokens() -> int` – reasoning token budget. +- `dryMultiplier() -> float` – DRY sampling multiplier. +- `dryBase() -> float` – DRY base. +- `dryAllowedLength() -> int` – DRY allowed length. +- `dryPenaltyLastN() -> int` – DRY penalty look‑back. +- `drySequenceBreakers() -> List` – unmodifiable list. +- `stopStrings() -> List` – unmodifiable list. +- `Builder.contextSize(int) -> Builder` – set context size. +- `Builder.maxOutputTokens(int) -> Builder` – set max output tokens. +- `Builder.temperature(float) -> Builder` – set temperature. +- `Builder.threads(int) -> Builder` – set CPU threads. +- `Builder.topP(float) -> Builder` – set nucleus‑sampling threshold. +- `Builder.topK(int) -> Builder` – set top‑k limit. +- `Builder.minP(float) -> Builder` – set min‑p threshold. +- `Builder.topNSigma(float) -> Builder` – set top‑n‑sigma threshold. +- `Builder.repeatPenalty(float) -> Builder` – set repetition penalty. +- `Builder.chatTemplateEnableThinking(@Nullable Boolean) -> Builder` – set chat‑template thinking. +- `Builder.cachePrompt(boolean) -> Builder` – set prompt caching. +- `Builder.swaFull(boolean) -> Builder` – set full‑size SWA cache. +- `Builder.cacheReuse(int) -> Builder` – set KV prefix‑reuse chunk size. +- `Builder.gpuLayers(int) -> Builder` – set GPU layers. +- `Builder.seed(int) -> Builder` – set RNG seed. +- `Builder.cpuMoeLayers(int) -> Builder` – set CPU MoE layers. +- `Builder.cpuFfnLayers(int) -> Builder` – set CPU FFN layers. +- `Builder.kvUnifiedPerSlot(int) -> Builder` – set KV unified cap. +- `Builder.lazyMode(String) -> Builder` – set tensor‑read laziness. +- `Builder.repeatLastN(int) -> Builder` – set repeat‑penalty window. +- `Builder.cacheTypeK(String) -> Builder` – set KV cache type K. +- `Builder.cacheTypeV(String) -> Builder` – set KV cache type V. +- `Builder.flashAttn(boolean) -> Builder` – set Flash Attention. +- `Builder.batchSize(int) -> Builder` – set logical batch size. +- `Builder.ubatchSize(int) -> Builder` – set physical batch size. +- `Builder.threadsBatch(int) -> Builder` – set batch/prompt threads. +- `Builder.mainGpu(int) -> Builder` – set primary GPU index. +- `Builder.devices(String) -> Builder` – set device selection. +- `Builder.provider(String) -> Builder` – set AI provider. +- `Builder.remoteModel(String) -> Builder` – set remote model ID. +- `Builder.baseUrl(String) -> Builder` – set base URL. +- `Builder.apiKeyEnv(String) -> Builder` – set API key env var. +- `Builder.reasoningEffort(String) -> Builder` – set reasoning effort. +- `Builder.reasoningBudgetTokens(int) -> Builder` – set reasoning budget. +- `Builder.dryMultiplier(float) -> Builder` – set DRY multiplier. +- `Builder.dryBase(float) -> Builder` – set DRY base. +- `Builder.dryAllowedLength(int) -> Builder` – set DRY allowed length. +- `Builder.dryPenaltyLastN(int) -> Builder` – set DRY penalty look‑back. +- `Builder.drySequenceBreakers(List) -> Builder` – set DRY sequence breakers. +- `Builder.stopStrings(List) -> Builder` – set stop strings. +- `Builder.build() -> LlamaCppJniConfig` – create immutable config. + +#### Dependencies +- `java.util.Collections`, `java.util.List`, `java.util.Objects`. +- `lombok.EqualsAndHashCode`, `lombok.ToString`. +- `net.ladenthin.srcmorph.config.AiGenerationConfig`. +- `net.ladenthin.srcmorph.support.ConvertToRecord`. +- `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `Objects.requireNonNull` throws `NullPointerException` if `modelPath` is null. +- No other explicit exceptions. + +#### Concurrency +- `Builder` is not thread‑safe; intended for single‑thread use. +- `LlamaCppJniConfig` is immutable and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..5b56a0d4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,113 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:10:07Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds and validates the JSON request, endpoint, and API key handling for an OpenAI‑compatible chat‑completion provider, and computes call timings and error messages. + +#### Purpose +- Constructs chat‑completion request bodies with sampling knobs. +- Validates and builds the endpoint URL. +- Retrieves and secures the API key. +- Provides utilities for status checks, error messages, and timing calculations. + +#### Type +- `final class OpenAiCompatibleProviderSupport` + - extends `Object` + - fields: + - `private final LlamaCppJniConfig config` + - `@ToString.Exclude private final AiPromptSupport promptSupport` + - `@ToString.Exclude private final Function environment` + - `private final Java8CompatibilityHelper compatibilityHelper` + - `private static final ObjectMapper MAPPER` + - static constants: `CHAT_COMPLETIONS_PATH`, `ERROR_BODY_EXCERPT`, `HTTP_OK_FIRST`, `HTTP_OK_END`, `HTTP_SCHEME`, `HTTPS_SCHEME`, `LOOPBACK_HOST_NAME`, `IPV4_LOOPBACK`, `IPV6_LOOPBACK`, `ELLIPSIS`. + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, `Function environment`. +- `requestBody(AiGenerationRequest request)` consumes `AiGenerationRequest` fields and config knobs. +- `endpoint()` reads `config.baseUrl()`. +- `apiKey()` reads `config.apiKeyEnv()` and environment lookup. +- `apiKeyFor(String endpoint)` reads `apiKey()` and parses `endpoint`. +- `isLoopbackHost(String host)` receives host string. +- `isSuccess(int status)` receives HTTP status. +- `errorMessage(String endpoint, int status, String body)` receives endpoint, status, body. +- `timings(String text, ChatResponse response, double seconds)` receives parsed text, response, and elapsed seconds. + +#### Output +- `requestBody` returns JSON string. +- `endpoint` returns full URL string. +- `apiKey` returns trimmed key or `null`. +- `apiKeyFor` returns key or `null`; throws `IOException` on insecure HTTP to non‑loopback. +- `isLoopbackHost` returns boolean. +- `isSuccess` returns boolean. +- `errorMessage` returns formatted message string. +- `timings` returns `AiGenerationTimings` instance. + +#### Core logic +- **requestBody**: + - Create `ObjectNode body`. + - Add `"model"` if `remoteModel` non‑blank. + - Build `"messages"` array with system and user prompts. + - Set `"max_tokens"`, `"temperature"`, `"top_p"`. + - Conditionally add `"top_k"`, `"min_p"`, `"seed"`, `"stop"` array, `"reasoning.effort"`. + - Set `"stream"` to `false`. + - Serialize with `MAPPER`. +- **endpoint**: + - Trim `config.baseUrl()`. + - Validate starts with `http://` or `https://`. + - Strip trailing slashes. + - Append `CHAT_COMPLETIONS_PATH`. +- **apiKey**: + - Return `null` if `apiKeyEnv` blank. + - Lookup env var; return trimmed key or `null` if unset/blank. +- **apiKeyFor**: + - If key `null` or endpoint not plain `http://`, return key. + - Parse host from `endpoint`. + - If host not loopback (`isLoopbackHost`), throw `IOException`. + - Return key. +- **isLoopbackHost**: + - Return true if host equals `"localhost"`, matches `IPV4_LOOPBACK`, or equals `"[::1]"`. +- **isSuccess**: + - Return true if status in `[200,300)`. +- **errorMessage**: + - Truncate body to `ERROR_BODY_EXCERPT` with ellipsis if longer. + - Return formatted string with endpoint, status, excerpt. +- **timings**: + - Extract `Usage` from `ChatResponse`. + - Compute `completionTokens`, `decodeRate = completionTokens / seconds` (or `0.0`). + - Return new `AiGenerationTimings` with prompt, cached, decode, completion, rate. + +#### Public API +- `String requestBody(AiGenerationRequest request) -> JSON body` +- `String endpoint() -> URL` +- `@Nullable String apiKey() -> key or null` +- `@Nullable String apiKeyFor(String endpoint) -> key or null` +- `static boolean isLoopbackHost(String host) -> true/false` +- `static boolean isSuccess(int status) -> true/false` +- `static String errorMessage(String endpoint, int status, String body) -> message` +- `static AiGenerationTimings timings(String text, ChatResponse response, double seconds) -> timings` + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper`, `ArrayNode`, `ObjectNode` +- `java.io.IOException`, `java.net.URL` +- `java.util.List`, `java.util.Objects`, `java.util.function.Function`, `java.util.regex.Pattern` +- `lombok.ToString` +- `net.ladenthin.llama.value.ChatResponse`, `Usage` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` in `endpoint()` if baseUrl not HTTP(S). +- `IOException` in `apiKeyFor()` if plain HTTP to non‑loopback host or URL parsing fails. +- `IOException` in `requestBody()` if JSON serialization fails. + +#### Concurrency +- All fields are immutable after construction; no synchronization required. +- `MAPPER` is thread‑safe for read operations. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..286d4ed8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,57 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:11:37Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Provides a pluggable AI text‑generation framework that supports local llama.cpp inference, OpenAI‑compatible APIs, and a mock provider, along with utilities for request construction, response parsing, and configuration. + +#### Purpose +- Expose a unified `AiGenerationProvider` interface for generating text from prompts. +- Offer concrete implementations: local llama.cpp JNI, OpenAI‑compatible HTTP, and a mock stub. +- Supply configuration, parsing, and timing support for each provider. + +#### Responsibilities +- **Provider abstraction** – `AiGenerationProvider` interface and factory (`AiGenerationProviderFactory`). +- **Local inference** – `LlamaCppJniAiGenerationProvider` loads a GGUF model, runs chat completions, and parses results. +- **Remote API** – `OpenAiCompatibleProviderSupport` builds request bodies, validates endpoints, handles API keys, and interprets responses. +- **Configuration** – `LlamaCppJniConfig` holds all runtime knobs for llama.cpp and is built via a fluent builder. +- **Parsing** – `AiCompletionParser` strips Gemma‑4 thinking blocks from raw completions. +- **Utilities** – shared helpers (`AiPromptSupport`, `Java8CompatibilityHelper`) and timing wrappers. + +#### Key units +- `AiGenerationProvider` – contract for generating text and optional timing metrics. +- `AiGenerationProviderFactory` – resolves provider key and creates the appropriate provider instance. +- `LlamaCppJniAiGenerationProvider` – llama.cpp JNI implementation, lazy model loading, chat completion, and timing extraction. +- `OpenAiCompatibleProviderSupport` – constructs OpenAI‑compatible request JSON, validates URLs, retrieves API keys, and builds `AiGenerationTimings`. +- `LlamaCppJniConfig` – immutable configuration record for llama.cpp, built via `Builder`. +- `AiCompletionParser` – removes Gemma‑4 thinking blocks from raw LLM output. +- `AiGenerationTimings` – DTO holding generated text, token counts, cache usage, and throughput. + +#### Data flow +1. **Factory** receives a provider key and configuration → creates a provider instance. +2. **Client** calls `generate` or `generateWithTimings` on the provider with an `AiGenerationRequest`. +3. **Local provider**: builds inference parameters → calls native `LlamaModel.chatComplete` → parses JSON → strips thinking block → returns text/timings. +4. **Remote provider**: builds JSON body → validates endpoint → sends HTTP request → parses `ChatResponse` → extracts usage → constructs `AiGenerationTimings`. +5. **Parser** (used by local provider) removes internal reasoning blocks before returning final answer. + +#### Dependencies +- **Internal**: `AiPromptSupport`, `Java8CompatibilityHelper`, `AiGenerationRequest`, `AiGenerationTimings`. +- **External**: `net.ladenthin:llama` JNI bindings, Jackson `ObjectMapper`, `org.jspecify.annotations.Nullable`. +- **Configuration**: `LlamaCppJniConfig` (built from `AiGenerationConfig` defaults). + +#### Cross-cutting +- **Immutability**: `LlamaCppJniConfig` and provider support classes are immutable; builders are single‑threaded. +- **Error handling**: `IOException` for missing end markers, HTTP errors, or insecure URLs; `IllegalArgumentException` for unsupported provider names. +- **Timing**: `generateWithTimings` wrappers compute prompt token counts, cache usage, and decode rates. +- **Environment**: API keys are read from environment variables; loopback checks enforce secure usage. +- **Parsing**: `AiCompletionParser` ensures only the final answer is returned from Gemma‑4 style completions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..3eea3fb8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,49 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:10:55Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Computes a 256‑bin byte histogram of an image or byte stream in two OpenCL kernel passes. + +#### Purpose +- Builds a byte histogram in two stages: per‑work‑group partial counts and global reduction. +- Supports arbitrary input length and parallel execution. + +#### Type +- OpenCL C 1.2 kernels (`__kernel` functions). + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms to `partial`. +- `histogram_reduce`: writes final histogram to `histogram`. + +#### Core logic +- **histogram_partial** + 1. Initialize local bins to zero (each work‑item handles a slice). + 2. Iterate over input in strides of global size, atomically increment local bin for each byte. + 3. Write local bins to global `partial` array at offset `group_id * BINS`. +- **histogram_reduce** + 1. Each work‑item processes one bin. + 2. Sum corresponding entries from all partial histograms. + 3. Store the sum in the final `histogram`. + +#### Public API +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – global reduction. + +#### Constants and configuration +- `#define BINS 256` + +#### Dependencies +- OpenCL built‑in functions: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- None; kernels exit early if `bin >= BINS` in `histogram_reduce`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..253d81d5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,38 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:11:48Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes a 256‑bin byte histogram of an image or byte stream using two OpenCL kernel passes. + +#### Purpose +- Parallel construction of a byte histogram for arbitrary‑length data. +- Two‑stage pipeline: per‑work‑group partial accumulation followed by global reduction. + +#### Responsibilities +- **Partial histogram kernel**: local binning per work‑group, atomic updates, writes to global partial array. +- **Reduction kernel**: summing partial histograms into final 256‑bin result. + +#### Key units +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram kernel. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – global reduction kernel. +- Constant `#define BINS 256` – number of histogram bins. + +#### Data flow +1. **Input**: byte stream (`uchar *input`) and its length. +2. **Partial pass**: each work‑group processes a slice, atomically updates `local_bins`, writes to `partial[group_id * BINS]`. +3. **Reduction pass**: each work‑item sums across all `partial` entries for a specific bin, writes to `histogram[bin]`. + +#### Dependencies +- OpenCL runtime functions: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. +- Requires a global buffer `partial` sized `group_count * BINS` and a final `histogram` buffer of 256 `uint`s. + +#### Cross-cutting +- Uses atomic increments for thread‑safe local bin updates. +- Employs local memory (`__local uint *local_bins`) for intra‑group cooperation. +- No explicit error handling; kernels exit early if a bin index exceeds `BINS`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..7d3120e5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,52 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:11:59Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> A collection of low‑level utilities for image histogramming, byte‑stream buffering, and command‑line data processing. + +#### Purpose +- Provide reusable, high‑performance components for image analysis, streaming I/O, and data‑engineering tasks. + +#### Responsibilities +- **Image processing** – compute 256‑bin byte histograms on GPU via OpenCL kernels. +- **Stream buffering** – lock‑free, power‑of‑two ring buffer for single‑producer/single‑consumer byte streams. +- **Command‑line tooling** – backup rotation and monthly sales reporting from CSV exports. + +#### Key units +- **OpenCL kernels** + - `histogram_partial` – per‑group partial histogram accumulation. + - `histogram_reduce` – global reduction of partial histograms. +- **Ring buffer API** + - `ringbuf_t` – buffer descriptor. + - `ringbuf_status_t` – status enum. + - `ringbuf_init`, `ringbuf_free`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space`. +- **Scripts** + - `rotate_backups.sh` – backup rotation Bash script. + - `sales_report.py` – Python module with `parse_orders`, `revenue_by_month_and_region`, and CLI entry point. + +#### Data flow +1. **Histogram** – input byte stream → `histogram_partial` (local bins) → `histogram_reduce` (final 256‑bin array). +2. **Ring buffer** – `ringbuf_init` → `ringbuf_write` (producer) → `ringbuf_read` (consumer) → status queries. +3. **Backup** – source directory → `tar` → compressed archive → `BACKUP_DIR`; old archives pruned. +4. **Sales report** – CSV → `parse_orders` → `Order` objects → `revenue_by_month_and_region` → tab‑separated output. + +#### Dependencies +- **OpenCL** runtime and standard kernel functions. +- **C standard library** (`stdlib.h`, `string.h`, etc.) for ring buffer. +- **Shell utilities** (`tar`, `date`, `du`, `ls`, `rm`) for backup script. +- **Python standard library** (`argparse`, `csv`, `collections`, `dataclasses`, `datetime`, `decimal`) for sales report. + +#### Cross-cutting +- **Atomicity & concurrency** – OpenCL kernels use `atomic_inc`; ring buffer relies on single‑producer/single‑consumer assumption. +- **Power‑of‑two sizing** – ring buffer capacity validated via `is_power_of_two`; modulo operations use bitmask. +- **Error handling** – ring buffer returns `ringbuf_status_t`; scripts use exit codes and exception propagation. +- **Performance** – OpenCL kernels split work into local and global phases; ring buffer minimizes memory copies with two‑chunk logic. +- **Time handling** – backup script uses UTC timestamps; sales report aggregates by month using `datetime`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..c6e49701 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,49 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:11:52Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides a lock‑free, power‑of‑two sized circular buffer for byte streams, enabling non‑blocking FIFO read/write between a single producer and consumer. + +#### Purpose +- Offer a reusable, fixed‑capacity byte ring buffer. +- Support non‑blocking, wrap‑around read/write operations. + +#### Responsibilities +- **API definition** – header declares `ringbuf_t`, status enum, and public functions. +- **Runtime logic** – source implements allocation, index arithmetic, and data movement. +- **Error handling** – validates capacity and reports allocation failures. + +#### Key units +- `ringbuf_t` – struct holding buffer pointer, capacity, head/tail indices. +- `ringbuf_status_t` – enum (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- `ringbuf_init` – allocates buffer, validates power‑of‑two capacity. +- `ringbuf_free` – releases allocated memory. +- `ringbuf_write` – copies up to two contiguous chunks to handle wrap‑around. +- `ringbuf_read` – copies up to two contiguous chunks from buffer. +- `ringbuf_used` – computes bytes currently stored via modulo arithmetic. +- `ringbuf_free_space` – computes available space. + +#### Data flow +1. **Initialization** – `ringbuf_init` allocates memory and sets indices to zero. +2. **Writing** – `ringbuf_write` checks free space, copies data, updates head. +3. **Reading** – `ringbuf_read` checks used bytes, copies data, updates tail. +4. **Querying** – `ringbuf_used` / `ringbuf_free_space` provide current state. +5. **Cleanup** – `ringbuf_free` releases resources. + +#### Dependencies +- Standard C headers: ``, ``, ``, ``. +- Uses `malloc`/`free` for dynamic buffer allocation. +- Relies on power‑of‑two capacity for efficient modulo via bitmask. + +#### Cross-cutting +- **Single‑producer / single‑consumer** assumption; no locks required. +- **Wrap‑around handling** via two‑chunk copy logic in both read and write. +- **Error codes** standardized through `ringbuf_status_t`. +- **Capacity validation** via `is_power_of_two` helper. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..bf547ba6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,58 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:10:59Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Implements a fixed‑size circular buffer with power‑of‑two capacity. + +#### Purpose +- Provides a FIFO buffer for byte streams. +- Supports non‑blocking read/write with wrap‑around. + +#### Type +- C source file (`ringbuf.c`) implementing functions for `ringbuf_t` defined in `ringbuf.h`. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – data to enqueue. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – buffer to dequeue into. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- `ringbuf_write` returns number of bytes actually written. +- `ringbuf_read` returns number of bytes actually read. +- `ringbuf_free` releases allocated memory. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates memory, initializes indices. +- `ringbuf_free` frees memory and resets fields. +- `ringbuf_used` computes bytes in buffer via modulo arithmetic. +- `ringbuf_free_space` computes available space. +- `ringbuf_write` copies up to two contiguous chunks to handle wrap‑around. +- `ringbuf_read` copies up to two contiguous chunks from buffer. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free resources. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – space left. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – enqueue data. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – dequeue data. + +#### Constants and configuration +- None defined in this file. + +#### Dependencies +- `ringbuf.h` +- Standard library: `stdlib.h`, `string.h`. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity not power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..f999834f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,62 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:11:04Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> A single‑producer, single‑consumer fixed‑capacity byte ring buffer API. + +#### Purpose +- Provides a lock‑free circular buffer for byte streams. +- Supports non‑blocking write/read with capacity checks. + +#### Type +- Header file (`ringbuf.h`) in C. +- Defines `ringbuf_t` struct, `ringbuf_status_t` enum, and public API functions. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes (must be power of two, >0). +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. +- `ringbuf_used(const ringbuf_t *rb)` – reads current used bytes. +- `ringbuf_free_space(const ringbuf_t *rb)` – reads available space. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_free` frees allocated memory. +- `ringbuf_used` and `ringbuf_free_space` return size_t counts. + +#### Core logic +- `ringbuf_init`: validates capacity, allocates `capacity` bytes, sets head/tail to 0. +- `ringbuf_write`: calculates free space, copies up to `len` bytes, updates head atomically. +- `ringbuf_read`: calculates used bytes, copies up to `len` bytes, updates tail atomically. +- `ringbuf_used`: `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space`: `capacity - 1 - ringbuf_used(rb)`. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free buffer. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – bytes available for writing. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- `` for `size_t`. +- `` for `uint8_t`. +- Uses `malloc`/`free` implicitly via implementation (not shown). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..6e730165 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,42 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:11:56Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> A utility package that provides command‑line tools for backing up directories and generating monthly sales reports from CSV order exports. + +#### Purpose +- Automate creation and rotation of compressed directory backups. +- Aggregate and report sales revenue by month and region from CSV data. + +#### Responsibilities +- **Backup rotation**: create timestamped `.tar.gz` archives, prune old ones. +- **Sales reporting**: parse CSV orders, filter by currency, aggregate revenue, output tab‑separated report. + +#### Key units +- `rotate_backups.sh` – Bash script that validates arguments, creates a compressed backup, and deletes older archives beyond a keep count. +- `sales_report.py` – Python script exposing `parse_orders`, `revenue_by_month_and_region`, and `main` to generate revenue summaries. + +#### Data flow +1. **Backup**: + `SOURCE_DIR` → `tar` → temporary archive → final `.tar.gz` → `BACKUP_DIR`. + Existing archives are listed, sorted, and the oldest beyond `KEEP` are removed. +2. **Sales report**: + CSV files → `parse_orders` → `Order` objects → `revenue_by_month_and_region` → sorted totals → printed report. + +#### Dependencies +- **Shell**: `tar`, `date`, `du`, `ls`, `rm`, `mkdir`. +- **Python**: `argparse`, `csv`, `collections.defaultdict`, `dataclasses`, `datetime`, `decimal`. +- No external libraries beyond the standard library. + +#### Cross-cutting +- Strict error handling: exit codes `0`/`1`/`2`, `ValueError` for malformed input. +- Consistent use of UTC timestamps for backup naming. +- Input validation for required columns and positive integer `KEEP`. +- Clean‑up via `trap` in Bash and exception propagation in Python. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..1bc70a95 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,60 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:11:13Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Creates a dated, compressed backup of a directory and prunes older archives to keep only the newest N. + +#### Purpose +- Generates a `.tar.gz` backup of `SOURCE_DIR` into `BACKUP_DIR`. +- Keeps only the most recent `KEEP` archives, deleting older ones. +- Intended to be run directly from the command line. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- `$1` → `SOURCE_DIR` (required). +- `$2` → `BACKUP_DIR` (required). +- `$3` → `KEEP` (optional, defaults to `7`). +- No external options or environment variables. + +#### Output +- Creates file `"$BACKUP_DIR/${name}_.tar.gz"`. +- Deletes older backup files matching `"$BACKUP_DIR/${name}_*.tar.gz"`. +- Prints creation and removal messages to stdout. +- Exit status `0` on success, `2` on argument or validation errors. + +#### Core logic +- Validate `KEEP` is a positive integer. +- Verify `SOURCE_DIR` exists; create `BACKUP_DIR` if missing. +- Build archive name with UTC timestamp. +- Create temporary archive `"$tmp"`, then rename to final name. +- List existing archives sorted newest first. +- Remove all but the first `KEEP` entries. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR`=`"${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR`=`"${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP`=`"${3:-7}"` +- `name`=`"$(basename "$SOURCE_DIR")"` +- `archive`=`"$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp`=`"$archive.partial"` + +#### Dependencies +- External commands: `tar`, `date`, `du`, `ls`, `rm`, `mkdir`. +- No sourced files. + +#### Errors and exit codes +- `exit 2` if `KEEP` not a positive integer. +- `exit 2` if `SOURCE_DIR` does not exist. +- `trap` ensures temporary file `"$tmp"` is removed on exit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..1c472e44 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,62 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:11:18Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Generates a monthly sales report from CSV order exports, aggregating revenue by month and region in a specified currency. + +#### Purpose +- Produce revenue totals per month and region from order CSV files. +- Filter by currency and minimum revenue threshold. + +#### Type +- Python script (`.py`). + +#### Input +- Positional arguments: list of CSV file paths (`csv_files`). +- Optional arguments: + - `--currency`: target currency code (default `EUR`). + - `--min-revenue`: minimum revenue to display (default `0`). +- CSV columns required: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints tab‑separated lines: `monthregionrevenue currency`. +- Exits with code `0` on success, `1` if no orders found. + +#### Core logic +- `parse_orders(path, currency)`: + - Open CSV, validate required columns. + - Skip rows with non‑matching currency. + - Convert `order_date` to `date`, `amount` to `Decimal`. + - Yield `Order` dataclass instances. +- `revenue_by_month_and_region(orders)`: + - Accumulate totals in `defaultdict(Decimal)` keyed by `(YYYY-MM, region)`. + - Return sorted dictionary of totals. +- `main(argv)`: + - Parse CLI arguments. + - Collect all orders from provided files. + - If none, report error. + - Iterate sorted totals, print those meeting `min_revenue`. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` + Parses CSV, yields orders in specified currency. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` + Aggregates revenue by month and region. +- `main(argv=None) -> int` + CLI entry point; processes arguments, outputs report. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` if CSV missing required columns or contains invalid data. +- `ValueError` propagated from `parse_orders` for malformed rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..f13f6a4f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,63 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:12:22Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A unified framework for AI‑driven source‑code generation, low‑level performance utilities, and cross‑domain database schemas, all orchestrated to support automated code synthesis, data processing, and business rule enforcement. + +#### Purpose +- Central AI‑powered source‑generation engine with pluggable inference back‑ends. +- High‑performance image and stream utilities for data‑engineering tasks. +- Robust database schemas and procedures for library, shop, and warehouse domains. + +#### Responsibilities +- **AI Generation** – configuration, file selection, fact extraction, provider abstraction, request/response handling. +- **Utilities** – GPU‑accelerated histograms, lock‑free ring buffers, backup rotation, sales reporting. +- **Database** – schema definition, stored procedures, triggers, views, and audit logging across PostgreSQL, MySQL, and SQL Server. + +#### Key units +- **Java** + - `SrcMorphConfiguration` – mutable config bean. + - `AiGenerationConfig` – immutable provider settings. + - `AiOversizeStrategy` – enum for oversized prompt handling. + - `AiConditionEvaluator` – tree evaluator for file filtering. + - `AiFactExtractor` – deterministic fact block builder. + - `AiGenerationProvider` / `AiGenerationProviderFactory` – abstraction and factory. + - `LlamaCppJniAiGenerationProvider` – native llama.cpp wrapper. + - `OpenAiCompatibleProviderSupport` – HTTP client for OpenAI‑compatible APIs. + - `AiCompletionParser` – removes thinking blocks from completions. + - `AiGenerationTimings` – DTO for performance metrics. +- **Other** + - OpenCL kernels `histogram_partial` / `histogram_reduce`. + - Ring buffer API (`ringbuf_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read`). + - Scripts `rotate_backups.sh`, `sales_report.py`. +- **SQL** + - Library tables (`author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`). + - Views (`overdue_loans`, `member_loan_stats`, `popular_books`). + - Functions (`fn_checkout_book`, `fn_late_fee`). + - Procedures (`sp_return_book`). + - Shop tables (`product`, `customer_order`, `order_item`) and procedure `add_order_item`. + - Warehouse tables (`dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`) and procedure `dbo.usp_SyncStock`. + +#### Data flow +1. **AI Generation** – configuration → condition & fact evaluation → provider selection → prompt + facts → provider execution → text + timings returned. +2. **Utilities** – input stream → OpenCL histogram kernels → 256‑bin result; producer writes to ring buffer → consumer reads; backup script archives directory; sales report parses CSV → aggregates revenue. +3. **Database** – application calls stored procedures (`fn_checkout_book`, `add_order_item`, `usp_SyncStock`) → triggers log audits → views expose aggregated data for reporting. + +#### Dependencies +- **Internal** – AI modules (`AiCondition`, `AiFileContext`, `AiFactCounter`, etc.), utility kernels, database cross‑references. +- **External** – Java standard libraries, Lombok, Jackson, llama JNI, OpenCL runtime, shell utilities, Python stdlib, PostgreSQL/MySQL/SQL Server built‑ins. + +#### Cross‑cutting +- **Thread safety** – stateless evaluators, immutable DTOs, single‑producer/single‑consumer ring buffer. +- **Error handling** – configuration validation, provider exceptions, SQL error capture into logs. +- **Performance** – native llama.cpp calls, OpenCL parallelism, ring buffer minimal copying, timing metrics. +- **Security** – API key handling, loopback URL checks, audit trails. +- **Scalability** – provider factory supports local and remote back‑ends, database procedures use row‑level locks and transactions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..3ee074ba --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 418A4294 +- D: 2026-11-04T12:04:37Z +- T: 2026-11-04T12:12:29Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard project unifies an AI‑driven source‑generation framework with low‑level performance utilities and cross‑domain database schemas. The core Java packages configure file‑selection rules, orchestrate model runs, and provide pluggable inference back‑ends (llama.cpp, OpenAI‑compatible APIs, or mocks) for generating deterministic, language‑agnostic code artifacts. Supporting this, the “other” utilities expose OpenCL kernels for byte‑histogramming, a lock‑free ring buffer for non‑blocking byte streams, and command‑line tools for data processing and reporting. The SQL subpackages expose PostgreSQL, MySQL, and SQL Server schemas and stored procedures that manage library lending, e‑commerce orders, and warehouse inventory, enabling synchronized data flows and audit trails across the system. + +#### Packages +- java/config — A configuration‑driven AI source‑generation framework that evaluates file‑selection rules, extracts deterministic language‑agnostic facts, and orchestrates model runs with fine‑grained tuning. +- java — A framework that configures, selects, and generates source‑code artifacts using AI models, with pluggable local or remote inference back‑ends. +- java/provider — Provides a pluggable AI text‑generation framework that supports local llama.cpp inference, OpenAI‑compatible APIs, and a mock provider, along with utilities for request construction, response parsing, and configuration. +- other/kernels — Computes a 256‑bin byte histogram of an image or byte stream using two OpenCL kernel passes. +- other — A collection of low‑level utilities for image histogramming, byte‑stream buffering, and command‑line data processing. +- other/ringbuf — Provides a lock‑free, power‑of‑two sized circular buffer for byte streams, enabling non‑blocking FIFO read/write between a single producer and consumer. +- other/scripts — A utility package that provides command‑line tools for backing up directories and generating monthly sales reports from CSV order exports. +- . — A unified framework for AI‑driven source‑code generation, low‑level performance utilities, and cross‑domain database schemas, all orchestrated to support automated code synthesis, data processing, and business rule enforcement. +- sql/library — A PostgreSQL‑based library management system that stores catalog, member, and loan data, tracks book availability, and provides reporting and audit trails for lending operations. +- sql — A collection of database schemas and stored procedures that manage library lending, e‑commerce orders, and warehouse inventory synchronization across PostgreSQL, MySQL, and SQL Server. +- sql/shop — A MySQL schema and stored procedure for managing a web‑shop’s product catalog, customer orders, and order line items, including stock reservation and total calculation. +- sql/warehouse — Keeps the warehouse inventory in sync with nightly supplier feeds, logging each run and handling inserts, updates, and errors. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..06c05199 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,73 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:10:16Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Defines the core tables and indexes for a library lending system, tracking authors, books, members, and loans. + +#### Purpose +- Store library catalog and member data. +- Record book loans and enforce borrowing rules. + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` + +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author(author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` + +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` + +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book(book_id)` + - `member_id BIGINT NOT NULL REFERENCES member(member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` + +- **Indexes** + - `idx_book_author ON book(author_id)` + - `idx_loan_member ON loan(member_id)` + - `idx_loan_open ON loan(due_on) WHERE returned_on IS NULL` + +#### Reads +- `author` (author_id, full_name, birth_year, country_code) +- `book` (book_id, isbn, title, author_id, published_year, copies_total, copies_free) +- `member` (member_id, email, full_name, joined_on, is_blocked) +- `loan` (loan_id, book_id, member_id, loaned_on, due_on, returned_on) + +#### Writes +- None (only table and index definitions). + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (ON DELETE CASCADE) + +#### Dependencies +- None beyond standard PostgreSQL types and constraints. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..e166b74a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,66 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:10:22Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Provides reporting views for a library system: overdue loans, member loan statistics, and popular books. + +#### Purpose +- Exposes aggregated loan data for reporting. +- Highlights overdue loans, member activity, and recent popular books. + +#### Type +- PostgreSQL views and materialized view. +- Index: `idx_popular_books_id` on `popular_books`. + +#### Schema +**View `overdue_loans`** +- `loan_id` integer +- `member_id` integer +- `email` text +- `title` text +- `due_on` date +- `days_overdue` integer +- **Indexes**: none +- **Constraints**: none + +**View `member_loan_stats`** +- `member_id` integer +- `full_name` text +- `loans_total` bigint +- `loans_open` bigint +- `last_loan_on` timestamp +- **Indexes**: none +- **Constraints**: none + +**Materialized View `popular_books`** +- `book_id` integer +- `title` text +- `author_name` text +- `times_loaned` bigint +- **Indexes**: `idx_popular_books_id` on `(book_id)` +- **Constraints**: unique index enforces distinct `book_id` + +#### Reads +- `loan` (all columns referenced) +- `member` (`member_id`, `email`, `full_name`) +- `book` (`book_id`, `title`, `author_id`) +- `author` (`author_id`, `full_name`) + +#### Writes +- None (views are read‑only). + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author` +- Functions: `CURRENT_DATE`, `CURRENT_DATE - INTERVAL '365 days'` +- Index: `idx_popular_books_id` on `popular_books` (materialized view) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..ffe742ab --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,69 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:10:25Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Handles book lending, returning, late fee calculation, and audit logging for a library system. + +#### Purpose +- Implements checkout, return, and late fee logic. +- Records audit trail of loan actions. + +#### Type +- Table: `loan_audit` (PostgreSQL). +- Function: `fn_checkout_book` (plpgsql), `fn_late_fee` (sql), `trg_loan_audit_fn` (plpgsql trigger function). +- Procedure: `sp_return_book` (plpgsql). +- Trigger: `trg_loan_audit` (AFTER INSERT OR UPDATE OF returned_on ON loan). + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` +- **Indexes** + - `PK_loan_audit` on `audit_id` (primary key). + +#### Reads +- `member` (`member_id`, `is_blocked`) – check blocked status. +- `book` (`book_id`, `copies_free`) – verify free copy. +- `loan` (`loan_id`, `returned_on`, `book_id`) – update return status. +- `loan` (`loan_id`, `book_id`) – retrieve book id for return. +- `loan` (`due_on`, `returned_on`) – late fee calculation (implicit in `fn_late_fee`). + +#### Writes +- `book` – decrement `copies_free` on checkout; increment on return. +- `loan` – insert new loan record; update `returned_on` on return. +- `loan_audit` – insert audit rows on checkout and return. +- **Insert counts** + - `loan`: 1 row per checkout. + - `loan_audit`: 1 row per checkout, 1 row per return. + +#### Relationships +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Verify member not blocked. + - Decrement `book.copies_free`; error if none. + - Insert into `loan` with `due_on = CURRENT_DATE + p_days`; return new `loan_id`. +- **sp_return_book(p_loan_id)** + - Update `loan.returned_on` to `CURRENT_DATE`; return `book_id`. + - Increment `book.copies_free` for that book. +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Fee = `LEAST(GREATEST(days_overdue,0) * 50, 2000)`. +- **trg_loan_audit_fn()** + - On INSERT: log `CHECKOUT`. + - On UPDATE where `returned_on` changes from NULL to non‑NULL: log `RETURN`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Functions: `fn_late_fee`. +- Trigger: `trg_loan_audit_fn` attached to `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..32561456 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,65 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:10:30Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Migrates the library schema to support multiple branches, creates a book_copy table, and updates loan and member tables accordingly. + +#### Purpose +- Add branch support and per‑copy tracking. +- Replace book copy counters with explicit book_copy rows. +- Update member and loan tables for new branch relationships. + +#### Type +- PostgreSQL migration script (DDL). + +#### Schema +- **branch** + - `branch_id SMALLSERIAL PRIMARY KEY` + - `name VARCHAR(100) NOT NULL UNIQUE` + - `city VARCHAR(100) NOT NULL` +- **book_copy** + - `copy_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `branch_id SMALLINT NOT NULL REFERENCES branch (branch_id)` + - `barcode VARCHAR(32) NOT NULL UNIQUE` + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE', 'ON_LOAN', 'LOST'))` + - Index: `idx_book_copy_book` on `book_id` +- **loan** (altered) + - Added column `copy_id BIGINT REFERENCES book_copy (copy_id)` +- **member** (altered) + - Renamed column `joined_on` → `member_since` + - Added column `home_branch_id SMALLINT REFERENCES branch (branch_id)` + - Updated existing rows: `home_branch_id = 1` where null +- **book** (altered) + - Dropped constraint `book_free_le_total` + - Dropped columns `copies_free`, `copies_total` + +#### Reads +- `book` (SELECT book_id, copies_total, copies_free) +- `branch` (INSERT default row) +- `book_copy` (none) + +#### Writes +- `branch`: 1 row (`INSERT INTO branch VALUES ('Main', 'Springfield')`) +- `book_copy`: 1 + 1 + … rows (one per existing copy; total equals sum of `copies_total` across all books) +- `loan`: 1 new column added (no data written) +- `member`: 1 new column added, 1 update to set `home_branch_id = 1` where null +- `book`: 1 constraint dropped, 2 columns dropped + +#### Relationships +- `book_copy.book_id → book.book_id` +- `book_copy.branch_id → branch.branch_id` +- `loan.copy_id → book_copy.copy_id` +- `member.home_branch_id → branch.branch_id` + +#### Dependencies +- Existing tables: `book`, `loan`, `member` +- New table: `branch`, `book_copy` +- New index: `idx_book_copy_book` on `book_copy(book_id)` +- Existing constraint: `book_free_le_total` (removed) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..bace05c0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,37 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:10:39Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Seed data for a PostgreSQL library system: authors, books, members, and loans. + +#### Purpose +- Populate the `author`, `book`, `member`, and `loan` tables with initial test data. + +#### Type +- SQL script (INSERT statements) for PostgreSQL. + +#### Schema +- No tables or constraints are defined in this file; it only inserts rows. + +#### Reads +- None. + +#### Writes +- `author`: 15 rows +- `book`: 150 rows (book_id 1‑150) +- `member`: 50 rows (member_id 1‑50) +- `loan`: 150 rows (loan_id 1‑150) + +#### Relationships +- `book.author_id` → `author.author_id` +- `loan.book_id` → `book.book_id` +- `loan.member_id` → `member.member_id` + +#### Dependencies +- Tables: `author`, `book`, `member`, `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..7a8f1f4c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,50 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:12:04Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL‑based library management system that stores catalog, member, and loan data, tracks book availability, and provides reporting and audit trails for lending operations. + +#### Purpose +- Persist library catalog, member, and loan information. +- Enforce borrowing rules and maintain audit logs. + +#### Responsibilities +- **Data definition** – tables, indexes, and constraints for authors, books, members, loans, and audit. +- **Reporting** – views for overdue loans, member statistics, and popular books. +- **Business logic** – checkout, return, late‑fee calculation, and audit logging. +- **Schema evolution** – migration to support branches and per‑copy tracking. +- **Seeding** – initial data for authors, books, members, and loans. + +#### Key units +- **Tables**: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. +- **Views**: `overdue_loans`, `member_loan_stats`, materialized `popular_books`. +- **Functions**: `fn_checkout_book`, `fn_late_fee`. +- **Procedure**: `sp_return_book`. +- **Trigger**: `trg_loan_audit` (fires `trg_loan_audit_fn` on loan changes). + +#### Data flow +1. **Checkout** – `fn_checkout_book` validates member, decrements `book.copies_free`, inserts a `loan` row, and logs a `CHECKOUT` audit. +2. **Return** – `sp_return_book` updates `loan.returned_on`, increments `book.copies_free`, and logs a `RETURN` audit. +3. **Late fee** – `fn_late_fee` computes fee based on `due_on` and `returned_on` (or current date). +4. **Reporting** – Views aggregate `loan`, `member`, `book`, and `author` data to expose overdue loans, member activity, and popular books. + +#### Dependencies +- **Internal**: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. +- **External**: PostgreSQL built‑in functions (`CURRENT_DATE`, `now()`, date arithmetic). +- **Migration**: Adds `branch` and `book_copy` tables, removes copy counters from `book`, and links `loan` and `member` to branches. + +#### Cross‑cutting +- **Constraints**: foreign keys, uniqueness, check constraints on dates, copies, and status. +- **Indexes**: on foreign keys and materialized view (`idx_popular_books_id`). +- **Audit trail**: `loan_audit` table records every checkout and return with timestamps. +- **Branching**: after migration, loans reference a specific `book_copy` and members have a `home_branch_id`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..d756a997 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,52 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:12:18Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A collection of database schemas and stored procedures that manage library lending, e‑commerce orders, and warehouse inventory synchronization across PostgreSQL, MySQL, and SQL Server. + +#### Purpose +- Persist and enforce business rules for library loans, online shop orders, and warehouse stock. +- Provide audit trails, reporting, and transactional integrity across three distinct domains. + +#### Responsibilities +- **Library** – catalog, member, loan, audit, reporting, and migration. +- **Shop** – product catalog, order lifecycle, line‑item handling, and stock reservation. +- **Warehouse** – nightly supplier feed ingestion, inventory upsert, and run logging. + +#### Key units +- **Library** + - Tables: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. + - Views: `overdue_loans`, `member_loan_stats`, `popular_books`. + - Functions: `fn_checkout_book`, `fn_late_fee`. + - Procedure: `sp_return_book`. + - Trigger: `trg_loan_audit` (logs to `loan_audit`). +- **Shop** + - Tables: `product`, `customer_order`, `order_item`. + - Procedure: `add_order_item(p_order_id, p_sku, p_qty)`. +- **Warehouse** + - Tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. + - Procedure: `dbo.usp_SyncStock(@Since)`. + +#### Data flow +1. **Library** – `fn_checkout_book` validates member, updates `book.copies_free`, inserts `loan`, logs audit; `sp_return_book` updates `loan.returned_on`, restores copies, logs audit; `fn_late_fee` calculates penalties; views aggregate data for reporting. +2. **Shop** – `add_order_item` locks `product`, verifies stock, inserts/updates `order_item`, decrements `product.stock`, recalculates `customer_order.total_cents`. +3. **Warehouse** – `usp_SyncStock` aggregates new `SupplierFeed` rows, merges into `StockLevel`, records counts, logs run metadata and errors. + +#### Dependencies +- **Internal** – cross‑package tables referenced by procedures and views (`author`, `book`, `member`, `loan`, `product`, `customer_order`, `order_item`, `StockLevel`, `SupplierFeed`, `SyncLog`). +- **External** – PostgreSQL built‑ins (`CURRENT_DATE`, `now()`), MySQL ENUM and `FOR UPDATE`, SQL Server system functions (`SYSUTCDATETIME()`, `ERROR_MESSAGE()`). + +#### Cross‑cutting +- **Audit & Logging** – library audit table, warehouse sync log, and trigger‑based audit capture. +- **Concurrency Control** – `SELECT … FOR UPDATE` in shop, transaction scopes in warehouse and library procedures. +- **Error Handling** – shop procedure raises errors for missing SKU or insufficient stock; warehouse procedure captures `ERROR_MESSAGE()` into `SyncLog`. +- **Schema Evolution** – library migration adds `branch` and `book_copy`, removes copy counter from `book`. +- **Indexes & Constraints** – foreign keys, unique constraints, check constraints, and indexes on foreign keys and materialized views to support performance and data integrity. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..b81c8e2d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,67 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:10:43Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Manages products, customer orders, and order line items in a MySQL web shop, including stock reservation and order total calculation. + +#### Purpose +- Stores product catalog, customer orders, and order line items. +- Provides a stored procedure to add an item to an order, reserve stock, and recalculate the order total. + +#### Type +- Table: `product`, `customer_order`, `order_item` +- Procedure: `add_order_item` +- Dialect: MySQL 8 + +#### Schema +- **product** + - `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `sku VARCHAR(40) NOT NULL` UNIQUE `uk_product_sku` + - `name VARCHAR(200) NOT NULL` + - `price_cents INT UNSIGNED NOT NULL` + - `stock INT NOT NULL DEFAULT 0` +- **customer_order** + - `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `customer_id BIGINT UNSIGNED NOT NULL` + - `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW' + - `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` + - `total_cents INT UNSIGNED NOT NULL DEFAULT 0` + - Index `idx_order_customer` on `(customer_id, created_at)` +- **order_item** + - `order_id BIGINT UNSIGNED NOT NULL` PK part + - `product_id INT UNSIGNED NOT NULL` PK part + - `quantity SMALLINT UNSIGNED NOT NULL` + - `unit_price_cents INT UNSIGNED NOT NULL` + - FK `fk_item_order` references `customer_order(order_id)` ON DELETE CASCADE + - FK `fk_item_product` references `product(product_id)` + +#### Reads +- `product` (SELECT `product_id`, `price_cents` WHERE `sku` AND `stock` >= `p_qty` FOR UPDATE) +- `order_item` (SELECT SUM(quantity * unit_price_cents) WHERE `order_id` = `p_order_id`) + +#### Writes +- `order_item` (INSERT or UPDATE quantity; 1 row per call) +- `product` (UPDATE stock; 1 row) +- `customer_order` (UPDATE total_cents; 1 row) + +#### Relationships +- `order_item.order_id -> customer_order.order_id` +- `order_item.product_id -> product.product_id` + +#### Routine logic +- Parameters: `p_order_id`, `p_sku`, `p_qty` +- Lookup product by SKU with sufficient stock; lock row. +- If not found, raise error. +- Insert or update `order_item` quantity. +- Decrement `product.stock` by `p_qty`. +- Recalculate `customer_order.total_cents` from current `order_item` rows. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item` +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..7e60c1c4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,45 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:12:07Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> A MySQL schema and stored procedure for managing a web‑shop’s product catalog, customer orders, and order line items, including stock reservation and total calculation. + +#### Purpose +- Persist product, order, and order‑item data for an online shop. +- Provide a single stored procedure to add items to an order, reserve stock, and update the order total. + +#### Responsibilities +- **Catalog Management** – `product` table stores SKU, name, price, and stock. +- **Order Lifecycle** – `customer_order` tracks status, timestamps, and total amount. +- **Line‑Item Handling** – `order_item` links orders to products with quantity and unit price. +- **Business Logic** – `add_order_item` procedure encapsulates validation, stock locking, quantity adjustment, stock decrement, and total recalculation. + +#### Key units +- `product` (PK: `product_id`; unique SKU; price in cents; stock count) +- `customer_order` (PK: `order_id`; status enum; total in cents) +- `order_item` (composite PK: `order_id`, `product_id`; quantity; unit price) +- `add_order_item(p_order_id BIGINT, p_sku VARCHAR, p_qty SMALLINT)` – reserves stock, updates or inserts an order item, and refreshes the order total. + +#### Data flow +1. Caller invokes `add_order_item` with order ID, SKU, and quantity. +2. Procedure locks the matching `product` row (`FOR UPDATE`) after verifying sufficient stock. +3. Inserts or updates the corresponding `order_item` row. +4. Decrements `product.stock` by the requested quantity. +5. Recalculates `customer_order.total_cents` by summing all line items for that order. +6. Commits the transaction, ensuring atomicity of stock reservation and total update. + +#### Dependencies +- Internal tables: `product`, `customer_order`, `order_item`. +- No external functions or sequences; relies on MySQL 8 features (ENUM, `FOR UPDATE`, auto‑increment). + +#### Cross-cutting +- **Concurrency control** – `SELECT … FOR UPDATE` on `product` ensures safe stock decrement. +- **Error handling** – procedure raises an error if SKU not found or stock insufficient. +- **Data integrity** – foreign keys enforce referential consistency; cascading delete from `customer_order` to `order_item`. +- **Performance** – indexes on `product.sku`, `customer_order.customer_id`, and composite PKs support efficient lookups. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..82c455aa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,43 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:12:12Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Keeps the warehouse inventory in sync with nightly supplier feeds, logging each run and handling inserts, updates, and errors. + +#### Purpose +- Aggregate supplier stock data into the warehouse inventory. +- Persist a log of each synchronization run. + +#### Responsibilities +- **Data ingestion**: read `SupplierFeed` rows since a given timestamp. +- **Inventory update**: merge aggregated quantities into `StockLevel`. +- **Audit trail**: record run metadata and error messages in `SyncLog`. + +#### Key units +- **`dbo.StockLevel`** – table holding current on‑hand quantities per warehouse and SKU. +- **`dbo.SupplierFeed`** – staging table for nightly supplier feed rows. +- **`dbo.SyncLog`** – audit table logging start time, row counts, and errors. +- **`dbo.usp_SyncStock`** – stored procedure orchestrating the sync: aggregates, merges, logs, and error handling. + +#### Data flow +1. Caller supplies `@Since` timestamp to `usp_SyncStock`. +2. Procedure aggregates `SupplierFeed` rows (`WarehouseId`, `Sku`, `Quantity`) received after `@Since`. +3. Aggregated rows are merged into `StockLevel`: existing rows are updated (`OnHand += Quantity`), new rows are inserted. +4. Counts of inserted and updated rows are captured. +5. A single row is inserted into `SyncLog` with start time, counts, and any error message. +6. Transaction commits; on failure, rollback and log error. + +#### Dependencies +- Internal tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. +- SQL Server system functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. + +#### Cross-cutting +- Uses a single transaction to ensure atomicity of merge and logging. +- Error handling captures `ERROR_MESSAGE()` and records it in `SyncLog`. +- T‑SQL `MERGE` pattern for upsert logic. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..6bf2fe3a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run3/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,74 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:10:49Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Synchronises nightly supplier stock feed into the warehouse inventory, recording changes and errors. + +#### Purpose +- Updates `StockLevel` with aggregated supplier quantities. +- Logs each sync run in `SyncLog`. + +#### Type +- **Table**: `dbo.StockLevel` (PostgreSQL dialect implied by T‑SQL syntax). +- **Table**: `dbo.SupplierFeed`. +- **Table**: `dbo.SyncLog`. +- **Procedure**: `dbo.usp_SyncStock` (T‑SQL). + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT (0)` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())` + - **PK**: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + - **PK**: `PK_SupplierFeed (FeedRowId)` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + - **PK**: `PK_SyncLog (SyncLogId)` + +#### Reads +- `dbo.SupplierFeed` (columns: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`). +- `dbo.StockLevel` (columns: `WarehouseId`, `Sku`, `OnHand`). + +#### Writes +- `dbo.StockLevel`: `INSERT` (new rows) and `UPDATE` (existing rows) via `MERGE`. +- `dbo.SyncLog`: `INSERT` (one row per sync run). + +#### Relationships +- None defined via foreign keys. + +#### Routine logic +- **Parameters**: `@Since DATETIME2(0)`. +- **Steps**: + 1. Capture start time `@Started`. + 2. Aggregate `SupplierFeed` rows received since `@Since` by `WarehouseId` and `Sku`. + 3. `MERGE` into `StockLevel`: + - `UPDATE` existing rows: `OnHand += Quantity`, `UpdatedAt = SYSUTCDATETIME()`. + - `INSERT` new rows: `OnHand = Quantity`. + 4. Record merge actions in table variable `@Changes`. + 5. Insert a log row into `SyncLog` with counts of inserts and updates. + 6. Commit transaction; on error rollback and log error. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/meta/gpt-oss-20b.json new file mode 100644 index 00000000..643f7b53 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:50:13Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 109.4, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 78.2, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 1.9, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:53:22Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 88281, + "cachedPromptTokens": 6592, + "completionTokens": 17678, + "seconds": 108.7284737 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.004947, + "costUsd": 0.002085, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..b625ea84 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,66 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T12:50:12Z +- T: 2026-11-04T12:50:14Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Evaluates and validates file‑matching conditions against file metadata, supporting logical combinators, size, line count, modification dates, extensions, and path glob patterns. + +#### Purpose +- Implements condition tree evaluation for file indexing. +- Validates condition syntax and bounds. +- Detects if line counting is required. + +#### Type +- `final class AiConditionEvaluator` + - extends `Object` + - annotations: none + - fields: `private static final String ERROR_ONE_BRANCH` + - methods: 10 (3 public, 7 private) + +#### Input +- `matches(AiCondition, AiFileContext)` – condition tree, file facts. +- `validate(AiCondition)` – condition tree. +- `usesLines(AiCondition)` – condition tree. +- `AiCondition` fields accessed: `and`, `or`, `not`, `extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, `pathGlob`. +- `AiFileContext` methods: `fileName()`, `sizeBytes()`, `lineCount()`, `lastModifiedEpochMilli()`, `relativePath()`. +- `AiRangeCondition` methods: `contains(long)`, `hasBound()`. +- `AiSourceExcludeFilter` constructor and `isExcluded(String)`. + +#### Output +- `matches` returns `boolean` indicating file matches condition. +- `validate` throws `IllegalArgumentException` on misconfiguration. +- `usesLines` returns `boolean` indicating line count needed. +- `parseEpochMilli` returns epoch milliseconds or throws `IllegalArgumentException`. +- `globMatches` returns `boolean`. +- `matchesExtension` returns `boolean`. + +#### Core logic +- `matches`: recursively evaluates `and`, `or`, `not` groups; otherwise checks leaf conditions: extensions, size, lines, modifiedAfter/Before, pathGlob. +- `validate`: ensures exactly one branch/leaf per node; validates groups, extensions list non‑empty, size/lines bounds, ISO‑8601 dates, non‑blank glob. +- `usesLines`: recursively checks for `lines` leaf; uses helper `anyUsesLines` on child lists. +- `validateGroup`: ensures group has at least one child; recursively validates each child. +- `branchCount`: counts non‑null branch/leaf fields in a node. +- `matchesExtension`: iterates extensions, checks `fileName.endsWith`. +- `globMatches`: creates `AiSourceExcludeFilter` with single glob, calls `isExcluded`. +- `parseEpochMilli`: parses ISO‑8601 instant to epoch milliseconds, throws `IllegalArgumentException` on parse error. + +#### Public API +- `matches(AiCondition, AiFileContext) -> boolean` – evaluate condition tree. +- `validate(AiCondition) -> void` – validate condition syntax. +- `usesLines(AiCondition) -> boolean` – detect line‑count requirement. + +#### Dependencies +- `java.time.Instant`, `java.time.format.DateTimeParseException`, `java.util.Collections`, `java.util.List`, `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`, `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `IllegalStateException` in `matches` when node has no branch/leaf. +- `IllegalArgumentException` in `validate` for: wrong branch count, empty extensions, missing size/lines bounds, invalid dates, blank glob. +- `IllegalArgumentException` in `parseEpochMilli` for invalid ISO‑8601 instant. + +#### Concurrency +- No explicit synchronization; all methods are stateless and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..6793a741 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,54 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T12:50:12Z +- T: 2026-11-04T12:50:19Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Holds a list of child conditions for an AI condition combinator. + +#### Purpose +- Stores child `AiCondition` objects for `` / `` combinators. +- Provides defensive copying of the list. + +#### Type +- `public class AiConditionGroup` + - Modifiers: public, final (implicit), no superclass. + - Field: `private @Nullable List conditions`. + - Constructor: `public AiConditionGroup()`. + - Methods: + - `public @Nullable List getConditions()`. + - `public void setConditions(final @Nullable Collection conditions)`. + +#### Input +- Constructor: none. +- `setConditions`: a `Collection` (nullable). + +#### Output +- `getConditions`: returns the internal `List` or `null`. +- `setConditions`: assigns a defensive copy of the input collection to `conditions`. + +#### Core logic +- `setConditions`: + - If input `conditions` is non‑null, create `new ArrayList<>(conditions)` and assign to field. + - Else assign `null` to field. + +#### Public API +- `getConditions() -> List` – retrieve child conditions. +- `setConditions(Collection) -> void` – set child conditions. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List`. +- `lombok.ToString`. +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.config.AiCondition`. + +#### Exceptions / Errors +- No checked exceptions thrown. +- No explicit null checks beyond defensive copying. + +#### Concurrency +- No synchronization; class is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..ec6f6ea3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,70 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T12:50:12Z +- T: 2026-11-04T12:50:21Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Computes deterministic, language‑agnostic fact counts from source text using regex counters. + +#### Purpose +- Generates a facts block summarizing exact counts of language constructs. +- Validates fact counter configurations. + +#### Type +- `final class AiFactExtractor` (class, final) + - No supertypes. + - Annotations: none. + +#### Input +- `factsBlock(List counters, String source)` + - `counters`: list of counters (may be null/empty). + - `source`: full source text. +- `validate(List counters)` + - `counters`: list of counters (may be null/empty). +- `countMatches(String pattern, String source)` + - `pattern`: regex string. + - `source`: text to search. + +#### Output +- `factsBlock` returns a string: `FACTS_HEADER + entries + FACTS_SUFFIX` or empty string. +- `validate` throws `IllegalArgumentException` on invalid counters. +- `countMatches` returns integer match count. + +#### Core logic +- `factsBlock` + - Skip null counters or those with null label/pattern. + - Append `ENTRY_SEPARATOR` between entries. + - For each counter: `label + LABEL_COUNT_SEPARATOR + countMatches(pattern, source)`. + - Prepend `FACTS_HEADER`, append `FACTS_SUFFIX`. +- `validate` + - For each counter: check non‑null label and pattern. + - Compile pattern with `Pattern.compile`; catch `PatternSyntaxException` and wrap in `IllegalArgumentException`. +- `countMatches` + - Compile pattern, create matcher, iterate `matcher.find()` counting matches. + +#### Public API +- `factsBlock(List counters, String source) -> String` – build facts block. +- `validate(List counters) -> void` – validate counters. +- `FACTS_HEADER: String` – facts header. +- `LABEL_COUNT_SEPARATOR: String` – label/count separator. +- `ENTRY_SEPARATOR: String` – entry separator. +- `FACTS_SUFFIX: String` – suffix after facts block. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiFactCounter` + +#### Exceptions / Errors +- `validate` throws `IllegalArgumentException` for missing label/pattern or invalid regex. +- `countMatches` may throw `PatternSyntaxException` if pattern compilation fails (handled in `validate`). + +#### Concurrency +- All methods are static and stateless; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..790240ed --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,57 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T12:50:12Z +- T: 2026-11-04T12:50:25Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> A mutable JavaBean that holds all AI‑generation parameters for a single model run, exposing getters and setters for each configurable option. + +#### Purpose +- Stores AI generation configuration (model path, sampling, prompt trimming, cache, GPU, provider, etc.). +- Serves as a data transfer object between Maven configuration and AI provider implementations. + +#### Type +- `public class AiGenerationConfig` + - Modifiers: `public` + - Annotations: `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`, `@ToString` + - Fields: 57 (including 2 lists, 1 calibration, 55 primitives/objects). + - No supertype. + +#### Input +- Constructor: no arguments, defaults applied. +- Setter methods for each field (e.g., `setModelPath(String)`, `setContextSize(int)`, `setTemperature(float)`, …). +- `setDrySequenceBreakers(List)`, `setStopStrings(List)`, `setCalibration(AiCalibration)`. + +#### Output +- Getter methods for each field (e.g., `getModelPath()`, `getContextSize()`, `isWarnOnTrim()`, …). +- `getDrySequenceBreakers()` and `getStopStrings()` return unmodifiable lists. +- `toString()` generated by Lombok for diagnostics. + +#### Core logic +- No complex algorithms; the class only stores and returns values. +- Default constants provide sensible initial values for all parameters. +- Setter methods perform minimal validation (e.g., `setLazyMode` ensures non‑null, `setDevices` handles null). +- `setCalibration` stores a per‑machine timing calibration object. + +#### Public API +- Constructors: `AiGenerationConfig()` (1). +- Getters (57): `getModelPath()`, `getContextSize()`, `getMaxOutputTokens()`, `getTemperature()`, `getThreads()`, `getCharsPerToken()`, `getMaxInputChars()`, `isWarnOnTrim()`, `getTopP()`, `getTopK()`, `getRepeatPenalty()`, `getMinP()`, `getTopNSigma()`, `getChatTemplateEnableThinking()`, `isCachePrompt()`, `isSwaFull()`, `getCacheReuse()`, `getGpuLayers()`, `getSeed()`, `getCpuMoeLayers()`, `getCpuFfnLayers()`, `getKvUnifiedPerSlot()`, `getLazyMode()`, `getRepeatLastN()`, `getCacheTypeK()`, `getCacheTypeV()`, `isFlashAttn()`, `getBatchSize()`, `getUbatchSize()`, `getThreadsBatch()`, `getMainGpu()`, `getDevices()`, `getProvider()`, `getRemoteModel()`, `getBaseUrl()`, `getApiKeyEnv()`, `getReasoningEffort()`, `getReasoningBudgetTokens()`, `getDryMultiplier()`, `getDryBase()`, `getDryAllowedLength()`, `getDryPenaltyLastN()`, `getDrySequenceBreakers()`, `getStopStrings()`, `getCalibration()`. +- Setters (57): `setModelPath(String)`, `setContextSize(int)`, `setMaxOutputTokens(int)`, `setTemperature(float)`, `setThreads(int)`, `setCharsPerToken(int)`, `setMaxInputChars(int)`, `setWarnOnTrim(boolean)`, `setTopP(float)`, `setTopK(int)`, `setRepeatPenalty(float)`, `setMinP(float)`, `setTopNSigma(float)`, `setChatTemplateEnableThinking(Boolean)`, `setCachePrompt(boolean)`, `setSwaFull(boolean)`, `setCacheReuse(int)`, `setGpuLayers(int)`, `setSeed(int)`, `setCpuMoeLayers(int)`, `setCpuFfnLayers(int)`, `setKvUnifiedPerSlot(int)`, `setLazyMode(String)`, `setRepeatLastN(int)`, `setCacheTypeK(String)`, `setCacheTypeV(String)`, `setFlashAttn(boolean)`, `setBatchSize(int)`, `setUbatchSize(int)`, `setThreadsBatch(int)`, `setMainGpu(int)`, `setDevices(String)`, `setProvider(String)`, `setRemoteModel(String)`, `setBaseUrl(String)`, `setApiKeyEnv(String)`, `setReasoningEffort(String)`, `setReasoningBudgetTokens(int)`, `setDryMultiplier(float)`, `setDryBase(float)`, `setDryAllowedLength(int)`, `setDryPenaltyLastN(int)`, `setDrySequenceBreakers(List)`, `setStopStrings(List)`, `setCalibration(AiCalibration)`. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCalibration` (used as a field type) + +#### Exceptions / Errors +- No explicit exceptions thrown. +- Null handling: fields annotated with `@Nullable`; setters replace null with defaults or empty collections. + +#### Concurrency +- No synchronization; intended for single‑threaded configuration usage. +- Immutable lists returned via `Collections.unmodifiableList`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..cfa7d8dc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,61 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T12:50:12Z +- T: 2026-11-04T12:50:34Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Defines how oversized source files are handled during routing. + +#### Purpose +- Enumerates strategies for processing source files that exceed the model’s context window. +- Provides default strategy and parsing from configuration. + +#### Type +- `public enum AiOversizeStrategy` + - Modifiers: `public` + - Supertypes: `java.lang.Enum` + - Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` + - Static field: `public static final AiOversizeStrategy DEFAULT = FAIL` + - Instance field: `private final String configValue` + - Constructor: `AiOversizeStrategy(String configValue)` + - Methods: + - `public String configValue()` – returns token + - `public static AiOversizeStrategy fromConfig(@Nullable String value)` – parses token + +#### Input +- Constructor parameter: `String configValue` per enum constant. +- `fromConfig` parameter: `@Nullable String value` (config token). + +#### Output +- `configValue()` returns the token string. +- `fromConfig` returns an `AiOversizeStrategy` or throws `IllegalArgumentException`. + +#### Core logic +- `fromConfig`: + 1. If `value` is `null` → return `DEFAULT`. + 2. Trim `value`; if empty → return `DEFAULT`. + 3. Iterate over `values()`; compare `strategy.configValue` case‑insensitively to trimmed token. + 4. Return matching strategy. + 5. If none match → throw `IllegalArgumentException` with message listing valid tokens. + +#### Public API +- `FAIL(String)` – abort build (default). +- `SAMPLE(String)` – trim head, single call. +- `MAP_REDUCE(String)` – chunk, summarize, combine. +- `DETERMINISTIC(String)` – emit deterministic body. +- `DEFAULT: AiOversizeStrategy` – default strategy. +- `configValue() -> String` – get config token. +- `fromConfig(@Nullable String) -> AiOversizeStrategy` – parse config token. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `fromConfig` when token is non‑blank and unrecognized. + +#### Concurrency +- Immutable enum; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..ec5ed10b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,128 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T12:50:12Z +- T: 2026-11-04T12:50:39Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Holds all mutable configuration needed to run a srcmorph AI generation job, exposed as a JavaBean for Maven, JSON/YAML, or programmatic use. + +#### Purpose +- Stores AI generation parameters, file selection rules, and model settings for a srcmorph run. +- Serves as the single shared config object for all binding surfaces. + +#### Type +- `public class SrcMorphConfiguration` + - Modifiers: public, final (implicitly), mutable JavaBean. + - Supertypes: none. + - Annotations: `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`, `@ToString`. + - Fields (23): + - `private File baseDirectory;` + - `private File outputDirectory = new File(DEFAULT_OUTPUT_DIRECTORY);` + - `private boolean force;` + - `private @Nullable List subtrees;` + - `private @Nullable List excludes;` + - `private @Nullable List fileExtensions;` + - `private long minFileSizeBytes;` + - `private long maxFileSizeBytes;` + - `private boolean planOnly;` + - `private String generationProvider = DEFAULT_GENERATION_PROVIDER;` + - `private @Nullable List promptDefinitions;` + - `private @Nullable List aiDefinitions;` + - `private @Nullable File modelDirectory;` + - `private @Nullable List fieldGenerations;` + - `private @Nullable List factDefinitions;` + - `private @Nullable String llamaModelPath;` + - `private int llamaContextSize = DEFAULT_LLAMA_CONTEXT_SIZE;` + - `private int llamaMaxOutputTokens = DEFAULT_LLAMA_MAX_OUTPUT_TOKENS;` + - `private float llamaTemperature = DEFAULT_LLAMA_TEMPERATURE;` + - `private int llamaThreads = DEFAULT_LLAMA_THREADS;` + - `private String pluginVersion = "";` + - `private String aiVersion = DEFAULT_AI_VERSION;` + - `private @Nullable String projectName;` + - Constants (7): `DEFAULT_OUTPUT_DIRECTORY`, `DEFAULT_GENERATION_PROVIDER`, `DEFAULT_LLAMA_CONTEXT_SIZE`, `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS`, `DEFAULT_LLAMA_TEMPERATURE`, `DEFAULT_LLAMA_THREADS`, `DEFAULT_AI_VERSION`. + +#### Input +- Constructor: none. +- Setters accept: `File`, `boolean`, `List`, `long`, `String`, `List`, `List`, `File`, `List`, `List`, `String`, `int`, `float`. +- No injected dependencies; all values are set via setters. + +#### Output +- Getters return the current field values. +- No state mutation beyond setters. +- No external resources written or read. + +#### Core logic +- None; the class is a pure data holder with getters and setters. + +#### Public API +- Constructor: `SrcMorphConfiguration() -> void` – creates defaults. +- Getters (23): + - `getBaseDirectory() -> File` – base project dir. + - `getOutputDirectory() -> File` – output dir for .ai.md. + - `isForce() -> boolean` – always regenerate flag. + - `getSubtrees() -> List` – source subdirs. + - `getExcludes() -> List` – exclude globs. + - `getFileExtensions() -> List` – file extensions. + - `getMinFileSizeBytes() -> long` – lower size bound. + - `getMaxFileSizeBytes() -> long` – upper size bound. + - `isPlanOnly() -> boolean` – stop after routing plan. + - `getGenerationProvider() -> String` – AI provider name. + - `getPromptDefinitions() -> List` – prompt templates. + - `getAiDefinitions() -> List` – model definitions. + - `getModelDirectory() -> File` – model path base. + - `getFieldGenerations() -> List` – routing rules. + - `getFactDefinitions() -> List` – reusable fact groups. + - `getLlamaModelPath() -> String` – fallback GGUF path. + - `getLlamaContextSize() -> int` – context window. + - `getLlamaMaxOutputTokens() -> int` – max tokens. + - `getLlamaTemperature() -> float` – sampling temperature. + - `getLlamaThreads() -> int` – CPU threads. + - `getPluginVersion() -> String` – generator version. + - `getAiVersion() -> String` – AI logic version. + - `getProjectName() -> String` – project title. +- Setters (23): + - `setBaseDirectory(File)` – set base dir. + - `setOutputDirectory(File)` – set output dir. + - `setForce(boolean)` – set regenerate flag. + - `setSubtrees(List)` – set subtrees. + - `setExcludes(List)` – set excludes. + - `setFileExtensions(List)` – set extensions. + - `setMinFileSizeBytes(long)` – set lower bound. + - `setMaxFileSizeBytes(long)` – set upper bound. + - `setPlanOnly(boolean)` – set plan‑only flag. + - `setGenerationProvider(String)` – set provider. + - `setPromptDefinitions(List)` – set prompts. + - `setAiDefinitions(List)` – set models. + - `setModelDirectory(File)` – set model dir. + - `setFieldGenerations(List)` – set routing rules. + - `setFactDefinitions(List)` – set fact groups. + - `setLlamaModelPath(String)` – set fallback model path. + - `setLlamaContextSize(int)` – set context size. + - `setLlamaMaxOutputTokens(int)` – set max tokens. + - `setLlamaTemperature(float)` – set temperature. + - `setLlamaThreads(int)` – set thread count. + - `setPluginVersion(String)` – set generator version. + - `setAiVersion(String)` – set AI logic version. + - `setProjectName(String)` – set project title. + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiModelDefinition` +- `net.ladenthin.srcmorph.config.AiFieldGenerationConfig` +- `net.ladenthin.srcmorph.config.AiFactDefinition` +- `net.ladenthin.srcmorph.config.AiGenerationConfig` (for `DEFAULT_LLAMA_THREADS`) + +#### Exceptions / Errors +- No explicit exceptions thrown. +- Nullability handled via `@Nullable` annotations; callers must check. + +#### Concurrency +- No synchronization; the bean is intended for single‑threaded configuration building. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..171feabb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,53 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T12:50:12Z +- T: 2026-11-04T12:52:03Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> A configuration‑driven AI‑generation framework that routes source files, evaluates file‑matching rules, extracts deterministic language facts, and supplies all parameters for model execution. + +#### Purpose +- Centralize AI generation settings for a Maven/CLI run. +- Provide file‑selection logic and fact extraction for source‑to‑AI pipelines. + +#### Responsibilities +- **Configuration Management** – `SrcMorphConfiguration` aggregates all runtime options (directories, file filters, model specs, prompt templates, fact groups, Llama settings). +- **Condition Evaluation** – `AiConditionEvaluator` validates and evaluates logical file‑matching trees (`AiCondition`, `AiConditionGroup`). +- **Fact Extraction** – `AiFactExtractor` builds deterministic fact blocks from source text using regex counters. +- **Oversize Handling** – `AiOversizeStrategy` defines how to process files that exceed the model’s context window. +- **Generation Parameters** – `AiGenerationConfig` holds per‑run model and sampling options. + +#### Key units +- `SrcMorphConfiguration` – mutable bean for Maven/CLI configuration. +- `AiConditionEvaluator` – stateless evaluator/validator for `AiCondition` trees. +- `AiConditionGroup` – container for child conditions in `/` combinators. +- `AiFactExtractor` – static utility to produce fact blocks from source. +- `AiOversizeStrategy` – enum of oversize strategies (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`). +- `AiGenerationConfig` – JavaBean with 57 fields for model, sampling, caching, and provider settings. + +#### Data flow +1. **Configuration**: `SrcMorphConfiguration` is populated via Maven/CLI or programmatically. +2. **File Selection**: `AiConditionEvaluator` receives an `AiCondition` tree and `AiFileContext` for each source file, returning a boolean match. +3. **Fact Generation**: For matched files, `AiFactExtractor.factsBlock` produces a deterministic facts block from the source text. +4. **Oversize Decision**: `AiOversizeStrategy.fromConfig` selects a strategy based on config; the routing logic (outside this package) applies it. +5. **Model Invocation**: `AiGenerationConfig` supplies all parameters to the chosen AI provider for prompt generation and response handling. + +#### Dependencies +- **Internal**: `AiCondition`, `AiConditionGroup`, `AiFileContext`, `AiSourceExcludeFilter`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`. +- **External**: `java.time.Instant`, `java.util.regex`, `org.jspecify.annotations.Nullable`, Lombok (`@ToString`), and standard Java collections. + +#### Cross-cutting +- Defensive copying in `AiConditionGroup.setConditions`. +- Validation of condition syntax and regex patterns in `AiConditionEvaluator.validate` and `AiFactExtractor.validate`. +- Thread‑safe, stateless utilities (`AiConditionEvaluator`, `AiFactExtractor`). +- Immutable enums (`AiOversizeStrategy`). +- Mutable JavaBeans (`SrcMorphConfiguration`, `AiGenerationConfig`) expose getters/setters; lists returned are unmodifiable where appropriate. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..0e0fc87d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,58 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T12:50:13Z +- T: 2026-11-04T12:52:31Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A framework that orchestrates AI‑driven code generation by selecting source files, extracting deterministic facts, and delegating prompt execution to configurable local or cloud providers. + +#### Purpose +- Centralize AI‑generation configuration for Maven/CLI workflows. +- Provide a pluggable provider system that supports llama.cpp, OpenAI‑compatible APIs, and mocks. + +#### Responsibilities +- **Configuration & Fact Extraction** – `SrcMorphConfiguration`, `AiConditionEvaluator`, `AiFactExtractor`, `AiOversizeStrategy`. +- **Provider Abstraction & Factory** – `AiGenerationProvider`, `AiGenerationProviderFactory`. +- **Local Inference** – `LlamaCppJniAiGenerationProvider`, `LlamaCppJniConfig`. +- **OpenAI Compatibility** – `OpenAiCompatibleProviderSupport`. +- **Response Handling** – `AiCompletionParser`. + +#### Key units +- `SrcMorphConfiguration` – mutable bean holding directories, filters, model specs, prompt templates, fact groups, and llama settings. +- `AiConditionEvaluator` – stateless validator/evaluator for file‑matching trees (`AiCondition`, `AiConditionGroup`). +- `AiFactExtractor` – static utility that builds deterministic fact blocks from source text via regex counters. +- `AiOversizeStrategy` – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`) controlling oversized‑file handling. +- `AiGenerationProvider` – interface exposing `generate`, `generateWithTimings`, `close`. +- `AiGenerationProviderFactory` – resolves provider keys and instantiates the appropriate provider. +- `LlamaCppJniAiGenerationProvider` – lazy‑loaded llama.cpp JNI provider that runs chat completions, parses responses, and reports metrics. +- `LlamaCppJniConfig` – immutable 37‑parameter config with a fluent builder for llama.cpp tuning. +- `OpenAiCompatibleProviderSupport` – builds request bodies, validates endpoints, retrieves API keys, and formats errors/timings. +- `AiCompletionParser` – strips Gemma‑4 thinking blocks from raw completions. + +#### Data flow +1. **Configuration** – `SrcMorphConfiguration` is populated via Maven/CLI or programmatically. +2. **File Selection** – `AiConditionEvaluator` evaluates an `AiCondition` tree against each `AiFileContext`; matched files proceed. +3. **Fact Generation** – `AiFactExtractor.factsBlock` produces a deterministic facts block from the source. +4. **Oversize Decision** – `AiOversizeStrategy.fromConfig` selects a strategy; routing logic applies it. +5. **Prompt Assembly** – `AiPromptSupport` (internal) supplies system/user messages. +6. **Provider Selection** – `AiGenerationProviderFactory.effectiveProvider` chooses a key; `create` instantiates the provider. +7. **Generation** – + - *Local*: `LlamaCppJniAiGenerationProvider.generate` calls `model.chatComplete`, parses `ChatResponse`, strips thinking blocks, logs cache reuse, and returns text. + - *OpenAI*: provider builds request body via `OpenAiCompatibleProviderSupport`, sends it, parses the response similarly. +8. **Timing & Metrics** – `generateWithTimings` captures token counts, TPS, and decode rates. +9. **Cleanup** – `close` releases native resources. + +#### Dependencies +- **Internal** – `AiCondition`, `AiConditionGroup`, `AiFileContext`, `AiSourceExcludeFilter`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`, `AiPromptSupport`, `Java8CompatibilityHelper`, `MockAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`. +- **External** – `net.ladenthin.llama` (model, parameters, JSON), `com.fasterxml.jackson.databind` (JSON), Lombok, `org.jspecify`, standard Java (`java.time`, `java.util`, `java.io`, `java.net`). + +#### Cross-cutting +- **Immutability & Thread Safety** – `LlamaCppJniConfig`, provider support classes, and `AiOversizeStrategy` are immutable; providers are stateless except for lazy `LlamaModel`. +- **Error Handling** – `AiCompletionParser` throws `IOException` on truncated blocks; `OpenAiCompatibleProviderSupport` throws `IllegalArgumentException` for bad URLs and `IOException` for key/host issues. +- **Timing & Logging** – `AiGenerationTimings` captures prompt/cache tokens, TPS, and decode rates; providers log cache reuse and truncated answers. +- **Configuration Knobs** – `LlamaCppJniConfig` exposes 37 tunable parameters (threads, GPU layers, cache types, DRY settings, etc.) for fine‑grained inference control. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..f10a22f5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,57 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T12:50:12Z +- T: 2026-11-04T12:50:50Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Parses raw LLM completion text to strip Gemma‑4 thinking blocks and return the model’s answer. + +#### Purpose +- Removes internal reasoning from Gemma‑4 completions. +- Validates presence of closing marker; throws if truncated. + +#### Type +- `public class AiCompletionParser` + - Modifiers: public + - Annotations: `@ToString` + - Supertypes: none + - Fields: + - `public static final String THINKING_BLOCK_START_MARKER` + - `public static final String THINKING_BLOCK_END_MARKER` + - Methods: + - `public AiCompletionParser()` – no‑op constructor + - `public String parseCompletion(final String response) throws IOException` + +#### Input +- `parseCompletion` parameter: `String response` (may be `null`). + +#### Output +- Returns `String` – cleaned answer, never `null`. +- Throws `IOException` if a start marker is present but no end marker. + +#### Core logic +- If `response` is `null`, return `""`. +- Trim `response` → `trimmed`. +- If `trimmed` does not start with `THINKING_BLOCK_START_MARKER`, return `trimmed`. +- Extract substring after start marker → `thinking`. +- Find first occurrence of `THINKING_BLOCK_END_MARKER` in `thinking` → `thinkingEnd`. +- If `thinkingEnd < 0`, throw `IOException` with message indicating truncated block and response length. +- Return substring of `thinking` after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` – constructs parser. +- `String parseCompletion(final String response) throws IOException` – strips leading thinking block. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` when a start marker is found but no end marker is present. + +#### Concurrency +- No concurrency constructs; class is stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..9eb5065c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,52 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T12:50:12Z +- T: 2026-11-04T12:50:53Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides an interface for AI text generation backends, exposing generation and optional timing metrics. + +#### Purpose +- Declares contract for AI text generation providers. +- Supplies default timing wrapper for calibration. + +#### Type +- `public interface AiGenerationProvider extends AutoCloseable` + - Methods: `String generate(AiGenerationRequest) throws IOException`, `AiGenerationTimings generateWithTimings(AiGenerationRequest) throws IOException`, `void close() throws IOException`. + - Default implementation of `generateWithTimings` returns `AiGenerationTimings` with zeroed metrics. + - Default implementation of `close` does nothing. + +#### Input +- `AiGenerationRequest request` parameter to `generate` and `generateWithTimings`. +- `AiGenerationRequest` contains prompt key, source file, source text, current header. + +#### Output +- `String` from `generate`; never `null`, may be blank. +- `AiGenerationTimings` from `generateWithTimings`; contains generated text and timing metrics (rates default to 0). +- `close` has no return. + +#### Core logic +- `generate(request)` – abstract; provider implements text generation. +- `generateWithTimings(request)` – default: calls `generate(request)` and constructs `AiGenerationTimings(generate(request), 0, 0, 0.0d, 0, 0.0d)`. +- `close()` – default: empty body. + +#### Public API +- `generate(AiGenerationRequest) -> String` – generate text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – generate text with timings. +- `close() -> void` – close resources. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.document.AiGenerationTimings` + +#### Exceptions / Errors +- `generate` and `generateWithTimings` declare `throws IOException`. +- No other exceptions. + +#### Concurrency +- No explicit concurrency constructs; interface is stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..074d99c3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,68 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T12:50:12Z +- T: 2026-11-04T12:50:55Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Instantiates AI generation providers based on a provider key or model configuration. + +#### Purpose +- Selects an `AiGenerationProvider` implementation by name or model configuration. +- Provides a default mock provider when no key is supplied. + +#### Type +- `public class AiGenerationProviderFactory` + - Modifiers: public, final (implicit), @ToString + - Supertype: `Object` + - Fields: + - `private final Java8CompatibilityHelper compatibilityHelper` – helper for blank checks + - Methods: + - `public AiGenerationProviderFactory()` – no‑op constructor + - `public static @Nullable String effectiveProvider(String runProvider, String modelProvider)` – resolves provider key + - `public AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` – factory method + +#### Input +- `providerName` (String) – run‑level provider key, may be null or blank. +- `llamaConfig` (`LlamaCppJniConfig`) – model configuration, provides `provider()` method. +- `promptSupport` (`AiPromptSupport`) – lookup support for providers that need it. + +#### Output +- Returns an instance of `AiGenerationProvider`: + - `MockAiGenerationProvider` when key is blank or `PROVIDER_MOCK`. + - `LlamaCppJniAiGenerationProvider` when key is `PROVIDER_LLAMACPP_JNI`. + - `OpenAiCompatibleAiGenerationProvider` when key is `PROVIDER_OPENAI_COMPATIBLE`. +- Throws `IllegalArgumentException` for unknown keys. + +#### Core logic +- `effectiveProvider` trims `modelProvider`; if empty, returns `runProvider`. +- `create` calls `effectiveProvider` to get `effective`. +- If `effective` is null or blank, instantiate `MockAiGenerationProvider`. +- Switch on `effective`: + - `PROVIDER_MOCK` → `MockAiGenerationProvider()` + - `PROVIDER_LLAMACPP_JNI` → `LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)` + - `PROVIDER_OPENAI_COMPATIBLE` → `OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)` + - default → `IllegalArgumentException("Unsupported AI provider: " + effective)` + +#### Public API +- `effectiveProvider(String, String) -> String?` – resolves provider key. +- `create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider` – creates provider instance. + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.provider.MockAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.OpenAiCompatibleAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniConfig` + +#### Exceptions / Errors +- `IllegalArgumentException` when provider key is unrecognised. + +#### Concurrency +- No explicit synchronization; instance fields are immutable after construction. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..22c5e432 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,92 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T12:50:12Z +- T: 2026-11-04T12:51:04Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides local AI generation by loading a GGUF model via llama.cpp and executing chat completions. + +#### Purpose +- Lazily loads a GGUF model for inference. +- Executes chat completions and parses responses. +- Supplies timing metrics and handles resource cleanup. + +#### Type +- `final class LlamaCppJniAiGenerationProvider` + *implements* `AiGenerationProvider`, `AutoCloseable` + *extends* none + *annotations*: `@ToString` + *fields*: + - `private final LlamaCppJniConfig config` (final) + - `@ToString.Exclude private @Nullable LlamaModel model` (nullable) + - `private final AiPromptSupport promptSupport` (final) + - `@ToString.Exclude private final LlamaCppJniProviderSupport support` (final) + - `private final AiCompletionParser completionParser` (final) + - `private final ChatResponseParser chatResponseParser` (final) + - `private final Java8CompatibilityHelper compatibilityHelper` (final) + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` accept `AiGenerationRequest`. +- `chatResponse(AiGenerationRequest request)` uses `support.buildInferenceParameters(request)` and `model().chatComplete(...)`. + +#### Output +- `generate` returns `String` (parsed completion). +- `generateWithTimings` returns `AiGenerationTimings` (text, prompt tokens, cache tokens, prompt TPS, predicted tokens, predicted TPS). +- `close` releases native `LlamaModel` resources. + +#### Core logic +- `model()` lazily constructs `LlamaModel`: + - Builds `chatTemplateKwargs` via `support.buildChatTemplateKwargs()`. + - Configures `ModelParameters` with model path, context size, threads, reasoning format, chat template kwargs. + - Applies optional settings: SWA full, cache reuse, GPU layers, CPU MoE layers, CPU FFN layers, KV unified per slot, lazy mode, flash attention, cache type K/V, batch sizes, main GPU, devices. + - Instantiates `new LlamaModel(modelParameters)` and caches it. +- `generate(request)`: + - Calls `chatResponse(request)` → parses full chat response. + - Warns on truncated answer via `support.warnOnTruncatedAnswer`. + - Logs prompt cache reuse via `support.logPromptCacheReuse`. + - Parses completion text with `completionParser.parseCompletion`. +- `chatResponse(request)`: + - Calls `chatResponseParser.parseResponse(model().chatComplete(support.buildInferenceParameters(request)))`. +- `generateWithTimings(request)`: + - Obtains `ChatResponse` via `chatResponse`. + - Extracts text, timings; if null, returns zeroed metrics. + - Returns `AiGenerationTimings` with promptN, cacheN, promptPerSecond, predictedN, predictedPerSecond. +- `close()`: + - If `model` is non‑null, calls `current.close()`. + +#### Public API +- `generate(AiGenerationRequest request) -> String` – produce completion text. +- `generateWithTimings(AiGenerationRequest request) -> AiGenerationTimings` – produce completion text with metrics. +- `close() -> void` – release native resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.args.FlashAttn` +- `net.ladenthin.llama.args.ReasoningFormat` +- `net.ladenthin.llama.json.ChatResponseParser` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.ChatResponse` +- `net.ladenthin.llama.value.Timings` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `java.io.IOException` +- `java.util.Map` +- `java.util.Objects` +- Lombok `@ToString` + +#### Exceptions / Errors +- Constructor throws `NullPointerException` if `config` or `promptSupport` is null. +- `generate` declares `throws IOException` (though underlying chat path throws unchecked). +- `generateWithTimings` does not throw checked exceptions. +- `close` handles null model gracefully. + +#### Concurrency +- No explicit synchronization; `model()` is not thread‑safe for concurrent first‑use; callers should ensure single‑threaded initialization or external locking. +- Native `LlamaModel` operations are assumed thread‑safe per library contract. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..77d76954 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,105 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T12:50:13Z +- T: 2026-11-04T12:51:09Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds an immutable configuration for llama.cpp JNI provider, exposing all runtime knobs and defaults for model execution. + +#### Purpose +- Holds 37 configuration parameters for llama.cpp JNI provider. +- Provides fluent builder with defaults from `AiGenerationConfig`. +- Supplies read‑only accessors for each parameter. + +#### Type +- `final class LlamaCppJniConfig` (class, final) + - Extends `Object`. + - Annotations: `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. + - Fields: 37 private final fields (see below). +- `public static final class Builder` (class, final) + - No supertype beyond `Object`. + - Fields: 37 mutable fields matching config, plus `modelPath` final. + - Methods: 37 setters, `build()`. + +#### Input +- `Builder(String modelPath)` requires non‑null `modelPath`. +- Setter methods accept primitive or object values, many with defaults from `AiGenerationConfig`. +- `drySequenceBreakers` and `stopStrings` accept `List` (may be null → empty list). + +#### Output +- `LlamaCppJniConfig` immutable instance with all fields set from builder. +- Accessor methods return primitive or immutable views (`Collections.unmodifiableList` for lists). + +#### Core logic +- `private LlamaCppJniConfig(Builder)` copies each builder field to the corresponding final field. +- `Builder.build()` creates a new `LlamaCppJniConfig(this)`. +- Setter methods assign the provided value to the builder field and return `this`. +- `lazyMode`, `cacheTypeK`, `cacheTypeV`, `devices`, `provider`, `remoteModel`, `baseUrl`, `apiKeyEnv`, `reasoningEffort` replace null with default constants from `AiGenerationConfig`. +- `drySequenceBreakers` and `stopStrings` replace null with `Collections.emptyList()`. + +#### Public API +- `static Builder builder(String modelPath)` → `Builder` (requires non‑null). +- `String modelPath()` → model file path. +- `int contextSize()` → context window size. +- `int maxOutputTokens()` → max output tokens. +- `float temperature()` → sampling temperature. +- `int threads()` → CPU threads. +- `float topP()` → nucleus‑sampling threshold. +- `int topK()` → top‑k limit. +- `float minP()` → min‑p threshold. +- `float topNSigma()` → top‑n‑sigma threshold. +- `float repeatPenalty()` → repetition penalty. +- `@Nullable Boolean chatTemplateEnableThinking()` → chat‑template thinking flag. +- `boolean cachePrompt()` → prompt caching enabled. +- `boolean swaFull()` → full‑size SWA cache kept. +- `int cacheReuse()` → KV prefix‑reuse chunk size. +- `int gpuLayers()` → GPU layers offloaded. +- `int seed()` → RNG seed. +- `int cpuMoeLayers()` → CPU MoE layers. +- `int cpuFfnLayers()` → CPU FFN layers. +- `int kvUnifiedPerSlot()` → per‑slot KV context cap. +- `String lazyMode()` → tensor‑read laziness. +- `int repeatLastN()` → repeat‑penalty window. +- `String cacheTypeK()` → KV‑cache data type for K. +- `String cacheTypeV()` → KV‑cache data type for V. +- `boolean flashAttn()` → Flash Attention enabled. +- `int batchSize()` → logical batch size. +- `int ubatchSize()` → physical batch size. +- `int threadsBatch()` → batch/prompt‑processing threads. +- `int mainGpu()` → primary GPU index. +- `String devices()` → device selection. +- `String provider()` → AI provider. +- `String remoteModel()` → remote model ID. +- `String baseUrl()` → OpenAI‑compatible base URL. +- `String apiKeyEnv()` → API key environment variable name. +- `String reasoningEffort()` → reasoning‑effort value. +- `int reasoningBudgetTokens()` → reasoning token budget. +- `float dryMultiplier()` → DRY multiplier. +- `float dryBase()` → DRY base. +- `int dryAllowedLength()` → DRY allowed length. +- `int dryPenaltyLastN()` → DRY penalty look‑back. +- `List drySequenceBreakers()` → unmodifiable list of DRY sequence breakers. +- `List stopStrings()` → unmodifiable list of stop strings. + +Builder setters (public, return `Builder`): +- `contextSize(int)`, `maxOutputTokens(int)`, `temperature(float)`, `threads(int)`, `topP(float)`, `topK(int)`, `minP(float)`, `topNSigma(float)`, `repeatPenalty(float)`, `chatTemplateEnableThinking(Boolean)`, `cachePrompt(boolean)`, `swaFull(boolean)`, `cacheReuse(int)`, `gpuLayers(int)`, `seed(int)`, `cpuMoeLayers(int)`, `cpuFfnLayers(int)`, `kvUnifiedPerSlot(int)`, `lazyMode(String)`, `repeatLastN(int)`, `cacheTypeK(String)`, `cacheTypeV(String)`, `flashAttn(boolean)`, `batchSize(int)`, `ubatchSize(int)`, `threadsBatch(int)`, `mainGpu(int)`, `devices(String)`, `provider(String)`, `remoteModel(String)`, `baseUrl(String)`, `apiKeyEnv(String)`, `reasoningEffort(String)`, `reasoningBudgetTokens(int)`, `dryMultiplier(float)`, `dryBase(float)`, `dryAllowedLength(int)`, `dryPenaltyLastN(int)`, `drySequenceBreakers(List)`, `stopStrings(List)`. +- `build()` → `LlamaCppJniConfig`. + +#### Dependencies +- `java.util.Collections`, `java.util.List`, `java.util.Objects`. +- `lombok.EqualsAndHashCode`, `lombok.ToString`. +- `net.ladenthin.srcmorph.config.AiGenerationConfig`. +- `net.ladenthin.srcmorph.support.ConvertToRecord`. +- `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `Objects.requireNonNull` throws `NullPointerException` if `modelPath` is null. +- No other explicit exceptions. + +#### Concurrency +- Builder is not thread‑safe; intended for single‑thread use. +- `LlamaCppJniConfig` is immutable and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..9b8a512f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,129 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T12:50:13Z +- T: 2026-11-04T12:51:17Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds the JSON request, endpoint, API key handling, and error/timing logic for an OpenAI‑compatible chat‑completion provider. + +#### Purpose +- Constructs request bodies for chat‑completion calls. +- Validates and builds endpoint URLs. +- Retrieves and secures API keys. +- Generates error messages and timing metrics. + +#### Type +- `final class OpenAiCompatibleProviderSupport` + - extends `Object` + - annotations: `@ToString` + - fields: + - `static final String CHAT_COMPLETIONS_PATH` – endpoint suffix + - `static final int ERROR_BODY_EXCERPT` – error body limit + - `private static final int HTTP_OK_FIRST` – success start + - `private static final int HTTP_OK_END` – success end + - `static final String HTTP_SCHEME` – http prefix + - `static final String HTTPS_SCHEME` – https prefix + - `private static final String LOOPBACK_HOST_NAME` – localhost + - `private static final Pattern IPV4_LOOPBACK` – IPv4 loopback regex + - `private static final String IPV6_LOOPBACK` – IPv6 loopback + - `private static final String ELLIPSIS` – ellipsis marker + - `private static final ObjectMapper MAPPER` – JSON mapper + - `private final LlamaCppJniConfig config` – model config + - `@ToString.Exclude private final AiPromptSupport promptSupport` – prompt helper + - `@ToString.Exclude private final Function environment` – env lookup + - `private final Java8CompatibilityHelper compatibilityHelper` – null/blank checks + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, `Function environment`. +- `requestBody(AiGenerationRequest request)` consumes `AiGenerationRequest` fields: `promptKey()`, `sourceFile()`, `sourceText()`. +- `endpoint()` reads `config.baseUrl()`. +- `apiKey()` reads `config.apiKeyEnv()` and `environment.apply(...)`. +- `apiKeyFor(String endpoint)` reads `endpoint` and `apiKey()`. +- `isLoopbackHost(String host)` reads `host`. +- `isSuccess(int status)` reads `status`. +- `errorMessage(String endpoint, int status, String body)` reads all three. +- `timings(String text, ChatResponse response, double seconds)` reads `response.getUsage()`. + +#### Output +- `requestBody` returns JSON string. +- `endpoint` returns full URL string. +- `apiKey` returns trimmed key or `null`. +- `apiKeyFor` returns key or `null`; may throw `IOException`. +- `isLoopbackHost` returns boolean. +- `isSuccess` returns boolean. +- `errorMessage` returns formatted string. +- `timings` returns `AiGenerationTimings` instance. + +#### Core logic +- **requestBody** + - Create `ObjectNode body`. + - Add `"model"` if `config.remoteModel()` non‑blank. + - Build `"messages"` array with system and user messages from `promptSupport`. + - Set `"max_tokens"`, `"temperature"`, `"top_p"`. + - Conditionally add `"top_k"`, `"min_p"`, `"seed"`, `"stop"` array, `"reasoning.effort"`. + - Set `"repetition_penalty"` and `"stream"`. + - Serialize with `MAPPER.writeValueAsString(body)`. + +- **endpoint** + - Trim `config.baseUrl()`. + - Validate starts with `http://` or `https://`. + - Strip trailing slashes. + - Append `CHAT_COMPLETIONS_PATH`. + +- **apiKey** + - Return `null` if `config.apiKeyEnv()` blank. + - Lookup env var; return trimmed key or `null` if unset/blank. + +- **apiKeyFor** + - If key absent or endpoint not `http://`, return key. + - Parse host from `endpoint`. + - If host not loopback (`isLoopbackHost`), throw `IOException`. + - Return key. + +- **isLoopbackHost** + - Return true if host equals `localhost`, matches `IPV4_LOOPBACK`, or equals `IPV6_LOOPBACK`. + +- **isSuccess** + - Return true if status in [200,300). + +- **errorMessage** + - Truncate body to `ERROR_BODY_EXCERPT` with ellipsis if needed. + - Return formatted string. + +- **timings** + - Extract `completionTokens`, `promptTokens`, `cachedTokens` from `response.getUsage()`. + - Compute `decodeRate = completionTokens / seconds` if seconds > 0. + - Return new `AiGenerationTimings(text, promptTokens, cachedTokens, 0.0, completionTokens, decodeRate)`. + +#### Public API +- `String requestBody(AiGenerationRequest request) -> request body` +- `String endpoint() -> chat‑completions URL` +- `@Nullable String apiKey() -> API key` +- `@Nullable String apiKeyFor(String endpoint) -> key or null` +- `static boolean isLoopbackHost(String host) -> loopback check` +- `static boolean isSuccess(int status) -> success check` +- `static String errorMessage(String endpoint, int status, String body) -> message` +- `static AiGenerationTimings timings(String text, ChatResponse response, double seconds) -> timings` + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper`, `ArrayNode`, `ObjectNode` +- `java.io.IOException`, `java.net.URL`, `java.util.List`, `java.util.Objects`, `java.util.function.Function`, `java.util.regex.Pattern` +- `lombok.ToString` +- `net.ladenthin.llama.value.ChatResponse`, `Usage` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` in `endpoint()` if baseUrl not http(s). +- `IOException` in `apiKeyFor()` if plain http to non‑loopback host or URL parsing fails. +- `IOException` in `requestBody()` if JSON serialization fails. + +#### Concurrency +- No explicit synchronization; all fields are immutable after construction. +- Thread‑safe usage of `ObjectMapper` (thread‑safe after configuration). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..abf7c73b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,63 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T12:50:13Z +- T: 2026-11-04T12:52:08Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> A lightweight, configurable AI‑generation framework that supports local llama.cpp inference, OpenAI‑compatible APIs, and mock providers, with robust request parsing, timing, and error handling. + +#### Purpose +- Provide a unified interface for generating text from various AI backends. +- Offer a pluggable factory to select providers by key or configuration. +- Enable local inference via llama.cpp JNI with fine‑grained tuning. +- Support OpenAI‑compatible chat completions with secure API key handling. +- Strip internal reasoning blocks from Gemma‑4 responses. + +#### Responsibilities +- **Provider abstraction** – `AiGenerationProvider` defines generation and timing contracts. +- **Factory & selection** – `AiGenerationProviderFactory` resolves provider names and creates instances. +- **Local inference** – `LlamaCppJniAiGenerationProvider` loads a GGUF model, runs chat completions, parses responses, and reports metrics. +- **Configuration** – `LlamaCppJniConfig` holds all runtime knobs for llama.cpp and exposes a fluent builder. +- **OpenAI compatibility** – `OpenAiCompatibleProviderSupport` builds request bodies, validates endpoints, retrieves API keys, and formats errors/timings. +- **Response parsing** – `AiCompletionParser` removes Gemma‑4 thinking blocks from raw completions. + +#### Key units +- `AiGenerationProvider` (interface) – `generate`, `generateWithTimings`, `close`. +- `AiGenerationProviderFactory` – `effectiveProvider`, `create`. +- `LlamaCppJniAiGenerationProvider` – lazy model loading, `generate`, `generateWithTimings`, `close`. +- `LlamaCppJniConfig` – immutable config with 37 parameters, `Builder`. +- `OpenAiCompatibleProviderSupport` – `requestBody`, `endpoint`, `apiKey`, `apiKeyFor`, `timings`. +- `AiCompletionParser` – `parseCompletion`. + +#### Data flow +1. **Request creation** – `AiPromptSupport` supplies system/user messages; `OpenAiCompatibleProviderSupport.requestBody` builds JSON. +2. **Endpoint resolution** – `OpenAiCompatibleProviderSupport.endpoint` validates and appends the chat‑completion path. +3. **API key handling** – `apiKey`/`apiKeyFor` fetch credentials from env or config. +4. **Provider selection** – `AiGenerationProviderFactory.effectiveProvider` chooses a key; `create` instantiates the appropriate provider. +5. **Generation** – + - *Local*: `LlamaCppJniAiGenerationProvider.generate` calls `model.chatComplete`, parses the `ChatResponse`, strips thinking blocks, logs cache reuse, and returns text. + - *OpenAI*: provider (not shown) would use the request body, endpoint, and key to call the API, then parse the response similarly. +6. **Timing** – `generateWithTimings` wraps generation, extracting token counts and rates from `ChatResponse` or defaults. +7. **Cleanup** – `close` releases native `LlamaModel` resources. + +#### Dependencies +- **Internal** – `AiPromptSupport`, `Java8CompatibilityHelper`, `MockAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`. +- **External** – `net.ladenthin.llama` (model, parameters, JSON parsing), `com.fasterxml.jackson.databind` (JSON), `lombok` (annotations), `org.jspecify` (nullable), `java.io`, `java.util`, `java.net`. +- **Configuration** – `AiGenerationConfig` supplies defaults for `LlamaCppJniConfig`. + +#### Cross-cutting +- **Immutability** – `LlamaCppJniConfig` and provider support classes are immutable; builders are single‑threaded. +- **Error handling** – `AiCompletionParser` throws `IOException` on truncated blocks; `OpenAiCompatibleProviderSupport` throws `IllegalArgumentException` for bad URLs and `IOException` for key/host issues. +- **Timing metrics** – `AiGenerationTimings` captures prompt/cache tokens, TPS, and decode rates across providers. +- **Logging** – Providers log cache reuse and truncated answers (via `OpenAiCompatibleProviderSupport` helpers). +- **Thread safety** – Providers are stateless except for the lazy `LlamaModel`; callers must guard first‑use initialization. +- **Configuration knobs** – `LlamaCppJniConfig` exposes 37 tunable parameters (threads, GPU layers, cache types, DRY settings, etc.) for fine‑grained inference control. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..313b5491 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,49 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:51:50Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Computes a 256‑bin histogram of a byte stream in two OpenCL kernel passes. + +#### Purpose +- Builds a byte histogram for image or generic byte data. +- Uses two‑pass reduction: local partial histograms then global sum. + +#### Type +- OpenCL C 1.2 kernels (`__kernel` functions). + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms to `partial`. +- `histogram_reduce`: writes final histogram to `histogram`. + +#### Core logic +- **histogram_partial** + 1. Zero local bin array in parallel. + 2. Iterate over input bytes in strided global work‑items, atomically increment local bin counts. + 3. Write local bin counts to global `partial` buffer per group. +- **histogram_reduce** + 1. Each global work‑item handles one bin. + 2. Sum corresponding bin across all partial histograms. + 3. Store result in final `histogram`. + +#### Public API +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – compute per‑group partial histograms. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – reduce partials into final histogram. + +#### Constants and configuration +- `#define BINS 256` – number of histogram bins. + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier(CLK_LOCAL_MEM_FENCE)`. + +#### Exceptions / Errors +- None; kernels exit early if `bin >= BINS` in `histogram_reduce`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..78fe5a6c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,37 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:52:47Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes a 256‑bin histogram of a byte stream using two OpenCL kernel passes. + +#### Purpose +- Build a byte histogram for image or generic byte data. +- Perform two‑pass reduction: local partial histograms then global sum. + +#### Responsibilities +- **Partial histogram generation** – `histogram_partial` kernel creates per‑group local histograms. +- **Global reduction** – `histogram_reduce` kernel aggregates partials into the final 256‑bin histogram. + +#### Key units +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – computes per‑group partial histograms. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – reduces partials into the final histogram. +- `#define BINS 256` – constant defining histogram size. + +#### Data flow +1. Host copies input byte stream to device global memory. +2. `histogram_partial` runs: each work‑group builds a local histogram, writes it to `partial`. +3. `histogram_reduce` runs: each work‑item sums a specific bin across all partial histograms, writes the result to `histogram`. + +#### Dependencies +- OpenCL 1.2 built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier(CLK_LOCAL_MEM_FENCE)`. + +#### Cross-cutting +- Two‑stage reduction pattern (local partials → global sum). +- Atomic increments for thread‑safe bin updates. +- Fixed 256‑bin configuration via macro. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..97942415 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,54 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:52:56Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> A collection of utilities for efficient byte‑level data handling, a lock‑free ring buffer for streaming, and small backup/reporting scripts. + +#### Purpose +- Provide GPU‑accelerated byte histogram computation. +- Offer a lightweight, single‑producer/single‑consumer ring buffer. +- Supply shell/Python helpers for directory backups and sales reporting. + +#### Responsibilities +- **GPU kernels** – two‑pass histogram generation and reduction. +- **Ring buffer** – allocation, wrap‑around copy, capacity checks, metrics. +- **Scripts** – backup rotation, CSV parsing, revenue aggregation, CLI. + +#### Key units +- **kernels** + - `histogram_partial` – builds per‑group local 256‑bin histograms. + - `histogram_reduce` – aggregates partials into final histogram. + - `#define BINS 256` – histogram size constant. +- **ringbuf** + - `ringbuf_t` – buffer struct (`data`, `capacity`, `head`, `tail`). + - `ringbuf_status_t` – status enum (`OK`, `EINVAL`, `ENOMEM`). + - `ringbuf_init`, `ringbuf_free`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space`. +- **scripts** + - `rotate_backups.sh` – tar‑compresses directories, timestamps, prunes old archives. + - `sales_report.py` – `parse_orders`, `revenue_by_month_and_region`, `main`. + +#### Data flow +1. **Histogram** – host → device global memory → `histogram_partial` (local histograms) → `histogram_reduce` (final 256‑bin histogram). +2. **Ring buffer** – init allocates memory; producer writes via `ringbuf_write`; consumer reads via `ringbuf_read`; metrics derived from head/tail indices. +3. **Scripts** – backup: source → tar.gz → archive directory → prune; sales: CSV files → `Order` objects → filter by currency → aggregate by month/region → output TSV. + +#### Dependencies +- OpenCL 1.2 built‑ins for kernels. +- Standard C headers (`stddef.h`, `stdint.h`, `stdlib.h`, `string.h`) for ring buffer. +- Bash utilities (`tar`, `date`, etc.) for backup script. +- Python stdlib (`argparse`, `csv`, `collections`, `dataclasses`, `datetime`, `decimal`, `sys`) for sales report. + +#### Cross-cutting +- **Power‑of‑two sizing** – ring buffer capacity must be a power of two; modulo arithmetic (`& (capacity-1)`) for wrap‑around. +- **Two‑stage reduction** – kernels use local partials then global sum. +- **Error handling** – ring buffer returns status codes; scripts exit with specific codes or raise `ValueError`. +- **Thread safety** – ring buffer designed for single‑producer/single‑consumer; no locks. +- **UTC timestamps** – both scripts use UTC for consistency. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..089e60dd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,48 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:52:49Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> Provides a lock‑free, power‑of‑two sized byte ring buffer for single‑producer/single‑consumer scenarios. + +#### Purpose +- Offer a lightweight circular buffer for byte streams. +- Expose a C API for init, free, read, write, and space queries. + +#### Responsibilities +- **Buffer management** – allocate, deallocate, and maintain head/tail indices. +- **Data movement** – copy data into/out of the buffer with wrap‑around handling. +- **Capacity validation** – enforce power‑of‑two size and non‑zero capacity. +- **Metrics** – report used bytes and free space. + +#### Key units +- `ringbuf_t` – struct holding `data`, `capacity`, `head`, `tail`. +- `ringbuf_status_t` enum – `RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`. +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – allocate buffer, validate capacity. +- `ringbuf_free(ringbuf_t *rb)` – release allocated memory. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write up to `len` bytes. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read up to `len` bytes. +- `ringbuf_used(const ringbuf_t *rb)` – compute bytes currently stored. +- `ringbuf_free_space(const ringbuf_t *rb)` – compute available space. + +#### Data flow +1. **Initialization** – caller supplies `capacity`; `ringbuf_init` allocates `data` and sets indices. +2. **Writing** – producer calls `ringbuf_write`; function copies data in up to two contiguous chunks, updates `head`. +3. **Reading** – consumer calls `ringbuf_read`; function copies data in up to two contiguous chunks, updates `tail`. +4. **Metrics** – `ringbuf_used` and `ringbuf_free_space` derive values from `head`/`tail` modulo `capacity`. + +#### Dependencies +- Standard C headers: ``, ``, ``, ``. +- No external libraries; purely self‑contained. + +#### Cross-cutting +- **Power‑of‑two enforcement** – `is_power_of_two` helper ensures capacity validity. +- **Modulo arithmetic** – head/tail wrap using `& (capacity - 1)`. +- **Error handling** – `ringbuf_init` returns status codes; write/read return actual byte counts. +- **Thread safety** – designed for single‑producer/single‑consumer; no locks required. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..6f0aeb9b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,59 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:51:53Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Implements a fixed‑size circular buffer with power‑of‑two capacity. + +#### Purpose +- Provides a ring buffer for byte streams. +- Supports initialization, deallocation, read, write, and space queries. + +#### Type +- C source file (`ringbuf.c`) implementing functions for `ringbuf_t` defined in `ringbuf.h`. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity value. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_free` deallocates internal buffer. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates memory, sets head/tail to 0. +- `ringbuf_free` frees memory, resets fields. +- `ringbuf_used` computes used bytes via modulo arithmetic. +- `ringbuf_free_space` calculates available space. +- `ringbuf_write` copies up to two contiguous chunks to wrap around. +- `ringbuf_read` copies up to two contiguous chunks from buffer. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free resources. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – free capacity. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write data. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read data. + +#### Constants and configuration +- None defined in this file. + +#### Dependencies +- `stdlib.h` – `malloc`, `free`. +- `string.h` – `memcpy`. +- `ringbuf.h` – type and status definitions. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity not power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..d0c4fb52 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,59 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:51:55Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Provides a fixed‑size byte ring buffer for single‑producer/single‑consumer use. + +#### Purpose +- Implements a lock‑free circular buffer. +- Supports byte‑level read/write with capacity checks. + +#### Type +- Header (`ringbuf.h`) in C. +- Defines `ringbuf_t` struct, `ringbuf_status_t` enum, and public API functions. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes (must be power of two, >0). +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes actually written. +- `ringbuf_read` returns number of bytes actually read. +- `ringbuf_used` and `ringbuf_free_space` return current usage metrics. + +#### Core logic +- `ringbuf_init`: validates capacity, allocates `data` array, sets `head` and `tail` to 0. +- `ringbuf_write`: copies up to `len` bytes from `src` into buffer, respecting free space; updates `head`. +- `ringbuf_read`: copies up to `len` bytes from buffer into `dst`, respecting used space; updates `tail`. +- `ringbuf_used`: computes `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space`: computes `(capacity - 1) - ringbuf_used`. +- `ringbuf_free`: frees allocated `data`. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – release resources. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – available space. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- ``, `` for standard types. +- Uses `malloc`/`free` implicitly via `ringbuf_init`/`ringbuf_free`. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..e12cb325 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,47 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:52:52Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> A small utility package that backs up directories and produces monthly sales reports from CSV order exports. + +#### Purpose +- Provide a shell script to create timestamped tar.gz backups and prune old ones. +- Offer a Python tool to aggregate order revenue by month and region, filtered by currency and threshold. + +#### Responsibilities +- **Backup management**: directory validation, archive creation, retention policy. +- **Sales reporting**: CSV parsing, currency filtering, revenue aggregation, CLI interface. + +#### Key units +- `rotate_backups.sh` – Bash script that creates `"$BACKUP_DIR/${name}_.tar.gz"` and removes older archives beyond the configured `KEEP`. +- `sales_report.py` – Python module exposing + - `parse_orders(path, currency)` – yields `Order` dataclass instances from CSV. + - `revenue_by_month_and_region(orders)` – returns a sorted dict of `(YYYY‑MM, region) → Decimal` totals. + - `main(argv)` – CLI entry point that prints tab‑separated `monthregionrevenue currency`. + +#### Data flow +1. **Backup**: + - Input: source directory, backup directory, optional keep count. + - Process: validate, tar‑compress, timestamp, prune. + - Output: new archive file, optional deletion messages. + +2. **Sales report**: + - Input: list of CSV files, target currency, min revenue. + - Process: parse each CSV, filter by currency, aggregate by month/region. + - Output: printed report lines; exit status indicates success or no data. + +#### Dependencies +- Bash utilities: `tar`, `du`, `ls`, `date`. +- Python standard library: `argparse`, `csv`, `collections`, `dataclasses`, `datetime`, `decimal`, `sys`. + +#### Cross-cutting +- Both tools use UTC timestamps for consistency. +- Error handling is explicit: shell exits with `2` on validation errors; Python raises `ValueError` for malformed CSV data. +- Both provide clear, concise command‑line interfaces with helpful usage messages. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..4f428c8d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,59 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:51:58Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Creates a dated, compressed backup of a directory and prunes older archives to keep only the newest N. + +#### Purpose +- Backup a single directory. +- Keep only the most recent *N* archives. + +#### Type +- `bash` +- `set -euo pipefail` + +#### Input +- `$1` → `SOURCE_DIR` (required) +- `$2` → `BACKUP_DIR` (required) +- `$3` → `KEEP` (optional, defaults to `7`) + +#### Output +- Creates `"$BACKUP_DIR/${name}_.tar.gz"`. +- Deletes older archives beyond the newest `KEEP`. +- Prints creation and removal messages. +- Exits with status `0` on success, `2` on argument or validation errors. + +#### Core logic +- Validate `KEEP` is a positive integer. +- Ensure `SOURCE_DIR` exists; create `BACKUP_DIR`. +- Build archive name with UTC timestamp. +- Create temporary `.partial` tarball, then rename to final archive. +- List existing archives sorted newest first. +- Remove archives beyond the first `KEEP`. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR`=`"${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR`=`"${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP`=`"${3:-7}"` +- `name`=`"$(basename "$SOURCE_DIR")"` +- `archive`=`"$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp`=`"$archive.partial"` + +#### Dependencies +- `tar` (creates compressed archive) +- `du` (reports archive size) +- `ls` (lists existing archives) +- `date` (generates timestamp) + +#### Errors and exit codes +- `2` – missing arguments, invalid `KEEP`, or non‑existent `SOURCE_DIR`. +- `0` – successful backup and cleanup. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..c5808dbc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,58 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:52:00Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Generates a monthly sales report from CSV order exports, aggregating revenue by month and region in a specified currency. + +#### Purpose +- Aggregate order revenue per month and region. +- Filter by currency and minimum revenue threshold. + +#### Type +- Python script (`.py`). + +#### Input +- `csv_files`: list of CSV file paths (positional arguments). +- `--currency`: target currency code (default `EUR`). +- `--min-revenue`: minimum revenue to display (default `0`). +- CSV columns: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints tab‑separated lines: `monthregionrevenue currency`. +- Exits with status `0` on success, `1` if no orders found. + +#### Core logic +- `parse_orders(path, currency)`: + - Open CSV, validate required columns. + - Skip rows with non‑matching currency. + - Convert `order_date` to `date`, `amount` to `Decimal`. + - Yield `Order` dataclass instances. +- `revenue_by_month_and_region(orders)`: + - Sum `amount` per `(YYYY-MM, region)` key using `defaultdict`. + - Return sorted dictionary of totals. +- `main(argv)`: + - Parse CLI arguments. + - Collect orders from all files. + - If none, error message and exit `1`. + - Iterate sorted totals, print rows meeting `min_revenue`. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` – read and filter CSV orders. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` – aggregate totals. +- `main(argv=None) -> int` – command‑line entry point. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")`. + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` if CSV missing required columns or contains invalid data. +- `ValueError` propagated from `parse_orders` for malformed rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..7d0756f9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,46 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T12:50:13Z +- T: 2026-11-04T12:53:15Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A unified framework for AI‑driven code generation, data‑processing utilities, and domain‑specific database logic, all orchestrated to support Maven/CLI workflows, GPU‑accelerated analytics, and robust persistence across library, shop, and warehouse systems. + +#### Purpose +- Centralize AI‑generation configuration and execution for Maven/CLI workflows. +- Provide efficient byte‑level utilities (histograms, ring buffers) and helper scripts. +- Persist and enforce business rules for library loans, shop orders, and warehouse inventory. + +#### Responsibilities +- **AI Generation** – configuration, fact extraction, provider abstraction, local and cloud inference, response parsing. +- **Data Utilities** – GPU histogram kernels, lock‑free ring buffer, backup/reporting scripts. +- **Database Modules** – library cataloging & auditing, shop order processing, warehouse stock synchronization. + +#### Key units +- **Java AI** – `SrcMorphConfiguration`, `AiConditionEvaluator`, `AiFactExtractor`, `AiOversizeStrategy`, `AiGenerationProvider`, `AiGenerationProviderFactory`, `LlamaCppJniAiGenerationProvider`, `LlamaCppJniConfig`, `OpenAiCompatibleProviderSupport`, `AiCompletionParser`. +- **Other Utilities** – `histogram_partial`, `histogram_reduce`, `ringbuf_t`, `ringbuf_status_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read`, `rotate_backups.sh`, `sales_report.py`. +- **SQL Modules** – Library tables (`author`, `book`, `member`, `loan`, `loan_audit`) and functions (`fn_checkout_book`, `sp_return_book`, `fn_late_fee`); Shop tables (`product`, `customer_order`, `order_item`) and procedure (`add_order_item`); Warehouse tables (`dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`) and procedure (`dbo.usp_SyncStock`). + +#### Data flow +1. **AI Pipeline** – `SrcMorphConfiguration` → `AiConditionEvaluator` selects files → `AiFactExtractor` builds facts → oversize strategy applied → prompt assembled → `AiGenerationProviderFactory` selects provider → provider generates → `AiCompletionParser` cleans response → metrics recorded. +2. **Utility Flow** – Host data → GPU kernels (`histogram_partial` → `histogram_reduce`) → final histogram; ring buffer: init → write → read → metrics. +3. **Database Flow** – Library: checkout → update book copies → insert loan → audit; return → update loan → increment copies → audit. + Shop: add order item → lock product → adjust stock → recalc order total. + Warehouse: ingest supplier feed → `MERGE` into `StockLevel` → log in `SyncLog`. + +#### Dependencies +- **Internal** – AI: `AiCondition`, `AiFileContext`, `AiPromptSupport`, `MockAiGenerationProvider`; Utilities: ring buffer headers, OpenCL built‑ins; SQL: schema‑specific tables and functions. +- **External** – Java: `net.ladenthin.llama`, Jackson, Lombok, JSPECIFY; C: OpenCL 1.2, standard headers; Python: argparse, csv, collections; SQL: PostgreSQL, MySQL 8, SQL Server. + +#### Cross‑cutting +- **Immutability & Thread Safety** – `LlamaCppJniConfig`, provider factories, and ring buffer designed for lock‑free or stateless use. +- **Error Handling** – AI parsers throw IOExceptions; provider support validates URLs and keys; ring buffer returns status codes; SQL functions raise explicit errors for business rule violations. +- **Metrics & Logging** – AI timings (`AiGenerationTimings`), cache reuse logs, and database audit tables capture state changes. +- **Configuration Knobs** – `LlamaCppJniConfig` exposes 37 tuning parameters; AI fact extraction uses regex counters; SQL modules enforce constraints and indexes for performance. +- **Time Handling** – UTC timestamps used in scripts and SQL logs for consistency. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..72572456 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 8E98F355 +- D: 2026-11-04T12:50:13Z +- T: 2026-11-04T12:53:21Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project unifies an AI‑driven code‑generation framework with a set of data‑processing utilities and domain‑specific database modules. The core Java packages orchestrate source‑file selection, deterministic fact extraction, and prompt execution through configurable providers that support local llama.cpp, OpenAI‑compatible APIs, and mocks. GPU‑accelerated analytics are enabled by OpenCL kernels that compute byte‑stream histograms, while a lock‑free ring buffer and byte‑level utilities support efficient streaming and backup/reporting scripts. Database logic spans PostgreSQL and MySQL schemas for library cataloging, e‑commerce ordering, and warehouse inventory, each with stored procedures, audit logging, and nightly synchronization, all integrated into Maven/CLI workflows for robust persistence across library, shop, and warehouse systems. + +#### Packages +- java/config — A configuration‑driven AI‑generation framework that routes source files, evaluates file‑matching rules, extracts deterministic language facts, and supplies all parameters for model execution. +- java — A framework that orchestrates AI‑driven code generation by selecting source files, extracting deterministic facts, and delegating prompt execution to configurable local or cloud providers. +- java/provider — A lightweight, configurable AI‑generation framework that supports local llama.cpp inference, OpenAI‑compatible APIs, and mock providers, with robust request parsing, timing, and error handling. +- other/kernels — Computes a 256‑bin histogram of a byte stream using two OpenCL kernel passes. +- other — A collection of utilities for efficient byte‑level data handling, a lock‑free ring buffer for streaming, and small backup/reporting scripts. +- other/ringbuf — Provides a lock‑free, power‑of‑two sized byte ring buffer for single‑producer/single‑consumer scenarios. +- other/scripts — A small utility package that backs up directories and produces monthly sales reports from CSV order exports. +- . — A unified framework for AI‑driven code generation, data‑processing utilities, and domain‑specific database logic, all orchestrated to support Maven/CLI workflows, GPU‑accelerated analytics, and robust persistence across library, shop, and warehouse systems. +- sql/library — A PostgreSQL‑based library management system that stores catalog, member, and loan data, provides reporting views, and enforces business rules through stored routines and audit logging. +- sql — A collection of database‑centric modules that manage library cataloging, e‑commerce ordering, and warehouse inventory synchronization, each with its own schema, business logic, and audit mechanisms. +- sql/shop — Provides a MySQL schema and stored procedure for a web shop’s product catalog, orders, and order line items, handling stock reservation and order total calculation. +- sql/warehouse — Synchronises nightly supplier stock feeds into a warehouse inventory, logging changes and errors. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..57acf6a7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,73 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:51:25Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Defines the core tables and indexes for a library lending system, tracking authors, books, members, and loans. + +#### Purpose +- Store library catalog and member data. +- Record book loans and enforce business rules. + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author(author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book(book_id)` + - `member_id BIGINT NOT NULL REFERENCES member(member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` + +Indexes +- `idx_book_author ON book(author_id)` +- `idx_loan_member ON loan(member_id)` +- `idx_loan_open ON loan(due_on) WHERE returned_on IS NULL` + +#### Reads +- `author` (author_id) +- `book` (author_id, book_id) +- `member` (member_id) +- `loan` (member_id, book_id, loan_id) + +#### Writes +- `author`: INSERT (1 row per author) +- `book`: INSERT (1 row per book) +- `member`: INSERT (1 row per member) +- `loan`: INSERT (1 row per loan) + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` (ON DELETE CASCADE) + +#### Dependencies +- `author`, `book`, `member`, `loan` tables referenced by foreign keys and indexes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..f6d76bc1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,59 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:51:29Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> A set of reporting views and a materialized view for a library system, summarizing overdue loans, member loan statistics, and popular books. + +#### Purpose +- Provide aggregated loan and book data for reporting and analytics. +- Enable quick access to overdue loan details, member loan summaries, and recent popular books. + +#### Type +- PostgreSQL views: `overdue_loans`, `member_loan_stats`. +- PostgreSQL materialized view: `popular_books`. +- PostgreSQL index: `idx_popular_books_id`. + +#### Schema +- **overdue_loans** + - `loan_id` integer + - `member_id` integer + - `email` text + - `title` text + - `due_on` date + - `days_overdue` integer +- **member_loan_stats** + - `member_id` integer + - `full_name` text + - `loans_total` bigint + - `loans_open` bigint + - `last_loan_on` timestamp +- **popular_books** + - `book_id` integer + - `title` text + - `author_name` text + - `times_loaned` bigint + - **Index**: `idx_popular_books_id` on `popular_books(book_id)` (unique) + +#### Reads +- `overdue_loans`: `loan`, `member`, `book`. +- `member_loan_stats`: `member`, `loan`. +- `popular_books`: `loan`, `book`, `author`. + +#### Writes +- `popular_books`: materialized view refreshed via `REFRESH MATERIALIZED VIEW` (not shown in source). + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. +- Views: none. +- Functions: none. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..b5ea0a61 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,70 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:51:33Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Manages book loans, returns, late fees, and audit logging for a library system. + +#### Purpose +- Handles checkout and return operations for library books. +- Calculates late fees. +- Records audit trail of loan actions. + +#### Type +- Table: `loan_audit` (PostgreSQL). +- Function: `fn_checkout_book` (plpgsql), `fn_late_fee` (sql), `trg_loan_audit_fn` (plpgsql trigger function). +- Procedure: `sp_return_book` (plpgsql). +- Trigger: `trg_loan_audit` (AFTER INSERT OR UPDATE OF returned_on ON loan). + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member` (`member_id`, `is_blocked`) – check blocked status. +- `book` (`book_id`, `copies_free`) – verify and decrement free copies. +- `loan` (`loan_id`, `returned_on`) – update return status. +- `loan` (`loan_id`, `book_id`) – retrieve book id on return. +- `loan` (`due_on`, `returned_on`) – late fee calculation. + +#### Writes +- `book` – decrement `copies_free` on checkout; increment on return. +- `loan` – insert new loan record; update `returned_on` on return. +- `loan_audit` – insert audit rows on checkout and return. + +#### Relationships +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` +- `loan_audit.loan_id -> loan.loan_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Verify member not blocked. + - Decrement `book.copies_free`; error if none. + - Insert into `loan` with `due_on = CURRENT_DATE + p_days`; return new `loan_id`. + +- **sp_return_book(p_loan_id)** + - Update `loan.returned_on` to `CURRENT_DATE`; return `book_id`. + - If no row updated, raise exception. + - Increment `book.copies_free` for returned book. + +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Multiply by 50, cap at 2000, ensure non‑negative. + +- **trg_loan_audit_fn()** + - On INSERT: log `CHECKOUT`. + - On UPDATE where `returned_on` changes from NULL to non‑NULL: log `RETURN`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Functions: `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `trg_loan_audit_fn`. +- Trigger: `trg_loan_audit`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..45df8ea0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,54 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:51:37Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Migrates the library schema to support multiple branches, introduces a book_copy table, and updates member and loan tables accordingly. + +#### Purpose +- Add branch support and per‑copy tracking. +- Replace book copy counters with explicit book_copy rows. +- Update member and loan tables for new relationships. + +#### Type +- PostgreSQL migration script (DDL). + +#### Schema +- **branch** + - `branch_id SMALLSERIAL PRIMARY KEY` + - `name VARCHAR(100) NOT NULL UNIQUE` + - `city VARCHAR(100) NOT NULL` +- **book_copy** + - `copy_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `branch_id SMALLINT NOT NULL REFERENCES branch (branch_id)` + - `barcode VARCHAR(32) NOT NULL UNIQUE` + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE', 'ON_LOAN', 'LOST'))` + - Index: `idx_book_copy_book` on `book_copy (book_id)` + +#### Reads +- `book` (SELECT book_id, isbn, copies_free, copies_total) +- `member` (UPDATE member SET home_branch_id = 1 WHERE home_branch_id IS NULL) + +#### Writes +- `branch`: 1 row inserted (`Main`, `Springfield`). +- `book_copy`: 1 × `b.copies_total` rows inserted per book (family: total rows = sum of copies_total across all books). +- `loan`: adds column `copy_id` (no data written). +- `member`: renames column, adds `home_branch_id`, updates existing rows to 1. +- `book`: drops columns and constraint (no data written). + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- Existing tables: `book`, `loan`, `member`. +- New table: `branch`, `book_copy`. +- Index: `idx_book_copy_book`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..b165cbc5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,62 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:51:39Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Seed data for a library system: authors, books, members, and loan records. + +#### Purpose +- Populate the `author`, `book`, `member`, and `loan` tables with initial data for testing or demo purposes. + +#### Type +- SQL script (PostgreSQL) containing `INSERT` statements. + +#### Schema +- **author** + - `author_id` integer PK + - `full_name` text NOT NULL + - `birth_year` integer + - `country_code` char(2) NOT NULL +- **book** + - `book_id` integer PK + - `isbn` text NOT NULL + - `title` text NOT NULL + - `author_id` integer NOT NULL FK → `author.author_id` + - `published_year` integer + - `copies_total` integer NOT NULL + - `copies_free` integer NOT NULL +- **member** + - `member_id` integer PK + - `email` text NOT NULL + - `full_name` text NOT NULL + - `joined_on` date NOT NULL + - `is_blocked` boolean NOT NULL +- **loan** + - `loan_id` integer PK + - `book_id` integer NOT NULL FK → `book.book_id` + - `member_id` integer NOT NULL FK → `member.member_id` + - `loaned_on` date NOT NULL + - `due_on` date NOT NULL + - `returned_on` date + +#### Reads +- None (only INSERT statements). + +#### Writes +- `author`: 15 rows +- `book`: 150 rows +- `member`: 50 rows +- `loan`: 150 rows + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- None beyond the tables referenced above. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..e232f7fa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,55 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:53:00Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL‑based library management system that stores catalog, member, and loan data, provides reporting views, and enforces business rules through stored routines and audit logging. + +#### Purpose +- Persist library catalog, member, and loan information. +- Enforce borrowing rules and track late fees. +- Offer aggregated reporting for overdue loans, member activity, and popular titles. + +#### Responsibilities +- **Data Definition** – Tables, indexes, and constraints for authors, books, members, loans, and audit trails. +- **Reporting** – Views and a materialized view summarizing overdue loans, member statistics, and popular books. +- **Business Logic** – Functions and procedures for checking out, returning, and calculating late fees, plus triggers for audit logging. +- **Schema Evolution** – Migration script adding branch support and explicit book copy tracking. +- **Seeding** – Sample data for authors, books, members, and loans. + +#### Key units +- `author`, `book`, `member`, `loan` tables – core data entities. +- `loan_audit` table – audit trail of checkout/return actions. +- `fn_checkout_book(p_member_id, p_book_id, p_days)` – checkout logic. +- `sp_return_book(p_loan_id)` – return logic. +- `fn_late_fee(p_due_on, p_returned_on)` – late fee calculation. +- `trg_loan_audit_fn()` – trigger function logging audit rows. +- `overdue_loans`, `member_loan_stats`, `popular_books` views – reporting surfaces. +- `branch`, `book_copy` tables – added by migration for multi‑branch support. + +#### Data flow +1. **Checkout**: `fn_checkout_book` validates member, decrements `book.copies_free`, inserts a `loan` record, and triggers `loan_audit` with action `CHECKOUT`. +2. **Return**: `sp_return_book` updates `loan.returned_on`, increments `book.copies_free`, and triggers `loan_audit` with action `RETURN`. +3. **Late fee**: `fn_late_fee` is called by application logic (or could be used in reports) to compute fees based on `due_on` and `returned_on`. +4. **Reporting**: Views join `loan`, `member`, `book`, and `author` to expose overdue details, member loan summaries, and popular book counts. + +#### Dependencies +- Internal: `author`, `book`, `member`, `loan`, `loan_audit`, `branch`, `book_copy`. +- External: PostgreSQL built‑in functions, `now()`, `CURRENT_DATE`. +- Migration: relies on existing `book`, `loan`, `member` tables before adding `branch` and `book_copy`. + +#### Cross‑cutting +- **Constraints & Checks**: `copies_free <= copies_total`, `due_on > loaned_on`, `status` enum for `book_copy`. +- **Indexes**: `idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_book_copy_book`, `idx_popular_books_id`. +- **Audit Pattern**: `loan_audit` table and trigger `trg_loan_audit` capture all state changes to loans. +- **Error Handling**: Functions raise exceptions when members are blocked or no copies are available. +- **Concurrency**: Decrement/increment of `copies_free` occurs within the checkout/return functions to maintain consistency. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..3cb309d0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,44 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:53:09Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A collection of database‑centric modules that manage library cataloging, e‑commerce ordering, and warehouse inventory synchronization, each with its own schema, business logic, and audit mechanisms. + +#### Purpose +- Persist and enforce rules for library loans, shop orders, and warehouse stock. +- Provide reporting, audit trails, and concurrency‑safe operations across three distinct domains. + +#### Responsibilities +- **Library** – catalog, member, loan data; checkout/return logic; overdue reporting; audit logging. +- **Shop** – product catalog, customer orders, order items; stock reservation; order total calculation. +- **Warehouse** – nightly supplier feed ingestion; inventory upsert; sync audit logging. + +#### Key units +- **Library**: `author`, `book`, `member`, `loan`, `loan_audit`; `fn_checkout_book`, `sp_return_book`, `fn_late_fee`; `overdue_loans`, `member_loan_stats`, `popular_books` views. +- **Shop**: `product`, `customer_order`, `order_item`; `add_order_item` procedure. +- **Warehouse**: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`; `dbo.usp_SyncStock` procedure. + +#### Data flow +1. **Library**: `fn_checkout_book` → validates → updates `book.copies_free` → inserts `loan` → triggers `loan_audit`. + `sp_return_book` → updates `loan.returned_on` → increments `book.copies_free` → triggers `loan_audit`. + Views aggregate loan/member/book data for reporting. +2. **Shop**: `add_order_item` locks `product` → checks stock → inserts/updates `order_item` → decrements `product.stock` → recalculates `customer_order.total_cents`. +3. **Warehouse**: `usp_SyncStock` aggregates `SupplierFeed` → `MERGE` into `StockLevel` (insert/update) → logs run in `SyncLog` with row counts and errors. + +#### Dependencies +- **Internal**: each module references its own tables and audit tables; cross‑module dependencies are none. +- **External**: PostgreSQL (functions, triggers, materialized views) for Library; MySQL 8 (ENUM, `FOR UPDATE`) for Shop; SQL Server system functions (`SYSUTCDATETIME`, `ERROR_MESSAGE`) for Warehouse. + +#### Cross‑cutting +- **Audit patterns**: `loan_audit` and `SyncLog` capture state changes; Shop relies on FK cascades and unique SKU constraints. +- **Concurrency**: Library functions use transactional updates to `copies_free`; Shop procedure locks product rows; Warehouse uses `MERGE` within a transaction. +- **Error handling**: Functions/procedures raise explicit errors for blocked members, insufficient stock, or missing SKUs; Warehouse rolls back and logs errors. +- **Constraints & indexes**: Each schema enforces referential integrity, uniqueness, and performance indexes on key columns. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..c2567e88 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,69 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:51:43Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Manages product catalog, customer orders, and order line items in a MySQL web shop, including stock reservation and order total calculation. + +#### Purpose +- Stores products, orders, and order items. +- Provides a stored procedure to add an item to an order, reserve stock, and recalculate the order total. + +#### Type +- Table: `product`, `customer_order`, `order_item` +- Procedure: `add_order_item` +- Dialect: MySQL 8 + +#### Schema +- **product** + - `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `sku VARCHAR(40) NOT NULL` UNIQUE `uk_product_sku` + - `name VARCHAR(200) NOT NULL` + - `price_cents INT UNSIGNED NOT NULL` + - `stock INT NOT NULL DEFAULT 0` +- **customer_order** + - `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `customer_id BIGINT UNSIGNED NOT NULL` + - `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW' + - `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` + - `total_cents INT UNSIGNED NOT NULL DEFAULT 0` + - Index `idx_order_customer` on `(customer_id, created_at)` +- **order_item** + - `order_id BIGINT UNSIGNED NOT NULL` + - `product_id INT UNSIGNED NOT NULL` + - `quantity SMALLINT UNSIGNED NOT NULL` + - `unit_price_cents INT UNSIGNED NOT NULL` + - PK `(order_id, product_id)` + - FK `fk_item_order` references `customer_order(order_id)` ON DELETE CASCADE + - FK `fk_item_product` references `product(product_id)` + +#### Reads +- `product` (SELECT product_id, price_cents WHERE sku = p_sku AND stock >= p_qty FOR UPDATE) +- `order_item` (SELECT SUM(quantity * unit_price_cents) WHERE order_id = p_order_id) +- `customer_order` (UPDATE total_cents WHERE order_id = p_order_id) + +#### Writes +- `order_item`: INSERT one row; if duplicate, UPDATE quantity (up to 1 row) +- `product`: UPDATE stock (1 row) +- `customer_order`: UPDATE total_cents (1 row) + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (FK `fk_item_order`) +- `order_item.product_id -> product.product_id` (FK `fk_item_product`) + +#### Routine logic +- Parameters: `p_order_id`, `p_sku`, `p_qty` +- Lookup product by SKU with stock check; lock row FOR UPDATE. +- If not found or insufficient stock, raise error. +- Insert or update `order_item` quantity. +- Decrement `product.stock` by `p_qty`. +- Recalculate `customer_order.total_cents` from current `order_item` rows. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item` +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..f581701e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,42 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:53:05Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> Provides a MySQL schema and stored procedure for a web shop’s product catalog, orders, and order line items, handling stock reservation and order total calculation. + +#### Purpose +- Persist products, customer orders, and order items. +- Offer a single procedure to add items, reserve stock, and update totals. + +#### Responsibilities +- **Data storage**: tables `product`, `customer_order`, `order_item`. +- **Business logic**: stored procedure `add_order_item` that validates stock, updates inventory, and recalculates order totals. +- **Integrity enforcement**: foreign keys, unique SKU, and status enum. + +#### Key units +- **Table `product`** – holds SKU, name, price, and stock. +- **Table `customer_order`** – tracks order status, timestamps, and total amount. +- **Table `order_item`** – links orders to products with quantity and unit price. +- **Procedure `add_order_item(p_order_id, p_sku, p_qty)`** – reserves stock, inserts/updates an order item, and updates the order total. + +#### Data flow +1. Caller invokes `add_order_item` with order ID, SKU, and quantity. +2. Procedure locks the product row (`FOR UPDATE`), checks stock. +3. If sufficient, inserts or updates the `order_item` row. +4. Decrements `product.stock` by the ordered quantity. +5. Recalculates `customer_order.total_cents` from all items of that order. + +#### Dependencies +- **Internal**: `product`, `customer_order`, `order_item` tables. +- **External**: MySQL 8 features (ENUM, `FOR UPDATE`, auto‑increment). + +#### Cross-cutting +- **Concurrency**: row‑level locking on `product` to prevent overselling. +- **Error handling**: procedure raises errors when SKU not found or stock insufficient. +- **Data integrity**: foreign keys with `ON DELETE CASCADE`, unique SKU constraint, and status enum enforce consistent state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..e2d3aa23 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,47 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:53:07Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Synchronises nightly supplier stock feeds into a warehouse inventory, logging changes and errors. + +#### Purpose +- Aggregate supplier quantities into `dbo.StockLevel`. +- Record each sync run in `dbo.SyncLog`. + +#### Responsibilities +- **Data ingestion** – read `dbo.SupplierFeed` rows since a given timestamp. +- **Inventory update** – merge aggregated quantities into `dbo.StockLevel`. +- **Audit logging** – insert a sync record with counts of inserted/updated rows and any error message. + +#### Key units +- **dbo.StockLevel** – warehouse inventory table (`WarehouseId`, `Sku`, `OnHand`, `UpdatedAt`). +- **dbo.SupplierFeed** – raw supplier feed table (`WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`). +- **dbo.SyncLog** – audit table for sync runs (`SyncLogId`, `StartedAt`, `RowsInserted`, `RowsUpdated`, `ErrorMessage`). +- **dbo.usp_SyncStock** – T‑SQL procedure that aggregates, merges, logs, and handles errors. + +#### Data flow +1. `dbo.usp_SyncStock(@Since)` starts a transaction and records `StartedAt`. +2. Aggregates `SupplierFeed` rows received after `@Since` by `(WarehouseId, Sku)` → `Quantity`. +3. `MERGE` into `StockLevel`: + - `WHEN MATCHED`: `OnHand += Quantity`, update `UpdatedAt`. + - `WHEN NOT MATCHED BY TARGET`: `INSERT` new row. +4. Capture `$action` counts into `@Changes`. +5. Insert a row into `SyncLog` with `RowsInserted`, `RowsUpdated`, and any `ErrorMessage`. +6. Commit or rollback on error. + +#### Dependencies +- Internal tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. +- SQL Server system functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. +- Transaction control via `@@TRANCOUNT`. + +#### Cross-cutting +- Uses `MERGE` for upsert logic. +- Error handling: rollback, log error message, rethrow. +- Default constraints on `OnHand` and `UpdatedAt` ensure non‑null values. +- No foreign key relationships; relies on composite primary keys for uniqueness. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..7d1d59f9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run4/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,76 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:51:46Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Synchronises nightly stock levels from a supplier feed into the warehouse inventory, recording changes and errors. + +#### Purpose +- Updates `dbo.StockLevel` with aggregated supplier quantities. +- Logs each sync run in `dbo.SyncLog`. + +#### Type +- Table: `dbo.StockLevel` +- Table: `dbo.SupplierFeed` +- Table: `dbo.SyncLog` +- Procedure: `dbo.usp_SyncStock` (T‑SQL, SQL Server) + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL CONSTRAINT DF_StockLevel_OnHand DEFAULT (0)` + - `UpdatedAt DATETIME2(0) NOT NULL CONSTRAINT DF_StockLevel_UpdatedAt DEFAULT (SYSUTCDATETIME())` + - PK: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL CONSTRAINT PK_SupplierFeed PRIMARY KEY` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL CONSTRAINT PK_SyncLog PRIMARY KEY` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + +#### Reads +- `dbo.SupplierFeed` columns: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt` +- `dbo.StockLevel` columns: `WarehouseId`, `Sku`, `OnHand` + +#### Writes +- `dbo.StockLevel` + - `UPDATE` rows: number equal to distinct `(WarehouseId, Sku)` in source that match target. + - `INSERT` rows: number equal to distinct `(WarehouseId, Sku)` in source that do not match target. +- `dbo.SyncLog` + - One row per sync: `StartedAt`, `RowsInserted`, `RowsUpdated`, optional `ErrorMessage`. + +#### Relationships +- None defined via foreign keys. + +#### Routine logic +- Parameters: `@Since DATETIME2(0)` +- Steps: + 1. Begin transaction. + 2. Aggregate `SupplierFeed` rows received since `@Since` by `(WarehouseId, Sku)` → `Quantity`. + 3. `MERGE` into `StockLevel`: + - `WHEN MATCHED`: `OnHand += Quantity`, `UpdatedAt = SYSUTCDATETIME()`. + - `WHEN NOT MATCHED BY TARGET`: `INSERT (WarehouseId, Sku, OnHand)`. + 4. Capture `$action` into `@Changes`. + 5. Insert into `SyncLog` the counts of `INSERT` and `UPDATE` actions. + 6. Commit; on error rollback, log error, rethrow. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()` +- System variable: `@@TRANCOUNT` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/meta/gpt-oss-20b.json new file mode 100644 index 00000000..d5c372c1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:53:23Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 106.2, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 53.7, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.2, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:56:05Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 88281, + "cachedPromptTokens": 88080, + "completionTokens": 18349, + "seconds": 105.5127345 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.005034, + "costUsd": 0.001811, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..b79e7a26 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,90 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:53:24Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Evaluates and validates file‑selection conditions against file metadata. + +#### Purpose +- Checks if a file satisfies a tree of `AiCondition` nodes. +- Validates condition trees for correct structure and bounds. +- Detects whether line counting is required. + +#### Type +- `final class AiConditionEvaluator` (class) + - Extends `Object`. + - No annotations. + +#### Input +- `matches(AiCondition, AiFileContext)` – condition tree, file facts. +- `validate(AiCondition)` – condition tree. +- `usesLines(AiCondition)` – condition tree. +- Internal helpers: `branchCount(AiCondition)`, `matchesExtension(List, String)`, `globMatches(String, String)`, `parseEpochMilli(String)`. + +#### Output +- `matches` returns `boolean`. +- `validate` throws `IllegalArgumentException` on misconfiguration. +- `usesLines` returns `boolean`. +- Helpers return booleans or `long`. + +#### Core logic +- `matches` + - If `and` group: all children must match. + - If `or` group: any child must match. + - If `not` group: negates child match. + - `extensions`: file name ends with any listed extension. + - `size`: `AiRangeCondition.contains(sizeBytes)`. + - `lines`: `AiRangeCondition.contains(lineCount)`. + - `modifiedAfter`: file last modified > parsed epoch. + - `modifiedBefore`: file last modified < parsed epoch. + - `pathGlob`: uses `AiSourceExcludeFilter.isExcluded(relativePath)`. + - Otherwise throw `IllegalStateException(ERROR_ONE_BRANCH + condition)`. + +- `validate` + - Ensure exactly one branch/leaf via `branchCount`. + - For groups: call `validateGroup`. + - For `extensions`: non‑empty list. + - For `size`/`lines`: must have a bound. + - For `modifiedAfter`/`modifiedBefore`: parse ISO‑8601. + - For `pathGlob`: non‑blank. + +- `usesLines` + - Recursively checks for any `lines` node in the tree. + +- `validateGroup` + - Requires at least one child; validates each child. + +- `branchCount` + - Counts non‑null branch/leaf fields. + +- `matchesExtension` + - Returns true if file name ends with any non‑null extension. + +- `globMatches` + - Delegates to `AiSourceExcludeFilter.isExcluded`. + +- `parseEpochMilli` + - Parses ISO‑8601 instant to epoch milliseconds; throws `IllegalArgumentException` on failure. + +#### Public API +- `matches(AiCondition, AiFileContext) -> boolean` – evaluate condition tree. +- `validate(AiCondition) -> void` – validate condition tree. +- `usesLines(AiCondition) -> boolean` – check for line‑count usage. + +#### Dependencies +- `java.time.Instant`, `java.time.format.DateTimeParseException`, `java.util.Collections`, `java.util.List`. +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`. +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.config.AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`. + +#### Exceptions / Errors +- `IllegalArgumentException` for invalid condition configuration or ISO‑8601 parsing. +- `IllegalStateException` if a node has no branch/leaf. + +#### Concurrency +- Stateless; no shared mutable state. Thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..e4f0a6b9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,53 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:53:29Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Holds a list of child conditions for an AI combinator, enabling / logic in configuration. + +#### Purpose +- Stores child `AiCondition` objects for combinator bodies. +- Provides defensive copying on set. + +#### Type +- `public class AiConditionGroup` + - Modifiers: public, final (implicit), @ToString, @SuppressWarnings. + - Field: `private @Nullable List conditions`. + - Constructor: `public AiConditionGroup()` (no-op). + - Methods: + - `public @Nullable List getConditions()` – returns stored list or null. + - `public void setConditions(final @Nullable Collection conditions)` – copies into new `ArrayList` or sets null. + +#### Input +- Constructor: none. +- `setConditions`: accepts `Collection` (nullable). + +#### Output +- `getConditions`: returns `List` or null. +- `setConditions`: mutates `conditions` field. + +#### Core logic +- `setConditions`: + - If input `conditions` is non‑null, create `new ArrayList<>(conditions)` and assign to field. + - Else assign `null` to field. + +#### Public API +- `getConditions() -> List` – retrieve child conditions. +- `setConditions(Collection) -> void` – set child conditions. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List`. +- `lombok.ToString`. +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.config.AiCondition`. + +#### Exceptions / Errors +- No explicit exceptions thrown or caught. + +#### Concurrency +- No synchronization; class is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..ba349f4e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,74 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:53:32Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Computes deterministic, language‑agnostic fact counts from source text using regex counters. + +#### Purpose +- Generates a facts block summarizing exact counts of language constructs. +- Validates fact counter configurations. + +#### Type +- `final class AiFactExtractor` (public, final, no supertype). + - Annotations: none. + - Constants: `FACTS_HEADER`, `LABEL_COUNT_SEPARATOR`, `ENTRY_SEPARATOR`, `FACTS_SUFFIX`. + - Private constructor. + - Static methods: `factsBlock`, `validate`, `countMatches`. + +#### Input +- `factsBlock(List counters, String source)` + - `counters`: list of counters (may be null/empty). + - `source`: full source text. +- `validate(List counters)` + - `counters`: list of counters (may be null/empty). +- `countMatches(String pattern, String source)` + - `pattern`: regex string. + - `source`: text to search. + +#### Output +- `factsBlock` returns a string: `"**Facts (exact, whole file):** label1: count1; label2: count2\n\n"` or `""`. +- `validate` throws `IllegalArgumentException` on missing label/pattern or invalid regex. +- `countMatches` returns an `int` count of non‑overlapping matches. + +#### Core logic +- `factsBlock`: + 1. Return `""` if counters null/empty. + 2. Iterate counters; skip null or missing label/pattern. + 3. Append `ENTRY_SEPARATOR` between entries. + 4. Append `label + LABEL_COUNT_SEPARATOR + countMatches(pattern, source)`. + 5. If result empty, return `""`; else prepend `FACTS_HEADER` and append `FACTS_SUFFIX`. +- `validate`: + 1. Return if counters null. + 2. For each counter: + - Throw if label null. + - Throw if pattern null. + - Compile pattern; on `PatternSyntaxException`, wrap in `IllegalArgumentException`. +- `countMatches`: + 1. Compile pattern, create matcher on source. + 2. Loop `matcher.find()` incrementing count. + 3. Return count. + +#### Public API +- `factsBlock(List counters, String source) -> String` – build facts block. +- `validate(List counters) -> void` – validate counters. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiFactCounter` + +#### Exceptions / Errors +- `IllegalArgumentException` from `validate` for missing label/pattern or invalid regex. +- `PatternSyntaxException` caught and rethrown as `IllegalArgumentException`. + +#### Concurrency +- All methods are static and stateless; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..84d6306b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,137 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:53:37Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> A mutable JavaBean holding all AI generation parameters for a single model run, used by the Maven plugin to configure the AI provider. + +#### Purpose +- Stores configuration for AI generation (model path, sampling, prompt trimming, cache, GPU, API, etc.). +- Exposes getters/setters for Maven plugin binding. + +#### Type +- `public class AiGenerationConfig` (class, public, mutable, Lombok `@ToString`). + +#### Input +- Constructor: no arguments. +- Fields set via setters or Maven plugin injection: + - `modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `charsPerToken`, `maxInputChars`, `warnOnTrim`, `topP`, `topK`, `minP`, `topNSigma`, `repeatPenalty`, `chatTemplateEnableThinking`, `cachePrompt`, `swaFull`, `cacheReuse`, `gpuLayers`, `seed`, `cpuMoeLayers`, `cpuFfnLayers`, `kvUnifiedPerSlot`, `lazyMode`, `repeatLastN`, `cacheTypeK`, `cacheTypeV`, `flashAttn`, `batchSize`, `ubatchSize`, `threadsBatch`, `mainGpu`, `devices`, `provider`, `remoteModel`, `baseUrl`, `apiKeyEnv`, `reasoningEffort`, `reasoningBudgetTokens`, `dryMultiplier`, `dryBase`, `dryAllowedLength`, `dryPenaltyLastN`, `drySequenceBreakers`, `stopStrings`, `calibration`. + +#### Output +- Getters return current field values. +- `getDrySequenceBreakers()` and `getStopStrings()` return unmodifiable lists. +- No state mutation beyond setters. + +#### Core logic +- No complex algorithms; only field assignments and basic null‑coalescing in setters. +- Default constants provide initial values for all fields. +- `setLazyMode`, `setCacheTypeK`, `setCacheTypeV`, `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, `setApiKeyEnv` replace `null` with default constants. +- `getDrySequenceBreakers()`/`getStopStrings()` wrap internal lists with `Collections.unmodifiableList`. + +#### Public API +- `getModelPath() -> String?` – model file path. +- `setModelPath(String?) -> void` – set model path. +- `getContextSize() -> int` – context window size. +- `setContextSize(int) -> void` +- `getMaxOutputTokens() -> int` – max output tokens. +- `setMaxOutputTokens(int) -> void` +- `getTemperature() -> float` – sampling temperature. +- `setTemperature(float) -> void` +- `getThreads() -> int` – CPU threads. +- `setThreads(int) -> void` +- `getCharsPerToken() -> int` – chars per token. +- `setCharsPerToken(int) -> void` +- `getMaxInputChars() -> int` – max input chars. +- `setMaxInputChars(int) -> void` +- `isWarnOnTrim() -> boolean` – trim warning flag. +- `setWarnOnTrim(boolean) -> void` +- `getTopP() -> float` – nucleus sampling. +- `setTopP(float) -> void` +- `getTopK() -> int` – top‑k limit. +- `setTopK(int) -> void` +- `getRepeatPenalty() -> float` – repetition penalty. +- `setRepeatPenalty(float) -> void` +- `getMinP() -> float` – min‑p threshold. +- `setMinP(float) -> void` +- `getTopNSigma() -> float` – top‑n‑sigma threshold. +- `setTopNSigma(float) -> void` +- `getChatTemplateEnableThinking() -> Boolean?` – chat‑template thinking mode. +- `setChatTemplateEnableThinking(Boolean?) -> void` +- `isCachePrompt() -> boolean` – prompt cache flag. +- `isSwaFull() -> boolean` – full SWA cache flag. +- `setSwaFull(boolean) -> void` +- `getCacheReuse() -> int` – cache‑reuse chunk size. +- `setCacheReuse(int) -> void` +- `getGpuLayers() -> int` – GPU layers offload. +- `setGpuLayers(int) -> void` +- `getSeed() -> int` – RNG seed. +- `setSeed(int) -> void` +- `getCpuMoeLayers() -> int` – CPU MoE layers. +- `setCpuMoeLayers(int) -> void` +- `getCpuFfnLayers() -> int` – CPU FFN layers. +- `setCpuFfnLayers(int) -> void` +- `getKvUnifiedPerSlot() -> int` – KV unified per‑slot cap. +- `setKvUnifiedPerSlot(int) -> void` +- `getLazyMode() -> String` – tensor‑read laziness. +- `setLazyMode(String?) -> void` +- `getRepeatLastN() -> int` – repeat‑penalty window. +- `setRepeatLastN(int) -> void` +- `getCacheTypeK() -> String` – KV cache type K. +- `setCacheTypeK(String?) -> void` +- `getCacheTypeV() -> String` – KV cache type V. +- `setCacheTypeV(String?) -> void` +- `isFlashAttn() -> boolean` – Flash Attention flag. +- `setFlashAttn(boolean) -> void` +- `getBatchSize() -> int` – logical batch size. +- `setBatchSize(int) -> void` +- `getUbatchSize() -> int` – physical batch size. +- `setUbatchSize(int) -> void` +- `getThreadsBatch() -> int` – batch thread count. +- `setThreadsBatch(int) -> void` +- `getMainGpu() -> int` – primary GPU index. +- `setMainGpu(int) -> void` +- `getDevices() -> String` – device list. +- `setDevices(String) -> void` +- `getProvider() -> String` – AI provider. +- `setProvider(String?) -> void` +- `getRemoteModel() -> String` – remote model ID. +- `setRemoteModel(String?) -> void` +- `getBaseUrl() -> String` – API base URL. +- `setBaseUrl(String?) -> void` +- `getApiKeyEnv() -> String` – API key env var name. +- `setApiKeyEnv(String?) -> void` +- `getReasoningEffort() -> String` – reasoning effort level. +- `setReasoningEffort(String) -> void` +- `getReasoningBudgetTokens() -> int` – reasoning budget. +- `setReasoningBudgetTokens(int) -> void` +- `getDryMultiplier() -> float` – DRY multiplier. +- `setDryMultiplier(float) -> void` +- `getDryBase() -> float` – DRY base. +- `setDryBase(float) -> void` +- `getDryAllowedLength() -> int` – DRY allowed length. +- `setDryAllowedLength(int) -> void` +- `getDryPenaltyLastN() -> int` – DRY penalty window. +- `setDryPenaltyLastN(int) -> void` +- `getDrySequenceBreakers() -> List` – unmodifiable list. +- `setDrySequenceBreakers(List?) -> void` +- `getStopStrings() -> List` – unmodifiable list. +- `setStopStrings(List?) -> void` +- `getCalibration() -> AiCalibration?` – per‑machine calibration. +- `setCalibration(AiCalibration?) -> void` + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`. +- `lombok.ToString`. +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.config.AiCalibration` (used in `calibration` field). + +#### Exceptions / Errors +- No explicit exceptions thrown; setters perform null‑coalescing to defaults. + +#### Concurrency +- No synchronization; class is not thread‑safe. Instances are intended for single‑threaded configuration use. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..3fb186c8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,61 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:53:44Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Defines how oversized source files are handled during routing. + +#### Purpose +- Enumerates strategies for oversized source files. +- Provides default strategy and parsing from config. + +#### Type +- `public enum AiOversizeStrategy` + - Modifiers: `public` + - Supertypes: `java.lang.Enum` + - Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` + - Static field: `public static final AiOversizeStrategy DEFAULT` + - Instance field: `private final String configValue` + - Constructor: `AiOversizeStrategy(String configValue)` + - Methods: + - `public String configValue()` + - `public static AiOversizeStrategy fromConfig(@Nullable String value)` + +#### Input +- Constructor parameter: `String configValue` (strategy token). +- `fromConfig` parameter: `@Nullable String value` (config token). + +#### Output +- `configValue()` returns strategy token string. +- `fromConfig` returns matching `AiOversizeStrategy` or throws `IllegalArgumentException`. + +#### Core logic +- `fromConfig`: + 1. If `value` is `null` → return `DEFAULT`. + 2. Trim `value`; if empty → return `DEFAULT`. + 3. Iterate over `values()`; compare `strategy.configValue` with `trimmed` case‑insensitively. + 4. Return matching strategy. + 5. If none match → throw `IllegalArgumentException` with message listing valid tokens. + +#### Public API +- `FAIL(String)` – abort build. +- `SAMPLE(String)` – trim and summarize head. +- `MAP_REDUCE(String)` – chunk, summarize, combine. +- `DETERMINISTIC(String)` – emit deterministic metadata. +- `DEFAULT` – default strategy (`FAIL`). +- `configValue()` → strategy token. +- `fromConfig(String)` → strategy from config. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `fromConfig` when value is non‑blank and unrecognized. + +#### Concurrency +- Immutable enum; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..ded94296 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,122 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:53:47Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Holds all mutable configuration needed to run a srcmorph AI generation job, exposed as a JavaBean for Maven, JSON/YAML, or code binding. + +#### Purpose +- Stores AI generation parameters, file selection rules, and model settings. +- Provides defaults for all fields. + +#### Type +- `public class SrcMorphConfiguration` + - Modifiers: public, final (class itself), mutable JavaBean + - Supertypes: none + - Annotations: `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`, `@ToString` + - Fields (23): + - `File baseDirectory` + - `File outputDirectory = new File(DEFAULT_OUTPUT_DIRECTORY)` + - `boolean force` + - `@Nullable List subtrees` + - `@Nullable List excludes` + - `@Nullable List fileExtensions` + - `long minFileSizeBytes` + - `long maxFileSizeBytes` + - `boolean planOnly` + - `String generationProvider = DEFAULT_GENERATION_PROVIDER` + - `@Nullable List promptDefinitions` + - `@Nullable List aiDefinitions` + - `@Nullable File modelDirectory` + - `@Nullable List fieldGenerations` + - `@Nullable List factDefinitions` + - `@Nullable String llamaModelPath` + - `int llamaContextSize = DEFAULT_LLAMA_CONTEXT_SIZE` + - `int llamaMaxOutputTokens = DEFAULT_LLAMA_MAX_OUTPUT_TOKENS` + - `float llamaTemperature = DEFAULT_LLAMA_TEMPERATURE` + - `int llamaThreads = DEFAULT_LLAMA_THREADS` + - `String pluginVersion = ""` + - `String aiVersion = DEFAULT_AI_VERSION` + - `@Nullable String projectName` + +#### Input +- Constructor: none (default constructor). +- Setters accept: `File`, `boolean`, `@Nullable List`, `long`, `String`, `@Nullable List`, `@Nullable List`, `@Nullable File`, `@Nullable List`, `@Nullable List`, `@Nullable String`, `int`, `float`. + +#### Output +- Getters return the corresponding field values. +- No side‑effects beyond field mutation. + +#### Core logic +- No algorithmic logic; only property accessors. + +#### Public API +- `SrcMorphConfiguration()` -> constructs with defaults +- `File getBaseDirectory()` -> base dir +- `void setBaseDirectory(File)` -> set base dir +- `File getOutputDirectory()` -> output dir +- `void setOutputDirectory(File)` -> set output dir +- `boolean isForce()` -> force flag +- `void setForce(boolean)` -> set force flag +- `@Nullable List getSubtrees()` -> subtrees +- `void setSubtrees(@Nullable List)` -> set subtrees +- `@Nullable List getExcludes()` -> excludes +- `void setExcludes(@Nullable List)` -> set excludes +- `@Nullable List getFileExtensions()` -> file extensions +- `void setFileExtensions(@Nullable List)` -> set file extensions +- `long getMinFileSizeBytes()` -> min size +- `void setMinFileSizeBytes(long)` -> set min size +- `long getMaxFileSizeBytes()` -> max size +- `void setMaxFileSizeBytes(long)` -> set max size +- `boolean isPlanOnly()` -> plan‑only flag +- `void setPlanOnly(boolean)` -> set plan‑only flag +- `String getGenerationProvider()` -> provider name +- `void setGenerationProvider(String)` -> set provider +- `@Nullable List getPromptDefinitions()` -> prompt defs +- `void setPromptDefinitions(@Nullable List)` -> set prompt defs +- `@Nullable List getAiDefinitions()` -> model defs +- `void setAiDefinitions(@Nullable List)` -> set model defs +- `@Nullable File getModelDirectory()` -> model dir +- `void setModelDirectory(@Nullable File)` -> set model dir +- `@Nullable List getFieldGenerations()` -> field rules +- `void setFieldGenerations(@Nullable List)` -> set field rules +- `@Nullable List getFactDefinitions()` -> fact groups +- `void setFactDefinitions(@Nullable List)` -> set fact groups +- `@Nullable String getLlamaModelPath()` -> llama model path +- `void setLlamaModelPath(@Nullable String)` -> set llama model path +- `int getLlamaContextSize()` -> context size +- `void setLlamaContextSize(int)` -> set context size +- `int getLlamaMaxOutputTokens()` -> max output tokens +- `void setLlamaMaxOutputTokens(int)` -> set max output tokens +- `float getLlamaTemperature()` -> temperature +- `void setLlamaTemperature(float)` -> set temperature +- `int getLlamaThreads()` -> thread count +- `void setLlamaThreads(int)` -> set thread count +- `String getPluginVersion()` -> plugin version +- `void setPluginVersion(String)` -> set plugin version +- `String getAiVersion()` -> AI logic version +- `void setAiVersion(String)` -> set AI logic version +- `@Nullable String getProjectName()` -> project title +- `void setProjectName(@Nullable String)` -> set project title + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiModelDefinition` +- `net.ladenthin.srcmorph.config.AiFieldGenerationConfig` +- `net.ladenthin.srcmorph.config.AiFactDefinition` +- `net.ladenthin.srcmorph.config.AiGenerationConfig` (for DEFAULT_LLAMA_THREADS) + +#### Exceptions / Errors +- None declared or thrown. + +#### Concurrency +- No synchronization; instance is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..39b30e0d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,52 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:55:10Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> A configuration and evaluation framework that drives AI‑powered source‑code transformation jobs, handling file selection, fact extraction, and generation settings for a Maven‑based build pipeline. + +#### Purpose +- Central configuration holder for AI‑based source morphing. +- Validates and evaluates file‑selection conditions. +- Generates deterministic fact blocks from source text. +- Defines strategies for oversized source files. + +#### Responsibilities +- **Configuration Management** – `SrcMorphConfiguration` aggregates all runtime parameters (directories, file filters, AI provider, model paths, prompt definitions, field rules, fact definitions, Llama settings, etc.). +- **Condition Evaluation** – `AiConditionEvaluator` checks whether a file satisfies a tree of `AiCondition` nodes (extensions, size, lines, timestamps, path glob). +- **Fact Extraction** – `AiFactExtractor` counts language‑agnostic constructs via regex and builds a facts block. +- **Oversize Handling** – `AiOversizeStrategy` enumerates and parses strategies for files that exceed size limits. + +#### Key units +- `SrcMorphConfiguration` – mutable JavaBean for Maven/JSON/YAML binding. +- `AiConditionEvaluator` – stateless validator/evaluator for `AiCondition` trees. +- `AiFactExtractor` – static utility for regex‑based fact counting. +- `AiOversizeStrategy` – enum with `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`; default `FAIL`. +- `AiConditionGroup` – container for child `AiCondition` objects (used by evaluator). + +#### Data flow +1. **Configuration Load** – `SrcMorphConfiguration` is populated from Maven plugin parameters or external config. +2. **File Selection** – For each source file, `AiConditionEvaluator.matches` is invoked with the file’s metadata (`AiFileContext`) and the configured condition tree. +3. **Fact Generation** – If a file is selected, `AiFactExtractor.factsBlock` produces a facts section from configured `AiFactCounter` objects. +4. **Oversize Decision** – If a file exceeds configured size limits, `AiOversizeStrategy.fromConfig` selects the handling strategy (e.g., `FAIL` aborts, `SAMPLE` trims). +5. **Generation** – `AiGenerationConfig` (nested within `SrcMorphConfiguration`) supplies AI model parameters to the generation engine. + +#### Dependencies +- Internal: `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`. +- External: `java.time.Instant`, `java.util.regex`, `org.jspecify.annotations.Nullable`, Lombok (`@ToString`), `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`. + +#### Cross-cutting +- **Validation** – `AiConditionEvaluator.validate` and `AiFactExtractor.validate` enforce configuration correctness. +- **Thread‑safety** – All evaluator and extractor methods are stateless; configuration beans are not thread‑safe but intended for single‑threaded build execution. +- **Immutability** – `AiOversizeStrategy` enum and `AiConditionGroup` defensive copying promote safe sharing. +- **Error handling** – `IllegalArgumentException` signals misconfiguration; `IllegalStateException` guards against malformed condition trees. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..8e38c343 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,57 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:55:19Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A framework that orchestrates AI‑driven source‑code transformations, from configuration‑driven file selection and fact extraction to pluggable text‑generation backends. + +#### Purpose +- Central hub for AI‑based source‑code morphing in Maven builds. +- Validates file‑selection rules, extracts language‑agnostic facts, and drives generation engines. + +#### Responsibilities +- **Configuration & Validation** – `SrcMorphConfiguration` aggregates all runtime parameters and validates them. +- **File Selection** – `AiConditionEvaluator` evaluates `AiCondition` trees against `AiFileContext`. +- **Fact Extraction** – `AiFactExtractor` counts constructs via regex and builds fact blocks. +- **Oversize Handling** – `AiOversizeStrategy` dictates how oversized files are treated. +- **Provider Management** – `AiGenerationProviderFactory` resolves the correct `AiGenerationProvider`. +- **Generation Execution** – Concrete providers (`LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`, `MockAiGenerationProvider`) build requests, invoke models, parse responses, and return text or timings. + +#### Key units +- `SrcMorphConfiguration` – mutable bean for Maven/JSON/YAML binding. +- `AiConditionEvaluator` – stateless validator for `AiCondition` trees. +- `AiFactExtractor` – static utility for regex‑based fact counting. +- `AiOversizeStrategy` – enum (`FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC`). +- `AiGenerationProvider` – interface (`generate`, `generateWithTimings`, `close`). +- `AiGenerationProviderFactory` – resolves provider based on config. +- `LlamaCppJniAiGenerationProvider` – local GGUF inference with timing extraction. +- `OpenAiCompatibleAiGenerationProvider` – HTTP chat‑completion endpoint support. +- `MockAiGenerationProvider` – deterministic test provider. +- `LlamaCppJniConfig` – immutable builder for 37 llama.cpp knobs. +- `AiCompletionParser` – strips internal thinking blocks from raw completions. + +#### Data flow +1. **Load configuration** → `SrcMorphConfiguration` from Maven or external files. +2. **Select files** → `AiConditionEvaluator.matches` against each `AiFileContext`. +3. **Generate facts** → `AiFactExtractor.factsBlock` creates a facts section. +4. **Handle oversize** → `AiOversizeStrategy` decides action. +5. **Create provider** → `AiGenerationProviderFactory.create` returns concrete provider. +6. **Generate text** → provider receives `AiGenerationRequest`, builds request body, calls model, parses response, extracts completion text. +7. **Return result** → plain `String` or `AiGenerationTimings` with metrics. + +#### Dependencies +- **Internal**: `AiCondition`, `AiConditionGroup`, `AiRangeCondition`, `AiFileContext`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`, `AiPromptSupport`, `AiGenerationRequest`, `AiGenerationTimings`. +- **External**: `java.time.Instant`, `java.util.regex`, `org.jspecify.annotations.Nullable`, Lombok (`@ToString`), Jackson `ObjectMapper`, `net.ladenthin.llama` (local inference), `java.net.URL`. + +#### Cross-cutting +- **Immutability & Thread‑safety** – `LlamaCppJniConfig`, provider support, and `AiOversizeStrategy` are immutable; evaluator and extractor are stateless. +- **Validation** – `AiConditionEvaluator.validate` and `AiFactExtractor.validate` enforce correct configuration. +- **Error handling** – Misconfigurations throw `IllegalArgumentException`; malformed responses raise `IOException`. +- **Timing metrics** – Providers expose `generateWithTimings` returning `AiGenerationTimings` with throughput and token rates. +- **Configuration knobs** – 37 llama.cpp parameters in `LlamaCppJniConfig` allow fine‑grained control over model loading, GPU usage, caching, and sampling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..a89a94d3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,55 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:53:56Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Parses raw LLM completion text to extract the model answer by stripping any model‑internal thinking block before the result is stored in an AI index file. + +#### Purpose +- Removes Gemma‑4 thinking blocks from model responses. +- Validates presence of closing marker; throws error if missing. + +#### Type +- `public class AiCompletionParser` + - Modifiers: public + - Annotations: `@ToString` + - Supertypes: none + - Constants: + - `public static final String THINKING_BLOCK_START_MARKER` + - `public static final String THINKING_BLOCK_END_MARKER` + +#### Input +- `parseCompletion(String response)` + - `response`: raw completion text, may be `null`. + +#### Output +- `parseCompletion` returns `String` (never `null`). +- Throws `IOException` if a start marker is present but no end marker. + +#### Core logic +- If `response` is `null`, return empty string. +- Trim `response` to `trimmed`. +- If `trimmed` does not start with `THINKING_BLOCK_START_MARKER`, return `trimmed`. +- Extract substring after start marker into `thinking`. +- Find first occurrence of `THINKING_BLOCK_END_MARKER` in `thinking` → `thinkingEnd`. +- If `thinkingEnd < 0`, throw `IOException` with message about token budget exhaustion. +- Return substring of `thinking` after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` → no-op constructor. +- `String parseCompletion(String response) throws IOException` → strip leading thinking block. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `IOException` thrown when start marker present but end marker missing, with actionable message. + +#### Concurrency +- No concurrency constructs; class is stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..bfe88609 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,53 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:53:59Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides a pluggable AI backend for generating text from an `AiGenerationRequest`. + +#### Purpose +- Supplies text generation for AI requests. +- Supports optional timing metrics for calibration. + +#### Type +- `public interface AiGenerationProvider extends AutoCloseable` + - Methods: `generate(AiGenerationRequest)`, `generateWithTimings(AiGenerationRequest)`, `close()`. + - Default implementation of `generateWithTimings` returns `AiGenerationTimings` with zero rates. + - Default `close` does nothing. + +#### Input +- `generate(AiGenerationRequest request)` receives an `AiGenerationRequest` containing prompt key, source file, source text, and current header. +- `generateWithTimings(AiGenerationRequest request)` receives the same request. + +#### Output +- `generate` returns a non‑null `String` (may be blank). +- `generateWithTimings` returns an `AiGenerationTimings` with generated text and zeroed timing fields. +- `close` has no side effects. + +#### Core logic +- `generate` is abstract; implementations provide text generation. +- `generateWithTimings`: + 1. Calls `generate(request)`. + 2. Constructs `new AiGenerationTimings(text, 0, 0, 0.0d, 0, 0.0d)`. +- `close` is a no‑op default. + +#### Public API +- `generate(AiGenerationRequest) -> String` – produce text for request. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – produce text with timing. +- `close() -> void` – release resources. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.document.AiGenerationTimings` + +#### Exceptions / Errors +- `generate` and `generateWithTimings` declare `throws IOException`. + +#### Concurrency +- No explicit concurrency handling; interface is thread‑safe only if implementations ensure it. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..4d57e42a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,66 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:54:02Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Creates an AI generation provider instance based on a provider key or model configuration. + +#### Purpose +- Instantiates an `AiGenerationProvider` implementation. +- Resolves the effective provider key from run or model configuration. + +#### Type +- `public class AiGenerationProviderFactory` (class, public, final by default, annotated `@ToString`) + +#### Input +- Constructor: no parameters. +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` + - `providerName`: run‑level provider key, may be null or blank. + - `llamaConfig`: model configuration, provides `provider()` method. + - `promptSupport`: lookup support for prompts. + +#### Output +- Returns an `AiGenerationProvider` instance: + - `MockAiGenerationProvider` for mock or blank provider. + - `LlamaCppJniAiGenerationProvider` for `llamacpp-jni`. + - `OpenAiCompatibleAiGenerationProvider` for `openai-compatible`. +- Throws `IllegalArgumentException` if provider key unrecognised. + +#### Core logic +- `effectiveProvider(String runProvider, String modelProvider)` + - Returns `modelProvider.trim()` if non‑empty; otherwise `runProvider`. +- `create(...)` + - Calls `effectiveProvider` to get `effective`. + - If `effective` is null or blank (`compatibilityHelper.isBlank`), return `MockAiGenerationProvider`. + - Switch on `effective`: + - `PROVIDER_MOCK`: return `MockAiGenerationProvider`. + - `PROVIDER_LLAMACPP_JNI`: return `LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)`. + - `PROVIDER_OPENAI_COMPATIBLE`: return `OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)`. + - default: throw `IllegalArgumentException("Unsupported AI provider: " + effective)`. + +#### Public API +- `AiGenerationProviderFactory()` -> constructor, no-op. +- `static String effectiveProvider(String runProvider, String modelProvider)` -> provider key resolution. +- `AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` -> provider creation. + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.provider.MockAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.OpenAiCompatibleAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniConfig` + +#### Exceptions / Errors +- `IllegalArgumentException` when provider key not in `PROVIDER_MOCK`, `PROVIDER_LLAMACPP_JNI`, or `PROVIDER_OPENAI_COMPATIBLE`. + +#### Concurrency +- No explicit synchronization; instance fields are immutable (`compatibilityHelper`). +- Thread‑safe by design. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..e64184b7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,77 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:54:05Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides local AI text generation by loading a GGUF model via llama.cpp and executing chat completions. + +#### Purpose +- Lazily loads a GGUF model for inference. +- Executes chat completions and parses responses. +- Exposes timings and handles resource cleanup. + +#### Type +- `final class LlamaCppJniAiGenerationProvider` – implements `AiGenerationProvider`, `AutoCloseable`. + - Extends `Object`. + - Annotations: `@ToString`. +- Fields: + - `private final LlamaCppJniConfig config` – configuration. + - `@ToString.Exclude private @Nullable LlamaModel model` – native handle. + - `private final AiPromptSupport promptSupport` – prompt rendering. + - `@ToString.Exclude private final LlamaCppJniProviderSupport support` – helper. + - `private final AiCompletionParser completionParser` – parses text completions. + - `private final ChatResponseParser chatResponseParser` – parses full chat JSON. + - `private final Java8CompatibilityHelper compatibilityHelper` – string utilities. + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate(AiGenerationRequest request)` and `generateWithTimings(AiGenerationRequest request)` accept `AiGenerationRequest`. +- `chatResponse(AiGenerationRequest request)` builds inference parameters via `support.buildInferenceParameters(request)`. + +#### Output +- `generate` returns `String` completion text. +- `generateWithTimings` returns `AiGenerationTimings` containing text, prompt tokens, cache tokens, prompt throughput, predicted tokens, predicted throughput. +- `close` releases native `LlamaModel` resources. + +#### Core logic +- `model()` lazily initializes `LlamaModel`: + - Builds `ModelParameters` with config values (model path, context size, threads, reasoning format, chat template kwargs). + - Applies optional settings: SWA full, cache reuse, GPU layers, CPU MoE/FFN layers, KV unified per slot, lazy mode, flash attention, cache type K/V, batch sizes, main GPU, devices. + - Instantiates `LlamaModel` and caches it. +- `generate`: + - Calls `chatResponse(request)` → parses full chat JSON. + - Warns on truncated answer via `support.warnOnTruncatedAnswer`. + - Logs prompt cache reuse via `support.logPromptCacheReuse`. + - Parses completion text from first content using `completionParser`. +- `chatResponse`: + - Calls `model().chatComplete(support.buildInferenceParameters(request))`. + - Parses response JSON with `chatResponseParser`. +- `generateWithTimings`: + - Calls `chatResponse(request)`. + - Extracts text and `Timings` from response. + - If `Timings` null, returns zeroed metrics. + - Otherwise constructs `AiGenerationTimings` with promptN, cacheN, promptPerSecond, predictedN, predictedPerSecond. +- `close`: + - If `model` non‑null, calls `model.close()`. + +#### Public API +- `generate(AiGenerationRequest request) -> String` – produce completion text. +- `generateWithTimings(AiGenerationRequest request) -> AiGenerationTimings` – produce completion text with metrics. +- `close() -> void` – release native resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.args.FlashAttn`, `net.ladenthin.llama.args.ReasoningFormat`, `net.ladenthin.llama.json.ChatResponseParser`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.ChatResponse`, `net.ladenthin.llama.value.Timings`, `net.ladenthin.srcmorph.document.AiGenerationRequest`, `net.ladenthin.srcmorph.prompt.AiPromptSupport`, `net.ladenthin.srcmorph.support.Java8CompatibilityHelper`, `org.jspecify.annotations.Nullable`, `lombok.ToString`. + +#### Exceptions / Errors +- `generate` declares `throws IOException`. +- `model()` may throw unchecked exceptions from native calls. +- `generateWithTimings` handles missing `Timings` by returning zeroed metrics. + +#### Concurrency +- No explicit synchronization; `model` is lazily initialized without double‑checked locking, relying on single‑threaded usage or external synchronization. +- `close` safely checks for null before closing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..18a92d33 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,139 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:54:13Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds an immutable configuration for llama.cpp JNI provider, exposing all runtime knobs and defaults for model execution. + +#### Purpose +- Holds 37 configuration knobs for llama.cpp JNI provider. +- Provides fluent builder with defaults from `AiGenerationConfig`. + +#### Type +- `final class LlamaCppJniConfig` (class, final) + - Extends `Object`. + - Annotations: `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. + - Fields: 37 `private final` fields (see below). +- `public static final class Builder` (class, static, final) + - Fields: 37 mutable fields with defaults. + - No supertype beyond `Object`. + +#### Input +- `Builder` constructor: `String modelPath` (non‑null). +- Builder setters: various primitives, `@Nullable Boolean`, `String`, `List`. +- `build()` consumes the builder’s fields. + +#### Output +- `LlamaCppJniConfig` immutable instance with all fields copied from builder. +- Getter methods return primitive values, `String`, `@Nullable Boolean`, or unmodifiable `List`. + +#### Core logic +- `private LlamaCppJniConfig(Builder)` copies each builder field to the corresponding final field. +- `Builder` constructor assigns `modelPath` after `Objects.requireNonNull`. +- Each setter assigns the argument to its field and returns `this`. +- `build()` returns `new LlamaCppJniConfig(this)`. + +#### Public API +- `static Builder builder(String modelPath)` → `Builder` (creates builder with defaults). +- `String modelPath()` → model file path. +- `int contextSize()` → context window size. +- `int maxOutputTokens()` → max output tokens. +- `float temperature()` → sampling temperature. +- `int threads()` → CPU threads. +- `float topP()` → nucleus‑sampling threshold. +- `int topK()` → top‑k limit. +- `float minP()` → min‑p threshold. +- `float topNSigma()` → top‑n‑sigma threshold. +- `float repeatPenalty()` → repetition penalty. +- `@Nullable Boolean chatTemplateEnableThinking()` → chat‑template thinking flag. +- `boolean cachePrompt()` → prompt caching enabled. +- `boolean swaFull()` → full‑size SWA cache kept. +- `int cacheReuse()` → KV prefix‑reuse chunk size. +- `int gpuLayers()` → GPU layers offloaded. +- `int seed()` → RNG seed. +- `int cpuMoeLayers()` → CPU MoE layers. +- `int cpuFfnLayers()` → CPU FFN layers. +- `int kvUnifiedPerSlot()` → per‑slot unified KV cap. +- `String lazyMode()` → tensor‑read laziness. +- `int repeatLastN()` → repeat‑penalty window. +- `String cacheTypeK()` → KV‑cache type for K. +- `String cacheTypeV()` → KV‑cache type for V. +- `boolean flashAttn()` → Flash Attention enabled. +- `int batchSize()` → logical batch size. +- `int ubatchSize()` → physical batch size. +- `int threadsBatch()` → batch/prompt‑processing threads. +- `int mainGpu()` → primary GPU index. +- `String devices()` → device selection. +- `String provider()` → AI provider name. +- `String remoteModel()` → remote model ID. +- `String baseUrl()` → OpenAI‑compatible base URL. +- `String apiKeyEnv()` → API key environment variable name. +- `String reasoningEffort()` → reasoning‑effort value. +- `int reasoningBudgetTokens()` → reasoning token budget. +- `float dryMultiplier()` → DRY multiplier. +- `float dryBase()` → DRY base. +- `int dryAllowedLength()` → DRY allowed length. +- `int dryPenaltyLastN()` → DRY penalty look‑back. +- `List drySequenceBreakers()` → unmodifiable DRY sequence breakers. +- `List stopStrings()` → unmodifiable stop strings. +- `Builder contextSize(int)` → set context size. +- `Builder maxOutputTokens(int)` → set max output tokens. +- `Builder temperature(float)` → set temperature. +- `Builder threads(int)` → set CPU threads. +- `Builder topP(float)` → set nucleus‑sampling threshold. +- `Builder topK(int)` → set top‑k limit. +- `Builder minP(float)` → set min‑p threshold. +- `Builder topNSigma(float)` → set top‑n‑sigma threshold. +- `Builder repeatPenalty(float)` → set repetition penalty. +- `Builder chatTemplateEnableThinking(@Nullable Boolean)` → set chat‑template flag. +- `Builder cachePrompt(boolean)` → set prompt caching. +- `Builder swaFull(boolean)` → set full‑size SWA cache. +- `Builder cacheReuse(int)` → set KV prefix‑reuse chunk size. +- `Builder gpuLayers(int)` → set GPU layers. +- `Builder seed(int)` → set RNG seed. +- `Builder cpuMoeLayers(int)` → set CPU MoE layers. +- `Builder cpuFfnLayers(int)` → set CPU FFN layers. +- `Builder kvUnifiedPerSlot(int)` → set per‑slot unified KV cap. +- `Builder lazyMode(String)` → set tensor‑read laziness. +- `Builder repeatLastN(int)` → set repeat‑penalty window. +- `Builder cacheTypeK(String)` → set KV‑cache type K. +- `Builder cacheTypeV(String)` → set KV‑cache type V. +- `Builder flashAttn(boolean)` → set Flash Attention. +- `Builder batchSize(int)` → set logical batch size. +- `Builder ubatchSize(int)` → set physical batch size. +- `Builder threadsBatch(int)` → set batch/prompt‑processing threads. +- `Builder mainGpu(int)` → set primary GPU index. +- `Builder devices(String)` → set device selection. +- `Builder provider(String)` → set AI provider. +- `Builder remoteModel(String)` → set remote model ID. +- `Builder baseUrl(String)` → set base URL. +- `Builder apiKeyEnv(String)` → set API key env name. +- `Builder reasoningEffort(String)` → set reasoning‑effort. +- `Builder reasoningBudgetTokens(int)` → set reasoning budget. +- `Builder dryMultiplier(float)` → set DRY multiplier. +- `Builder dryBase(float)` → set DRY base. +- `Builder dryAllowedLength(int)` → set DRY allowed length. +- `Builder dryPenaltyLastN(int)` → set DRY penalty look‑back. +- `Builder drySequenceBreakers(List)` → set DRY sequence breakers. +- `Builder stopStrings(List)` → set stop strings. +- `Builder build()` → `LlamaCppJniConfig`. + +#### Dependencies +- `java.util.Collections`, `java.util.List`, `java.util.Objects`. +- `lombok.EqualsAndHashCode`, `lombok.ToString`. +- `net.ladenthin.srcmorph.config.AiGenerationConfig`. +- `net.ladenthin.srcmorph.support.ConvertToRecord`. +- `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `Objects.requireNonNull` throws `NullPointerException` if `modelPath` is null. +- No other explicit exceptions. + +#### Concurrency +- `Builder` is not thread‑safe; intended for single‑thread use. +- `LlamaCppJniConfig` is immutable and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..d2eb45c2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,98 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:54:21Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds the request body, endpoint, API key handling, and error/timing logic for an OpenAI‑compatible chat‑completion provider. + +#### Purpose +- Constructs JSON request bodies for chat‑completion calls. +- Validates and normalises endpoint URLs. +- Retrieves and secures API keys. +- Generates error messages and timing metrics. + +#### Type +- `final class OpenAiCompatibleProviderSupport` (class, final) + extends `Object` + annotations: `@ToString` + fields: + - `static final String CHAT_COMPLETIONS_PATH` (class) + - `static final int ERROR_BODY_EXCERPT` (class) + - `private static final int HTTP_OK_FIRST` (class) + - `private static final int HTTP_OK_END` (class) + - `static final String HTTP_SCHEME` (class) + - `static final String HTTPS_SCHEME` (class) + - `private static final String LOOPBACK_HOST_NAME` (class) + - `private static final Pattern IPV4_LOOPBACK` (class) + - `private static final String IPV6_LOOPBACK` (class) + - `private static final String ELLIPSIS` (class) + - `private static final ObjectMapper MAPPER` (class) + - `private final LlamaCppJniConfig config` (instance) + - `@ToString.Exclude private final AiPromptSupport promptSupport` (instance) + - `@ToString.Exclude private final Function environment` (instance) + - `private final Java8CompatibilityHelper compatibilityHelper` (instance) + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, `Function environment`. +- `requestBody(AiGenerationRequest request)` consumes `AiGenerationRequest` fields: `promptKey()`, `sourceFile()`, `sourceText()`. +- `endpoint()` reads `config.baseUrl()`. +- `apiKey()` reads `config.apiKeyEnv()` and `environment.apply(...)`. +- `apiKeyFor(String endpoint)` reads `endpoint` and `apiKey()`. +- `isLoopbackHost(String host)` reads `host`. +- `isSuccess(int status)` reads `status`. +- `errorMessage(String endpoint, int status, String body)` reads all three. +- `timings(String text, ChatResponse response, double seconds)` reads `response.getUsage()`. + +#### Output +- `requestBody` returns JSON string. +- `endpoint` returns URL string. +- `apiKey` returns trimmed key or `null`. +- `apiKeyFor` returns key or `null`; may throw `IOException`. +- `isLoopbackHost` returns boolean. +- `isSuccess` returns boolean. +- `errorMessage` returns formatted string. +- `timings` returns `AiGenerationTimings` instance. + +#### Core logic +- `requestBody`: builds `ObjectNode` with model, messages, sampling knobs, optional fields (`top_k`, `min_p`, `seed`, `stop`, `reasoning.effort`), sets `stream=false`, serialises with `MAPPER`. +- `endpoint`: trims `config.baseUrl()`, ensures it starts with `http://` or `https://`, removes trailing slashes, appends `CHAT_COMPLETIONS_PATH`. +- `apiKey`: returns trimmed environment variable value if `config.apiKeyEnv()` is non‑blank; otherwise `null`. +- `apiKeyFor`: if key exists and endpoint starts with `http://`, parses host via `URL`; if host not loopback (`isLoopbackHost`), throws `IOException`; otherwise returns key. +- `isLoopbackHost`: checks host equals `localhost`, matches IPv4 loopback regex, or equals `[::1]`. +- `isSuccess`: checks status in [200,300). +- `errorMessage`: truncates body to `ERROR_BODY_EXCERPT`, appends ellipsis if truncated, formats message with endpoint and status. +- `timings`: extracts `completionTokens`, `promptTokens`, `cachedTokens` from `Usage`; computes `decodeRate = completionTokens / seconds` if seconds>0; constructs `AiGenerationTimings` with prefillRate=0.0. + +#### Public API +- `String requestBody(AiGenerationRequest request) -> String` builds request body. +- `String endpoint() -> String` returns chat‑completions URL. +- `@Nullable String apiKey() -> String` retrieves API key. +- `@Nullable String apiKeyFor(String endpoint) -> String` secures key for endpoint. +- `static boolean isLoopbackHost(String host) -> boolean` checks loopback. +- `static boolean isSuccess(int status) -> boolean` checks 2xx. +- `static String errorMessage(String endpoint, int status, String body) -> String` formats error. +- `static AiGenerationTimings timings(String text, ChatResponse response, double seconds) -> AiGenerationTimings` computes timings. + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper`, `ArrayNode`, `ObjectNode` +- `java.io.IOException`, `java.net.URL`, `java.util.List`, `java.util.Objects`, `java.util.function.Function`, `java.util.regex.Pattern` +- `lombok.ToString`, `lombok.ToString.Exclude` +- `net.ladenthin.llama.value.ChatResponse`, `net.ladenthin.llama.value.Usage` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `requestBody` throws `IOException` if JSON serialization fails. +- `endpoint` throws `IllegalArgumentException` if baseUrl not http(s). +- `apiKeyFor` throws `IOException` if plain http to non‑loopback host or URL parsing fails. +- `errorMessage` no exceptions. + +#### Concurrency +- All methods are stateless or use immutable fields; thread‑safe. No synchronization or mutable shared state. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..e062c61f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,60 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:55:14Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> A modular AI generation framework that supports local llama.cpp inference, OpenAI‑compatible APIs, and mock providers, with configurable request building, response parsing, and timing metrics. + +#### Purpose +- Provide a pluggable text‑generation engine for source‑code transformation tasks. +- Offer local, cloud‑compatible, and test‑mode backends with unified request/response handling. + +#### Responsibilities +- **Provider Factory** – resolves and instantiates the correct `AiGenerationProvider` based on run‑time or model configuration. +- **Provider Implementations** – generate text and optionally timing data: + - `LlamaCppJniAiGenerationProvider` for local GGUF inference. + - `OpenAiCompatibleAiGenerationProvider` for HTTP chat‑completion endpoints. + - `MockAiGenerationProvider` for deterministic testing. +- **Request/Response Handling** – build JSON bodies, validate URLs, fetch API keys, parse raw completions, and extract metrics. +- **Configuration** – immutable `LlamaCppJniConfig` exposes all llama.cpp knobs and defaults. + +#### Key units +- `AiGenerationProvider` (interface) – `generate`, `generateWithTimings`, `close`. +- `AiGenerationProviderFactory` – `create`, `effectiveProvider`. +- `LlamaCppJniAiGenerationProvider` – lazy GGUF model loading, chat completion, timing extraction. +- `OpenAiCompatibleProviderSupport` – request body construction, endpoint normalization, API key resolution, error formatting, timing calculation. +- `LlamaCppJniConfig` – immutable builder‑based config with 37 knobs. +- `AiCompletionParser` – strips model‑internal thinking blocks from raw text. + +#### Data flow +1. **Factory** receives provider key, llama config, and prompt support → returns a concrete provider. +2. **Provider** receives `AiGenerationRequest` (prompt key, source file, source text, header). +3. **Request body** built by provider support → sent to local model or HTTP endpoint. +4. **Response** parsed: + - Local: `chatComplete` → JSON → `ChatResponseParser` → `ChatResponse`. + - Remote: HTTP body → `ChatResponseParser`. +5. **Completion text** extracted via `AiCompletionParser`. +6. **Timings** computed from inference metadata or usage stats. +7. **Result** returned as `String` or `AiGenerationTimings`. + +#### Dependencies +- **Internal**: `AiPromptSupport`, `Java8CompatibilityHelper`, `AiGenerationRequest`, `AiGenerationTimings`. +- **Local provider**: `net.ladenthin.llama` (model, parameters, JSON parsing). +- **Remote provider**: Jackson `ObjectMapper`, `ChatResponse`, `Usage`. +- **Utilities**: `lombok` annotations, `org.jspecify.annotations.Nullable`, `java.net.URL`, `java.util.regex.Pattern`. + +#### Cross-cutting +- **Immutability**: `LlamaCppJniConfig` and provider support classes are immutable; thread‑safe by design. +- **Error handling**: `AiCompletionParser` throws `IOException` on malformed thinking blocks; provider support throws `IOException` for key/URL issues. +- **Timing metrics**: `generateWithTimings` in providers returns `AiGenerationTimings` with prompt/cache throughput and predicted token rates. +- **Configuration knobs**: 37 parameters in `LlamaCppJniConfig` allow fine‑grained control over model loading, GPU usage, caching, and sampling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..2818dfa5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,49 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:54:51Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Computes a 256‑bin histogram of a byte stream in two OpenCL kernel passes. + +#### Purpose +- Build a byte histogram for image or arbitrary byte data. +- Split work into two passes: per‑group partial counts, then global reduction. + +#### Type +- OpenCL C 1.2 kernels (`__kernel` functions) in file `histogram.cl`. + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms into `partial` buffer. +- `histogram_reduce`: writes final 256‑bin histogram into `histogram` buffer. + +#### Core logic +- **histogram_partial** + 1. Zero local bin array in parallel (`local_bins[b] = 0`). + 2. Iterate over input bytes in strides of global size, atomically increment local bin for each byte. + 3. After all work-items finish, copy local bins to global `partial` at offset `group_id * BINS`. +- **histogram_reduce** + 1. Each work-item handles one bin (`bin = get_global_id(0)`). + 2. Sum the corresponding bin across all partial histograms (`partial[g * BINS + bin]`). + 3. Store the sum into `histogram[bin]`. + +#### Public API +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – final histogram reduction. + +#### Constants and configuration +- `#define BINS 256` – number of histogram bins. + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier(CLK_LOCAL_MEM_FENCE)`. + +#### Exceptions / Errors +- No explicit error handling; kernels return early if `bin >= BINS` in `histogram_reduce`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..b6e37d13 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,36 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:55:25Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes a 256‑bin histogram of a byte stream using two OpenCL kernel passes. + +#### Purpose +- Generate a byte‑frequency histogram for image or arbitrary byte data. +- Split computation into a per‑group partial pass and a global reduction pass. + +#### Responsibilities +- **Partial histogram kernel**: accumulate per‑work‑group local counts, write to global buffer. +- **Reduction kernel**: sum partial counts across groups to produce final 256‑bin histogram. + +#### Key units +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – per‑group partial histogram kernel. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – global reduction kernel. +- `#define BINS 256` – constant for histogram bin count. + +#### Data flow +1. **Input**: byte array `input` and its `length`. +2. `histogram_partial` reads `input`, atomically updates `local_bins`, copies to `partial` at `group_id * BINS`. +3. `histogram_reduce` reads `partial`, sums each bin across all groups, writes result to `histogram`. + +#### Dependencies +- OpenCL 1.2 built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier(CLK_LOCAL_MEM_FENCE)`. + +#### Cross-cutting +- Two‑pass pattern: local aggregation followed by global reduction. +- No explicit error handling; kernels exit early if a bin index exceeds `BINS`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..caafb52d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,46 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:55:35Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> A lightweight, OpenCL‑accelerated image‑processing toolkit that builds byte‑frequency histograms, supplies a lock‑free circular buffer for streaming data, and offers shell/Python helpers for backup and sales reporting. + +#### Purpose +- Deliver GPU‑based histogram computation for byte streams. +- Provide a fast, single‑producer/single‑consumer ring buffer for byte data. +- Supply auxiliary scripts for data backup and sales analytics. + +#### Responsibilities +- **GPU Histogram**: two‑pass OpenCL kernels that aggregate per‑group partial histograms and reduce them to a global 256‑bin result. +- **Ring Buffer**: power‑of‑two circular buffer with non‑blocking read/write, capacity queries, and minimal error handling. +- **Utilities**: Bash script for rotating compressed backups; Python module for parsing CSV orders, filtering by currency, and aggregating revenue by month and region. + +#### Key units +- `histogram_partial`, `histogram_reduce` (OpenCL kernels) – compute per‑group and global histograms. +- `ringbuf_t`, `ringbuf_status_t`, `ringbuf_init`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space` – C API for the lock‑free buffer. +- `rotate_backups.sh` – Bash script for timestamped tar.gz archiving and retention. +- `sales_report.py` – Python module exposing `parse_orders`, `revenue_by_month_and_region`, and a CLI `main`. + +#### Data flow +1. **Histogram**: byte array → `histogram_partial` (local bins) → `partial` buffer → `histogram_reduce` → final 256‑bin histogram. +2. **Ring Buffer**: `ringbuf_init` allocates memory → `ringbuf_write` copies data, updates head → `ringbuf_read` copies data, updates tail → `ringbuf_used`/`ringbuf_free_space` report state. +3. **Utilities**: `rotate_backups.sh` takes source dir → creates `tar.gz` → prunes old archives; `sales_report.py` reads CSV → parses `Order` objects → aggregates revenue → prints TSV. + +#### Dependencies +- **OpenCL**: built‑ins (`get_local_id`, `atomic_inc`, etc.) for histogram kernels. +- **C Standard Library**: `malloc`, `free`, `memcpy` for ring buffer. +- **Shell Tools**: `tar`, `date`, `du`, `ls`, `mkdir`, `rm`, `mv`, `echo` for backup script. +- **Python Standard Library**: `argparse`, `csv`, `collections.defaultdict`, `dataclasses`, `datetime`, `decimal` for sales reporting. + +#### Cross-cutting +- Power‑of‑two sizing and bit‑masking for efficient wrap‑around in the ring buffer. +- Two‑pass aggregation pattern in the histogram kernels. +- Consistent error handling: return codes for C functions, exceptions for Python, exit codes for shell scripts. +- Minimal configuration: backup retention count, report currency defaults. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..db8bf838 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,47 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:55:27Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> A lock‑free, power‑of‑two sized circular buffer for byte streams, enabling efficient single‑producer/single‑consumer data transfer. + +#### Purpose +- Provide a lightweight FIFO for byte streams. +- Offer non‑blocking read/write with minimal overhead. + +#### Responsibilities +- **Buffer lifecycle** – initialization, allocation, deallocation. +- **Data movement** – contiguous or split writes/reads with wrap‑around. +- **State reporting** – used bytes and free space queries. + +#### Key units +- `ringbuf_t` – struct holding buffer pointer, capacity, head/tail indices. +- `ringbuf_status_t` – enum (`RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`). +- `ringbuf_init` – validates capacity, allocates memory, sets indices. +- `ringbuf_free` – releases allocated memory. +- `ringbuf_write` – copies up to `len` bytes, updates head, returns written count. +- `ringbuf_read` – copies up to `len` bytes, updates tail, returns read count. +- `ringbuf_used` – computes `(head - tail) & (capacity-1)`. +- `ringbuf_free_space` – returns `capacity - 1 - used`. + +#### Data flow +1. **Init** → allocate `data` array, set `head = tail = 0`. +2. **Write** → copy from source to buffer, split if wrap‑around, advance `head`. +3. **Read** → copy from buffer to destination, split if wrap‑around, advance `tail`. +4. **Query** → `ringbuf_used`/`ringbuf_free_space` compute metrics via bit masking. + +#### Dependencies +- Standard C library: `stdlib.h` (`malloc`, `free`), `string.h` (`memcpy`). +- Header `ringbuf.h` defines types and API. + +#### Cross-cutting +- Power‑of‑two capacity enforced via `is_power_of_two`. +- Bit‑masking (`capacity-1`) used for efficient wrap‑around. +- Single‑producer/single‑consumer assumption; no explicit locking required. +- Error handling limited to initialization failures (`EINVAL`, `ENOMEM`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..0aa18f63 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,58 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:54:54Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Implements a fixed‑size ring buffer with power‑of‑two capacity, providing init, free, read, write, and status queries. + +#### Purpose +- Provides a circular FIFO buffer for byte streams. +- Ensures efficient wrap‑around using bit masking. + +#### Type +- C source file (`ringbuf.c`), implements functions declared in `ringbuf.h`. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_free` deallocates internal storage. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates buffer, sets head/tail to 0. +- `ringbuf_free` frees buffer and resets fields. +- `ringbuf_used` computes bytes in buffer via `(head - tail) & (capacity-1)`. +- `ringbuf_free_space` computes available space. +- `ringbuf_write` writes up to two contiguous chunks: from head to end, then from start. +- `ringbuf_read` reads similarly from tail. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free resources. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – space left. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write data. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read data. + +#### Constants and configuration +- None defined in this file. + +#### Dependencies +- `ringbuf.h` (declaration of `ringbuf_t`, `ringbuf_status_t`). +- Standard library: `stdlib.h` (`malloc`, `free`), `string.h` (`memcpy`). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity not power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..ae965f41 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,59 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:54:58Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> A fixed‑size byte ring buffer for single‑producer/single‑consumer use. + +#### Purpose +- Provides a lock‑free byte buffer with power‑of‑two capacity. +- Supports non‑blocking write/read operations. + +#### Type +- Header (`ringbuf.h`) in C. +- Defines `ringbuf_t` struct, `ringbuf_status_t` enum, and public API functions. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes (must be power of two, >0). +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes actually written. +- `ringbuf_read` returns number of bytes actually read. +- `ringbuf_used` and `ringbuf_free_space` return current usage metrics. + +#### Core logic +- `ringbuf_init`: validates capacity, allocates `data` array, initializes head/tail to 0. +- `ringbuf_write`: calculates available space (`capacity - 1 - used`), copies up to `len` bytes, updates `head` atomically. +- `ringbuf_read`: calculates available data (`used`), copies up to `len` bytes, updates `tail` atomically. +- `ringbuf_used`: computes `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space`: returns `capacity - 1 - used`. +- `ringbuf_free`: frees allocated `data`. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – release resources. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – free capacity. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- ``, `` for standard types. +- Uses `malloc`/`free` implicitly via `ringbuf_init`/`ringbuf_free`. + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- Returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..1ed51a52 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,40 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:55:30Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> Provides utilities for backing up directories and generating monthly sales reports from CSV order data. + +#### Purpose +- Automate creation and rotation of compressed backups. +- Produce aggregated revenue reports by month and region. + +#### Responsibilities +- **Backup Management** – `rotate_backups.sh` handles directory snapshotting, timestamped archiving, and retention policy. +- **Sales Reporting** – `sales_report.py` parses order exports, filters by currency, aggregates revenue, and outputs tab‑separated summaries. + +#### Key units +- **`rotate_backups.sh`** – Bash script that creates `tar.gz` archives, names them with UTC timestamps, and prunes older files beyond a configurable keep count. +- **`sales_report.py`** – Python module exposing: + - `parse_orders(path, currency)` – yields `Order` dataclass instances from CSV. + - `revenue_by_month_and_region(orders)` – returns a sorted dict of `(YYYY‑MM, region) → Decimal` totals. + - `main(argv=None)` – CLI entry point that orchestrates parsing, aggregation, and output. + +#### Data flow +1. **Backup**: User supplies source and backup directories; script validates, archives, and cleans old backups. +2. **Reporting**: User supplies CSV files and options; script parses each file, filters by currency, aggregates revenue per month/region, then prints results. + +#### Dependencies +- **Shell**: `tar`, `date`, `du`, `ls`, `mkdir`, `rm`, `mv`, `echo`. +- **Python**: `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses`, `datetime`, `decimal`. + +#### Cross-cutting +- Both utilities enforce strict input validation and provide clear exit codes (`0` success, `1/2` errors). +- Error handling uses standard exceptions (`ValueError`, `InvalidOperation`) and shell traps to clean temporary files. +- Configuration is minimal and explicit: backup keep count defaults to 7; report currency defaults to EUR. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..8eb351a9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,62 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:55:02Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Creates a dated, compressed backup of a directory and prunes older archives, keeping only the newest N. + +#### Purpose +- Backup a specified directory. +- Retain only the most recent N archives. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- `$1` → `SOURCE_DIR` (required). +- `$2` → `BACKUP_DIR` (required). +- `$3` → `KEEP` (optional, defaults to `7`). +- No external options or environment variables. + +#### Output +- Creates a file `"$BACKUP_DIR/${name}_.tar.gz"`. +- Deletes older archives beyond the `KEEP` count. +- Prints creation and removal messages. +- Exits with status `0` on success, `2` on argument or validation errors. + +#### Core logic +- Validate `KEEP` is a positive integer. +- Ensure `SOURCE_DIR` exists; create `BACKUP_DIR`. +- Build archive name with UTC timestamp. +- Create temporary archive (`.partial`), then rename to final. +- List existing archives sorted newest first. +- Remove archives beyond the `KEEP` limit. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR`=`"${1:?usage: rotate_backups.sh [keep]}"` +- `BACKUP_DIR`=`"${2:?usage: rotate_backups.sh [keep]}"` +- `KEEP`=`"${3:-7}"` +- `name`=`"$(basename "$SOURCE_DIR")"` +- `archive`=`"$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp`=`"$archive.partial"` + +#### Dependencies +- `tar` (creates compressed archive). +- `date` (generates timestamp). +- `du` (reports archive size). +- `ls` (lists existing archives). +- `mkdir`, `rm`, `mv`, `echo` (standard utilities). + +#### Errors and exit codes +- `exit 2` if `KEEP` is not a positive integer. +- `exit 2` if `SOURCE_DIR` does not exist. +- `trap` ensures temporary file is removed on exit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..3f071c11 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,61 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:55:06Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Generates a monthly sales report from CSV order exports, aggregating revenue by month and region for a specified currency. + +#### Purpose +- Aggregate order amounts by month and region. +- Output revenue per month/region in a specified currency. + +#### Type +- Python script (`.py`). + +#### Input +- `csv_files`: list of CSV file paths (positional arguments). +- `--currency`: target currency code (default `EUR`). +- `--min-revenue`: minimum revenue threshold (default `0`). +- CSV columns: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints tab‑separated lines: `monthregionrevenue currency`. +- Exits with status `0` on success, `1` if no orders found. + +#### Core logic +- `parse_orders(path, currency)`: + - Open CSV, validate required columns. + - Skip rows with non‑matching currency. + - Convert `order_date` to `date`, `amount` to `Decimal`. + - Yield `Order` dataclass instances. +- `revenue_by_month_and_region(orders)`: + - Sum `amount` per `(YYYY-MM, region)` key using `defaultdict`. + - Return sorted dictionary of totals. +- `main(argv)`: + - Parse CLI arguments. + - Collect orders from all files. + - If none, error message and exit `1`. + - Iterate sorted totals; print rows meeting `min_revenue`. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` + Parses CSV, filters by currency, yields orders. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` + Aggregates revenue per month/region. +- `main(argv=None) -> int` + CLI entry point; processes arguments, outputs report. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")` + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` on missing columns or invalid data rows. +- `ValueError` propagated from `parse_orders` for malformed dates or amounts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..29d14b8b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,46 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:55:58Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A unified framework for AI‑driven source‑code transformation, GPU‑accelerated data processing, and domain‑specific SQL persistence, all orchestrated through configuration, validation, and modular providers. + +#### Purpose +- Centralize AI‑based code morphing in Maven builds. +- Offer GPU‑accelerated histogram and ring‑buffer utilities for high‑throughput data streams. +- Persist and manage library, shop, and warehouse data with transactional logic and audit/reporting. + +#### Responsibilities +- **AI Morphing** – configuration, file selection, fact extraction, oversize handling, provider resolution, and generation execution. +- **GPU & Buffering** – two‑pass OpenCL histogram kernels, lock‑free ring buffer API, and auxiliary backup/report scripts. +- **SQL Domain Logic** – cataloging, checkout, order processing, stock sync, audit trails, and reporting views. + +#### Key units +- **Java**: `SrcMorphConfiguration`, `AiConditionEvaluator`, `AiFactExtractor`, `AiOversizeStrategy`, `AiGenerationProvider` (and concrete `LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleAiGenerationProvider`, `MockAiGenerationProvider`), `AiCompletionParser`, `LlamaCppJniConfig`. +- **C/OpenCL**: `histogram_partial`, `histogram_reduce`, `ringbuf_t` API (`ringbuf_init`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space`). +- **Shell/Python**: `rotate_backups.sh`, `sales_report.py` (`parse_orders`, `revenue_by_month_and_region`). +- **SQL**: Library tables (`author`, `book`, `member`, `loan`, `book_copy`, `loan_audit`), functions (`fn_checkout_book`, `fn_late_fee`), procedures (`sp_return_book`), views (`overdue_loans`, `member_loan_stats`, `popular_books`); Shop tables (`product`, `customer_order`, `order_item`), procedure `add_order_item`; Warehouse tables (`StockLevel`, `SupplierFeed`, `SyncLog`), procedure `usp_SyncStock`. + +#### Data flow +1. **AI Pipeline** – load `SrcMorphConfiguration` → evaluate `AiCondition` against `AiFileContext` → extract facts with `AiFactExtractor` → apply `AiOversizeStrategy` → create provider via `AiGenerationProviderFactory` → generate text, return `String` or `AiGenerationTimings`. +2. **Histogram** – input byte array → `histogram_partial` → per‑group bins → `histogram_reduce` → 256‑bin result. +3. **Ring Buffer** – `ringbuf_init` → `ringbuf_write` (producer) → `ringbuf_read` (consumer) → state via `ringbuf_used`/`ringbuf_free_space`. +4. **SQL Workflows** – Library checkout/return procedures update copies, loans, and audit; Shop `add_order_item` locks product, updates stock, recalculates totals; Warehouse `usp_SyncStock` merges supplier feed into stock levels and logs run. + +#### Dependencies +- **Internal** – AI: `AiCondition`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`, `AiPromptSupport`, `AiGenerationRequest`, `AiGenerationTimings`; C/OpenCL: ring‑buffer structs; SQL: cross‑package tables and functions. +- **External** – Java: Jackson, Lombok, `java.time`, `java.util.regex`; C/OpenCL: OpenCL runtime; Python: standard library; SQL: PostgreSQL/MySQL/SQL Server built‑ins and features. + +#### Cross-cutting +- **Immutability & Thread‑Safety** – `LlamaCppJniConfig`, provider implementations, and `AiOversizeStrategy` are immutable; evaluator and extractor are stateless. +- **Validation & Error Handling** – `AiConditionEvaluator.validate`, `AiFactExtractor.validate` enforce config correctness; providers throw `IllegalArgumentException` on misconfig, `IOException` on malformed responses. +- **Performance Metrics** – Providers expose `generateWithTimings` returning `AiGenerationTimings` (throughput, token rates). +- **Configuration Knobs** – 37 llama.cpp parameters in `LlamaCppJniConfig`; ring buffer uses power‑of‑two sizing; histogram kernels use two‑pass aggregation. +- **Audit & Logging** – Library `loan_audit`, Warehouse `SyncLog`; consistent error codes across C, Python, and shell utilities. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..755d9b4c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 920AA6FD +- D: 2026-11-04T12:53:23Z +- T: 2026-11-04T12:56:04Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project centers on an AI‑driven source‑code transformation framework that is configuration‑driven and orchestrated through a Maven‑based build pipeline. It integrates a modular provider layer that supports local llama.cpp inference, OpenAI‑compatible APIs, and mock backends, while a lightweight OpenCL toolkit accelerates data processing by computing byte‑frequency histograms and supplying a lock‑free circular buffer for streaming. SQL packages supply persistent storage for library cataloging, e‑commerce orders, and warehouse inventory, each with dedicated models, business logic, and audit/reporting capabilities, all tied together by the unified framework’s validation and modular provider architecture. + +#### Packages +- java/config — A configuration and evaluation framework that drives AI‑powered source‑code transformation jobs, handling file selection, fact extraction, and generation settings for a Maven‑based build pipeline. +- java — A framework that orchestrates AI‑driven source‑code transformations, from configuration‑driven file selection and fact extraction to pluggable text‑generation backends. +- java/provider — A modular AI generation framework that supports local llama.cpp inference, OpenAI‑compatible APIs, and mock providers, with configurable request building, response parsing, and timing metrics. +- other/kernels — Computes a 256‑bin histogram of a byte stream using two OpenCL kernel passes. +- other — A lightweight, OpenCL‑accelerated image‑processing toolkit that builds byte‑frequency histograms, supplies a lock‑free circular buffer for streaming data, and offers shell/Python helpers for backup and sales reporting. +- other/ringbuf — A lock‑free, power‑of‑two sized circular buffer for byte streams, enabling efficient single‑producer/single‑consumer data transfer. +- other/scripts — Provides utilities for backing up directories and generating monthly sales reports from CSV order data. +- . — A unified framework for AI‑driven source‑code transformation, GPU‑accelerated data processing, and domain‑specific SQL persistence, all orchestrated through configuration, validation, and modular providers. +- sql/library — A PostgreSQL library management system that stores catalog, member, and loan data, tracks book availability, and provides reporting and audit trails. +- sql — A collection of SQL packages that manage library cataloging, e‑commerce orders, and warehouse inventory, each with dedicated data models, business logic, and audit/reporting capabilities. +- sql/shop — A MySQL schema for a web shop that stores products, orders, and line items, and provides a stored procedure to add items, reserve stock, and update order totals. +- sql/warehouse — Keeps the warehouse inventory in sync with nightly supplier feeds and records each sync run. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..3f1e15cb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,69 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:54:29Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Defines the core relational schema for a library system, including authors, books, members, and loan transactions. + +#### Purpose +- Store library catalog and member data. +- Track book loans and availability. + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author (author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `member_id BIGINT NOT NULL REFERENCES member (member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` + +Indexes +- `idx_book_author ON book (author_id)` +- `idx_loan_member ON loan (member_id)` +- `idx_loan_open ON loan (due_on) WHERE returned_on IS NULL` + +#### Reads +- `author` (via `book.author_id` FK) +- `book` (via `loan.book_id` FK) +- `member` (via `loan.member_id` FK) + +#### Writes +- Inserts/updates/deletes on `author`, `book`, `member`, `loan`. + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- `author`, `book`, `member`, `loan` tables referenced by foreign keys and indexes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..e464af64 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,62 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:54:31Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Provides reporting views for a library system: overdue loans, member loan statistics, and popular books. + +#### Purpose +- Exposes aggregated loan data for reporting. +- Highlights overdue loans, member activity, and recent popular books. + +#### Type +- PostgreSQL views: `overdue_loans`, `member_loan_stats`. +- PostgreSQL materialized view: `popular_books`. +- Index: `idx_popular_books_id` on `popular_books`. + +#### Schema +- **overdue_loans** + - `loan_id` integer + - `member_id` integer + - `email` text + - `title` text + - `due_on` date + - `days_overdue` integer +- **member_loan_stats** + - `member_id` integer + - `full_name` text + - `loans_total` bigint + - `loans_open` bigint + - `last_loan_on` timestamp +- **popular_books** + - `book_id` integer + - `title` text + - `author_name` text + - `times_loaned` bigint +- **idx_popular_books_id** + - Unique index on `popular_books(book_id)`. + +#### Reads +- `loan` (all columns used: `loan_id`, `member_id`, `book_id`, `due_on`, `returned_on`, `loaned_on`) +- `member` (`member_id`, `email`, `full_name`) +- `book` (`book_id`, `title`, `author_id`) +- `author` (`author_id`, `full_name`) + +#### Writes +- None (views and materialized view are read‑only). + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. +- Functions: `CURRENT_DATE`, `CURRENT_DATE - INTERVAL '365 days'`. + +--- diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..d572737a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,66 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:54:33Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> A PostgreSQL library system that manages book loans, returns, late fees, and audit trails. + +#### Purpose +- Handles checkout and return of library books. +- Calculates late fees. +- Records audit events for loan actions. + +#### Type +- Table: `loan_audit` +- Function: `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn` +- Procedure: `sp_return_book` +- Trigger: `trg_loan_audit` + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member` (`member_id`, `is_blocked`) – check blocked status. +- `book` (`book_id`, `copies_free`) – verify and decrement free copies. +- `loan` (`loan_id`, `returned_on`) – update return status. +- `loan` (`loan_id`, `book_id`) – retrieve book id for return. +- `loan` (`due_on`, `returned_on`) – late fee calculation. + +#### Writes +- `book` – decrement `copies_free` on checkout; increment on return. +- `loan` – insert new loan record; update `returned_on` on return. +- `loan_audit` – insert audit rows on checkout and return. + +#### Relationships +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` +- `loan_audit.loan_id -> loan.loan_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Verify member not blocked. + - Decrement `book.copies_free`; error if none. + - Insert into `loan` with `due_on = CURRENT_DATE + p_days`; return new `loan_id`. +- **sp_return_book(p_loan_id)** + - Update `loan.returned_on = CURRENT_DATE` where not already returned; capture `book_id`. + - Increment `book.copies_free` for that book. +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Multiply by 50, cap at 2000. +- **trg_loan_audit_fn()** + - On `INSERT`: log `CHECKOUT`. + - On `UPDATE` where `returned_on` changes from NULL to non‑NULL: log `RETURN`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit` +- Functions: `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `trg_loan_audit_fn` +- Trigger: `trg_loan_audit` on `loan` table. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..8eeb7b02 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,80 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:54:36Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Adds library branches, creates a book_copy table linking books to branches, and updates member and loan tables to reference branches and copies. + +#### Purpose +- Introduce branch management and per‑copy tracking. +- Migrate existing book copy data into the new book_copy table. +- Update member and loan schemas to reference branches and copies. + +#### Type +- Table: `branch` +- Table: `book_copy` +- Table: `loan` (ALTER) +- Table: `member` (ALTER) +- Table: `book` (ALTER) +- Index: `idx_book_copy_book` + +#### Schema +- **branch** + - `branch_id SMALLSERIAL PRIMARY KEY` + - `name VARCHAR(100) NOT NULL UNIQUE` + - `city VARCHAR(100) NOT NULL` +- **book_copy** + - `copy_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `branch_id SMALLINT NOT NULL REFERENCES branch (branch_id)` + - `barcode VARCHAR(32) NOT NULL UNIQUE` + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE','ON_LOAN','LOST'))` +- **loan** + - `copy_id BIGINT REFERENCES book_copy (copy_id)` (new column) +- **member** + - `joined_on` renamed to `member_since` + - `home_branch_id SMALLINT REFERENCES branch (branch_id)` (new column) +- **book** + - `copies_free` and `copies_total` columns dropped; constraint `book_free_le_total` removed. +- **Index** + - `idx_book_copy_book` on `book_copy (book_id)` + +#### Reads +- `book` (SELECT book_id, isbn, copies_free, copies_total) +- `branch` (INSERT default branch) +- `loan` (none) +- `member` (none) + +#### Writes +- `branch`: 1 row (`Main`, `Springfield`) +- `book_copy`: 1 + 1 + … + 1 rows per existing copy (total equals sum of `copies_total` across all books) +- `loan`: adds column `copy_id` (no data written) +- `member`: adds column `home_branch_id` and updates existing rows to `1` where null +- `book`: drops columns and constraint (no data written) + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- `book` table (existing) +- `loan` table (existing) +- `member` table (existing) +- `book_copy` table (new) +- `branch` table (new) + +#### Routine logic +- Create `branch` table and insert default branch. +- Create `book_copy` table with constraints and status check. +- Populate `book_copy` by cross‑joining each book with a series from 1 to `copies_total`; assign barcode as `isbn` + '-' + series number; set status based on `copies_free`. +- Alter `loan` to reference `book_copy`. +- Rename `member.joined_on` to `member_since`; add `home_branch_id` and set default to main branch. +- Remove copy counters from `book` and drop related constraint. +- Create index on `book_copy.book_id`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..8f7e6dce --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,40 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:54:41Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Seed data for a library system: authors, books, members, and loan records. + +#### Purpose +- Populate the `author`, `book`, `member`, and `loan` tables with initial data for testing or demo purposes. + +#### Type +- SQL script (PostgreSQL DDL/DML). +- Creates no new objects; only performs `INSERT` statements. + +#### Schema (inferred) +| Table | Columns (type, constraints) | +|-------|-----------------------------| +| **author** | `author_id` integer PK, `full_name` text NOT NULL, `birth_year` integer, `country_code` char(2) | +| **book** | `book_id` integer PK, `isbn` text NOT NULL, `title` text NOT NULL, `author_id` integer FK → `author.author_id`, `published_year` integer, `copies_total` integer, `copies_free` integer | +| **member** | `member_id` integer PK, `email` text NOT NULL, `full_name` text NOT NULL, `joined_on` date, `is_blocked` boolean | +| **loan** | `loan_id` integer PK, `book_id` integer FK → `book.book_id`, `member_id` integer FK → `member.member_id`, `loaned_on` date, `due_on` date, `returned_on` date NULLABLE | + +#### Writes +- `author`: 15 rows (1‑15). +- `book`: 150 rows (1‑150). +- `member`: 50 rows (1‑50). +- `loan`: 150 rows (1‑150). + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- None beyond the tables listed above. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..ccf1309c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,50 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:55:40Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL library management system that stores catalog, member, and loan data, tracks book availability, and provides reporting and audit trails. + +#### Purpose +- Persist library catalog, members, and loan transactions. +- Enable checkout, return, late‑fee calculation, and audit logging. +- Offer reporting views for overdue loans, member activity, and popular books. + +#### Responsibilities +- **Data Modeling** – tables for authors, books, members, loans, branches, and book copies. +- **Business Logic** – functions and procedures for checkout, return, late‑fee calculation, and audit trail. +- **Reporting** – views and a materialized view for overdue loans, member statistics, and popular books. +- **Migration & Seeding** – scripts to add branch and copy tracking, migrate existing data, and seed initial records. + +#### Key units +- **Tables**: `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`. +- **Functions**: `fn_checkout_book`, `fn_late_fee`. +- **Procedure**: `sp_return_book`. +- **Trigger**: `trg_loan_audit` (calls `trg_loan_audit_fn`). +- **Views**: `overdue_loans`, `member_loan_stats`; **Materialized View**: `popular_books`. + +#### Data flow +1. **Checkout** – `fn_checkout_book` checks member status, decrements `book_copy.status`, inserts a `loan` record, and logs a `CHECKOUT` audit. +2. **Return** – `sp_return_book` updates `loan.returned_on`, increments `book_copy.status`, and logs a `RETURN` audit. +3. **Late fee** – `fn_late_fee` computes overdue days and caps the fee. +4. **Reporting** – Views aggregate `loan`, `member`, `book`, and `author` data to expose overdue loans, member activity, and popular books. + +#### Dependencies +- **Internal**: `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`. +- **External**: PostgreSQL built‑in functions (`CURRENT_DATE`, `now()`, `INTERVAL`). +- **Migration**: Uses existing `book` and `loan` tables to populate `book_copy` and add branch references. + +#### Cross-cutting +- **Constraints & Checks**: `copies_free <= copies_total`, status checks on `book_copy`, foreign‑key integrity across all tables. +- **Indexes**: `idx_book_author`, `idx_loan_member`, `idx_loan_open`, `idx_book_copy_book`, `idx_popular_books_id`. +- **Audit Trail**: `loan_audit` records every checkout and return with timestamps. +- **Branch & Copy Tracking**: `book_copy` replaces aggregate copy counts, enabling per‑branch inventory management. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..129b89f2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,43 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:55:53Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A collection of SQL packages that manage library cataloging, e‑commerce orders, and warehouse inventory, each with dedicated data models, business logic, and audit/reporting capabilities. + +#### Purpose +- Persist and manipulate domain data for libraries, shops, and warehouses. +- Provide transactional procedures for checkout, order item addition, and stock synchronization. +- Offer reporting views and audit trails for operational insight. + +#### Responsibilities +- **Library** – catalog, member, loan, and audit management with reporting on overdue and popular items. +- **Shop** – product catalog, order processing, and inventory reservation with a single add‑item procedure. +- **Warehouse** – nightly supplier feed ingestion, stock reconciliation, and sync run logging. + +#### Key units +- **Library**: tables `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`; functions `fn_checkout_book`, `fn_late_fee`; procedure `sp_return_book`; trigger `trg_loan_audit`; views `overdue_loans`, `member_loan_stats`; materialized view `popular_books`. +- **Shop**: tables `product`, `customer_order`, `order_item`; procedure `add_order_item`. +- **Warehouse**: tables `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`; procedure `dbo.usp_SyncStock`. + +#### Data flow +1. **Library**: `fn_checkout_book` → checks status → updates `book_copy` → inserts `loan` → logs audit; `sp_return_book` → updates `loan` → restores `book_copy` → logs audit; `fn_late_fee` → calculates fee; views aggregate for reporting. +2. **Shop**: `add_order_item` → locks `product` → validates stock → inserts/updates `order_item` → decrements `product.stock` → recalculates `customer_order.total_cents`. +3. **Warehouse**: `dbo.usp_SyncStock(@Since)` → aggregates `SupplierFeed` → `MERGE` into `StockLevel` → records counts → inserts `SyncLog` with run details. + +#### Dependencies +- **Internal**: cross‑package tables referenced only within their own package (e.g., `book_copy` in Library, `order_item` in Shop, `StockLevel` in Warehouse). +- **External**: PostgreSQL built‑ins (`CURRENT_DATE`, `now()`, `INTERVAL`); MySQL 8 features (`ENUM`, `FOR UPDATE`, `ON DUPLICATE KEY UPDATE`); SQL Server system functions (`SYSUTCDATETIME()`, `ERROR_MESSAGE()`). + +#### Cross-cutting +- **Audit & Logging**: Library `loan_audit`; Warehouse `SyncLog`. +- **Concurrency Control**: Shop uses row locking; Warehouse operations wrapped in single transactions. +- **Integrity**: Foreign keys, cascading deletes, and status checks enforce consistency across all packages. +- **Indexes & Constraints**: Strategic indexes (`idx_book_author`, `idx_loan_member`, etc.) and check constraints (`copies_free <= copies_total`) optimize performance and data validity. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..a70ed6c9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,69 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:54:44Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Stores product catalog, customer orders, and order line items for a web shop, with a stored procedure to add items, reserve stock, and recalculate totals. + +#### Purpose +- Define tables for products, orders, and order items. +- Provide a procedure to add an order line, reserve inventory, and update order total. + +#### Type +- Table: `product`, `customer_order`, `order_item` +- Procedure: `add_order_item` +- Dialect: MySQL 8 + +#### Schema +- **product** + - `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `sku VARCHAR(40) NOT NULL` UNIQUE `uk_product_sku` + - `name VARCHAR(200) NOT NULL` + - `price_cents INT UNSIGNED NOT NULL` + - `stock INT NOT NULL DEFAULT 0` +- **customer_order** + - `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT` PK + - `customer_id BIGINT UNSIGNED NOT NULL` + - `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW'` + - `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` + - `total_cents INT UNSIGNED NOT NULL DEFAULT 0` + - Index `idx_order_customer` on `(customer_id, created_at)` +- **order_item** + - `order_id BIGINT UNSIGNED NOT NULL` + - `product_id INT UNSIGNED NOT NULL` + - `quantity SMALLINT UNSIGNED NOT NULL` + - `unit_price_cents INT UNSIGNED NOT NULL` + - PK `(order_id, product_id)` + - FK `fk_item_order` references `customer_order(order_id)` ON DELETE CASCADE + - FK `fk_item_product` references `product(product_id)` + +#### Reads +- `product` (SELECT `product_id`, `price_cents` WHERE `sku` AND `stock` >= `p_qty` FOR UPDATE) +- `order_item` (SELECT SUM(quantity * unit_price_cents) WHERE `order_id` = `p_order_id`) + +#### Writes +- `order_item` (INSERT 1 row; ON DUPLICATE KEY UPDATE quantity) +- `product` (UPDATE 1 row: decrement `stock`) +- `customer_order` (UPDATE 1 row: recalculate `total_cents`) + +#### Relationships +- `order_item.order_id -> customer_order.order_id` (FK `fk_item_order`) +- `order_item.product_id -> product.product_id` (FK `fk_item_product`) + +#### Routine logic +- Parameters: `p_order_id BIGINT UNSIGNED`, `p_sku VARCHAR(40)`, `p_qty SMALLINT UNSIGNED` +- Steps: + 1. Lookup `product_id` and `price_cents` for `p_sku` with sufficient `stock`; lock row FOR UPDATE. + 2. If not found, raise error `'unknown SKU or not enough stock'`. + 3. Insert or update `order_item` with quantity and unit price; on duplicate, increment quantity. + 4. Decrement `product.stock` by `p_qty`. + 5. Recalculate `customer_order.total_cents` from all items of the order. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item` +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..6ab3923e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,41 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:55:47Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> A MySQL schema for a web shop that stores products, orders, and line items, and provides a stored procedure to add items, reserve stock, and update order totals. + +#### Purpose +- Persist product catalog, customer orders, and order line items. +- Offer a single procedure to add an item to an order, reserve inventory, and recalculate the order total. + +#### Responsibilities +- **Data definition** – tables `product`, `customer_order`, `order_item` with keys, indexes, and constraints. +- **Business logic** – stored procedure `add_order_item` that validates SKU and stock, updates inventory, inserts or updates order items, and refreshes the order total. + +#### Key units +- **Table `product`** – holds SKU, name, price, and stock. +- **Table `customer_order`** – tracks order status, timestamps, and total amount. +- **Table `order_item`** – links orders to products with quantity and unit price. +- **Procedure `add_order_item`** – encapsulates the transactional flow for adding an item to an order. + +#### Data flow +1. Caller supplies `p_order_id`, `p_sku`, `p_qty`. +2. Procedure locks the matching `product` row (FOR UPDATE) and checks stock. +3. If valid, inserts or updates an `order_item` row. +4. Decrements `product.stock` by `p_qty`. +5. Recalculates `customer_order.total_cents` from all items of the order. + +#### Dependencies +- Internal: `product`, `customer_order`, `order_item` tables. +- No external packages or sequences; relies on MySQL 8 features (ENUM, FOR UPDATE, ON DUPLICATE KEY UPDATE). + +#### Cross-cutting +- **Concurrency control** – uses row locking (`FOR UPDATE`) to prevent overselling. +- **Integrity** – foreign keys enforce referential consistency; cascading deletes keep order items in sync with orders. +- **Error handling** – raises a single error when SKU is unknown or stock is insufficient. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..5658b3f5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,44 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:55:50Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Keeps the warehouse inventory in sync with nightly supplier feeds and records each sync run. + +#### Purpose +- Aggregate supplier feed quantities into the warehouse stock table. +- Persist a log of each synchronization run. + +#### Responsibilities +- **Data ingestion** – read `dbo.SupplierFeed` rows since a given timestamp. +- **Stock reconciliation** – merge aggregated quantities into `dbo.StockLevel`. +- **Audit trail** – insert a record into `dbo.SyncLog` summarizing the run. + +#### Key units +- **dbo.StockLevel** – warehouse SKU inventory table (PK: `WarehouseId, Sku`). +- **dbo.SupplierFeed** – raw supplier feed rows (identity PK `FeedRowId`). +- **dbo.SyncLog** – log of each sync run (identity PK `SyncLogId`). +- **dbo.usp_SyncStock(@Since DATETIME2(0))** – T‑SQL procedure that performs the merge and logging. + +#### Data flow +1. Caller supplies `@Since` timestamp to `dbo.usp_SyncStock`. +2. Procedure aggregates `SupplierFeed` rows received after `@Since` by `WarehouseId, Sku`. +3. `MERGE` updates existing `StockLevel` rows or inserts new ones, incrementing `OnHand` and setting `UpdatedAt`. +4. Counts of `INSERT` and `UPDATE` actions are captured. +5. A new `SyncLog` row is inserted with `StartedAt`, `RowsInserted`, `RowsUpdated`, and any error message. +6. Transaction is committed; on error, rollback and log the error. + +#### Dependencies +- Internal tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. +- SQL Server system functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. +- Transaction control via `@@TRANCOUNT`. + +#### Cross-cutting +- All writes occur within a single transaction for atomicity. +- Error handling logs the message in `SyncLog` and rethrows for external handling. +- Default constraints provide `OnHand` zero and `UpdatedAt` UTC timestamp. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..bb2920f4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run5/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,78 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:54:47Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Synchronises nightly stock levels from a supplier feed into the warehouse inventory and records the operation outcome. + +#### Purpose +- Updates `dbo.StockLevel` with aggregated supplier feed quantities. +- Logs each sync run in `dbo.SyncLog`. + +#### Type +- Table: `dbo.StockLevel` +- Table: `dbo.SupplierFeed` +- Table: `dbo.SyncLog` +- Procedure: `dbo.usp_SyncStock` (T‑SQL, SQL Server) + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL CONSTRAINT DF_StockLevel_OnHand DEFAULT (0)` + - `UpdatedAt DATETIME2(0) NOT NULL CONSTRAINT DF_StockLevel_UpdatedAt DEFAULT (SYSUTCDATETIME())` + - **PK**: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL CONSTRAINT PK_SupplierFeed PRIMARY KEY` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL CONSTRAINT PK_SyncLog PRIMARY KEY` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + +#### Reads +- `dbo.SupplierFeed` (columns: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`) +- `dbo.StockLevel` (columns: `WarehouseId`, `Sku`, `OnHand`) + +#### Writes +- `dbo.StockLevel` + - `UPDATE` on matched rows: `OnHand`, `UpdatedAt` + - `INSERT` on non‑matched rows: `WarehouseId`, `Sku`, `OnHand` +- `dbo.SyncLog` + - `INSERT` one row per sync: `StartedAt`, `RowsInserted`, `RowsUpdated`, optional `ErrorMessage` + +#### Relationships +- None defined via foreign keys. + +#### Routine logic +- **dbo.usp_SyncStock(@Since DATETIME2(0))** + - Start transaction. + - Aggregate `SupplierFeed` rows received since `@Since` by `WarehouseId, Sku`. + - `MERGE` into `StockLevel`: + - `WHEN MATCHED`: increment `OnHand` by aggregated `Quantity`, update `UpdatedAt`. + - `WHEN NOT MATCHED BY TARGET`: insert new row with `OnHand = Quantity`. + - Capture `$action` into table variable `@Changes`. + - Insert into `SyncLog`: + - `RowsInserted` = count of `INSERT` actions. + - `RowsUpdated` = count of `UPDATE` actions. + - Commit transaction. + - On error: rollback, log error message, rethrow. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()` +- System variable: `@@TRANCOUNT` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/meta/gpt-oss-20b.json new file mode 100644 index 00000000..05a47158 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": "1e056c23652992a07cca0056d2783cbf6520f5a1", + "corpus": "srcmorph", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:56:06Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 110.6, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 43.5, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.3, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:58:43Z", + "fileTokens": { + "files": 24, + "written": 24, + "unchanged": 0, + "failed": 0, + "calls": 24, + "promptTokens": 88281, + "cachedPromptTokens": 88080, + "completionTokens": 18913, + "seconds": 109.9545843 + }, + "finishReasons": { + "stop": 24 + }, + "tokenCostUsd": 0.005107, + "costUsd": 0.001735, + "files": 37 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md new file mode 100644 index 00000000..56f6dd65 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiConditionEvaluator.java.ai.md @@ -0,0 +1,69 @@ +### AiConditionEvaluator.java +- H: 1.0 +- C: 529FFBC4 +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:56:07Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Evaluates and validates file‑selection conditions against file metadata, determining matches, required line counts, and validating configuration. + +#### Purpose +- Evaluates `AiCondition` trees against `AiFileContext`. +- Validates condition trees for correct structure and bounds. +- Reports whether line counting is needed for a condition. + +#### Type +- `final class AiConditionEvaluator` + - extends `Object` + - fields: `private static final String ERROR_ONE_BRANCH` + - constructor: `public AiConditionEvaluator()` (no-op) + +#### Input +- `matches(AiCondition, AiFileContext)` – condition tree, file facts. +- `validate(AiCondition)` – condition tree. +- `usesLines(AiCondition)` – condition tree. +- `branchCount(AiCondition)` – condition node. +- `matchesExtension(List, String)` – extensions list, file name. +- `globMatches(String, String)` – glob pattern, relative path. +- `parseEpochMilli(String)` – ISO‑8601 instant string. + +#### Output +- `matches` returns `boolean` indicating file match. +- `validate` throws `IllegalArgumentException` on misconfiguration. +- `usesLines` returns `boolean` if any `lines` condition exists. +- `branchCount` returns `int` count of non‑null branches/leaves. +- `matchesExtension` returns `boolean`. +- `globMatches` returns `boolean`. +- `parseEpochMilli` returns `long` epoch milliseconds. + +#### Core logic +- `matches`: recursively evaluates `and`, `or`, `not`, then leaf checks (`extensions`, `size`, `lines`, `modifiedAfter`, `modifiedBefore`, `pathGlob`). +- `validate`: ensures exactly one branch/leaf per node; validates groups, extensions, size/lines bounds, date parsing, non‑blank glob. +- `usesLines`: checks for `lines` leaf or recurses into `and`, `or`, `not`. +- `anyUsesLines`: helper iterating children list. +- `validateGroup`: ensures group has at least one child; recursively validates each child. +- `branchCount`: counts non‑null branch/leaf fields. +- `matchesExtension`: iterates extensions, checks `fileName.endsWith`. +- `globMatches`: uses `AiSourceExcludeFilter` to test exclusion. +- `parseEpochMilli`: parses ISO‑8601 instant to epoch milliseconds, throws `IllegalArgumentException` on failure. + +#### Public API +- `matches(AiCondition, AiFileContext) -> boolean` – check file matches condition. +- `validate(AiCondition) -> void` – validate condition tree. +- `usesLines(AiCondition) -> boolean` – detect line‑count requirement. + +#### Dependencies +- `java.time.Instant`, `java.time.format.DateTimeParseException` +- `java.util.Collections`, `java.util.List` +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalStateException` if a node has no branch/leaf. +- `IllegalArgumentException` for invalid configuration: missing branch, empty extensions, unbounded size/lines, invalid dates, blank glob. + +#### Concurrency +- Stateless; no shared mutable state. Thread‑safe by design. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md new file mode 100644 index 00000000..95b98b4a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiConditionGroup.java.ai.md @@ -0,0 +1,54 @@ +### AiConditionGroup.java +- H: 1.0 +- C: 66805F67 +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:56:12Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Holds a list of child AI conditions for logical combinators in the Maven plugin configuration. + +#### Purpose +- Stores child `AiCondition` objects for `` / `` combinators. +- Provides defensive copying of the condition list. + +#### Type +- `public class AiConditionGroup` + - Modifiers: public, final (implicitly), @ToString, @SuppressWarnings({"NullAway.Init","initialization.fields.uninitialized"}) + - Field: `private @Nullable List conditions` + - Constructor: `public AiConditionGroup()` (no-op) + - Methods: + - `public @Nullable List getConditions()` + - `public void setConditions(final @Nullable Collection conditions)` + +#### Input +- Constructor: none. +- `setConditions`: accepts `Collection` (nullable). + +#### Output +- `getConditions`: returns `List` (nullable). +- `setConditions`: assigns a defensive copy of the input collection to `conditions`. + +#### Core logic +- `setConditions`: + - If `conditions` is non‑null, creates `new ArrayList<>(conditions)`; otherwise assigns `null`. + - Stores result in the private field `conditions`. + +#### Public API +- `getConditions() -> List` – retrieve child conditions. +- `setConditions(Collection) -> void` – set child conditions defensively. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCondition` + +#### Exceptions / Errors +- No explicit exceptions thrown. +- Null handling: `@Nullable` annotations indicate parameters and return values may be null. + +#### Concurrency +- No synchronization; class is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md new file mode 100644 index 00000000..476eb32c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiFactExtractor.java.ai.md @@ -0,0 +1,74 @@ +### AiFactExtractor.java +- H: 1.0 +- C: 149025B2 +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:56:15Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Computes deterministic, language‑agnostic fact counts from source text using regex counters. + +#### Purpose +- Generates a facts block summarizing exact counts of language constructs. +- Validates fact counter configurations. + +#### Type +- `final class AiFactExtractor` (class, final) + - No supertypes. + - Annotations: none. + +#### Input +- `factsBlock(List counters, String source)` + - `counters`: list of counters (may be null/empty). + - `source`: full source text. +- `validate(List counters)` + - `counters`: list of counters (may be null/empty). +- `countMatches(String pattern, String source)` + - `pattern`: regex string. + - `source`: text to search. + +#### Output +- `factsBlock`: `String` facts block or empty string. +- `validate`: void; throws `IllegalArgumentException` on invalid counters. +- `countMatches`: `int` number of non‑overlapping matches. + +#### Core logic +- `factsBlock`: + - Return empty if counters null/empty. + - Iterate counters; skip null or missing label/pattern. + - Append `ENTRY_SEPARATOR` between entries. + - Append `label + LABEL_COUNT_SEPARATOR + countMatches(pattern, source)`. + - If no entries, return empty. + - Return `FACTS_HEADER + sb + FACTS_SUFFIX`. +- `validate`: + - Return if counters null. + - For each counter: + - Throw if counter null. + - Throw if label null. + - Throw if pattern null. + - Compile pattern; catch `PatternSyntaxException` and rethrow as `IllegalArgumentException` with label context. +- `countMatches`: + - Compile pattern, create matcher on source. + - Loop `matcher.find()` incrementing count. + - Return count. + +#### Public API +- `factsBlock(List counters, String source) -> String` – build facts block. +- `validate(List counters) -> void` – validate counters. + +#### Dependencies +- `java.util.List` +- `java.util.regex.Matcher` +- `java.util.regex.Pattern` +- `java.util.regex.PatternSyntaxException` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiFactCounter` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `validate` for missing label/pattern or invalid regex. +- `PatternSyntaxException` caught and wrapped. + +#### Concurrency +- All methods are static and stateless; thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md new file mode 100644 index 00000000..4b10db14 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,191 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 93D12775 +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:56:19Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> A mutable JavaBean that holds all AI‑generation parameters for a single model run, exposing getters/setters for configuration values used by Maven plugin and AI providers. + +#### Purpose +- Stores AI generation settings (model path, sampling, retry, prompt trimming, stop strings) for a single run. +- Provides default constants for all configurable parameters. +- Supplies Lombok‑generated `toString` for diagnostics. + +#### Type +- `public class AiGenerationConfig` (class, public, mutable, JavaBean) + - Extends `Object`. + - Annotated with `@ToString` (Lombok) and `@SuppressWarnings({"NullAway.Init","initialization.fields.uninitialized"})`. + - Declares 1 constructor (no‑arg). + +#### Input +- Constructor: none. +- Public setters: + - `setModelPath(String)` + - `setContextSize(int)` + - `setMaxOutputTokens(int)` + - `setTemperature(float)` + - `setThreads(int)` + - `setCharsPerToken(int)` + - `setMaxInputChars(int)` + - `setWarnOnTrim(boolean)` + - `setTopP(float)` + - `setTopK(int)` + - `setMinP(float)` + - `setTopNSigma(float)` + - `setRepeatPenalty(float)` + - `setChatTemplateEnableThinking(Boolean)` + - `setSwaFull(boolean)` + - `setCacheReuse(int)` + - `setGpuLayers(int)` + - `setSeed(int)` + - `setCpuMoeLayers(int)` + - `setCpuFfnLayers(int)` + - `setKvUnifiedPerSlot(int)` + - `setLazyMode(String)` + - `setRepeatLastN(int)` + - `setCacheTypeK(String)` + - `setCacheTypeV(String)` + - `setFlashAttn(boolean)` + - `setBatchSize(int)` + - `setUbatchSize(int)` + - `setThreadsBatch(int)` + - `setMainGpu(int)` + - `setDevices(String)` + - `setProvider(String)` + - `setRemoteModel(String)` + - `setBaseUrl(String)` + - `setApiKeyEnv(String)` + - `setReasoningEffort(String)` + - `setReasoningBudgetTokens(int)` + - `setDryMultiplier(float)` + - `setDryBase(float)` + - `setDryAllowedLength(int)` + - `setDryPenaltyLastN(int)` + - `setDrySequenceBreakers(List)` + - `setStopStrings(List)` + - `setCalibration(AiCalibration)` + - `setCachePrompt(boolean)` (duplicate of `setCachePrompt` earlier) +- Fields injected via setters or Maven plugin. + +#### Output +- Public getters return current configuration values: + - `getModelPath()`, `getContextSize()`, `getMaxOutputTokens()`, `getTemperature()`, `getThreads()`, `getCharsPerToken()`, `getMaxInputChars()`, `isWarnOnTrim()`, `getTopP()`, `getTopK()`, `getMinP()`, `getTopNSigma()`, `getRepeatPenalty()`, `getChatTemplateEnableThinking()`, `isCachePrompt()`, `isSwaFull()`, `getCacheReuse()`, `getGpuLayers()`, `getSeed()`, `getCpuMoeLayers()`, `getCpuFfnLayers()`, `getKvUnifiedPerSlot()`, `getLazyMode()`, `getRepeatLastN()`, `getCacheTypeK()`, `getCacheTypeV()`, `isFlashAttn()`, `getBatchSize()`, `getUbatchSize()`, `getThreadsBatch()`, `getMainGpu()`, `getDevices()`, `getProvider()`, `getRemoteModel()`, `getBaseUrl()`, `getApiKeyEnv()`, `getReasoningEffort()`, `getReasoningBudgetTokens()`, `getDryMultiplier()`, `getDryBase()`, `getDryAllowedLength()`, `getDryPenaltyLastN()`, `getDrySequenceBreakers()`, `getStopStrings()`, `getCalibration()`. +- `toString()` provides diagnostic view of all fields. + +#### Core logic +- No complex algorithms; the class is a plain data holder. +- Default constants are defined for every configurable parameter. +- Setters perform minimal validation (e.g., null checks, default fallbacks). +- `setLazyMode`, `setCacheTypeK`, `setCacheTypeV`, `setDevices`, `setProvider`, `setRemoteModel`, `setBaseUrl`, `setApiKeyEnv` replace null with default constants. +- `getDrySequenceBreakers()` and `getStopStrings()` return unmodifiable lists. + +#### Public API +- Constructor: `AiGenerationConfig() -> AiGenerationConfig` (no params). +- Getters (public, no args): + - `getModelPath() -> String?` + - `getContextSize() -> int` + - `getMaxOutputTokens() -> int` + - `getTemperature() -> float` + - `getThreads() -> int` + - `getCharsPerToken() -> int` + - `getMaxInputChars() -> int` + - `isWarnOnTrim() -> boolean` + - `getTopP() -> float` + - `getTopK() -> int` + - `getMinP() -> float` + - `getTopNSigma() -> float` + - `getRepeatPenalty() -> float` + - `getChatTemplateEnableThinking() -> Boolean?` + - `isCachePrompt() -> boolean` + - `isSwaFull() -> boolean` + - `getCacheReuse() -> int` + - `getGpuLayers() -> int` + - `getSeed() -> int` + - `getCpuMoeLayers() -> int` + - `getCpuFfnLayers() -> int` + - `getKvUnifiedPerSlot() -> int` + - `getLazyMode() -> String` + - `getRepeatLastN() -> int` + - `getCacheTypeK() -> String` + - `getCacheTypeV() -> String` + - `isFlashAttn() -> boolean` + - `getBatchSize() -> int` + - `getUbatchSize() -> int` + - `getThreadsBatch() -> int` + - `getMainGpu() -> int` + - `getDevices() -> String` + - `getProvider() -> String` + - `getRemoteModel() -> String` + - `getBaseUrl() -> String` + - `getApiKeyEnv() -> String` + - `getReasoningEffort() -> String` + - `getReasoningBudgetTokens() -> int` + - `getDryMultiplier() -> float` + - `getDryBase() -> float` + - `getDryAllowedLength() -> int` + - `getDryPenaltyLastN() -> int` + - `getDrySequenceBreakers() -> List` + - `getStopStrings() -> List` + - `getCalibration() -> AiCalibration?` +- Setters (public, one param): + - `setModelPath(String?)` + - `setContextSize(int)` + - `setMaxOutputTokens(int)` + - `setTemperature(float)` + - `setThreads(int)` + - `setCharsPerToken(int)` + - `setMaxInputChars(int)` + - `setWarnOnTrim(boolean)` + - `setTopP(float)` + - `setTopK(int)` + - `setMinP(float)` + - `setTopNSigma(float)` + - `setRepeatPenalty(float)` + - `setChatTemplateEnableThinking(Boolean?)` + - `setCachePrompt(boolean)` + - `setSwaFull(boolean)` + - `setCacheReuse(int)` + - `setGpuLayers(int)` + - `setSeed(int)` + - `setCpuMoeLayers(int)` + - `setCpuFfnLayers(int)` + - `setKvUnifiedPerSlot(int)` + - `setLazyMode(String?)` + - `setRepeatLastN(int)` + - `setCacheTypeK(String?)` + - `setCacheTypeV(String?)` + - `setFlashAttn(boolean)` + - `setBatchSize(int)` + - `setUbatchSize(int)` + - `setThreadsBatch(int)` + - `setMainGpu(int)` + - `setDevices(String?)` + - `setProvider(String?)` + - `setRemoteModel(String?)` + - `setBaseUrl(String?)` + - `setApiKeyEnv(String?)` + - `setReasoningEffort(String)` + - `setReasoningBudgetTokens(int)` + - `setDryMultiplier(float)` + - `setDryBase(float)` + - `setDryAllowedLength(int)` + - `setDryPenaltyLastN(int)` + - `setDrySequenceBreakers(List?)` + - `setStopStrings(List?)` + - `setCalibration(AiCalibration?)` + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.config.AiCalibration` (used as calibration type) + +#### Exceptions / Errors +- No explicit exceptions thrown; setters perform null checks and default substitutions. + +#### Concurrency +- No thread‑safety guarantees; class is mutable and intended for single‑thread use by Maven plugin. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md new file mode 100644 index 00000000..cf73af5d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/AiOversizeStrategy.java.ai.md @@ -0,0 +1,60 @@ +### AiOversizeStrategy.java +- H: 1.0 +- C: A01D1DA1 +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:56:31Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Defines how oversized source files are handled during routing. + +#### Purpose +- Provides strategies for processing source files that exceed the model’s context window. +- Parses configuration tokens into enum values. + +#### Type +- `public enum AiOversizeStrategy` + - Modifiers: `public` + - Supertypes: `java.lang.Enum` + - Constants: `FAIL`, `SAMPLE`, `MAP_REDUCE`, `DETERMINISTIC` + - Field: `private final String configValue` + - Constructor: `AiOversizeStrategy(String configValue)` + - Static field: `public static final AiOversizeStrategy DEFAULT` + - Methods: `public String configValue()`, `public static AiOversizeStrategy fromConfig(@Nullable String value)` + - Annotation: `@Nullable` on `fromConfig` parameter. + +#### Input +- Constructor parameter `configValue` (String) for each enum constant. +- `fromConfig` parameter `value` (`@Nullable String`). + +#### Output +- `configValue()` returns the strategy’s config token. +- `fromConfig` returns an `AiOversizeStrategy` or throws `IllegalArgumentException`. + +#### Core logic +- `fromConfig` + 1. If `value` is `null` → return `DEFAULT`. + 2. Trim `value`; if empty → return `DEFAULT`. + 3. Iterate over `values()`; compare `strategy.configValue` to trimmed string case‑insensitively. + 4. Return matching strategy. + 5. If none match → throw `IllegalArgumentException` with message listing valid tokens. + +#### Public API +- `FAIL(String)` – abort build (default). +- `SAMPLE(String)` – summarize head of file. +- `MAP_REDUCE(String)` – chunk and summarize. +- `DETERMINISTIC(String)` – emit deterministic metadata. +- `DEFAULT: AiOversizeStrategy` – default strategy. +- `configValue() -> String` – get config token. +- `fromConfig(@Nullable String) -> AiOversizeStrategy` – parse token. + +#### Dependencies +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown by `fromConfig` when token is unknown. + +#### Concurrency +- None. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md new file mode 100644 index 00000000..9170fa4a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/SrcMorphConfiguration.java.ai.md @@ -0,0 +1,95 @@ +### SrcMorphConfiguration.java +- H: 1.0 +- C: 1D938DBE +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:56:35Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Holds all mutable configuration needed to run a srcmorph AI generation job, exposing Maven‑style parameters for later binding. + +#### Purpose +- Stores runtime parameters for AI code generation. +- Provides defaults and mutable JavaBean accessors. + +#### Type +- `public class SrcMorphConfiguration` (class, final, mutable JavaBean) + - Supertypes: none + - Annotations: `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`, `@ToString` + - Constants: `DEFAULT_OUTPUT_DIRECTORY`, `DEFAULT_GENERATION_PROVIDER`, `DEFAULT_LLAMA_CONTEXT_SIZE`, `DEFAULT_LLAMA_MAX_OUTPUT_TOKENS`, `DEFAULT_LLAMA_TEMPERATURE`, `DEFAULT_LLAMA_THREADS`, `DEFAULT_AI_VERSION` + - Fields (22): `baseDirectory`, `outputDirectory`, `force`, `subtrees`, `excludes`, `fileExtensions`, `minFileSizeBytes`, `maxFileSizeBytes`, `planOnly`, `generationProvider`, `promptDefinitions`, `aiDefinitions`, `modelDirectory`, `fieldGenerations`, `factDefinitions`, `llamaModelPath`, `llamaContextSize`, `llamaMaxOutputTokens`, `llamaTemperature`, `llamaThreads`, `pluginVersion`, `aiVersion`, `projectName` + - Constructor: `public SrcMorphConfiguration()` (no-op) + +#### Input +- Constructor: none. +- Setters accept: `File`, `boolean`, `List`, `long`, `String`, `List`, `List`, `File`, `List`, `List`, `int`, `float`. + +#### Output +- Getters return: `File`, `boolean`, `List`, `long`, `String`, `List`, `List`, `File`, `List`, `List`, `String`, `int`, `float`. +- No side effects beyond field mutation. + +#### Core logic +- No algorithmic logic; only property accessors and default field initializers. + +#### Public API +- `getBaseDirectory() -> File` – retrieve base dir +- `setBaseDirectory(File)` – set base dir +- `getOutputDirectory() -> File` – retrieve output dir +- `setOutputDirectory(File)` – set output dir +- `isForce() -> boolean` – check force flag +- `setForce(boolean)` – set force flag +- `getSubtrees() -> List` – get subtrees +- `setSubtrees(List)` – set subtrees +- `getExcludes() -> List` – get excludes +- `setExcludes(List)` – set excludes +- `getFileExtensions() -> List` – get file extensions +- `setFileExtensions(List)` – set file extensions +- `getMinFileSizeBytes() -> long` – get min file size +- `setMinFileSizeBytes(long)` – set min file size +- `getMaxFileSizeBytes() -> long` – get max file size +- `setMaxFileSizeBytes(long)` – set max file size +- `isPlanOnly() -> boolean` – check plan‑only flag +- `setPlanOnly(boolean)` – set plan‑only flag +- `getGenerationProvider() -> String` – get AI provider name +- `setGenerationProvider(String)` – set AI provider name +- `getPromptDefinitions() -> List` – get prompt defs +- `setPromptDefinitions(List)` – set prompt defs +- `getAiDefinitions() -> List` – get AI model defs +- `setAiDefinitions(List)` – set AI model defs +- `getModelDirectory() -> File` – get model dir +- `setModelDirectory(File)` – set model dir +- `getFieldGenerations() -> List` – get field gen rules +- `setFieldGenerations(List)` – set field gen rules +- `getFactDefinitions() -> List` – get fact defs +- `setFactDefinitions(List)` – set fact defs +- `getLlamaModelPath() -> String` – get llama model path +- `setLlamaModelPath(String)` – set llama model path +- `getLlamaContextSize() -> int` – get llama context size +- `setLlamaContextSize(int)` – set llama context size +- `getLlamaMaxOutputTokens() -> int` – get llama max output tokens +- `setLlamaMaxOutputTokens(int)` – set llama max output tokens +- `getLlamaTemperature() -> float` – get llama temperature +- `setLlamaTemperature(float)` – set llama temperature +- `getLlamaThreads() -> int` – get llama thread count +- `setLlamaThreads(int)` – set llama thread count +- `getPluginVersion() -> String` – get plugin version +- `setPluginVersion(String)` – set plugin version +- `getAiVersion() -> String` – get AI version +- `setAiVersion(String)` – set AI version +- `getProjectName() -> String` – get project title +- `setProjectName(String)` – set project title + +#### Dependencies +- `java.io.File` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptDefinition` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- None declared; all setters accept nullable values where annotated. + +#### Concurrency +- No synchronization; class is not thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/package.ai.md new file mode 100644 index 00000000..0a5076c5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/config/package.ai.md @@ -0,0 +1,58 @@ +### java/config +- H: 1.0 +- C: 6E389E7C +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:57:58Z +- G: +- A: 0.0.0 +- X: package +- F: [AiConditionEvaluator.java](AiConditionEvaluator.java.ai.md) +- F: [AiConditionGroup.java](AiConditionGroup.java.ai.md) +- F: [AiFactExtractor.java](AiFactExtractor.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiOversizeStrategy.java](AiOversizeStrategy.java.ai.md) +- F: [SrcMorphConfiguration.java](SrcMorphConfiguration.java.ai.md) +--- +> A Maven‑style configuration and runtime engine for AI‑driven source‑code generation, handling file selection, fact extraction, and model‑specific generation settings. + +#### Purpose +- Orchestrate AI code generation jobs from source trees. +- Provide flexible file‑selection, fact extraction, and model configuration. + +#### Responsibilities +- **Configuration** – `SrcMorphConfiguration` holds all runtime parameters; `AiGenerationConfig` stores per‑model generation options. +- **File selection** – `AiConditionEvaluator` validates and evaluates `AiCondition` trees against file metadata. +- **Fact extraction** – `AiFactExtractor` builds deterministic fact blocks from source text. +- **Oversize handling** – `AiOversizeStrategy` defines how to process files that exceed model context limits. +- **Condition grouping** – `AiConditionGroup` supplies defensive lists of child conditions for logical combinators. + +#### Key units +- `SrcMorphConfiguration` – mutable JavaBean for Maven plugin parameters. +- `AiGenerationConfig` – mutable holder for model‑specific generation flags. +- `AiConditionEvaluator` – stateless validator/evaluator for `AiCondition` trees. +- `AiFactExtractor` – static utility for regex‑based fact counting. +- `AiOversizeStrategy` – enum mapping config tokens to handling strategies. +- `AiConditionGroup` – defensive container for child `AiCondition` objects. + +#### Data flow +1. **Configuration**: Maven plugin populates `SrcMorphConfiguration` → `AiGenerationConfig`. +2. **File selection**: `AiConditionEvaluator` checks each file against `AiCondition` trees from the configuration. +3. **Fact extraction**: For selected files, `AiFactExtractor.factsBlock` generates fact strings. +4. **Oversize handling**: `AiOversizeStrategy.fromConfig` selects strategy for large files. +5. **Generation**: `AiGenerationConfig` values drive the AI model invocation (not shown in summaries). + +#### Dependencies +- Java standard libraries (`java.util`, `java.io`, `java.time`, `java.util.regex`). +- Lombok (`@ToString`). +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.srcmorph.support.AiSourceExcludeFilter` for glob matching. +- Configuration classes: `AiCondition`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`. + +#### Cross‑cutting +- **Immutability**: `AiConditionEvaluator` and `AiFactExtractor` are stateless; thread‑safe. +- **Defensive copying**: `AiConditionGroup.setConditions` copies input collections. +- **Validation**: `AiConditionEvaluator.validate` and `AiFactExtractor.validate` enforce configuration correctness. +- **Error handling**: `IllegalArgumentException` used for misconfiguration; `IllegalStateException` for structural errors. +- **Configuration defaults**: `SrcMorphConfiguration` and `AiGenerationConfig` expose constants for default values. +- **Concurrency**: Mutable configuration classes are not thread‑safe; evaluation and extraction utilities are. +- **Logging/diagnostics**: `@ToString` annotations provide readable state dumps for debugging. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..44ec2ac8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,59 @@ +### java +- H: 1.0 +- C: 643999B1 +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:58:07Z +- G: +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A Maven‑style framework that orchestrates AI‑driven source‑code generation, selecting files, extracting deterministic facts, and delegating prompt generation to pluggable AI back‑ends (local llama.cpp, OpenAI‑compatible APIs, or mocks). + +#### Purpose +- Orchestrate AI code‑generation jobs from source trees. +- Provide flexible file‑selection, fact extraction, and model configuration. + +#### Responsibilities +- **Configuration & Runtime** – `SrcMorphConfiguration` and `AiGenerationConfig` hold all plugin parameters and per‑model flags. +- **File Selection** – `AiConditionEvaluator` validates `AiCondition` trees; `AiConditionGroup` supplies child conditions. +- **Fact Extraction** – `AiFactExtractor` builds deterministic fact blocks from source text. +- **Oversize Handling** – `AiOversizeStrategy` defines how to process files that exceed model context limits. +- **AI Provider Abstraction** – `AiGenerationProvider` interface, `AiGenerationProviderFactory`, and concrete providers (`LlamaCppJniAiGenerationProvider`, `OpenAiCompatibleProviderSupport`, `MockAiGenerationProvider`). +- **Response Cleaning** – `AiCompletionParser` removes internal reasoning blocks from completions. + +#### Key units +- `SrcMorphConfiguration` – mutable JavaBean for Maven plugin parameters. +- `AiGenerationConfig` – mutable holder for model‑specific generation flags. +- `AiConditionEvaluator` – stateless validator/evaluator for `AiCondition` trees. +- `AiFactExtractor` – static utility for regex‑based fact counting. +- `AiOversizeStrategy` – enum mapping config tokens to handling strategies. +- `AiConditionGroup` – defensive container for child `AiCondition` objects. +- `AiGenerationProvider` – interface for generating text and timings. +- `AiGenerationProviderFactory` – resolves provider key → concrete provider. +- `LlamaCppJniAiGenerationProvider` – local llama.cpp implementation. +- `OpenAiCompatibleProviderSupport` – helper for OpenAI‑compatible HTTP interactions. +- `LlamaCppJniConfig` – immutable config builder for llama.cpp. +- `AiCompletionParser` – removes Gemma‑4 thinking blocks from raw completions. + +#### Data flow +1. Maven plugin populates `SrcMorphConfiguration` → `AiGenerationConfig`. +2. `AiConditionEvaluator` filters source files against `AiCondition` trees. +3. For each selected file, `AiFactExtractor.factsBlock` generates fact strings. +4. `AiOversizeStrategy.fromConfig` selects handling for large files. +5. `AiGenerationProviderFactory.create(...)` resolves the runtime provider. +6. Provider generates text (`generate` or `generateWithTimings`), optionally returning `AiGenerationTimings`. +7. `AiCompletionParser` cleans the raw completion before returning to the caller. + +#### Dependencies +- **Internal** – `AiCondition`, `AiFactCounter`, `AiPromptDefinition`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFactDefinition`, `AiCalibration`, `AiPromptSupport`, `Java8CompatibilityHelper`, `MockAiGenerationProvider`. +- **External** – Lombok (`@ToString`), `org.jspecify.annotations.Nullable`, `net.ladenthin.srcmorph.support.AiSourceExcludeFilter`, `net.ladenthin.llama` (native model, JSON parser), `com.fasterxml.jackson` (JSON), HTTP client for OpenAI support, native llama.cpp library. +- **Runtime** – environment variables for API keys, native libraries for llama.cpp. + +#### Cross‑cutting +- **Immutability & Thread‑Safety** – `AiConditionEvaluator`, `AiFactExtractor`, `LlamaCppJniConfig`, and provider support classes are stateless/immutable; mutable configuration classes are not thread‑safe. +- **Validation & Error Handling** – `validate` methods throw `IllegalArgumentException`; structural errors throw `IllegalStateException`; I/O or parsing failures propagate `IOException`. +- **Timing Metrics** – `AiGenerationProvider` supplies default zeroed metrics; concrete providers override with real timings. +- **Configuration Resolution** – `effectiveProvider` logic centralizes provider key precedence (run vs. model level). +- **Response Parsing** – `AiCompletionParser` ensures consistent output by stripping internal reasoning blocks across providers. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md new file mode 100644 index 00000000..4a837fd6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,57 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 9766C36B +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:56:45Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Extracts the model’s final answer from a raw LLM completion by removing any leading Gemma‑4 thinking block. + +#### Purpose +- Removes internal reasoning blocks from Gemma‑4 completions. +- Validates presence of closing marker; throws if truncated. + +#### Type +- `public class AiCompletionParser` + - Modifiers: public + - Annotations: `@ToString` + - Supertypes: none + - Fields: + - `public static final String THINKING_BLOCK_START_MARKER` + - `public static final String THINKING_BLOCK_END_MARKER` + - Methods: + - `public AiCompletionParser()` – no‑op constructor + - `public String parseCompletion(final String response) throws IOException` + +#### Input +- `parseCompletion` receives `String response` (may be `null`). + +#### Output +- Returns `String` – cleaned answer, never `null`. +- Throws `IOException` if a start marker is present but no end marker. + +#### Core logic +- If `response` is `null`, return `""`. +- Trim `response` → `trimmed`. +- If `trimmed` does not start with `THINKING_BLOCK_START_MARKER`, return `trimmed`. +- Extract substring after start marker → `thinking`. +- Find first occurrence of `THINKING_BLOCK_END_MARKER` in `thinking` → `thinkingEnd`. +- If `thinkingEnd < 0`, throw `IOException` with message indicating token budget exhaustion. +- Return substring of `thinking` after the end marker, trimmed. + +#### Public API +- `AiCompletionParser()` – constructor, no-op. +- `String parseCompletion(final String response) throws IOException` – strips leading thinking block, validates markers. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `IOException` thrown when start marker present but end marker missing, with actionable message. + +#### Concurrency +- No concurrency constructs; class is stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 00000000..0fc71ff1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,51 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 87DF69D2 +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:56:48Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides a pluggable AI backend that generates text for an AI generation request. + +#### Purpose +- Supplies AI-generated text for `AiGenerationRequest`. +- Supports optional timing metrics for calibration. + +#### Type +- `public interface AiGenerationProvider` (interface, extends `AutoCloseable`) + +#### Input +- `generate(AiGenerationRequest request)` – request contains prompt key, source file, source text, current header. +- `generateWithTimings(AiGenerationRequest request)` – same request. + +#### Output +- `generate` returns `String` (never null, may be blank). +- `generateWithTimings` returns `AiGenerationTimings` (generated text, token rate, time per token, etc.). +- `close` performs no action by default. + +#### Core logic +- `generate` – abstract; implementations provide text generation. +- `generateWithTimings` – default implementation: + 1. Calls `generate(request)`. + 2. Wraps result in `AiGenerationTimings` with all timing fields set to `0` or `0.0d`. +- `close` – default empty implementation. + +#### Public API +- `generate(AiGenerationRequest) -> String` – generate text. +- `generateWithTimings(AiGenerationRequest) -> AiGenerationTimings` – generate text with timings. +- `close() -> void` – close provider. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` + +#### Exceptions / Errors +- `generate` throws `IOException` if provider fails. +- `generateWithTimings` throws `IOException` if provider fails. +- `close` throws `IOException`. + +#### Concurrency +- No explicit concurrency handling; interface is thread‑safe only if implementations ensure it. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 00000000..d910d57e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,68 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: E2DEA5E5 +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:56:50Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Creates an AI generation provider instance based on a provider key or model configuration. + +#### Purpose +- Instantiates an `AiGenerationProvider` implementation. +- Resolves provider key from run or model configuration. + +#### Type +- `public class AiGenerationProviderFactory` (class, public, final by default, annotated `@ToString`). + +#### Input +- Constructor: no parameters. +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)`: + - `providerName`: run‑level provider key, may be null or blank. + - `llamaConfig`: model configuration, provides `provider()` method. + - `promptSupport`: lookup support for prompts. +- `effectiveProvider(String runProvider, String modelProvider)`: + - `runProvider`: run‑level provider key, may be null. + - `modelProvider`: model‑level provider key, may be null or empty. + +#### Output +- `create`: returns an `AiGenerationProvider` instance: + - `MockAiGenerationProvider` for mock or blank keys. + - `LlamaCppJniAiGenerationProvider` for `llamacpp-jni`. + - `OpenAiCompatibleAiGenerationProvider` for `openai-compatible`. +- `effectiveProvider`: returns the resolved provider key or null. + +#### Core logic +- `effectiveProvider`: + - If `modelProvider` is null or empty after trim, return `runProvider`; else return trimmed `modelProvider`. +- `create`: + - Compute `effective` via `effectiveProvider`. + - If `effective` is null or blank (`compatibilityHelper.isBlank`), return `new MockAiGenerationProvider()`. + - Switch on `effective`: + - `PROVIDER_MOCK`: `new MockAiGenerationProvider()`. + - `PROVIDER_LLAMACPP_JNI`: `new LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)`. + - `PROVIDER_OPENAI_COMPATIBLE`: `new OpenAiCompatibleAiGenerationProvider(llamaConfig, promptSupport)`. + - default: throw `IllegalArgumentException("Unsupported AI provider: " + effective)`. + +#### Public API +- `AiGenerationProviderFactory()` -> no-op constructor. +- `static @Nullable String effectiveProvider(String runProvider, String modelProvider)` -> resolve provider key. +- `AiGenerationProvider create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` -> instantiate provider. + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.srcmorph.provider.MockAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.OpenAiCompatibleAiGenerationProvider` +- `net.ladenthin.srcmorph.provider.LlamaCppJniConfig` + +#### Exceptions / Errors +- `IllegalArgumentException` thrown for unsupported provider keys in `create`. + +#### Concurrency +- No explicit concurrency constructs; instance fields are immutable after construction. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 00000000..ee473d65 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,97 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 2E0029DC +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:56:53Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Provides local AI text generation by loading a GGUF model via llama.cpp and exposing a simple generate API. + +#### Purpose +- Loads a GGUF model lazily and caches it for repeated calls. +- Generates chat completions, parses responses, and exposes timings. + +#### Type +- `final class LlamaCppJniAiGenerationProvider implements AiGenerationProvider, AutoCloseable` + - Extends `Object`; implements `AiGenerationProvider`, `AutoCloseable`. + - Modifiers: `final`. + - Fields: + - `private final LlamaCppJniConfig config` + - `@Nullable private LlamaModel model` + - `private final AiPromptSupport promptSupport` + - `private final LlamaCppJniProviderSupport support` + - `private final AiCompletionParser completionParser` + - `private final ChatResponseParser chatResponseParser` + - `private final Java8CompatibilityHelper compatibilityHelper` + - Constructor: `public LlamaCppJniAiGenerationProvider(final LlamaCppJniConfig config, final AiPromptSupport promptSupport)` + - Methods: + - `private LlamaModel model()` + - `public String generate(final AiGenerationRequest request) throws IOException` + - `private ChatResponse chatResponse(final AiGenerationRequest request)` + - `public AiGenerationTimings generateWithTimings(final AiGenerationRequest request)` + - `public void close()` + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`. +- `generate`/`generateWithTimings` parameter: `AiGenerationRequest request`. +- `model()` reads `config` fields (`modelPath`, `contextSize`, `threads`, `swaFull`, `cacheReuse`, `gpuLayers`, `cpuMoeLayers`, `cpuFfnLayers`, `kvUnifiedPerSlot`, `lazyMode`, `flashAttn`, `cacheTypeK`, `cacheTypeV`, `batchSize`, `ubatchSize`, `threadsBatch`, `mainGpu`, `devices`) and `support.buildChatTemplateKwargs()`. +- `chatResponse` uses `support.buildInferenceParameters(request)`. + +#### Output +- `generate`: returns `String` completion text. +- `generateWithTimings`: returns `AiGenerationTimings` containing text, prompt token counts, cache usage, throughput rates. +- `close`: releases native `LlamaModel` resources. + +#### Core logic +- `model()`: + - If `model` is null, construct `ModelParameters` with config values. + - Apply optional settings (swaFull, cacheReuse, gpuLayers, cpuMoeLayers, cpuFfnLayers, kvUnifiedPerSlot, lazyMode, flashAttn, cacheTypeK/V, batch sizes, mainGpu, devices). + - Instantiate `LlamaModel` with `modelParameters` and cache it. +- `generate(request)`: + - Call `chatResponse(request)` to get `ChatResponse`. + - Warn on truncated answer via `support.warnOnTruncatedAnswer(request, response)`. + - Log prompt cache reuse via `support.logPromptCacheReuse(request, response)`. + - Parse completion text with `completionParser.parseCompletion(response.getFirstContent())`. +- `chatResponse(request)`: + - Invoke `model().chatComplete(support.buildInferenceParameters(request))`. + - Parse JSON into `ChatResponse` with `chatResponseParser.parseResponse(...)`. +- `generateWithTimings(request)`: + - Obtain `ChatResponse` via `chatResponse(request)`. + - Extract text and `Timings` from response. + - If `Timings` null, return zeroed `AiGenerationTimings`. + - Else construct `AiGenerationTimings` with promptN, cacheN, promptPerSecond, predictedN, predictedPerSecond. +- `close()`: + - If `model` not null, call `model.close()`. + +#### Public API +- `public LlamaCppJniAiGenerationProvider(final LlamaCppJniConfig, final AiPromptSupport)` – create provider. +- `public String generate(final AiGenerationRequest) throws IOException` – generate text. +- `public AiGenerationTimings generateWithTimings(final AiGenerationRequest)` – generate with metrics. +- `public void close()` – release resources. + +#### Dependencies +- `java.io.IOException` +- `java.util.Map` +- `java.util.Objects` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.args.FlashAttn` +- `net.ladenthin.llama.args.ReasoningFormat` +- `net.ladenthin.llama.json.ChatResponseParser` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.ChatResponse` +- `net.ladenthin.llama.value.Timings` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `generate` declares `throws IOException` (propagated from `chatComplete`/`chatCompleteText`). +- No explicit null checks beyond `Objects.requireNonNull` in constructor. + +#### Concurrency +- No synchronization; single‑threaded usage assumed. The native `LlamaModel` is used only after lazy initialization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 00000000..3836a229 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,103 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 13EDB813 +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:56:59Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds an immutable configuration for llama.cpp JNI provider, exposing all runtime knobs and defaults for model execution. + +#### Purpose +- Holds 37 configuration parameters for llama.cpp JNI provider. +- Provides fluent builder with defaults from `AiGenerationConfig`. +- Exposes read‑only accessors for each parameter. + +#### Type +- `final class LlamaCppJniConfig` (class, final) + - Extends `Object`. + - Annotations: `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. + - 37 `private final` fields: `modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `topP`, `topK`, `minP`, `topNSigma`, `repeatPenalty`, `chatTemplateEnableThinking`, `cachePrompt`, `swaFull`, `cacheReuse`, `gpuLayers`, `seed`, `cpuMoeLayers`, `cpuFfnLayers`, `kvUnifiedPerSlot`, `lazyMode`, `repeatLastN`, `cacheTypeK`, `cacheTypeV`, `flashAttn`, `batchSize`, `ubatchSize`, `threadsBatch`, `mainGpu`, `devices`, `provider`, `remoteModel`, `baseUrl`, `apiKeyEnv`, `reasoningEffort`, `reasoningBudgetTokens`, `dryMultiplier`, `dryBase`, `dryAllowedLength`, `dryPenaltyLastN`, `drySequenceBreakers`, `stopStrings`. +- `public static final class Builder` (class, final) + - No supertype beyond `Object`. + - 37 mutable fields mirroring the config, initialized to `AiGenerationConfig.DEFAULT_*`. + - Constructor `Builder(String modelPath)` (private). + - Setter methods for each field, returning `Builder`. + - `build()` returns `LlamaCppJniConfig`. + +#### Input +- `Builder` constructor receives `modelPath` (non‑null). +- Each setter accepts a value for its corresponding field. +- `build()` consumes the populated `Builder`. + +#### Output +- `LlamaCppJniConfig` instance with all fields set from the builder. +- Accessor methods return primitive or immutable values; list getters return unmodifiable views. + +#### Core logic +- `LlamaCppJniConfig(Builder)` copies each builder field to the final config fields. +- `Builder` setters assign the provided value to the mutable field and return `this`. +- `Builder.build()` creates a new `LlamaCppJniConfig` by invoking the private constructor. +- List getters wrap the internal lists with `Collections.unmodifiableList`. + +#### Public API +- `static Builder builder(String modelPath) -> Builder` – starts builder with required model path. +- `String modelPath() -> model file path` +- `int contextSize() -> context window size` +- `int maxOutputTokens() -> maximum output tokens` +- `float temperature() -> sampling temperature` +- `int threads() -> CPU thread count` +- `float topP() -> nucleus-sampling threshold` +- `int topK() -> top‑k limit` +- `float minP() -> min‑p threshold` +- `float topNSigma() -> top‑n‑sigma threshold` +- `float repeatPenalty() -> repetition penalty` +- `@Nullable Boolean chatTemplateEnableThinking() -> chat‑template thinking flag` +- `boolean cachePrompt() -> prompt caching enabled` +- `boolean swaFull() -> full‑size SWA cache kept` +- `int cacheReuse() -> KV prefix‑reuse chunk size` +- `int gpuLayers() -> GPU layers offloaded` +- `int seed() -> RNG seed` +- `int cpuMoeLayers() -> CPU MoE layers` +- `int cpuFfnLayers() -> CPU FFN layers` +- `int kvUnifiedPerSlot() -> per‑slot KV cap` +- `String lazyMode() -> tensor‑read laziness` +- `int repeatLastN() -> repeat‑penalty window` +- `String cacheTypeK() -> KV cache type K` +- `String cacheTypeV() -> KV cache type V` +- `boolean flashAttn() -> Flash Attention enabled` +- `int batchSize() -> logical batch size` +- `int ubatchSize() -> physical batch size` +- `int threadsBatch() -> batch/prompt thread count` +- `int mainGpu() -> primary GPU index` +- `String devices() -> device selection` +- `String provider() -> AI provider` +- `String remoteModel() -> remote model ID` +- `String baseUrl() -> OpenAI‑compatible base URL` +- `String apiKeyEnv() -> API key environment variable` +- `String reasoningEffort() -> reasoning‑effort value` +- `int reasoningBudgetTokens() -> reasoning budget tokens` +- `float dryMultiplier() -> DRY multiplier` +- `float dryBase() -> DRY base` +- `int dryAllowedLength() -> DRY allowed length` +- `int dryPenaltyLastN() -> DRY penalty look‑back` +- `List drySequenceBreakers() -> unmodifiable DRY sequence breakers` +- `List stopStrings() -> unmodifiable stop strings` +- Builder setters: `contextSize(int)`, `maxOutputTokens(int)`, `temperature(float)`, `threads(int)`, `topP(float)`, `topK(int)`, `minP(float)`, `topNSigma(float)`, `repeatPenalty(float)`, `chatTemplateEnableThinking(Boolean)`, `cachePrompt(boolean)`, `swaFull(boolean)`, `cacheReuse(int)`, `gpuLayers(int)`, `seed(int)`, `cpuMoeLayers(int)`, `cpuFfnLayers(int)`, `kvUnifiedPerSlot(int)`, `lazyMode(String)`, `repeatLastN(int)`, `cacheTypeK(String)`, `cacheTypeV(String)`, `flashAttn(boolean)`, `batchSize(int)`, `ubatchSize(int)`, `threadsBatch(int)`, `mainGpu(int)`, `devices(String)`, `provider(String)`, `remoteModel(String)`, `baseUrl(String)`, `apiKeyEnv(String)`, `reasoningEffort(String)`, `reasoningBudgetTokens(int)`, `dryMultiplier(float)`, `dryBase(float)`, `dryAllowedLength(int)`, `dryPenaltyLastN(int)`, `drySequenceBreakers(List)`, `stopStrings(List)`, `build() -> LlamaCppJniConfig`. + +#### Dependencies +- `java.util.Collections`, `java.util.List`, `java.util.Objects`. +- `lombok.EqualsAndHashCode`, `lombok.ToString`. +- `net.ladenthin.srcmorph.config.AiGenerationConfig`. +- `net.ladenthin.srcmorph.support.ConvertToRecord`. +- `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- `Objects.requireNonNull(modelPath, "modelPath")` throws `NullPointerException` if `modelPath` is null. +- No other explicit exceptions. + +#### Concurrency +- `Builder` is not thread‑safe; intended for single‑thread use. +- `LlamaCppJniConfig` is immutable and thread‑safe. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md new file mode 100644 index 00000000..d01b6987 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/OpenAiCompatibleProviderSupport.java.ai.md @@ -0,0 +1,120 @@ +### OpenAiCompatibleProviderSupport.java +- H: 1.0 +- C: 92F0B02B +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:57:09Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +--- +> Builds the JSON request, validates endpoints, secures API keys, and interprets responses for an OpenAI‑compatible chat model. + +#### Purpose +- Constructs chat‑completion request bodies with sampling knobs. +- Validates HTTP endpoints and API key safety. +- Parses error messages and computes generation timings. + +#### Type +- `final class OpenAiCompatibleProviderSupport` (class, final) + - Extends `Object` + - Annotations: `@ToString` + - Fields: + - `static final String CHAT_COMPLETIONS_PATH` (class) + - `static final int ERROR_BODY_EXCERPT` (class) + - `private static final int HTTP_OK_FIRST` (class) + - `private static final int HTTP_OK_END` (class) + - `static final String HTTP_SCHEME` (class) + - `static final String HTTPS_SCHEME` (class) + - `private static final String LOOPBACK_HOST_NAME` (class) + - `private static final Pattern IPV4_LOOPBACK` (class) + - `private static final String IPV6_LOOPBACK` (class) + - `private static final String ELLIPSIS` (class) + - `private static final ObjectMapper MAPPER` (class) + - `private final LlamaCppJniConfig config` (instance) + - `@ToString.Exclude private final AiPromptSupport promptSupport` (instance) + - `@ToString.Exclude private final Function environment` (instance) + - `private final Java8CompatibilityHelper compatibilityHelper` (instance) + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport`, `Function environment`. +- `requestBody(AiGenerationRequest request)` consumes `AiGenerationRequest` fields: `promptKey()`, `sourceFile()`, `sourceText()`. +- `endpoint()` reads `config.baseUrl()`. +- `apiKey()` reads `config.apiKeyEnv()` and `environment.apply(...)`. +- `apiKeyFor(String endpoint)` reads `endpoint` and `apiKey()`. +- `isLoopbackHost(String host)` reads `host`. +- `errorMessage(String endpoint, int status, String body)` reads `endpoint`, `status`, `body`. +- `timings(String text, ChatResponse response, double seconds)` reads `response.getUsage()`. + +#### Output +- `requestBody` returns JSON string. +- `endpoint` returns URL string. +- `apiKey` returns trimmed key or `null`. +- `apiKeyFor` returns key or `null`; may throw `IOException`. +- `isLoopbackHost` returns boolean. +- `isSuccess` returns boolean. +- `errorMessage` returns formatted string. +- `timings` returns `AiGenerationTimings` instance. + +#### Core logic +- **requestBody** + - Create `ObjectNode body`. + - Add `"model"` if `remoteModel` non‑blank. + - Build `"messages"` array with system and user messages from `promptSupport`. + - Set `"max_tokens"`, `"temperature"`, `"top_p"`. + - Conditionally add `"top_k"`, `"min_p"`, `"seed"`, `"stop"` array, `"reasoning.effort"`. + - Set `"stream"` to `false`. + - Serialize with `MAPPER.writeValueAsString(body)`. +- **endpoint** + - Trim `config.baseUrl()`. + - Validate starts with `http://` or `https://`. + - Strip trailing slashes. + - Append `CHAT_COMPLETIONS_PATH`. +- **apiKey** + - Return `null` if `apiKeyEnv` blank. + - Lookup env var; return trimmed key or `null` if unset/blank. +- **apiKeyFor** + - If key `null` or endpoint not `http://`, return key. + - Parse host from `endpoint`. + - If host not loopback (`isLoopbackHost`), throw `IOException`. + - Return key. +- **isLoopbackHost** + - Return true if host equals `"localhost"`, matches `IPV4_LOOPBACK`, or equals `"[::1]"`. +- **isSuccess** + - Return true if status in [200,300). +- **errorMessage** + - Truncate body to `ERROR_BODY_EXCERPT` with ellipsis if longer. + - Return formatted string. +- **timings** + - Extract `completionTokens`, `promptTokens`, `cachedTokens` from `response.getUsage()`. + - Compute `decodeRate = completionTokens / seconds` if seconds > 0. + - Return new `AiGenerationTimings(text, promptTokens, cachedTokens, 0.0, completionTokens, decodeRate)`. + +#### Public API +- `String requestBody(AiGenerationRequest request) -> JSON body` +- `String endpoint() -> URL` +- `@Nullable String apiKey() -> API key` +- `@Nullable String apiKeyFor(String endpoint) -> API key or null` +- `static boolean isLoopbackHost(String host) -> true if loopback` +- `static boolean isSuccess(int status) -> true if 2xx` +- `static String errorMessage(String endpoint, int status, String body) -> message` +- `static AiGenerationTimings timings(String text, ChatResponse response, double seconds) -> timings` + +#### Dependencies +- `com.fasterxml.jackson.databind.ObjectMapper`, `ArrayNode`, `ObjectNode` +- `java.io.IOException`, `java.net.URL`, `java.util.List`, `java.util.Objects`, `java.util.function.Function`, `java.util.regex.Pattern` +- `lombok.ToString` +- `net.ladenthin.llama.value.ChatResponse`, `Usage` +- `net.ladenthin.srcmorph.document.AiGenerationRequest` +- `net.ladenthin.srcmorph.prompt.AiPromptSupport` +- `net.ladenthin.srcmorph.support.Java8CompatibilityHelper` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- `IllegalArgumentException` in `endpoint()` if baseUrl not http(s). +- `IOException` in `apiKeyFor()` if plain http to non‑loopback host or URL parsing fails. +- `IOException` in `requestBody()` if JSON serialization fails. + +#### Concurrency +- All fields are immutable after construction; no synchronization needed. +- Methods are stateless except for reading immutable fields. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/package.ai.md new file mode 100644 index 00000000..44af9eae --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/java/provider/package.ai.md @@ -0,0 +1,57 @@ +### java/provider +- H: 1.0 +- C: 8CDF0C9A +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:58:02Z +- G: +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [OpenAiCompatibleProviderSupport.java](OpenAiCompatibleProviderSupport.java.ai.md) +--- +> Provides a pluggable AI generation layer that supports local llama.cpp models, OpenAI‑compatible APIs, and mock back‑ends, exposing a unified request/response contract and optional timing metrics. + +#### Purpose +- Abstract AI text generation behind a single interface. +- Allow runtime selection of provider (local, remote, mock) via configuration. +- Offer clean parsing of model responses and optional performance telemetry. + +#### Responsibilities +- **Provider abstraction** – `AiGenerationProvider` interface defines generation and timing APIs. +- **Factory orchestration** – `AiGenerationProviderFactory` resolves provider keys and instantiates the correct implementation. +- **Local model handling** – `LlamaCppJniAiGenerationProvider` loads a GGUF model lazily, runs chat completions, parses responses, and reports timings. +- **Remote API support** – `OpenAiCompatibleProviderSupport` builds request bodies, validates endpoints, secures API keys, and interprets OpenAI‑compatible responses. +- **Configuration** – `LlamaCppJniConfig` holds all runtime knobs for the llama.cpp provider. +- **Response cleaning** – `AiCompletionParser` strips Gemma‑4 thinking blocks from raw completions. + +#### Key units +- `AiGenerationProvider` – interface for generating text and timings. +- `AiGenerationProviderFactory` – resolves provider key → concrete provider. +- `LlamaCppJniAiGenerationProvider` – local llama.cpp implementation. +- `OpenAiCompatibleProviderSupport` – helper for OpenAI‑compatible HTTP interactions. +- `LlamaCppJniConfig` – immutable config builder for llama.cpp. +- `AiCompletionParser` – removes internal reasoning blocks from completions. + +#### Data flow +1. **Request creation** – caller builds an `AiGenerationRequest` (prompt key, source file/text, header). +2. **Provider selection** – `AiGenerationProviderFactory.create(...)` chooses the provider based on run‑level or model‑level keys. +3. **Generation** – provider’s `generate(...)` or `generateWithTimings(...)` is invoked. + - *Local*: `LlamaCppJniAiGenerationProvider` lazily loads `LlamaModel`, runs `chatComplete`, parses `ChatResponse`, cleans text via `AiCompletionParser`, and returns result or timings. + - *Remote*: `OpenAiCompatibleProviderSupport` builds JSON body, validates endpoint, secures API key, sends HTTP request, parses `ChatResponse`, and extracts timings. +4. **Response handling** – caller receives plain text or `AiGenerationTimings` (text + token counts, rates). + +#### Dependencies +- **Internal** – `AiPromptSupport`, `Java8CompatibilityHelper`, `MockAiGenerationProvider`, `LlamaCppJniConfig`. +- **External** – `net.ladenthin.llama` (native model, JSON parser), `com.fasterxml.jackson` (JSON), `org.jspecify` (nullable annotations), `lombok` (annotations). +- **Runtime** – native llama.cpp library, HTTP client (used by OpenAI support), environment variables for API keys. + +#### Cross-cutting +- **Immutability** – `LlamaCppJniConfig` and support classes are immutable; thread‑safe by design. +- **Error handling** – `IOException` propagated for I/O or parsing failures; `IllegalArgumentException` for misconfiguration. +- **Timing metrics** – default implementation in `AiGenerationProvider` returns zeroed metrics; concrete providers override to supply real data. +- **Configuration resolution** – `effectiveProvider` logic centralizes provider key precedence (run vs. model level). +- **Response parsing** – `AiCompletionParser` ensures consistent output by stripping internal reasoning blocks across providers. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md new file mode 100644 index 00000000..c0bc824d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/kernels/histogram.cl.ai.md @@ -0,0 +1,49 @@ +### histogram.cl +- H: 1.0 +- C: C466EA12 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:41Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Computes a 256‑bin histogram of a byte stream in two OpenCL kernel passes. + +#### Purpose +- Builds a byte histogram for image or generic byte data. +- Splits work into two passes: local partial counts then global reduction. + +#### Type +- OpenCL C 1.2 kernels (`__kernel` functions). + +#### Input +- `histogram_partial`: `__global const uchar *input`, `uint length`, `__global uint *partial`, `__local uint *local_bins`. +- `histogram_reduce`: `__global const uint *partial`, `uint group_count`, `__global uint *histogram`. + +#### Output +- `histogram_partial`: writes per‑group partial histograms to `partial`. +- `histogram_reduce`: writes final histogram to `histogram`. + +#### Core logic +- **histogram_partial** + 1. Zero local bin array in parallel. + 2. Each work‑item iterates over its assigned input indices, atomically increments corresponding local bin. + 3. After synchronization, each work‑item copies its local bin slice to the global `partial` buffer at offset `group_id * BINS`. +- **histogram_reduce** + 1. Each work‑item handles one bin index. + 2. Sums the bin value across all partial histograms (`group_count` groups). + 3. Stores the sum into the final `histogram` array. + +#### Public API +- `histogram_partial(__global const uchar *input, uint length, __global uint *partial, __local uint *local_bins)` – partial histogram per work‑group. +- `histogram_reduce(__global const uint *partial, uint group_count, __global uint *histogram)` – final histogram reduction. + +#### Constants and configuration +- `#define BINS 256` + +#### Dependencies +- OpenCL built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Exceptions / Errors +- None declared; kernels return early if `bin >= BINS` in `histogram_reduce`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/kernels/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/kernels/package.ai.md new file mode 100644 index 00000000..37ee2e37 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/kernels/package.ai.md @@ -0,0 +1,37 @@ +### other/kernels +- H: 1.0 +- C: 7D744C6A +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:58:10Z +- G: +- A: 0.0.0 +- X: package +- F: [histogram.cl](histogram.cl.ai.md) +--- +> Computes a 256‑bin histogram of a byte stream using two OpenCL kernel passes. + +#### Purpose +- Generate a byte histogram for image or generic byte data. +- Split computation into local partial counting and global reduction. + +#### Responsibilities +- **Partial counting**: per‑work‑group accumulation of byte frequencies. +- **Global reduction**: summing per‑group partials into final histogram. + +#### Key units +- `histogram_partial` – OpenCL kernel that builds per‑group partial histograms. +- `histogram_reduce` – OpenCL kernel that reduces partial histograms into the final 256‑bin result. +- `BINS` – constant defining histogram size (256). + +#### Data flow +1. **Input**: `__global const uchar *input`, `uint length`. +2. `histogram_partial` writes per‑group partial counts to `__global uint *partial`. +3. `histogram_reduce` reads `partial`, aggregates across `group_count`, writes final `__global uint *histogram`. + +#### Dependencies +- OpenCL 1.2 built‑ins: `get_local_id`, `get_local_size`, `get_global_id`, `get_global_size`, `get_group_id`, `atomic_inc`, `barrier`, `CLK_LOCAL_MEM_FENCE`. + +#### Cross-cutting +- Uses local memory (`__local uint *local_bins`) for intra‑group accumulation. +- Atomic increments guard concurrent updates to local bins. +- Barrier synchronization ensures all work‑items finish local accumulation before copying to global partial buffer. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..9315383c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,50 @@ +### other +- H: 1.0 +- C: 7465CD55 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:58:16Z +- G: +- A: 0.0.0 +- X: package +- F: [kernels/](kernels/package.ai.md) +- F: [ringbuf/](ringbuf/package.ai.md) +- F: [scripts/](scripts/package.ai.md) +--- +> Provides low‑level utilities for byte‑level data processing, including an OpenCL histogram kernel, a lock‑free ring buffer, and small shell/Python tools for backup and sales reporting. + +#### Purpose +- Deliver efficient, reusable components for byte‑stream analysis and buffering. +- Offer simple command‑line helpers for data backup and CSV‑based reporting. + +#### Responsibilities +- **Histogram computation** – split counting and reduction across OpenCL work‑groups. +- **Ring buffer management** – power‑of‑two circular storage with single‑producer/single‑consumer semantics. +- **Utility scripts** – rotating tarball backups and CSV sales aggregation. + +#### Key units +- `histogram_partial`, `histogram_reduce` (OpenCL kernels) – build and reduce 256‑bin histograms. +- `ringbuf_t`, `ringbuf_status_t` – data structure and status enum for the ring buffer. +- `ringbuf_init`, `ringbuf_write`, `ringbuf_read`, `ringbuf_used`, `ringbuf_free_space` – core API. +- `rotate_backups.sh` – Bash script for timestamped archive rotation. +- `sales_report.py` – Python module exposing `parse_orders`, `revenue_by_month_and_region`, `main`. +- `Order` dataclass – represents an order record. + +#### Data flow +1. **Histogram**: input byte stream → `histogram_partial` writes per‑group partials → `histogram_reduce` aggregates into final 256‑bin histogram. +2. **Ring buffer**: `ringbuf_init` allocates buffer → `ringbuf_write` enqueues bytes → `ringbuf_read` dequeues bytes → status queries report used/free space. +3. **Scripts**: + - `rotate_backups.sh`: source → tarball → target directory → prune old archives. + - `sales_report.py`: CSV rows → `Order` objects → aggregation by month/region → tab‑separated report. + +#### Dependencies +- OpenCL 1.2 built‑ins (`get_local_id`, `atomic_inc`, etc.) for histogram kernels. +- Standard C headers (`stddef.h`, `stdint.h`, `stdlib.h`, `string.h`) for ring buffer. +- Shell utilities (`tar`, `date`, `du`, `ls`, `rm`, `mkdir`) for backup script. +- Python standard library (`argparse`, `csv`, `collections`, `dataclasses`, `datetime`, `decimal`) for sales report. + +#### Cross-cutting +- **Power‑of‑two sizing**: ring buffer capacity must be a power of two; one slot unused to distinguish full/empty. +- **Modulo arithmetic**: head/tail wrap via `& (capacity - 1)` for efficiency. +- **Atomicity & barriers**: histogram kernels use local memory, atomic increments, and barriers to avoid race conditions. +- **Error handling**: ring buffer functions return status codes or byte counts; scripts exit non‑zero on failure with clear messages. +- **Input validation**: backup script checks numeric `KEEP`; sales report validates CSV columns and currency. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/ringbuf/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/ringbuf/package.ai.md new file mode 100644 index 00000000..a37778a0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/ringbuf/package.ai.md @@ -0,0 +1,46 @@ +### other/ringbuf +- H: 1.0 +- C: 040A7597 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:58:12Z +- G: +- A: 0.0.0 +- X: package +- F: [ringbuf.c](ringbuf.c.ai.md) +- F: [ringbuf.h](ringbuf.h.ai.md) +--- +> A lock‑free, power‑of‑two sized byte ring buffer for single‑producer/single‑consumer scenarios. + +#### Purpose +- Provide a fixed‑size circular buffer for byte streams. +- Expose a clean API for initialization, deallocation, read/write, and space queries. + +#### Responsibilities +- **Buffer management** – allocate, free, and maintain head/tail indices. +- **Data transfer** – copy data to/from the internal array with wrap‑around. +- **Space accounting** – compute used bytes and available free space. + +#### Key units +- `ringbuf_t` – struct holding buffer pointer, capacity, head, tail. +- `ringbuf_status_t` enum – `RINGBUF_OK`, `RINGBUF_EINVAL`, `RINGBUF_ENOMEM`. +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – allocate and set up buffer. +- `ringbuf_free(ringbuf_t *rb)` – release memory. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – enqueue bytes. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – dequeue bytes. +- `ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `ringbuf_free_space(const ringbuf_t *rb)` – bytes available for writing. + +#### Data flow +1. **Initialization**: `ringbuf_init` allocates a power‑of‑two buffer, sets `head = tail = 0`. +2. **Writing**: `ringbuf_write` copies up to `free_space` bytes, updates `head` modulo capacity. +3. **Reading**: `ringbuf_read` copies up to `used` bytes, updates `tail` modulo capacity. +4. **Querying**: `ringbuf_used` and `ringbuf_free_space` compute values via modulo arithmetic. + +#### Dependencies +- Standard C headers: ``, ``, ``, ``. +- Internal: `ringbuf.h` declares types and API used by `ringbuf.c`. + +#### Cross-cutting +- **Power‑of‑two constraint**: capacity must be a power of two; one slot left unused to distinguish full vs empty. +- **Modulo arithmetic**: head and tail wrap using `& (capacity - 1)` for efficiency. +- **Error handling**: `ringbuf_init` returns `RINGBUF_EINVAL` for invalid capacity, `RINGBUF_ENOMEM` for allocation failure. All other functions return the actual number of bytes processed. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md new file mode 100644 index 00000000..7cdb1c05 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/ringbuf/ringbuf.c.ai.md @@ -0,0 +1,58 @@ +### ringbuf.c +- H: 1.0 +- C: 9F74BBA2 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:44Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> A circular buffer implementation that stores bytes in a power‑of‑two sized array and supports write/read with wrap‑around. + +#### Purpose +- Provides a fixed‑size ring buffer for byte streams. +- Supports initialization, deallocation, and querying of used/free space. + +#### Type +- C source file (`ringbuf.c`), implements functions declared in `ringbuf.h`. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity in bytes. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t` (OK, EINVAL, ENOMEM). +- `ringbuf_write` returns number of bytes written. +- `ringbuf_read` returns number of bytes read. +- `ringbuf_free` deallocates internal buffer. + +#### Core logic +- `is_power_of_two` checks capacity validity. +- `min_size` selects smaller of two sizes. +- `ringbuf_init` allocates buffer, sets head/tail to 0. +- `ringbuf_free` frees buffer and resets fields. +- `ringbuf_used` computes bytes in buffer via modulo arithmetic. +- `ringbuf_free_space` computes available space. +- `ringbuf_write` writes up to two contiguous chunks: from current head to end, then from start. +- `ringbuf_read` reads similarly from tail, updating tail pointer. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – initialize buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free buffer. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – bytes available. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write data. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read data. + +#### Constants and configuration +- None defined in this file. + +#### Dependencies +- `ringbuf.h` (declaration of `ringbuf_t`, `ringbuf_status_t`, status codes). +- Standard library: `stdlib.h` (`malloc`, `free`), `string.h` (`memcpy`). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity not power of two. +- `ringbuf_init` returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md new file mode 100644 index 00000000..26706bbf --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/ringbuf/ringbuf.h.ai.md @@ -0,0 +1,58 @@ +### ringbuf.h +- H: 1.0 +- C: 601BDB34 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:47Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Provides a fixed‑size byte ring buffer for single‑producer/single‑consumer use. + +#### Purpose +- Implements a lock‑free byte buffer with power‑of‑two capacity. +- Supports initialization, deallocation, read/write, and space queries. + +#### Type +- Header file (`ringbuf.h`) in C. +- Defines `ringbuf_t` struct, `ringbuf_status_t` enum, and related functions. + +#### Input +- `ringbuf_init(ringbuf_t *rb, size_t capacity)` – capacity value. +- `ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – source buffer and length. +- `ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – destination buffer and length. + +#### Output +- `ringbuf_init` returns `ringbuf_status_t`. +- `ringbuf_write` and `ringbuf_read` return number of bytes actually transferred. +- `ringbuf_used` and `ringbuf_free_space` return byte counts. + +#### Core logic +- Capacity must be a power of two; one slot unused to distinguish full/empty. +- `head` (producer) and `tail` (consumer) indices wrap via modulo capacity. +- `ringbuf_write` copies up to available free space, updates `head`. +- `ringbuf_read` copies up to available data, updates `tail`. +- `ringbuf_used` computes `(head - tail) & (capacity - 1)`. +- `ringbuf_free_space` computes `(capacity - 1) - used`. + +#### Public API +- `ringbuf_status_t ringbuf_init(ringbuf_t *rb, size_t capacity)` – allocate buffer. +- `void ringbuf_free(ringbuf_t *rb)` – free allocated memory. +- `size_t ringbuf_write(ringbuf_t *rb, const uint8_t *src, size_t len)` – write bytes. +- `size_t ringbuf_read(ringbuf_t *rb, uint8_t *dst, size_t len)` – read bytes. +- `size_t ringbuf_used(const ringbuf_t *rb)` – bytes currently stored. +- `size_t ringbuf_free_space(const ringbuf_t *rb)` – bytes available for writing. + +#### Constants and configuration +- `RINGBUF_OK = 0` +- `RINGBUF_EINVAL = -1` – capacity invalid. +- `RINGBUF_ENOMEM = -2` – allocation failure. + +#### Dependencies +- ``, `` for standard types. +- Uses `malloc`/`free` implicitly via implementation (not shown). + +#### Exceptions / Errors +- `ringbuf_init` returns `RINGBUF_EINVAL` if capacity is zero or not a power of two. +- Returns `RINGBUF_ENOMEM` if memory allocation fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/scripts/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/scripts/package.ai.md new file mode 100644 index 00000000..aeb7dfbc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/scripts/package.ai.md @@ -0,0 +1,38 @@ +### other/scripts +- H: 1.0 +- C: 88852564 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:58:15Z +- G: +- A: 0.0.0 +- X: package +- F: [rotate_backups.sh](rotate_backups.sh.ai.md) +- F: [sales_report.py](sales_report.py.ai.md) +--- +> A small utility bundle that backs up directories and aggregates sales data from CSV exports. + +#### Purpose +- Provide a command‑line backup script that keeps a rolling set of compressed archives. +- Offer a Python tool to generate monthly sales reports by region, filtered by currency and revenue threshold. + +#### Responsibilities +- **Backup rotation**: `rotate_backups.sh` creates timestamped tarballs, prunes old ones, and reports actions. +- **Sales reporting**: `sales_report.py` parses CSV orders, aggregates revenue per month/region, and outputs a tab‑separated report. + +#### Key units +- **`rotate_backups.sh`** – Bash script; core logic: validate inputs, create `tar.gz` archive, delete excess archives. +- **`sales_report.py`** – Python module; public API: `parse_orders`, `revenue_by_month_and_region`, `main`. +- **`Order` dataclass** – represents a single order record (date, region, amount). + +#### Data flow +1. **Backup**: User supplies source and target directories; script validates, archives, and cleans old backups. +2. **Reporting**: User supplies CSV files and optional filters; script parses rows, aggregates totals, and prints results. + +#### Dependencies +- **Shell**: `tar`, `date`, `du`, `ls`, `rm`, `mkdir`. +- **Python**: `argparse`, `csv`, `collections.defaultdict`, `dataclasses`, `datetime`, `decimal`. + +#### Cross-cutting +- Strict error handling: both tools exit with non‑zero status on failure and provide clear messages. +- Input validation: `rotate_backups.sh` checks numeric `KEEP`; `sales_report.py` validates CSV columns and currency. +- Output formatting: tab‑separated lines for the report; human‑readable logs for backup actions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md new file mode 100644 index 00000000..42d8e799 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/scripts/rotate_backups.sh.ai.md @@ -0,0 +1,59 @@ +### rotate_backups.sh +- H: 1.0 +- C: F50CF6FE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:51Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Creates a dated, compressed backup of a directory and prunes older archives, keeping only the newest N. + +#### Purpose +- Back up a specified directory to a target location. +- Retain only the most recent `KEEP` archives; older ones are deleted. +- Intended to be run directly from the command line. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- `$1` → `SOURCE_DIR` (required, source directory). +- `$2` → `BACKUP_DIR` (required, destination directory). +- `$3` → `KEEP` (optional, defaults to `7`). +- No external options or environment variables. + +#### Output +- Creates a file `"$BACKUP_DIR/${name}_.tar.gz"`. +- Prints creation and removal messages to stdout. +- Exit status `0` on success; `2` on invalid arguments or missing source directory. + +#### Core logic +- Validate `KEEP` is a positive integer. +- Ensure `SOURCE_DIR` exists; create `BACKUP_DIR` if missing. +- Build archive name with UTC timestamp. +- Create temporary archive `"$tmp"`, then rename to final name. +- List existing archives sorted newest first; delete those beyond the `KEEP` count. +- Report each removal. + +#### Functions +- None. + +#### Constants and configuration +- `SOURCE_DIR=${1:?usage: rotate_backups.sh [keep]}` +- `BACKUP_DIR=${2:?usage: rotate_backups.sh [keep]}` +- `KEEP=${3:-7}` +- `name="$(basename "$SOURCE_DIR")"` +- `archive="$BACKUP_DIR/${name}_$(date -u +%Y%m%dT%H%M%SZ).tar.gz"` +- `tmp="$archive.partial"` + +#### Dependencies +- External commands: `tar`, `date`, `du`, `ls`, `rm`, `mkdir`. +- No sourced files. + +#### Errors and exit codes +- `exit 2` if `KEEP` is not a positive integer. +- `exit 2` if `SOURCE_DIR` does not exist. +- `trap` ensures temporary file `$tmp` is removed on exit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md new file mode 100644 index 00000000..cae36460 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/other/scripts/sales_report.py.ai.md @@ -0,0 +1,58 @@ +### sales_report.py +- H: 1.0 +- C: 34684FDC +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:53Z +- G: +- A: 0.0.0 +- X: file +- P: C7A82429 +--- +> Generates a monthly sales report from CSV order exports, aggregating revenue by month and region for a specified currency. + +#### Purpose +- Aggregates order revenue per month and region. +- Filters by currency and minimum revenue threshold. + +#### Type +- Python script (`.py`). + +#### Input +- Positional arguments: list of CSV file paths (`csv_files`). +- Optional arguments: + - `--currency`: target currency (default `EUR`). + - `--min-revenue`: minimum revenue to display (default `0`). +- CSV columns required: `order_date`, `region`, `amount`, `currency`. + +#### Output +- Prints tab‑separated lines: `monthregionrevenue currency`. +- Exits with status `0` on success, `1` if no orders found. + +#### Core logic +- `parse_orders(path, currency)`: + - Opens CSV, validates required columns. + - Skips rows with non‑matching currency. + - Yields `Order(order_date, region, amount)`; raises `ValueError` on parse errors. +- `revenue_by_month_and_region(orders)`: + - Sums `amount` per `(YYYY-MM, region)` key using `defaultdict(Decimal)`. + - Returns sorted dictionary of totals. +- `main(argv)`: + - Parses CLI arguments. + - Collects all orders from provided files. + - If none, prints error and exits with `1`. + - Iterates over aggregated totals, prints entries meeting `min_revenue`. + +#### Public API +- `parse_orders(path, currency) -> Iterator[Order]` – yields orders in specified currency. +- `revenue_by_month_and_region(orders) -> Dict[Tuple[str, str], Decimal]` – aggregates revenue. +- `main(argv=None) -> int` – command‑line entry point. + +#### Constants and configuration +- `REQUIRED_COLUMNS = ("order_date", "region", "amount", "currency")`. + +#### Dependencies +- `argparse`, `csv`, `sys`, `collections.defaultdict`, `dataclasses.dataclass`, `datetime.date`, `decimal.Decimal`, `decimal.InvalidOperation`. + +#### Exceptions / Errors +- `ValueError` for missing columns or malformed data. +- `ValueError` propagated from `parse_orders` on invalid rows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..d557e291 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,69 @@ +### ai +- H: 1.0 +- C: 8A065534 +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:58:33Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +- F: [sql/](sql/package.ai.md) +--- +> A framework that orchestrates AI‑driven source‑code generation, from file selection and fact extraction to prompt creation and model execution, while also providing low‑level byte‑stream utilities and a set of SQL packages for inventory, lending, and e‑commerce data management. + +#### Purpose +- Orchestrate AI code‑generation jobs across source trees. +- Offer reusable byte‑stream tools (histograms, ring buffers, scripts). +- Persist and enforce business rules for library, shop, and warehouse domains. + +#### Responsibilities +- **AI Generation Pipeline** – configuration, file filtering, fact extraction, oversize handling, provider abstraction, and response cleaning. +- **Byte‑Stream Utilities** – OpenCL histogram kernels, lock‑free ring buffer, backup and reporting scripts. +- **Data Persistence** – schema, stored procedures, audit triggers, and reporting views for library, shop, and warehouse. + +#### Key units +- **Java AI Core** + - `SrcMorphConfiguration`, `AiGenerationConfig` – mutable Maven‑style settings. + - `AiConditionEvaluator`, `AiConditionGroup` – file‑selection logic. + - `AiFactExtractor` – deterministic fact block builder. + - `AiOversizeStrategy` – handling for context‑limit files. + - `AiGenerationProvider` / `AiGenerationProviderFactory` – pluggable back‑ends (llama.cpp, OpenAI, mock). + - `AiCompletionParser` – removes internal reasoning blocks. +- **Other Utilities** + - `histogram_partial`, `histogram_reduce` – OpenCL 256‑bin histogram kernels. + - `ringbuf_t`, `ringbuf_*` – power‑of‑two lock‑free circular buffer. + - `rotate_backups.sh`, `sales_report.py` – backup rotation and CSV sales aggregation. +- **SQL Packages** + - **Library (PostgreSQL)** – tables (`author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`), views (`overdue_loans`, `member_loan_stats`, `popular_books`), functions (`fn_checkout_book`, `sp_return_book`, `fn_late_fee`), trigger (`trg_loan_audit_fn`). + - **Shop (MySQL)** – tables (`product`, `customer_order`, `order_item`), procedure (`add_order_item`). + - **Warehouse (SQL Server)** – tables (`dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`), procedure (`dbo.usp_SyncStock`). + +#### Data flow +1. **AI Generation** + - Maven plugin → `SrcMorphConfiguration` → `AiGenerationConfig`. + - `AiConditionEvaluator` filters files → `AiFactExtractor` builds fact blocks. + - Oversize strategy chosen → provider resolved by `AiGenerationProviderFactory`. + - Provider generates text → `AiCompletionParser` cleans → result returned. +2. **Byte‑Stream** + - Input bytes → `histogram_partial` → `histogram_reduce` → 256‑bin histogram. + - `ringbuf_init` → `ringbuf_write`/`ringbuf_read` → status queries. + - Scripts consume or produce files (tarballs, CSV reports). +3. **SQL Domain** + - **Library**: `fn_checkout_book` → loan insert, stock decrement, audit trigger. + - **Shop**: `add_order_item` locks product, updates stock, recalculates order total. + - **Warehouse**: `usp_SyncStock` merges supplier feed into stock levels, logs run. + +#### Dependencies +- **Internal** – AI core shares `AiCondition`, `AiFactCounter`, `AiPromptDefinition`, etc.; SQL routines reference cross‑package tables and views. +- **External** – Lombok, Jackson, OpenCL 1.2, HTTP client for OpenAI, native llama.cpp library, PostgreSQL/MySQL/SQL Server system functions. +- **Runtime** – environment variables for API keys, native libraries for llama.cpp, shell utilities (`tar`, `date`), Python stdlib. + +#### Cross‑cutting +- **Immutability & Thread‑Safety** – stateless evaluators, extractors, and provider support; mutable configs are not thread‑safe. +- **Validation & Error Handling** – `validate` throws `IllegalArgumentException`; parsing errors propagate `IOException`. +- **Timing Metrics** – providers expose `AiGenerationTimings`; defaults are zeroed. +- **Response Parsing** – `AiCompletionParser` standardizes output across providers. +- **Ring Buffer** – power‑of‑two sizing, modulo arithmetic, single‑producer/single‑consumer semantics. +- **Histogram Kernels** – atomic increments, local memory, barriers for race‑free aggregation. +- **Audit & Concurrency** – triggers, row‑level locks, transactional MERGE, and audit logs across SQL packages. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..af74e538 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,39 @@ +### srcmorph-modelcard +- H: 1.0 +- C: F63FE425 +- D: 2026-11-04T12:56:06Z +- T: 2026-11-04T12:58:41Z +- G: +- A: 0.0.0 +- X: project +- F: [java/config](java/config/package.ai.md) +- F: [java](java/package.ai.md) +- F: [java/provider](java/provider/package.ai.md) +- F: [other/kernels](other/kernels/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/ringbuf](other/ringbuf/package.ai.md) +- F: [other/scripts](other/scripts/package.ai.md) +- F: [.](package.ai.md) +- F: [sql/library](sql/library/package.ai.md) +- F: [sql](sql/package.ai.md) +- F: [sql/shop](sql/shop/package.ai.md) +- F: [sql/warehouse](sql/warehouse/package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard framework orchestrates AI‑driven source‑code generation by selecting files, extracting deterministic facts, and delegating prompt creation to pluggable AI back‑ends such as local llama.cpp, OpenAI‑compatible APIs, or mocks. Its core Java packages provide a Maven‑style configuration engine, a unified provider interface for AI generation, and a runtime orchestrator that ties file selection, fact extraction, and prompt execution together. Low‑level utilities in the other package supply byte‑stream processing tools—including an OpenCL histogram kernel, a lock‑free ring buffer, and backup/reporting scripts—while the sql packages expose PostgreSQL, MySQL, and SQL Server schemas and stored procedures for inventory, lending, e‑commerce, and warehouse management, enabling the generated code to interact with real data stores. + +#### Packages +- java/config — A Maven‑style configuration and runtime engine for AI‑driven source‑code generation, handling file selection, fact extraction, and model‑specific generation settings. +- java — A Maven‑style framework that orchestrates AI‑driven source‑code generation, selecting files, extracting deterministic facts, and delegating prompt generation to pluggable AI back‑ends (local llama.cpp, OpenAI‑compatible APIs, or mocks). +- java/provider — Provides a pluggable AI generation layer that supports local llama.cpp models, OpenAI‑compatible APIs, and mock back‑ends, exposing a unified request/response contract and optional timing metrics. +- other/kernels — Computes a 256‑bin histogram of a byte stream using two OpenCL kernel passes. +- other — Provides low‑level utilities for byte‑level data processing, including an OpenCL histogram kernel, a lock‑free ring buffer, and small shell/Python tools for backup and sales reporting. +- other/ringbuf — A lock‑free, power‑of‑two sized byte ring buffer for single‑producer/single‑consumer scenarios. +- other/scripts — A small utility bundle that backs up directories and aggregates sales data from CSV exports. +- . — A framework that orchestrates AI‑driven source‑code generation, from file selection and fact extraction to prompt creation and model execution, while also providing low‑level byte‑stream utilities and a set of SQL packages for inventory, lending, and e‑commerce data management. +- sql/library — A PostgreSQL‑based library management system that defines catalog, lending, and reporting objects, and provides stored routines for checkout, return, and fee calculation. +- sql — A collection of SQL packages that manage inventory, lending, and e‑commerce data across PostgreSQL, MySQL, and SQL Server, each providing schema, business logic, and audit capabilities for their domain. +- sql/shop — A MySQL schema and stored procedure that model a web shop’s product catalog, customer orders, and order items, ensuring stock reservation and order total consistency. +- sql/warehouse — Keeps warehouse inventory in sync with nightly supplier feeds and records each sync run. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md new file mode 100644 index 00000000..033880f9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/01_schema.sql.ai.md @@ -0,0 +1,68 @@ +### 01_schema.sql +- H: 1.0 +- C: 0604AED6 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:15Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> A PostgreSQL schema defining the core tables and indexes for a library lending system, modeling authors, books, members, and loans. + +#### Purpose +- Define relational structure for library catalog and lending operations. +- Enforce data integrity with constraints and indexes. + +#### Type +- PostgreSQL tables and indexes. + +#### Schema +- **author** + - `author_id BIGSERIAL PRIMARY KEY` + - `full_name VARCHAR(200) NOT NULL` + - `birth_year SMALLINT CHECK (birth_year BETWEEN 1000 AND 2100)` + - `country_code CHAR(2)` +- **book** + - `book_id BIGSERIAL PRIMARY KEY` + - `isbn VARCHAR(17) NOT NULL UNIQUE` + - `title VARCHAR(300) NOT NULL` + - `author_id BIGINT NOT NULL REFERENCES author (author_id)` + - `published_year SMALLINT` + - `copies_total INTEGER NOT NULL DEFAULT 1 CHECK (copies_total >= 0)` + - `copies_free INTEGER NOT NULL DEFAULT 1 CHECK (copies_free >= 0)` + - `CONSTRAINT book_free_le_total CHECK (copies_free <= copies_total)` +- **member** + - `member_id BIGSERIAL PRIMARY KEY` + - `email VARCHAR(254) NOT NULL UNIQUE` + - `full_name VARCHAR(200) NOT NULL` + - `joined_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `is_blocked BOOLEAN NOT NULL DEFAULT FALSE` +- **loan** + - `loan_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `member_id BIGINT NOT NULL REFERENCES member (member_id) ON DELETE CASCADE` + - `loaned_on DATE NOT NULL DEFAULT CURRENT_DATE` + - `due_on DATE NOT NULL` + - `returned_on DATE` + - `CONSTRAINT loan_due_after_loan CHECK (due_on > loaned_on)` +- **Indexes** + - `idx_book_author ON book (author_id)` + - `idx_loan_member ON loan (member_id)` + - `idx_loan_open ON loan (due_on) WHERE returned_on IS NULL` + +#### Reads +- `author` (via foreign key in `book`) +- `book` (via foreign key in `loan`) +- `member` (via foreign key in `loan`) + +#### Writes +- Inserts/updates/deletes on `author`, `book`, `member`, `loan` as per application operations (no explicit INSERT statements in this file). + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- `author`, `book`, `member`, `loan` tables referenced by foreign keys and indexes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/02_views.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/02_views.sql.ai.md new file mode 100644 index 00000000..750617d8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/02_views.sql.ai.md @@ -0,0 +1,63 @@ +### 02_views.sql +- H: 1.0 +- C: C0605265 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:18Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Provides reporting views for a library system: overdue loans, member loan statistics, and popular books. + +#### Purpose +- Expose aggregated loan data for reporting. +- Identify overdue loans and member activity. +- Highlight books frequently loaned in the past year. + +#### Type +- PostgreSQL views and materialized view. +- Index: `idx_popular_books_id` on `popular_books`. + +#### Schema +- **overdue_loans** + - `loan_id` integer + - `member_id` integer + - `email` text + - `title` text + - `due_on` date + - `days_overdue` integer + - Index: `idx_popular_books_id` (not on this view). + +- **member_loan_stats** + - `member_id` integer + - `full_name` text + - `loans_total` bigint + - `loans_open` bigint + - `last_loan_on` timestamp + +- **popular_books** (materialized) + - `book_id` integer + - `title` text + - `author_name` text + - `times_loaned` bigint + - Unique index: `idx_popular_books_id` on `book_id`. + +#### Reads +- `loan` (all columns referenced: `loan_id`, `member_id`, `book_id`, `due_on`, `returned_on`, `loaned_on`) +- `member` (`member_id`, `email`, `full_name`) +- `book` (`book_id`, `title`, `author_id`) +- `author` (`author_id`, `full_name`) + +#### Writes +- None (views and materialized view are read‑only). + +#### Relationships +- `loan.member_id -> member.member_id` +- `loan.book_id -> book.book_id` +- `book.author_id -> author.author_id` + +#### Dependencies +- Tables: `loan`, `member`, `book`, `author`. +- Functions: `CURRENT_DATE`, `INTERVAL`. +- Index: `idx_popular_books_id` on `popular_books`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md new file mode 100644 index 00000000..a304b6af --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/03_routines.sql.ai.md @@ -0,0 +1,69 @@ +### 03_routines.sql +- H: 1.0 +- C: 14E34698 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:20Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Handles book lending, returns, late fees, and audit logging for a library system. + +#### Purpose +- Implements checkout, return, and late fee logic. +- Records audit trail of loan actions. + +#### Type +- Table: `loan_audit` (PostgreSQL). +- Function: `fn_checkout_book` (plpgsql), `fn_late_fee` (sql), `trg_loan_audit_fn` (plpgsql). +- Procedure: `sp_return_book` (plpgsql). +- Trigger: `trg_loan_audit` (AFTER INSERT OR UPDATE OF returned_on ON loan). + +#### Schema +- **loan_audit** + - `audit_id BIGSERIAL PRIMARY KEY` + - `loan_id BIGINT NOT NULL` + - `action VARCHAR(10) NOT NULL CHECK (action IN ('CHECKOUT', 'RETURN'))` + - `changed_at TIMESTAMPTZ NOT NULL DEFAULT now()` + +#### Reads +- `member` (`member_id`, `is_blocked`) – check blocked status. +- `book` (`book_id`, `copies_free`) – verify free copy. +- `loan` (`loan_id`, `returned_on`, `book_id`) – update return status. +- `loan` (`loan_id`, `returned_on`) – trigger condition. +- `loan` (`loan_id`, `returned_on`) – trigger condition. + +#### Writes +- `book` – decrement `copies_free` on checkout; increment on return. +- `loan` – insert new loan record; update `returned_on` on return. +- `loan_audit` – insert audit rows on checkout and return. + +#### Relationships +- `loan.book_id` → `book.book_id` +- `loan.member_id` → `member.member_id` +- `loan_audit.loan_id` → `loan.loan_id` + +#### Routine logic +- **fn_checkout_book(p_member_id, p_book_id, p_days)** + - Raise if member blocked. + - Decrement `book.copies_free`; error if none. + - Insert into `loan` with `due_on = CURRENT_DATE + p_days`; return new `loan_id`. + +- **sp_return_book(p_loan_id)** + - Update `loan.returned_on = CURRENT_DATE` where not yet returned; capture `book_id`. + - Raise if loan unknown or already returned. + - Increment `book.copies_free`. + +- **fn_late_fee(p_due_on, p_returned_on)** + - Compute days overdue: `COALESCE(p_returned_on, CURRENT_DATE) - p_due_on`. + - Fee = `LEAST(GREATEST(days_overdue * 50, 0), 2000)`. + +- **trg_loan_audit_fn()** + - On INSERT: log `CHECKOUT`. + - On UPDATE where `returned_on` changes from NULL to NOT NULL: log `RETURN`. + +#### Dependencies +- Tables: `member`, `book`, `loan`, `loan_audit`. +- Functions: `fn_checkout_book`, `fn_late_fee`, `trg_loan_audit_fn`. +- Trigger: `trg_loan_audit`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md new file mode 100644 index 00000000..edc627de --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/04_migration_v2.sql.ai.md @@ -0,0 +1,66 @@ +### 04_migration_v2.sql +- H: 1.0 +- C: E2357141 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:25Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Adds library branches, creates a book_copy table to track individual copies per branch, and updates loan and member tables to reference copies and branches. + +#### Purpose +- Introduce branch management and per-copy tracking. +- Replace book-level copy counters with a dedicated book_copy table. +- Update member and loan schemas to reference branches and copies. + +#### Type +- Table: `branch` +- Table: `book_copy` +- Table: `loan` (ALTER) +- Table: `member` (ALTER) +- Index: `idx_book_copy_book` + +#### Schema +- **branch** + - `branch_id SMALLSERIAL PRIMARY KEY` + - `name VARCHAR(100) NOT NULL UNIQUE` + - `city VARCHAR(100) NOT NULL` +- **book_copy** + - `copy_id BIGSERIAL PRIMARY KEY` + - `book_id BIGINT NOT NULL REFERENCES book (book_id)` + - `branch_id SMALLINT NOT NULL REFERENCES branch (branch_id)` + - `barcode VARCHAR(32) NOT NULL UNIQUE` + - `status VARCHAR(12) NOT NULL DEFAULT 'AVAILABLE' CHECK (status IN ('AVAILABLE', 'ON_LOAN', 'LOST'))` +- **loan** + - `copy_id BIGINT REFERENCES book_copy (copy_id)` (new column) +- **member** + - `joined_on` renamed to `member_since` + - `home_branch_id SMALLINT REFERENCES branch (branch_id)` (new column) +- **Index** + - `idx_book_copy_book` on `book_copy (book_id)` + +#### Reads +- `book` (SELECT book_id, copies_total, copies_free, isbn) +- `branch` (INSERT default branch) +- `member` (UPDATE home_branch_id where NULL) + +#### Writes +- `branch`: 1 row (`Main`, `Springfield`) +- `book_copy`: 1 + 1 + … + 1 rows per existing copy (total = `b.copies_total` per book) +- `loan`: adds `copy_id` column (no data change) +- `member`: adds `home_branch_id` column and updates existing rows to 1 where NULL + +#### Relationships +- `book_copy.book_id -> book.book_id` +- `book_copy.branch_id -> branch.branch_id` +- `loan.copy_id -> book_copy.copy_id` +- `member.home_branch_id -> branch.branch_id` + +#### Dependencies +- `book` table (existing) +- `loan` table (existing) +- `member` table (existing) +- `book_copy` table (new) +- `branch` table (new) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md new file mode 100644 index 00000000..2e9f4f54 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/05_seed_data.sql.ai.md @@ -0,0 +1,63 @@ +### 05_seed_data.sql +- H: 1.0 +- C: E9A151DE +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:29Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Seed data for a library system: authors, books, members, and loan records. + +#### Purpose +- Populate the `author`, `book`, `member`, and `loan` tables with initial data for testing or demo purposes. + +#### Type +- SQL script (PostgreSQL dialect). +- Creates no new tables, types, or extensions. + +#### Schema +- **author** + - `author_id` integer PK + - `full_name` text NOT NULL + - `birth_year` integer + - `country_code` char(2) +- **book** + - `book_id` integer PK + - `isbn` text NOT NULL + - `title` text NOT NULL + - `author_id` integer FK → `author.author_id` + - `published_year` integer + - `copies_total` integer + - `copies_free` integer +- **member** + - `member_id` integer PK + - `email` text NOT NULL + - `full_name` text NOT NULL + - `joined_on` date + - `is_blocked` boolean +- **loan** + - `loan_id` integer PK + - `book_id` integer FK → `book.book_id` + - `member_id` integer FK → `member.member_id` + - `loaned_on` date + - `due_on` date + - `returned_on` date NULLABLE + +#### Reads +- None (only INSERT statements). + +#### Writes +- `author`: 15 rows +- `book`: 150 rows (ids 1‑150) +- `member`: 50 rows (ids 1‑50) +- `loan`: 150 rows (ids 1‑150) + +#### Relationships +- `book.author_id -> author.author_id` +- `loan.book_id -> book.book_id` +- `loan.member_id -> member.member_id` + +#### Dependencies +- Tables referenced: `author`, `book`, `member`, `loan`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/package.ai.md new file mode 100644 index 00000000..a06e164c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/library/package.ai.md @@ -0,0 +1,70 @@ +### sql/library +- H: 1.0 +- C: E07BF369 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:58:20Z +- G: +- A: 0.0.0 +- X: package +- F: [01_schema.sql](01_schema.sql.ai.md) +- F: [02_views.sql](02_views.sql.ai.md) +- F: [03_routines.sql](03_routines.sql.ai.md) +- F: [04_migration_v2.sql](04_migration_v2.sql.ai.md) +- F: [05_seed_data.sql](05_seed_data.sql.ai.md) +--- +> A PostgreSQL‑based library management system that defines catalog, lending, and reporting objects, and provides stored routines for checkout, return, and fee calculation. + +#### Purpose +- Persist library catalog, members, and loan data. +- Offer reporting views for overdue loans, member activity, and popular books. +- Encapsulate business logic for lending operations and audit logging. + +#### Responsibilities +- **Schema definition** – tables `author`, `book`, `member`, `loan`, plus migration tables `branch`, `book_copy`. +- **Reporting** – views `overdue_loans`, `member_loan_stats`, materialized view `popular_books`. +- **Business logic** – functions `fn_checkout_book`, `fn_late_fee`; procedure `sp_return_book`; audit table `loan_audit` and trigger `trg_loan_audit`. +- **Data seeding** – initial data for authors, books, members, and loans. + +#### Key units +- **Tables** + - `author` – author metadata. + - `book` – book catalog with copy counters. + - `member` – library patrons. + - `loan` – active and historical loan records. + - `branch` – library locations. + - `book_copy` – individual copy tracking per branch. + - `loan_audit` – audit trail of checkout/return actions. +- **Views** + - `overdue_loans` – list of loans past due. + - `member_loan_stats` – per‑member loan counts and last activity. + - `popular_books` – top‑loaned books in the past year. +- **Functions / Procedures** + - `fn_checkout_book(member_id, book_id, days)` – validates, decrements copy, inserts loan. + - `sp_return_book(loan_id)` – marks loan returned, increments copy. + - `fn_late_fee(due_on, returned_on)` – calculates fee up to a cap. + - `trg_loan_audit_fn()` – trigger function logging checkout/return events. + +#### Data flow +1. **Checkout** + - `fn_checkout_book` checks member status and book availability. + - Decrements `book.copies_free`. + - Inserts a new `loan` row with `due_on`. + - Trigger logs `CHECKOUT` in `loan_audit`. +2. **Return** + - `sp_return_book` sets `loan.returned_on`. + - Increments `book.copies_free`. + - Trigger logs `RETURN` in `loan_audit`. +3. **Reporting** + - Views join `loan`, `member`, `book`, `author` to expose aggregated data. + - `popular_books` materialized view aggregates loan counts per book. + +#### Dependencies +- **Internal** – tables `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`; views depend on these tables. +- **External** – PostgreSQL built‑in functions (`CURRENT_DATE`, `now()`, `INTERVAL`). +- **Migration** – `04_migration_v2.sql` adds `branch` and `book_copy`, altering `loan` and `member` to reference copies and branches. + +#### Cross-cutting +- **Integrity** – foreign keys, CHECK constraints, and unique indexes enforce data validity. +- **Audit** – `loan_audit` and trigger `trg_loan_audit` provide immutable action history. +- **Branch & Copy Tracking** – migration replaces aggregate copy counters with per‑copy status, enabling branch‑level inventory. +- **Seeding** – `05_seed_data.sql` populates all core tables for demo or test environments. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/package.ai.md new file mode 100644 index 00000000..8438114e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/package.ai.md @@ -0,0 +1,56 @@ +### sql +- H: 1.0 +- C: 69E20A85 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:58:30Z +- G: +- A: 0.0.0 +- X: package +- F: [library/](library/package.ai.md) +- F: [shop/](shop/package.ai.md) +- F: [warehouse/](warehouse/package.ai.md) +--- +> A collection of SQL packages that manage inventory, lending, and e‑commerce data across PostgreSQL, MySQL, and SQL Server, each providing schema, business logic, and audit capabilities for their domain. + +#### Purpose +- Persist and manipulate domain data (library catalog, shop orders, warehouse stock). +- Expose stored routines that enforce business rules and maintain consistency. +- Provide reporting and audit trails for operational insight. + +#### Responsibilities +- **Schema definition** – tables, views, and materialized views for catalog, orders, and inventory. +- **Business logic** – stored functions/procedures for checkout, return, order‑item addition, and nightly stock sync. +- **Reporting & audit** – views for overdue loans, member stats, popular books; audit tables and triggers for loan actions; sync logs for warehouse updates. +- **Data integrity** – foreign keys, constraints, row‑level locking, and transactional control. + +#### Key units +- **Library (PostgreSQL)** + - Tables: `author`, `book`, `member`, `loan`, `branch`, `book_copy`, `loan_audit`. + - Views: `overdue_loans`, `member_loan_stats`, `popular_books`. + - Functions/Procedures: `fn_checkout_book`, `sp_return_book`, `fn_late_fee`, `trg_loan_audit_fn`. +- **Shop (MySQL)** + - Tables: `product`, `customer_order`, `order_item`. + - Procedure: `add_order_item(p_order_id, p_sku, p_qty)`. +- **Warehouse (SQL Server)** + - Tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. + - Procedure: `dbo.usp_SyncStock`. + +#### Data flow +1. **Library checkout/return** + - `fn_checkout_book` validates, decrements `book.copies_free`, inserts `loan`, trigger logs `CHECKOUT`. + - `sp_return_book` updates `loan.returned_on`, increments `book.copies_free`, trigger logs `RETURN`. +2. **Shop order item addition** + - `add_order_item` locks `product`, checks stock, inserts/updates `order_item`, decrements `product.stock`, recalculates `customer_order.total_cents`. +3. **Warehouse sync** + - `usp_SyncStock` aggregates `SupplierFeed` since `@Since`, merges into `StockLevel`, logs run in `SyncLog`. + +#### Dependencies +- **Internal** – cross‑package tables and views referenced by stored routines. +- **External** – PostgreSQL built‑ins (`CURRENT_DATE`, `now()`), MySQL 8 features (`FOR UPDATE`, `ON DUPLICATE KEY`), SQL Server system functions (`SYSUTCDATETIME()`, `ERROR_MESSAGE()`). +- **Migration** – PostgreSQL migration scripts add `branch` and `book_copy`, altering loan/member relationships. + +#### Cross-cutting +- **Integrity** – foreign keys, CHECK constraints, unique indexes, and materialized view refreshes. +- **Audit** – `loan_audit` with trigger, `SyncLog` for warehouse runs. +- **Concurrency** – row‑level locking in MySQL, transactional MERGE in SQL Server, trigger‑based audit in PostgreSQL. +- **Seeding** – initial data scripts populate core tables for demo/testing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md new file mode 100644 index 00000000..42edae6f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/shop/orders_mysql.sql.ai.md @@ -0,0 +1,71 @@ +### orders_mysql.sql +- H: 1.0 +- C: CD8641B0 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:33Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> A MySQL schema for a web shop that stores products, customer orders, and order items, with a stored procedure to add items to an order while reserving stock and updating totals. + +#### Purpose +- Define tables for products, orders, and order items. +- Provide a procedure to add an item to an order, reserve stock, and recalculate the order total. + +#### Type +- Table: `product` +- Table: `customer_order` +- Table: `order_item` +- Procedure: `add_order_item` (MySQL 8) + +#### Schema +**product** +- `product_id INT UNSIGNED NOT NULL AUTO_INCREMENT` PK +- `sku VARCHAR(40) NOT NULL` UNIQUE `uk_product_sku` +- `name VARCHAR(200) NOT NULL` +- `price_cents INT UNSIGNED NOT NULL` +- `stock INT NOT NULL DEFAULT 0` + +**customer_order** +- `order_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT` PK +- `customer_id BIGINT UNSIGNED NOT NULL` +- `status ENUM('NEW','PAID','SHIPPED','CANCELLED') NOT NULL DEFAULT 'NEW'` +- `created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` +- `total_cents INT UNSIGNED NOT NULL DEFAULT 0` +- Index `idx_order_customer` on `(customer_id, created_at)` + +**order_item** +- `order_id BIGINT UNSIGNED NOT NULL` +- `product_id INT UNSIGNED NOT NULL` +- `quantity SMALLINT UNSIGNED NOT NULL` +- `unit_price_cents INT UNSIGNED NOT NULL` +- PK `(order_id, product_id)` +- FK `fk_item_order` references `customer_order(order_id)` ON DELETE CASCADE +- FK `fk_item_product` references `product(product_id)` + +#### Reads +- `product` (SELECT `product_id`, `price_cents` WHERE `sku` = `p_sku` AND `stock` >= `p_qty` FOR UPDATE) +- `order_item` (SELECT SUM(`quantity` * `unit_price_cents`) WHERE `order_id` = `p_order_id`) + +#### Writes +- `order_item` (INSERT or UPDATE via ON DUPLICATE KEY) – 1 row per call +- `product` (UPDATE `stock` – 1 row) +- `customer_order` (UPDATE `total_cents` – 1 row) + +#### Relationships +- `order_item.order_id` → `customer_order.order_id` (FK `fk_item_order`) +- `order_item.product_id` → `product.product_id` (FK `fk_item_product`) + +#### Routine logic +- Input: `p_order_id`, `p_sku`, `p_qty` +- Lookup product ID and price where SKU matches and stock sufficient (FOR UPDATE). +- If not found, raise error `'unknown SKU or not enough stock'`. +- Insert or update `order_item` with quantity and unit price; if duplicate, increment quantity. +- Decrement `product.stock` by `p_qty`. +- Recalculate `customer_order.total_cents` as sum of `quantity * unit_price_cents` for that order. + +#### Dependencies +- Tables: `product`, `customer_order`, `order_item` +- No external functions or sequences. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/shop/package.ai.md new file mode 100644 index 00000000..9c1e9799 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/shop/package.ai.md @@ -0,0 +1,43 @@ +### sql/shop +- H: 1.0 +- C: F029BDD3 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:58:24Z +- G: +- A: 0.0.0 +- X: package +- F: [orders_mysql.sql](orders_mysql.sql.ai.md) +--- +> A MySQL schema and stored procedure that model a web shop’s product catalog, customer orders, and order items, ensuring stock reservation and order total consistency. + +#### Purpose +- Persist product, order, and order‑item data for an e‑commerce platform. +- Provide a single atomic operation to add an item to an order while updating inventory and totals. + +#### Responsibilities +- **Data Modeling** – Define relational tables for products, orders, and items with appropriate keys, indexes, and constraints. +- **Business Logic** – Encapsulate order‑item addition, stock reservation, and total recalculation in a stored procedure. +- **Integrity Enforcement** – Use foreign keys, unique constraints, and transactional locking to maintain consistency. + +#### Key units +- **Table `product`** – Stores SKU, name, price, and stock; PK `product_id`, unique `sku`. +- **Table `customer_order`** – Records order metadata, status, timestamps, and running total; PK `order_id`. +- **Table `order_item`** – Links orders to products, tracks quantity and unit price; composite PK `(order_id, product_id)`. +- **Procedure `add_order_item(p_order_id, p_sku, p_qty)`** – Looks up product, reserves stock, inserts/updates `order_item`, and updates `customer_order.total_cents`. + +#### Data flow +1. Caller invokes `add_order_item` with order ID, SKU, and quantity. +2. Procedure locks the matching `product` row (`FOR UPDATE`) to check stock. +3. If stock is sufficient, inserts or updates the corresponding `order_item` row. +4. Decrements `product.stock` by the ordered quantity. +5. Recalculates the order total by summing all `order_item` rows for the order and updates `customer_order.total_cents`. +6. Transaction commits, ensuring all changes are atomic. + +#### Dependencies +- **Internal** – Tables `product`, `customer_order`, `order_item`; foreign key relationships enforce referential integrity. +- **External** – None; relies solely on MySQL 8 features (ENUM, `FOR UPDATE`, `ON DUPLICATE KEY`). + +#### Cross-cutting +- **Concurrency Control** – Uses row‑level locking (`FOR UPDATE`) to prevent race conditions on stock and totals. +- **Error Handling** – Procedure raises a clear error when SKU is unknown or stock is insufficient. +- **Indexing** – `idx_order_customer` on `customer_order` for efficient customer‑order queries; unique SKU index on `product`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/warehouse/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/warehouse/package.ai.md new file mode 100644 index 00000000..789fdb1d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/warehouse/package.ai.md @@ -0,0 +1,45 @@ +### sql/warehouse +- H: 1.0 +- C: 1013CFD7 +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:58:27Z +- G: +- A: 0.0.0 +- X: package +- F: [stock_sync_tsql.sql](stock_sync_tsql.sql.ai.md) +--- +> Keeps warehouse inventory in sync with nightly supplier feeds and records each sync run. + +#### Purpose +- Aggregate supplier feed quantities into the warehouse inventory. +- Persist a log of each sync operation. + +#### Responsibilities +- **Data ingestion** – read `dbo.SupplierFeed` rows since a given timestamp. +- **Inventory update** – merge aggregated quantities into `dbo.StockLevel`. +- **Audit trail** – record run metadata and errors in `dbo.SyncLog`. + +#### Key units +- **`dbo.StockLevel`** – inventory table keyed by `WarehouseId, Sku`; holds `OnHand` and `UpdatedAt`. +- **`dbo.SupplierFeed`** – raw feed rows with `WarehouseId, Sku, Quantity, ReceivedAt`. +- **`dbo.SyncLog`** – log table capturing `StartedAt`, `RowsInserted`, `RowsUpdated`, `ErrorMessage`. +- **`dbo.usp_SyncStock`** – T‑SQL stored procedure that performs the nightly sync. + +#### Data flow +1. Caller supplies `@Since` (last sync timestamp). +2. Procedure aggregates `SupplierFeed` rows (`WarehouseId, Sku, SUM(Quantity)`) received after `@Since`. +3. `MERGE` into `StockLevel`: + - **Matched**: increment `OnHand`, update `UpdatedAt`. + - **Unmatched**: insert new row. +4. Capture counts of inserts/updates. +5. Insert a single row into `SyncLog` with the counts and any error message. +6. Commit or rollback transaction. + +#### Dependencies +- Internal tables: `dbo.StockLevel`, `dbo.SupplierFeed`, `dbo.SyncLog`. +- SQL Server system functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. + +#### Cross-cutting +- Uses a single transaction per sync run. +- Error handling: rollback on failure, log error message, rethrow exception. +- No foreign keys; logical joins on `WarehouseId, Sku`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md new file mode 100644 index 00000000..0bb0c927 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/benchmark/run6/out/gpt-oss-20b/sql/warehouse/stock_sync_tsql.sql.ai.md @@ -0,0 +1,77 @@ +### stock_sync_tsql.sql +- H: 1.0 +- C: 197358EF +- D: 2026-10-29T10:08:51Z +- T: 2026-11-04T12:57:37Z +- G: +- A: 0.0.0 +- X: file +- P: 6E189EB5 +--- +> Synchronises nightly stock levels from a supplier feed into the warehouse inventory and records the operation outcome. + +#### Purpose +- Updates `dbo.StockLevel` with aggregated supplier feed quantities. +- Logs each sync run in `dbo.SyncLog`. + +#### Type +- **Table**: `dbo.StockLevel` (PostgreSQL dialect inferred from T‑SQL syntax, but actual target is SQL Server). +- **Table**: `dbo.SupplierFeed`. +- **Table**: `dbo.SyncLog`. +- **Procedure**: `dbo.usp_SyncStock` (T‑SQL). + +#### Schema +- **dbo.StockLevel** + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `OnHand INT NOT NULL DEFAULT (0)` + - `UpdatedAt DATETIME2(0) NOT NULL DEFAULT (SYSUTCDATETIME())` + - **PK**: `PK_StockLevel (WarehouseId, Sku)` + +- **dbo.SupplierFeed** + - `FeedRowId BIGINT IDENTITY(1,1) NOT NULL` + - `WarehouseId INT NOT NULL` + - `Sku NVARCHAR(40) NOT NULL` + - `Quantity INT NOT NULL` + - `ReceivedAt DATETIME2(0) NOT NULL` + - **PK**: `PK_SupplierFeed (FeedRowId)` + +- **dbo.SyncLog** + - `SyncLogId INT IDENTITY(1,1) NOT NULL` + - `StartedAt DATETIME2(0) NOT NULL` + - `RowsInserted INT NOT NULL` + - `RowsUpdated INT NOT NULL` + - `ErrorMessage NVARCHAR(4000) NULL` + - **PK**: `PK_SyncLog (SyncLogId)` + +#### Reads +- `dbo.SupplierFeed` (columns: `WarehouseId`, `Sku`, `Quantity`, `ReceivedAt`). +- `dbo.StockLevel` (columns: `WarehouseId`, `Sku`, `OnHand`). + +#### Writes +- `dbo.StockLevel` + - `UPDATE` on matched rows: increments `OnHand`, updates `UpdatedAt`. + - `INSERT` on non‑matched rows: inserts `WarehouseId`, `Sku`, `OnHand`. +- `dbo.SyncLog` + - `INSERT` once per sync: `StartedAt`, `RowsInserted`, `RowsUpdated` (or `ErrorMessage` on failure). + +#### Relationships +- None defined via foreign keys; logical join: `dbo.StockLevel.WarehouseId, Sku` ↔ `dbo.SupplierFeed.WarehouseId, Sku`. + +#### Routine logic +- Parameters: `@Since DATETIME2(0)`. +- Steps: + 1. Capture start time `@Started`. + 2. Aggregate `SupplierFeed` rows received since `@Since` by `WarehouseId, Sku`. + 3. `MERGE` into `StockLevel`: + - `WHEN MATCHED`: `OnHand += Quantity`, `UpdatedAt = SYSUTCDATETIME()`. + - `WHEN NOT MATCHED BY TARGET`: `INSERT (WarehouseId, Sku, OnHand)`. + 4. Capture merge actions in table variable `@Changes`. + 5. Insert a log row into `SyncLog` with counts of inserts and updates. + 6. Commit transaction; on error rollback, log error, rethrow. + +#### Dependencies +- `dbo.StockLevel` +- `dbo.SupplierFeed` +- `dbo.SyncLog` +- System functions: `SYSUTCDATETIME()`, `ERROR_MESSAGE()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/meta/gpt-6-luna.json new file mode 100644 index 00000000..2d78f93a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/meta/gpt-6-luna.json @@ -0,0 +1,108 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "avro-facts.tsv": "e6583308a5fcb3d9faedb51121dce0aff932776a05d8c948a0c8430172f9aa31", + "bpmn-facts.tsv": "c8866122184147e94cb14970a4f6e02dcf9e147ebb4b809885273aef8c4f0a31", + "compose-facts.tsv": "2d193b8ea01e46c1d184b7014e23daa07da545c2f756c07d8f6e0473cd86229a", + "dmn-facts.tsv": "825a542139ca18f05785b950d48eb810e4b1ed1b4ffc1d6b8f22cb3b2aed4f90", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "gradle-facts.tsv": "72890901e1506738b2578cdc11d7ca294ba4c663e4b36ca1b23c5c1f7112d6ad", + "graphql-facts.tsv": "98e82ef81dae468917392d60b0c60b8dd62037dedea84960af2ecaa6664b40c1", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "700ac765c97b6fb49a18f21691ad0b16de43ffc126073c2498d38512331d6ed6", + "java-facts.tsv": "368639880755328cc631124f71567c5fc7ac483fcb4ec887512e63cb3c272b61", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "properties-facts.tsv": "a7c7c2313792923e1f4fa576b2caa191377d5049455b0259a91122edbec4562c", + "proto-facts.tsv": "0d163bfbd7752fb9f736ed1ea4d7874ba1c58c1b182e6f5f9be3cafd3ba13e62", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "scala-facts.tsv": "019420f060147ac67c90c8d0690889021b20426f50ff148bcc025e1b3cc89fdf", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "terraform-facts.tsv": "a5fa06308874b12d69fff284ab0ea3e3868b151cb4d82fd7a82d83b46b2de6e3", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:22:05Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 111.6, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 106.3, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.6, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:25:46Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 28242, + "cachedPromptTokens": 16217, + "completionTokens": 10013, + "seconds": 110.9791124 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.006371, + "costUsd": 0.013093, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/meta/gpt-oss-20b.json new file mode 100644 index 00000000..e9935e0f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/meta/gpt-oss-20b.json @@ -0,0 +1,108 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "avro-facts.tsv": "e6583308a5fcb3d9faedb51121dce0aff932776a05d8c948a0c8430172f9aa31", + "bpmn-facts.tsv": "c8866122184147e94cb14970a4f6e02dcf9e147ebb4b809885273aef8c4f0a31", + "compose-facts.tsv": "2d193b8ea01e46c1d184b7014e23daa07da545c2f756c07d8f6e0473cd86229a", + "dmn-facts.tsv": "825a542139ca18f05785b950d48eb810e4b1ed1b4ffc1d6b8f22cb3b2aed4f90", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "gradle-facts.tsv": "72890901e1506738b2578cdc11d7ca294ba4c663e4b36ca1b23c5c1f7112d6ad", + "graphql-facts.tsv": "98e82ef81dae468917392d60b0c60b8dd62037dedea84960af2ecaa6664b40c1", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "700ac765c97b6fb49a18f21691ad0b16de43ffc126073c2498d38512331d6ed6", + "java-facts.tsv": "368639880755328cc631124f71567c5fc7ac483fcb4ec887512e63cb3c272b61", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "properties-facts.tsv": "a7c7c2313792923e1f4fa576b2caa191377d5049455b0259a91122edbec4562c", + "proto-facts.tsv": "0d163bfbd7752fb9f736ed1ea4d7874ba1c58c1b182e6f5f9be3cafd3ba13e62", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "scala-facts.tsv": "019420f060147ac67c90c8d0690889021b20426f50ff148bcc025e1b3cc89fdf", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "terraform-facts.tsv": "a5fa06308874b12d69fff284ab0ea3e3868b151cb4d82fd7a82d83b46b2de6e3", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:25:46Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 64.4, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 93.4, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.3, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:28:26Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 29312, + "cachedPromptTokens": 1872, + "completionTokens": 8724, + "seconds": 63.7502455 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.002013, + "costUsd": 0.005376, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..0343b090 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,37 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:24:03Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> Backoffice order operations provide access to open orders, cancellation with payment refunds and audit tracking, and scheduled cleanup of aged cancelled records. + +#### Purpose +- Support authorized backoffice order listing, lookup, and cancellation. +- Purge cancelled orders older than 30 days and audit the cleanup. + +#### Responsibilities +- **Order access:** list open orders and retrieve orders by ID, returning 404 when absent. +- **Cancellation:** refund payment, mark the order cancelled, and record an audit event. +- **Scheduled cleanup:** delete aged cancelled orders and audit the removal count. + +#### Key units +- `OrderResource` — `/orders` JAX-RS resource and stateless EJB for backoffice order operations. +- `PURGE_AFTER_DAYS` — 30-day threshold for cancelled-order cleanup. + +#### Data flow +- `openOrders()` queries `Order.open`; `find(id)` retrieves an `Order` through `EntityManager`. +- `cancel(id)` retrieves the order, refunds through `PaymentGateway`, sets `OrderStatus.CANCELLED`, and records `order.cancelled`. +- Daily `purgeCancelled()` runs `Order.purgeCancelled` with the age threshold and records `order.purged` with the deletion count. + +#### Dependencies +- Project types: `Order`, `OrderStatus`, `PaymentGateway`, and `AuditLog`; persistence unit `shop`. +- Jakarta EE APIs for JAX-RS, EJB scheduling and transactions, security, dependency injection, and JPA. + +#### Cross-cutting +- Access is restricted to the `backoffice` and `admin` roles. +- Cancellation uses a required transaction; cleanup runs on a non-persistent daily schedule at 02:15. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..06a49b15 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/java/shop/OrderResource.java.ai.md @@ -0,0 +1,62 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:22:06Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 37CE394E +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Backoffice users can list and retrieve orders, cancel orders with payment refunds, and purge old cancelled orders. + +#### Purpose +- `OrderResource` exposes order lookup and cancellation operations for the backoffice. +- A nightly job deletes cancelled orders older than 30 days and records the purge. + +#### Type +- `public class OrderResource` — class; `@Stateless`, `@Path("/orders")`, `@Produces(MediaType.APPLICATION_JSON)`, `@RolesAllowed({"backoffice", "admin"})`; no declared supertypes. +- `PURGE_AFTER_DAYS` — package-private `static final int`, value `30`. + +#### Input +- `find(long id)` and `cancel(long id)` receive the order ID from the `{id}` path parameter. +- Injected `EntityManager em` uses persistence unit `"shop"`; `PaymentGateway payments` and `AuditLog audit` are injected dependencies. +- `purgeCancelled()` uses `PURGE_AFTER_DAYS` as the `"days"` query parameter. + +#### Output +- `openOrders()` returns the result list of `Order.open`. +- `find(long id)` returns HTTP 404 when no order exists; otherwise returns the order with HTTP 200. +- `cancel(long id)` returns HTTP 404 when no order exists; otherwise refunds payment, updates order status, records an audit event, and returns HTTP 204. +- `purgeCancelled()` executes the purge query and records the number removed. + +#### Core logic +- `openOrders()` calls `em.createNamedQuery("Order.open", Order.class).getResultList()`. +- `find(long id)` calls `em.find(Order.class, id)`; builds `Response.status(Response.Status.NOT_FOUND).build()` for a missing order, otherwise `Response.ok(order).build()`. +- `cancel(long id)`: + - Calls `em.find(Order.class, id)`; returns 404 if missing. + - Calls `payments.refund(order.getPaymentReference(), order.getTotal())`. + - Sets `order.setStatus(OrderStatus.CANCELLED)`. + - Calls `audit.record("order.cancelled", id)`. + - Returns `Response.noContent().build()`. +- `purgeCancelled()` runs `em.createNamedQuery("Order.purgeCancelled").setParameter("days", PURGE_AFTER_DAYS).executeUpdate()` and calls `audit.record("order.purged", removed)`. + +#### Public API +- `openOrders()` -> `List` — list open orders. +- `find(long id)` -> `Response` — retrieve an order. +- `cancel(long id)` -> `Response` — refund and cancel an order. + +#### Dependencies +- Jakarta APIs: `RolesAllowed`, `EJB`, `Schedule`, `Stateless`, `TransactionAttribute`, `TransactionAttributeType`, `Inject`, `EntityManager`, `PersistenceContext`, `GET`, `POST`, `Path`, `PathParam`, `Produces`, `MediaType`, `Response`. +- Java: `List`. +- Project types: `Order`, `OrderStatus`, `PaymentGateway`, `AuditLog`. + +#### Exceptions / Errors +- Missing order IDs produce HTTP 404 responses in `find` and `cancel`. +- No exceptions are explicitly caught or thrown. + +#### Concurrency +- `@Stateless` EJB; `cancel` uses `@TransactionAttribute(TransactionAttributeType.REQUIRED)`. +- `purgeCancelled()` is scheduled daily at 02:15 with `persistent = false`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/java/shop/package.ai.md new file mode 100644 index 00000000..9126c8ac --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/java/shop/package.ai.md @@ -0,0 +1,38 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:23:57Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Backoffice order operations support querying open orders, retrieving and refunding cancellations, and purging aged cancelled records. + +#### Purpose +- Provide authorized backoffice access to order listing, lookup, and cancellation. +- Automatically remove cancelled orders older than 30 days and audit the purge. + +#### Responsibilities +- **Order access:** list open orders and retrieve an order by ID, returning 404 when absent. +- **Cancellation:** refund the order payment, mark the order cancelled, and record an audit event. +- **Scheduled cleanup:** purge cancelled orders older than 30 days and audit the number removed. + +#### Key units +- `OrderResource` — `/orders` JSON JAX-RS resource and stateless EJB for backoffice order operations. +- `PURGE_AFTER_DAYS` — 30-day age threshold used by the cleanup query. + +#### Data flow +- `openOrders()` retrieves results from the `Order.open` named query. +- `find(id)` looks up an `Order` through `EntityManager`, returning either 404 or the order. +- `cancel(id)` looks up the order; if found, refunds via `PaymentGateway`, sets `OrderStatus.CANCELLED`, records `order.cancelled`, and returns 204. +- `purgeCancelled()` runs `Order.purgeCancelled` with the 30-day threshold and records `order.purged` with the removal count. + +#### Dependencies +- Jakarta EE APIs for JAX-RS, EJB scheduling and transactions, security, dependency injection, and JPA. +- Project types: `Order`, `OrderStatus`, `PaymentGateway`, and `AuditLog`; persistence unit `shop`. + +#### Cross-cutting +- Resource access is restricted to `backoffice` and `admin` roles. +- `cancel` uses a required transaction; the stateless EJB runs a non-persistent daily schedule at 02:15 for cleanup. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/.github/package.ai.md new file mode 100644 index 00000000..8e329af9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/.github/package.ai.md @@ -0,0 +1,35 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:24:11Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Releases the orders backoffice application by verifying versioned builds, publishing container images, and deploying them to production. + +#### Purpose +- Automates the tagged or manually triggered release path from Maven verification to production deployment. + +#### Responsibilities +- **Build and test:** Verifies the application with Maven’s `ci` profile on Java 21 and 25. +- **Publish and deploy:** Pushes a version-tagged image to `registry.shop.example` and invokes the Kubernetes deployment workflow for production. + +#### Key units +- `release-backoffice` — GitHub Actions workflow triggered by `v*` tags or manual dispatch. +- `build`, `image`, `deploy` — Sequential jobs for verification, container publishing, and deployment through `./.github/workflows/deploy-k8s.yml`. + +#### Data flow +- Workflow trigger starts the Java matrix build; after verification, the image job publishes `registry.shop.example/orders-backoffice` with the leading `v` removed from the tag. +- The deploy job runs after publication, targets `production`, and inherits secrets. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Maven, the `ci` profile, and registry credentials `REGISTRY_USER` and `REGISTRY_TOKEN`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Jobs use `ubuntu-24.04`; the image job uses the `production` environment. +- Workflow permissions are limited to `contents: read` and `packages: write`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..99148dbd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,41 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:24:06Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Automates release of the orders backoffice application from version-tagged builds through container publishing and production deployment. + +#### Purpose +- Builds and verifies the application across Java 21 and 25, publishes a version-tagged container image, and deploys it to production. + +#### Responsibilities +- **Build and test:** Runs `mvn -B verify -Pci` on an `ubuntu-24.04` matrix for Java 21 and 25. +- **Publish image:** Logs in to `registry.shop.example` and pushes `registry.shop.example/orders-backoffice` with the version tag derived from the Git reference. +- **Deploy:** Calls the Kubernetes deployment workflow for the `production` environment after image publication. + +#### Key units +- `release-backoffice` — GitHub Actions workflow triggered by `v*` tag pushes or manual dispatch. +- `build` — Matrix build and verification job. +- `image` — Production-environment job that builds and pushes the container image. +- `deploy` — Reusable-workflow job invoking `./.github/workflows/deploy-k8s.yml`. + +#### Data flow +- A version-tag push or manual dispatch starts the workflow. +- The Java matrix build and verification must complete before the image job runs. +- The image job publishes the application image with the leading `v` removed from the Git reference name. +- The deploy job runs after publication, passes `environment: production`, and inherits secrets. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Maven with the `ci` profile. +- Registry credentials from `REGISTRY_USER` and `REGISTRY_TOKEN`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Workflow permissions are limited to `contents: read` and `packages: write`. +- Build and image jobs run on `ubuntu-24.04`; the image job uses the `production` environment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..2110d8c4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,62 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:22:13Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds and tests the orders backoffice application, publishes its container image, then deploys it to production. + +#### Purpose +- Release workflow for the orders backoffice application. +- Builds and tests on Java 21 and 25, pushes a version-tagged image, and invokes the production Kubernetes deployment workflow. + +#### Type +- GitHub Actions workflow; no API version declared. + +#### Definitions +- Workflow `release-backoffice` +- Triggers: + - `push` tags matching `v*` + - `workflow_dispatch` +- Workflow permissions: `contents: read`, `packages: write` +- Job `build`: + - Runner: `ubuntu-24.04` + - Matrix: `java: [21, 25]` + - Steps, in order: + 1. `actions/checkout@v4` + 2. `actions/setup-java@v4` with `distribution: temurin`, `java-version: ${{ matrix.java }}` + 3. `Build and test`: `mvn -B verify -Pci` +- Job `image`: + - Needs: `build` + - Runner: `ubuntu-24.04` + - Environment: `production` + - Steps, in order: + 1. `actions/checkout@v4` + 2. `Log in to the registry`: `docker/login-action@v3` + 3. `Push the image`: builds and pushes `registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v}` +- Job `deploy`: + - Needs: `image` + - Reusable workflow: `./.github/workflows/deploy-k8s.yml` + - Input: `environment: production` + - Secrets: `inherit` + +#### Configuration +- `registry`: `registry.shop.example` +- `username`: `${{ secrets.REGISTRY_USER }}` +- `password`: `${{ secrets.REGISTRY_TOKEN }}` +- Image tag expression: `${GITHUB_REF_NAME#v}` +- `environment`: `production` +- `java`: matrix values `21`, `25` + +#### Dependencies +- Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3` +- Reusable workflow: `./.github/workflows/deploy-k8s.yml` +- Registry and image: `registry.shop.example/orders-backoffice` +- Build tool: Maven; command uses profile `ci` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/package.ai.md new file mode 100644 index 00000000..73ec633f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/actions/package.ai.md @@ -0,0 +1,35 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:24:15Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Verifies, publishes, and deploys versioned orders backoffice releases to production. + +#### Purpose +- Automates the release path from Maven verification through container publication and production deployment. + +#### Responsibilities +- **Build verification:** Runs the Maven `ci` profile on Java 21 and 25. +- **Image publishing and deployment:** Publishes a versioned container image and invokes the Kubernetes deployment workflow. + +#### Key units +- `release-backoffice` — GitHub Actions workflow triggered by `v*` tags or manual dispatch. +- `build`, `image`, `deploy` — Sequential jobs for verification, image publishing, and production deployment. + +#### Data flow +- A release trigger starts the Java matrix build; on success, the image job publishes `registry.shop.example/orders-backoffice` using the tag without its leading `v`. +- The deploy job runs after publication, targets `production`, and inherits secrets. + +#### Dependencies +- Maven with the `ci` profile; registry credentials `REGISTRY_USER` and `REGISTRY_TOKEN`. +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, and `docker/login-action@v3`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Jobs run on `ubuntu-24.04`; the image job uses the `production` environment. +- Workflow permissions are limited to `contents: read` and `packages: write`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..910b1cc1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,45 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:22:23Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 8D64B542 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1 + +> Defines an executable order-fulfilment process that reserves stock, waits for payment, routes large orders for approval, ships orders, and creates invoices, with an out-of-stock cancellation path. + +#### Purpose +- Orchestrates order fulfilment from order placement through completion or stock-related cancellation. +- Integrates payment messages, a stock-reservation delegate, an external shipping worker, and an invoicing process. + +#### Type +- BPMN process definition; root `definitions`. +- Target namespace: `http://shop.example/bpmn`. +- Declared namespaces: `bpmn` — `http://www.omg.org/spec/BPMN/20100524/MODEL`; `bpmndi` — `http://www.omg.org/spec/BPMN/20100524/DI`; `dc` — `http://www.omg.org/spec/DD/20100524/DC`; `camunda` — `http://camunda.org/schema/1.0/bpmn`. + +#### Definitions +- Process `orderFulfilment` (`Order fulfilment`), executable. +- Message `msgPaymentReceived` (`PaymentReceived`); error `errOutOfStock` (`OutOfStock`), code `STOCK_EMPTY`. +- Events: start `orderPlaced` (`Order placed`); message catch event `waitForPayment` (`Wait for payment`) referencing `msgPaymentReceived`; boundary error event `stockMissing` attached to `reserveStock`, referencing `errOutOfStock`; end events `orderCompleted` (`Order completed`) and `orderCancelled` (`Order cancelled`). +- Tasks: service task `reserveStock` (`Reserve stock`), class `shop.bpm.ReserveStockDelegate`; user task `approveOrder` (`Approve large order`), candidate group `backoffice`; external service task `shipOrder` (`Ship order`), topic `shipping`; call activity `createInvoice` (`Create invoice`), called element `invoicing`. +- Exclusive gateway `amountCheck` (`Large order?`): flow `large` to `approveOrder` when `${order.total > 1000}`; flow `small` to `shipOrder` when `${order.total <= 1000}`. +- Sequence flows: `toReserve` (`orderPlaced` → `reserveStock`); `toWaitPayment` (`reserveStock` → `waitForPayment`); `toAmountCheck` (`waitForPayment` → `amountCheck`); `large` and `small` (gateway branches); `approvedToShip` (`approveOrder` → `shipOrder`); `toInvoice` (`shipOrder` → `createInvoice`); `toEnd` (`createInvoice` → `orderCompleted`); `toCancelled` (`stockMissing` → `orderCancelled`). + +#### Configuration +- `isExecutable="true"`. +- `reserveStock`: `camunda:class="shop.bpm.ReserveStockDelegate"`. +- `approveOrder`: `camunda:candidateGroups="backoffice"`. +- `shipOrder`: `camunda:type="external"`; `camunda:topic="shipping"`. +- Gateway conditions: `${order.total > 1000}` and `${order.total <= 1000}`. + +#### Dependencies +- Delegate class: `shop.bpm.ReserveStockDelegate`. +- Called process element: `invoicing`. +- External worker topic: `shipping`. +- Incoming message: `PaymentReceived` (`msgPaymentReceived`); boundary error: `OutOfStock` (`errOutOfStock`, code `STOCK_EMPTY`). +- Gateway expressions reference `order.total`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/bpmn/package.ai.md new file mode 100644 index 00000000..84c6154d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/bpmn/package.ai.md @@ -0,0 +1,45 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:24:18Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> Coordinates order fulfilment from stock reservation and payment through approval, shipping, invoicing, or out-of-stock cancellation. + +#### Purpose +- Defines the executable `orderFulfilment` process for completing orders or cancelling them when stock is unavailable. +- Connects payment receipt, stock reservation, large-order approval, external shipping, and invoice creation. + +#### Responsibilities +- **Order and stock handling:** Start on `orderPlaced`, reserve stock via a Java delegate, and cancel on the `OutOfStock` boundary error. +- **Payment and routing:** Wait for `PaymentReceived`, then route orders by `order.total`; large orders require back-office approval. +- **Fulfilment completion:** Ship orders using the `shipping` external task topic and invoke the `invoicing` process. + +#### Key units +- `orderFulfilment` — executable BPMN process coordinating the order lifecycle. +- `reserveStock` — service task bound to `shop.bpm.ReserveStockDelegate`. +- `waitForPayment` — message catch event for `PaymentReceived`. +- `amountCheck` — exclusive gateway routing orders above or at/below `1000`. +- `approveOrder` — user task assigned to candidate group `backoffice`. +- `shipOrder` — external service task using topic `shipping`. +- `createInvoice` — call activity invoking process element `invoicing`. +- `stockMissing` — boundary error event for `OutOfStock` (`STOCK_EMPTY`), leading to `orderCancelled`. + +#### Data flow +- `orderPlaced` → `reserveStock` → `waitForPayment` → `amountCheck`. +- Orders with `order.total > 1000` pass through `approveOrder`; orders with `order.total <= 1000` proceed directly to `shipOrder`. +- Shipping → `createInvoice` → `orderCompleted`; a stock error at `reserveStock` leads to `orderCancelled`. + +#### Dependencies +- `shop.bpm.ReserveStockDelegate` for stock reservation. +- `PaymentReceived` message and `OutOfStock` error definitions. +- External worker subscribed to the `shipping` topic. +- Called process element `invoicing`. + +#### Cross-cutting +- BPMN definitions use the `http://shop.example/bpmn` target namespace and Camunda extensions for delegate, candidate group, and external-task configuration. +- Gateway routing is expressed using `${order.total > 1000}` and `${order.total <= 1000}` conditions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..c56effa0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/docker/Dockerfile.ai.md @@ -0,0 +1,39 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:22:31Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds the Orders Backoffice Java application and packages it as a production-oriented container serving on port 8080. + +#### Purpose +- Compiles `orders-backoffice.jar` in a Maven build stage and runs it in a Java 21 JRE container. + +#### Type +- Dockerfile; Maven 3.9 with Eclipse Temurin 21 for build, Eclipse Temurin 21 JRE Alpine for runtime. + +#### Definitions +- `build` stage: based on `maven:3.9-eclipse-temurin-21`; works in `/src`; copies `pom.xml` and `src`; runs `mvn -B dependency:go-offline` and `mvn -B package -DskipTests`. +- Runtime stage: based on `eclipse-temurin:21-jre-alpine`; copies `/src/target/orders-backoffice.jar` to `/opt/shop/orders-backoffice.jar`. +- Creates group `shop` and user `backoffice`; runs as `backoffice`. +- Exposes port `8080`; healthcheck runs `wget -qO- http://localhost:8080/health/live || exit 1` every 30 seconds. +- Entrypoint: `sh -c "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"`. + +#### Configuration +- `APP_VERSION=2.1.0` build argument. +- `JAVA_OPTS="-XX:MaxRAMPercentage=75"`. +- `SHOP_PROFILE=production`. +- `WORKDIR=/src`. + +#### Dependencies +- Build image: `maven:3.9-eclipse-temurin-21`. +- Runtime image: `eclipse-temurin:21-jre-alpine`. +- Build inputs: `pom.xml`, `src`. +- Runtime artifact: `/src/target/orders-backoffice.jar`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/docker/package.ai.md new file mode 100644 index 00000000..861a2125 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/docker/package.ai.md @@ -0,0 +1,34 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:24:24Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> Packages the Orders Backoffice Java application as a production container that serves on port 8080. + +#### Purpose +- Builds `orders-backoffice.jar` and runs it in a Java 21 JRE container. +- Provides a non-root runtime with a liveness health check. + +#### Responsibilities +- Build: resolves Maven dependencies and packages the application with tests skipped. +- Runtime: copies the JAR into the image and launches it with configurable JVM options. + +#### Key units +- `Dockerfile`: defines the Maven build stage and production runtime stage. + +#### Data flow +- `pom.xml` and `src` → Maven package build → `/src/target/orders-backoffice.jar` → `/opt/shop/orders-backoffice.jar` → Java process. + +#### Dependencies +- Build image: `maven:3.9-eclipse-temurin-21`; runtime image: `eclipse-temurin:21-jre-alpine`. +- Build inputs: `pom.xml`, `src`. + +#### Cross-cutting +- Runtime configuration: `APP_VERSION=2.1.0`, `JAVA_OPTS="-XX:MaxRAMPercentage=75"`, and `SHOP_PROFILE=production`. +- Runs as the `backoffice` user in the `shop` group; exposes port `8080`. +- Health check probes `/health/live` every 30 seconds. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..84a087c0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,45 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:22:40Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> The checkout page collects a delivery address and shipping method, updates the euro total, and submits the order. + +#### Purpose +- Lets the customer enter checkout details and place an order. + +#### Type +- Jakarta Faces Facelets page; XHTML. +- `h` = Jakarta Faces HTML; `f` = Jakarta Faces core; `ui` = Jakarta Faces Facelets. + +#### Data +- `checkoutBean.address.street` — street input. +- `checkoutBean.address.zip` — ZIP input. +- `checkoutBean.shippingMethod` — selected shipping method. +- `checkoutBean.shippingMethods` — options for the shipping selector. +- `checkoutBean.total` — displayed order total. + +#### Actions +- Form `checkoutForm` — submits checkout fields using the default Faces form method. +- `checkoutBean.recalculate` — AJAX listener when `shipping` changes; renders `total`. +- `checkoutBean.placeOrder` — command button action for “Place order”. +- `zip` — regex validator `[0-9]{5}`. +- `total` — number converter formatted as currency with currency code `EUR`. + +#### Structure +- Uses `/WEB-INF/templates/shop.xhtml`; defines `content`. +- Includes `/WEB-INF/includes/payment-hints.xhtml`. +- An HTML comment contains a commented-out “Save cart” command for `checkoutBean.saveCart`. + +#### Dependencies +- `/WEB-INF/templates/shop.xhtml` +- `/WEB-INF/includes/payment-hints.xhtml` +- `checkoutBean` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/facelets/package.ai.md new file mode 100644 index 00000000..9685e1a2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/facelets/package.ai.md @@ -0,0 +1,39 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:24:28Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> Collects a customer’s delivery address and shipping choice, recalculates the euro order total, and submits the order. + +#### Purpose +- Provide the customer checkout form for entering delivery details and placing an order. + +#### Responsibilities +- Capture street and ZIP address fields, with a five-digit ZIP validator. +- Offer shipping-method selection and update the displayed total through AJAX. +- Submit the order and display the total formatted as EUR currency. + +#### Key units +- `checkoutForm` — Faces form containing checkout fields and order submission. +- `checkoutBean` — supplies address, shipping methods, and total; handles recalculation and order placement. +- `shipping` — selector whose change invokes `checkoutBean.recalculate` and renders `total`. +- `Place order` command button — invokes `checkoutBean.placeOrder`. + +#### Data flow +- Customer enters street and ZIP and selects a shipping method; the ZIP value is validated against `[0-9]{5}`. +- A shipping selection change triggers recalculation and refreshes the EUR-formatted total. +- Form submission invokes the order-placement action. + +#### Dependencies +- `/WEB-INF/templates/shop.xhtml` — provides the `content` template. +- `/WEB-INF/includes/payment-hints.xhtml` — included payment hints. +- `checkoutBean` — backing data and actions. + +#### Cross-cutting +- Jakarta Faces Facelets page using HTML, core, and Facelets namespaces, with EL-bound data and actions. +- Uses Faces validation, AJAX rendering, and number conversion for the total. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..23530321 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,59 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:22:45Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Calculates shipping charges from order value and parcel weight, including free delivery, weight-based rates, and rejection of parcels above the configured limit. + +#### Purpose +- `ShippingRulesSpec` verifies free shipping, weight-tier pricing, and rejection of overweight orders. +- `ShippingRules` calculates an order’s shipping cost using a carrier and maximum parcel weight. + +#### Type +- `ShippingRulesSpec` — class; extends `Specification`. +- `ShippingRules` — class; annotated `@CompileStatic`. + +#### Input +- `ShippingRules.carrier`: carrier name; `ShippingRules.maxParcelKg`: maximum parcel weight. +- `ShippingRules.costFor(Order order)`: consumes an `Order` with `weightKg` and `total`. +- `ShippingRulesSpec` initializes rules with carrier `'DHL'` and maximum weight `31.5`; test orders use varying totals and weights. + +#### Output +- `ShippingRules.costFor` returns a `BigDecimal` shipping cost. +- Orders at or above `ShippingRulesSpec.FREE_SHIPPING_THRESHOLD` receive cost `0`; other orders receive a weight-tier price. +- `costFor` throws `ParcelTooHeavyException` when the order exceeds `maxParcelKg`. + +#### Core logic +- `costFor` first compares `order.weightKg` with `maxParcelKg`; if heavier, throws `ParcelTooHeavyException` with a message containing actual and maximum weights. +- If `order.total >= ShippingRulesSpec.FREE_SHIPPING_THRESHOLD`, returns `0`. +- Otherwise defines `tiers` at 2 kg (`4.99`), 10 kg (`9.99`), and 31.5 kg (`19.99`); selects the first tier where `order.weightKg <= tier.upTo` and casts its `price` to `BigDecimal`. +- `ShippingRulesSpec` checks an order totaling `75.00` ships free; `@Unroll` tests weights 1, 10, and 30 against their expected prices; verifies a 40 kg order throws `ParcelTooHeavyException`. +- Private helper `heavyOrder(BigDecimal kg)` constructs an `Order` totaling 10; it is not used by the shown tests. + +#### Public API +- `ShippingRulesSpec.FREE_SHIPPING_THRESHOLD: BigDecimal` — free-shipping minimum (`50.00`). +- `getRules()`/`setRules(Object)` — rules fixture property. +- `"orders above the threshold ship for free"()` -> `void` — verifies free shipping. +- `"a parcel of #weight kg costs #expected"()` -> `void` — verifies weight-tier prices; unrolled. +- `"an overweight parcel is rejected"()` -> `void` — verifies overweight rejection. +- `getCarrier()`/`setCarrier(String)` — carrier property. +- `getMaxParcelKg()`/`setMaxParcelKg(BigDecimal)` — maximum parcel weight. +- `costFor(Order order)` -> `BigDecimal` — calculate shipping charge. + +#### Dependencies +- `groovy.transform.CompileStatic` +- `spock.lang.Specification` +- `spock.lang.Unroll` +- `Order`, `ParcelTooHeavyException` (`shop.shipping` package) + +#### Exceptions / Errors +- Throws `ParcelTooHeavyException` when `order.weightKg > maxParcelKg`. +- If a parcel passes the configured maximum but exceeds every hard-coded tier, `tiers.find { ... }` can return `null` before `.price` access. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/groovy/package.ai.md new file mode 100644 index 00000000..722e9850 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/groovy/package.ai.md @@ -0,0 +1,37 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:24:32Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> Determines whether an order qualifies for free delivery, calculates weight-based shipping charges, and rejects parcels exceeding the configured weight limit. + +#### Purpose +- Calculates shipping costs from order value and parcel weight. +- Specifies expected behavior for free shipping, weight-tier rates, and overweight parcels. + +#### Responsibilities +- **Shipping rules:** Apply the parcel weight limit, free-shipping threshold, and weight-tier pricing. +- **Behavioral tests:** Use Spock examples to verify free delivery, unrolled weight-based prices, and overweight rejection. + +#### Key units +- `ShippingRules` — stores carrier and maximum parcel weight; `costFor(Order)` returns a `BigDecimal` charge or throws `ParcelTooHeavyException`. +- `ShippingRulesSpec` — Spock specification defining a `50.00` free-shipping threshold and testing shipping-rule outcomes. +- `Order` — supplies the `weightKg` and `total` used by the rules. +- `ParcelTooHeavyException` — signals that an order exceeds the configured maximum parcel weight. + +#### Data flow +- `costFor(Order)` checks `weightKg` against `maxParcelKg` and rejects overweight orders. +- If within the limit, it returns zero when `total` meets or exceeds `FREE_SHIPPING_THRESHOLD`; otherwise it selects the first matching tier: up to 2 kg (`4.99`), 10 kg (`9.99`), or 31.5 kg (`19.99`). + +#### Dependencies +- `Order` and `ParcelTooHeavyException` from `shop.shipping`. +- `groovy.transform.CompileStatic` for the rules implementation; Spock `Specification` and `Unroll` for tests. + +#### Cross-cutting +- `ShippingRules` is annotated with `@CompileStatic`; tests use Spock feature methods and `@Unroll`. +- A parcel within `maxParcelKg` but beyond all listed pricing tiers may yield no tier match before `.price` access. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..9dc6bcc6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/integration/order-routes.xml.ai.md @@ -0,0 +1,43 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:22:54Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Defines Camel order-processing routes that validate incoming orders, route them to ERP or manual review, and handle ERP failures. + +#### Purpose +- Integrates incoming JMS orders with validation, review routing, ERP submission, audit tapping, and dead-letter handling. +- Loads integration settings from `classpath:integration.properties`. + +#### Type +- Spring / Apache Camel integration XML; root element `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` → `http://www.w3.org/2001/XMLSchema-instance`; nested Camel context uses default `http://camel.apache.org/schema/spring`. +- Schema locations: `https://www.springframework.org/schema/beans/spring-beans.xsd`; `https://camel.apache.org/schema/spring/camel-spring.xsd`. + +#### Definitions +- Beans: `orderValidator` → `shop.integration.OrderValidator`; `invoiceTranslator` → `shop.integration.InvoiceTranslator`. +- Property placeholder: `properties`, loading `classpath:integration.properties`. +- Exception handling: `shop.integration.ErpUnavailableException`; handled as true, then sent to `jms:queue:orders.deadletter`. +- Routes: + - `incomingOrders`: consumes `jms:queue:{{orders.incoming.queue}}`; calls `orderValidator.validate`; routes orders with `${body.total} > {{orders.review.threshold}}` to `direct:manualReview`, otherwise to `direct:toErp`; wire-taps to `seda:orderAudit`. + - `toErp`: consumes `direct:toErp`; calls `invoiceTranslator`; dynamically sends to `https://{{erp.host}}/api/orders/${header.orderId}`. + - `manualReview`: consumes `direct:manualReview`; splits `${body.lines}` and sends each part to `jms:queue:review.lines`. + +#### Configuration +- Property source: `classpath:integration.properties`. +- `maximumRedeliveries=5`; `redeliveryDelay=2000`; `useExponentialBackOff=true`. +- Routing placeholders: `{{orders.incoming.queue}}`, `{{orders.review.threshold}}`, `{{erp.host}}`. +- Runtime expressions: `${body.total}`, `${body.lines}`, `${header.orderId}`. + +#### Dependencies +- Classes: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `shop.integration.ErpUnavailableException`. +- Referenced file: `classpath:integration.properties`. +- Endpoints: `jms:queue:{{orders.incoming.queue}}`, `jms:queue:orders.deadletter`, `jms:queue:review.lines`, `seda:orderAudit`, `direct:manualReview`, `direct:toErp`, `https://{{erp.host}}/api/orders/${header.orderId}`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/integration/package.ai.md new file mode 100644 index 00000000..f33083a6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/integration/package.ai.md @@ -0,0 +1,42 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:24:37Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Processes incoming orders by validating them, directing high-value orders to manual review and eligible orders to ERP, while auditing and dead-lettering failures. + +#### Purpose +- Connects JMS order intake to validation, manual review, ERP submission, audit, and failure handling. +- Loads routing and ERP settings from `classpath:integration.properties`. + +#### Responsibilities +- **Order routing:** Validate incoming orders and direct them to manual review or ERP based on the configured total threshold. +- **ERP integration:** Translate orders and submit them to an order-specific ERP API endpoint. +- **Review and audit:** Split review-bound orders into lines for a JMS queue and wire-tap incoming orders to an audit endpoint. +- **Failure handling:** Handle `ErpUnavailableException` by sending messages to the dead-letter queue, with configured redelivery. + +#### Key units +- `incomingOrders` — consumes the configured incoming JMS queue, validates orders, routes by total, and wire-taps for audit. +- `toErp` — translates orders and sends them to the ERP API using the order ID. +- `manualReview` — splits order lines and sends them to `jms:queue:review.lines`. +- `orderValidator` — Spring bean for `shop.integration.OrderValidator`. +- `invoiceTranslator` — Spring bean for `shop.integration.InvoiceTranslator`. + +#### Data flow +- Incoming JMS orders pass through validation, then route to `direct:manualReview` when `${body.total}` exceeds the configured threshold or to `direct:toErp` otherwise; the intake route also taps messages to `seda:orderAudit`. +- The ERP route translates orders and sends them to `https://{{erp.host}}/api/orders/${header.orderId}`; the review route splits `${body.lines}` to `jms:queue:review.lines`. +- `shop.integration.ErpUnavailableException` is handled by sending to `jms:queue:orders.deadletter`. + +#### Dependencies +- Java integration classes: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, and `shop.integration.ErpUnavailableException`. +- Configuration: `classpath:integration.properties`, including the incoming queue, review threshold, and ERP host placeholders. +- Camel endpoints: JMS queues, `direct:toErp`, `direct:manualReview`, `seda:orderAudit`, and the ERP HTTPS endpoint. + +#### Cross-cutting +- Spring beans and Apache Camel routes are defined in XML. +- Redelivery is configured with `maximumRedeliveries=5`, `redeliveryDelay=2000`, and `useExponentialBackOff=true`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..0031ccc4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,40 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:23:01Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Configures stateless and stateful EJBs, an order-event message-driven bean, shared timing interception, and transaction behavior for stock reservations. + +#### Purpose +- Declares enterprise beans and their runtime wiring for stock reservation, checkout, and order events. +- Applies timing interception to all EJBs and a transaction attribute to stock reservation. + +#### Type +- Jakarta EE `ejb-jar.xml` descriptor; root element `ejb-jar`. +- Namespace: default `https://jakarta.ee/xml/ns/jakartaee`. + +#### Definitions +- Session bean `StockReservationBean`: class `shop.stock.StockReservationBean`; type `Stateless`; environment entry `reservationMinutes` of type `java.lang.Integer`, value `45`. +- Session bean `CheckoutSessionBean`: class `shop.checkout.CheckoutSessionBean`; type `Stateful`; local EJB reference `ejb/StockReservation` to `shop.stock.StockReservation`. +- Message-driven bean `OrderPlacedListener`: class `shop.events.OrderPlacedListener`; activation property `destinationLookup` set to `java:/jms/queue/OrderPlaced`. +- Interceptor `shop.audit.TimingInterceptor`; bound to all EJBs via `ejb-name` `*`. +- Transaction attribute `RequiresNew` for `StockReservationBean` method `reserve`. + +#### Configuration +- `reservationMinutes=45`. +- `destinationLookup=java:/jms/queue/OrderPlaced`. +- `StockReservationBean.reserve` transaction attribute: `RequiresNew`. +- `shop.audit.TimingInterceptor` applies to all EJBs. + +#### Dependencies +- Classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`. +- Local business interface: `shop.stock.StockReservation`. +- JMS destination: `java:/jms/queue/OrderPlaced`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jee/package.ai.md new file mode 100644 index 00000000..85457dcf --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jee/package.ai.md @@ -0,0 +1,47 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:24:42Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> Configures the shop back-office web application and enterprise services for report access, admin security, stock reservations, checkout, and order-event handling. + +#### Purpose +- Declares web and EJB runtime components and their container-managed configuration. +- Connects back-office requests and shop services to security, data-source, transaction, and JMS settings. + +#### Responsibilities +- **Web application:** maps `ReportDownloadServlet` to `/reports/*`, applies `RequestIdFilter` to all requests, runs `StartupAuditListener`, and sets report-directory and session-timeout configuration. +- **Access control and resources:** protects `/admin/*` for the `admin` role and declares the `jdbc/ShopDS` data-source reference. +- **Enterprise services:** configures stateless stock reservation and stateful checkout beans, plus the order-placed message-driven listener. +- **EJB behavior:** applies `TimingInterceptor` to all EJBs and sets `StockReservationBean.reserve` to `RequiresNew`. + +#### Key units +- `ReportDownloadServlet` — serves the report endpoint at `/reports/*`. +- `RequestIdFilter` — filters requests mapped to `/*`. +- `StartupAuditListener` — web-application startup listener. +- `StockReservationBean` — stateless bean with a `reservationMinutes` environment entry set to `45`. +- `CheckoutSessionBean` — stateful bean with a local reference to `shop.stock.StockReservation`. +- `OrderPlacedListener` — message-driven bean listening at `java:/jms/queue/OrderPlaced`. +- `shop.audit.TimingInterceptor` — interceptor bound to all EJBs. +- `jdbc/ShopDS` — container-managed `javax.sql.DataSource` reference. + +#### Data flow +- Web requests pass through `RequestIdFilter`; report requests route to `ReportDownloadServlet`, while `/admin/*` access requires the `admin` role. +- Checkout can reference the stock reservation business interface; `StockReservationBean.reserve` runs with `RequiresNew`. +- Order-placement messages are delivered to `OrderPlacedListener` through `java:/jms/queue/OrderPlaced`. + +#### Dependencies +- Application classes in `shop.web`, `shop.stock`, `shop.checkout`, `shop.events`, and `shop.audit`. +- Local business interface `shop.stock.StockReservation`. +- Container-managed resources: `jdbc/ShopDS` and JMS destination `java:/jms/queue/OrderPlaced`. + +#### Cross-cutting +- Jakarta EE deployment descriptors define container-managed component wiring, security, resources, and lifecycle behavior. +- Session timeout is 20 minutes; `shop.reportDirectory` is `/var/shop/reports`. +- `TimingInterceptor` applies across EJBs; admin authorization is role-based. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jee/web.xml.ai.md new file mode 100644 index 00000000..8c3837ad --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jee/web.xml.ai.md @@ -0,0 +1,43 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:23:06Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Configures the shop back-office web application’s report endpoint, request filtering, startup audit, session lifetime, admin access control, and data source reference. + +#### Purpose +- Defines web application settings and server-managed components for `shop-backoffice`. +- Protects `/admin/*` for the `admin` role and maps report downloads to `/reports/*`. + +#### Type +- Jakarta EE 6.0 web application descriptor; root element `web-app`. +- Declares the default namespace `https://jakarta.ee/xml/ns/jakartaee` (no prefix). + +#### Definitions +- Display name: `shop-backoffice`. +- Servlet `ReportDownloadServlet`: class `shop.web.ReportDownloadServlet`; load-on-startup `1`; URL pattern `/reports/*`. +- Filter `RequestIdFilter`: class `shop.web.RequestIdFilter`; mapped to `/*`. +- Listener: `shop.web.StartupAuditListener`. +- Session timeout: `20` minutes. +- Security constraint `backoffice`: protects `/admin/*`; requires role `admin`. +- Security role: `admin`. +- Resource reference `jdbc/ShopDS`: type `javax.sql.DataSource`. + +#### Configuration +- Context parameter `shop.reportDirectory`: `/var/shop/reports`. +- Session timeout: `20` minutes. +- Servlet startup order: `ReportDownloadServlet` loads at `1`. + +#### Dependencies +- Servlet class: `shop.web.ReportDownloadServlet`. +- Filter class: `shop.web.RequestIdFilter`. +- Listener class: `shop.web.StartupAuditListener`. +- Container-managed data source: `jdbc/ShopDS` (`javax.sql.DataSource`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..b7f15469 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,47 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:23:12Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> Lists open orders and lets users search by customer email or status, review totals and overdue status, and cancel an order. + +#### Purpose +- Display orders with their number, total, overdue indicator, and cancellation link. +- Search orders by customer email and status. + +#### Type +- JSP page; `text/html;charset=UTF-8`. +- Tag libraries: `c` = Jakarta Tags core (`jakarta.tags.core`); `fmt` = Jakarta Tags formatting (`jakarta.tags.fmt`). +- JSP standard actions: `jsp:include`. + +#### Data +- Request attribute `orderFilter`: cast to `OrderFilter`; reads `getPageSize()` when non-null. +- Request attribute `orders`: iterated with `c:forEach`, variable `order`; reads `order.number`, `order.total`, `order.overdue`, `order.id`. +- Request parameter `customerEmail`: used as the search input value. +- Request context path: `pageContext.request.contextPath`, used in the search form action. + +#### Actions +- Search form: GET `${pageContext.request.contextPath}/orders/search`; fields `customerEmail` (text input) and `status` (select: `OPEN`, `SHIPPED`); submit control labeled `Search`. +- Per-order cancellation link: `orders/${order.id}/cancel`. + +#### Structure +- Includes `/WEB-INF/jspf/header.jspf` via JSP include directive. +- Includes `/WEB-INF/jspf/footer.jspf` via `jsp:include`. + +#### Server code +- Imports `java.util.List`, `shop.Order`, and `shop.OrderFilter`. +- Reads request attribute `orderFilter` as `OrderFilter`; computes `pageSize` as its page size, or `25` if the filter is null; displays the result. + +#### Dependencies +- Tag libraries: `jakarta.tags.core`, `jakarta.tags.fmt`. +- Imported classes: `java.util.List`, `shop.Order`, `shop.OrderFilter`. +- Included files: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf`. +- Search URL: `${pageContext.request.contextPath}/orders/search`; cancellation URL pattern: `orders/${order.id}/cancel`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jsp/package.ai.md new file mode 100644 index 00000000..f3672463 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/jsp/package.ai.md @@ -0,0 +1,30 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:24:49Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> Provides an order-listing interface for searching customer orders, reviewing order totals and overdue status, and initiating cancellation. + +#### Purpose +- Display orders with their number, total, overdue indicator, and cancellation link. +- Search orders by customer email and status. + +#### Responsibilities +- Render order results from the `orders` request attribute and display the configured page size from `orderFilter`, defaulting to 25. +- Submit a GET search to `/orders/search` with `customerEmail` and `status` (`OPEN` or `SHIPPED`); provide per-order cancellation links. + +#### Key units +- `order-list.jsp` — JSP page rendering the search form and order list using Jakarta Tags core and formatting libraries. + +#### Data flow +- Reads `orders`, `orderFilter`, and the `customerEmail` request parameter; iterates over orders to show their number, total, overdue state, and ID. +- Sends search criteria to `/orders/search`; cancellation links target `orders/{order.id}/cancel`. + +#### Dependencies +- Uses `shop.Order`, `shop.OrderFilter`, and `java.util.List`. +- Uses `jakarta.tags.core` and `jakarta.tags.fmt`; includes `/WEB-INF/jspf/header.jspf` and `/WEB-INF/jspf/footer.jspf`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..65ebcde7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,46 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:23:18Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the Orders backoffice application with three replicas, exposes it internally, and routes `backoffice.shop.example` traffic to it. + +#### Purpose +- Runs the Orders backoffice application in Kubernetes. +- Exposes the application through a Service and Ingress. + +#### Type +- Kubernetes manifest; API versions `apps/v1`, `v1`, and `networking.k8s.io/v1`. + +#### Definitions +- `Deployment` `orders-backoffice`: 3 replicas; container `backoffice` uses `registry.shop.example/orders-backoffice:2.1.0`. + - Container port: `8080`. + - Readiness probe: HTTP `GET /health/ready` on port `8080`. + - Resource limits: memory `768Mi`, CPU `"1"`. +- `Service` `orders-backoffice`: selects `app: orders-backoffice`; port `80` targets port `8080`. +- `Ingress` `orders-backoffice`: routes host `backoffice.shop.example`, path `/` (`Prefix`), to Service `orders-backoffice` port `80`. + +#### Configuration +- `replicas=3` +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD=***` — sourced from Secret `orders-db-credentials`, key `password`. +- Deployment and pod label selector: `app=orders-backoffice` +- `containerPort=8080` +- `readinessProbe.path=/health/ready` +- `resources.limits.memory=768Mi` +- `resources.limits.cpu="1"` +- Service `port=80`, `targetPort=8080` +- Ingress `host=backoffice.shop.example`, `path=/`, `pathType=Prefix` + +#### Dependencies +- Image: `registry.shop.example/orders-backoffice:2.1.0` +- Secret: `orders-db-credentials`, key `password` +- Database endpoint: `orders-db:5432` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/k8s/package.ai.md new file mode 100644 index 00000000..c66d102c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/k8s/package.ai.md @@ -0,0 +1,37 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:24:52Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Runs the Orders backoffice application and makes it reachable over HTTP for shop operations. + +#### Purpose +- Deploys the Orders backoffice application in Kubernetes with three replicas. +- Exposes it internally and routes `backoffice.shop.example` traffic to the application. + +#### Responsibilities +- **Application workload:** Runs `orders-backoffice` and checks readiness at `/health/ready`. +- **Network access:** Connects the workload to a Kubernetes Service and exposes it through an Ingress. + +#### Key units +- `Deployment/orders-backoffice` — runs `registry.shop.example/orders-backoffice:2.1.0` on port `8080`, with three replicas. +- `Service/orders-backoffice` — exposes the workload on port `80`, targeting port `8080`. +- `Ingress/orders-backoffice` — routes `/` traffic for `backoffice.shop.example` to the Service. + +#### Data flow +- Requests for `backoffice.shop.example/` pass through the Ingress to `Service/orders-backoffice`, then to the application on port `8080`. +- The application receives `SHOP_DB_URL` for `orders-db:5432` and `SHOP_DB_PASSWORD` from Secret `orders-db-credentials`, key `password`. + +#### Dependencies +- Container image: `registry.shop.example/orders-backoffice:2.1.0`. +- Kubernetes Secret: `orders-db-credentials`. +- Database endpoint: `orders-db:5432`. + +#### Cross-cutting +- Deployment and pod selection use label `app=orders-backoffice`. +- Container resource limits are `768Mi` memory and `1` CPU; readiness uses HTTP `GET /health/ready` on port `8080`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..eb50b4c7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,77 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:23:22Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Issues and stores invoices for completed orders, assigning invoice numbers and payment due dates while rejecting orders without lines. + +#### Purpose +- `InvoiceService` issues invoices from completed orders and applies payment terms. +- `InvoiceLine` calculates line amounts; `List.total()` sums them. + +#### Type +- `InvoiceNumber` — value class; wraps `String`; annotated `@JvmInline`. +- `InvoiceLine` — data class; fields `sku: String`, `quantity: Int`, `unitPrice: BigDecimal`. +- `InvoiceResult` — sealed interface. +- `InvoiceResult.Issued` — nested data class implementing `InvoiceResult`; fields `number: InvoiceNumber`, `dueDate: LocalDate`. +- `InvoiceResult.Rejected` — nested data class implementing `InvoiceResult`; field `reason: String`. +- `InvoiceService` — class; constructor dependencies `repository: InvoiceRepository`, `clock: () -> LocalDate`. + +#### Input +- `InvoiceService` constructor receives `InvoiceRepository` and a date supplier, defaulting to `LocalDate::now`. +- `issue(order: CompletedOrder)` consumes order ID, customer ID, and lines. +- `taxRate(category: String)` consumes a category. +- `InvoiceLine` receives SKU, quantity, and unit price. +- `PAYMENT_TERM_DAYS` is 14; `REDUCED_TAX_CATEGORIES` contains `"books"` and `"food"`. + +#### Output +- `issue` returns `InvoiceResult`; successful issuance saves an `Invoice` and returns its number and due date. +- Empty-line orders return `InvoiceResult.Rejected`. +- `taxRate` returns `BigDecimal`; reduced categories receive `0.07`, others `0.19`. +- `InvoiceLine.amount` returns `unitPrice * quantity`; `List.total()` returns the sum of line amounts. +- `InvoiceService.defaultCurrency` is a public mutable property. + +#### Core logic +- `issue` switches to `Dispatchers.IO` with `withContext`. +- If `order.lines.isEmpty()`, returns `Rejected("order ${order.id} has no lines")` without numbering or saving. +- Otherwise calls private `nextNumber()`, which increments `sequence` and formats `"$PREFIX-${++sequence}"` as an `InvoiceNumber`. +- Builds `Invoice(number, order.customerId, order.lines, clock().plusDays(PAYMENT_TERM_DAYS.toLong()))`. +- Calls `repository.save(invoice)` and returns `Issued(number, invoice.dueDate)`. +- `taxRate` checks whether `category` is in `REDUCED_TAX_CATEGORIES`. +- `InvoiceLine.amount` multiplies `unitPrice` by `BigDecimal(quantity)`; `total()` folds from `BigDecimal.ZERO` using each `line.amount`. + +#### Public API +- `InvoiceNumber(value: String)` — wraps an invoice number. +- `InvoiceLine(sku: String, quantity: Int, unitPrice: BigDecimal)` — represents an invoice line. +- `amount: BigDecimal` — calculated line amount. +- `InvoiceResult.Issued(number: InvoiceNumber, dueDate: LocalDate)` — represents successful issuance. +- `InvoiceResult.Rejected(reason: String)` — represents rejected issuance. +- `InvoiceService(repository: InvoiceRepository, clock: () -> LocalDate)` — creates the service. +- `REDUCED_TAX_CATEGORIES: Set` — reduced-rate categories. +- `defaultCurrency: String` — configured currency property. +- `issue(order: CompletedOrder): InvoiceResult` — issues an invoice. +- `taxRate(category: String): BigDecimal` — selects the tax rate. +- `PAYMENT_TERM_DAYS: Int` — payment term in days. +- `List.total(): BigDecimal` — sums line amounts. + +#### Dependencies +- `BigDecimal`, `LocalDate` +- `Dispatchers`, `withContext` +- `InvoiceRepository`, `CompletedOrder`, `Invoice` + +#### Exceptions / Errors +- No explicit exception handling or precondition checks. +- `defaultCurrency` is `lateinit`; reading it before initialization can fail. +- `repository.save(invoice)` and the date supplier may propagate failures. + +#### Concurrency +- `issue` executes its block on `Dispatchers.IO`. +- `sequence` is mutable and unsynchronized; concurrent calls may race. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/kotlin/package.ai.md new file mode 100644 index 00000000..1ab8d1b7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/kotlin/package.ai.md @@ -0,0 +1,44 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:24:57Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> Issues invoices for completed orders, applying payment terms and tax rates while rejecting orders without invoice lines. + +#### Purpose +- Create and persist invoices from completed orders, returning either issuance details or a rejection reason. +- Calculate invoice-line totals and select tax rates by category. + +#### Responsibilities +- **Invoice issuance:** Validate that orders contain lines, assign invoice numbers and due dates, and save invoices. +- **Invoice calculations and policy:** Calculate line and list totals; apply reduced tax rates to configured categories and set a 14-day payment term. + +#### Key units +- `InvoiceService` — issues invoices using an `InvoiceRepository` and an injectable date supplier. +- `InvoiceNumber` — value class wrapping an invoice-number string. +- `InvoiceLine` — represents an SKU, quantity, and unit price; exposes a calculated `amount`. +- `InvoiceResult` — sealed result type with `Issued` and `Rejected` variants. +- `InvoiceResult.Issued` — returns the invoice number and due date. +- `InvoiceResult.Rejected` — returns the reason issuance was rejected. +- `List.total()` — sums line amounts. +- `PAYMENT_TERM_DAYS`, `REDUCED_TAX_CATEGORIES` — define the payment period and reduced-rate categories. + +#### Data flow +- `issue(CompletedOrder)` rejects orders with no lines; otherwise generates an `InvoiceNumber`, builds an `Invoice` using the customer, lines, and clock-derived due date, saves it through `InvoiceRepository`, and returns `Issued`. +- `InvoiceLine.amount` multiplies unit price by quantity; `total()` folds line amounts from `BigDecimal.ZERO`. +- `taxRate(category)` returns `0.07` for `"books"` and `"food"`, otherwise `0.19`. + +#### Dependencies +- Domain types: `CompletedOrder`, `Invoice`, `InvoiceRepository`. +- Kotlin coroutine dispatch: `Dispatchers.IO`, `withContext`. +- Date and monetary values: `LocalDate`, `BigDecimal`. + +#### Cross-cutting +- `issue` runs on `Dispatchers.IO`; the mutable invoice-number sequence is unsynchronized and may race under concurrent calls. +- The date supplier defaults to `LocalDate::now`; `defaultCurrency` is mutable and `lateinit`. +- No explicit exception handling: repository-save and date-supplier failures may propagate; accessing `defaultCurrency` before initialization can fail. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..193605ca --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,44 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:23:30Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Defines customer database operations for lookup, conditional search, insertion, promotion, and deletion. + +#### Purpose +- Maps SQL operations on `CUSTOMER` to the `shop.customer.CustomerMapper` namespace. +- Maps customer query columns to `shop.customer.Customer` properties. + +#### Type +- MyBatis mapper; root element `mapper`; no XML namespace declared. +- DTD: `https://mybatis.org/dtd/mybatis-3-mapper.dtd`. + +#### Definitions +- Namespace: `shop.customer.CustomerMapper`. +- Result map `customerResult` → `shop.customer.Customer`: `id` from `CUSTOMER_ID`, `email` from `EMAIL`, `loyaltyTier` from `LOYALTY_TIER`. +- SQL fragment `customerColumns`: `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT`. +- Select `findByEmail`: uses `customerResult`; reads `CUSTOMER`, filters by `EMAIL = #{email}`; parameter and result types not explicitly declared. +- Select `search`: uses `customerResult`; reads `CUSTOMER`; optional filters on `tier` and `createdAfter`; orders by `${sortColumn}`; parameter and result types not explicitly declared. +- Insert `insert`: writes `CUSTOMER`; inserts `EMAIL`, `LOYALTY_TIER`, and `CREATED_AT` (`now()`); generated keys enabled with `keyProperty="id"`. +- Update `promote`: updates `CUSTOMER.LOYALTY_TIER` for `CUSTOMER_ID` values from `ids`; parameter and result types not explicitly declared. +- Delete `deleteInactive`: deletes from `CUSTOMER` where `LAST_ORDER_AT < #{cutoff}`; parameter and result types not explicitly declared. +- `${sortColumn}` is spliced into SQL unescaped. + +#### Configuration +- `search`: adds `LOYALTY_TIER = #{tier}` when `tier != null`; adds `CREATED_AT >= #{createdAfter}` when `createdAfter != null`. +- `search`: sort column supplied by `${sortColumn}`. +- `insert`: `useGeneratedKeys="true"`; `keyProperty="id"`. +- `promote`: `ids` expanded as a comma-separated `IN` list. + +#### Dependencies +- Java type: `shop.customer.Customer`. +- Database table: `CUSTOMER`; columns referenced include `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, and `LAST_ORDER_AT`. +- MyBatis mapper DTD: `https://mybatis.org/dtd/mybatis-3-mapper.dtd`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/mybatis/package.ai.md new file mode 100644 index 00000000..d029394c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/mybatis/package.ai.md @@ -0,0 +1,38 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:25:02Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Provides database-backed customer lookup, filtering, creation, loyalty-tier promotion, and inactive-customer cleanup. + +#### Purpose +- Maps customer operations to SQL on the `CUSTOMER` table. +- Converts query results to `shop.customer.Customer` through `customerResult`. + +#### Responsibilities +- **Customer retrieval:** find by email and search with optional loyalty-tier and creation-date filters. +- **Customer maintenance:** insert customers with generated IDs, promote selected customers, and delete customers whose last order predates a cutoff. + +#### Key units +- `shop.customer.CustomerMapper` — MyBatis namespace for customer SQL operations. +- `customerResult` — maps `CUSTOMER_ID`, `EMAIL`, and `LOYALTY_TIER` to `Customer` properties. +- `customerColumns` — shared SQL fragment listing customer columns. +- `findByEmail`, `search`, `insert`, `promote`, `deleteInactive` — customer query and mutation statements. + +#### Data flow +- Mapper inputs provide lookup criteria, optional search filters and sort column, inserted customer values, promotion IDs, or deletion cutoff. +- SQL operates on `CUSTOMER`; query results use `customerResult`, and `insert` writes the generated key to `id`. + +#### Dependencies +- Java type `shop.customer.Customer`. +- Database table `CUSTOMER`, including `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, and `LAST_ORDER_AT`. +- MyBatis mapper DTD. + +#### Cross-cutting +- `search` conditionally adds filters when `tier` or `createdAfter` is non-null; `promote` expands `ids` into an `IN` list. +- `search` injects `sortColumn` through unescaped `${}` SQL substitution. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..0f58000d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,40 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:23:37Z +- G: +- A: 0.0.0 +- X: file +- P: 30325B28 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> The Shop Orders API lets backoffice clients list, retrieve, and cancel shop orders. + +#### Purpose +- Read orders and change their cancellation status in the shop backoffice. + +#### Type +- OpenAPI 3.0.3; `Shop Orders API`, version `2.1.0`. + +#### Operations +- `GET /orders` — `listOrders`; query parameters: `status` (`OrderStatus`), `limit` (integer, maximum 200); response `200`: array of `Order`. +- `GET /orders/{orderId}` — `getOrder`; required path parameter `orderId` (string); response `200`: `Order`; response `404`: no schema specified. +- `POST /orders/{orderId}/cancel` — `cancelOrder`; required path parameter `orderId` (string); response `204`: no schema specified; response `409`: no schema specified; requires `backofficeToken` scope `orders:write`. + +#### Schemas +- `OrderStatus`: string enum — `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order`: object; required fields: `orderId`, `status`, `total`. + - `orderId`: string. + - `status`: `OrderStatus`. + - `total`: number, format `double`. + - `couponCode`: string; deprecated. + +#### Security and servers +- Server: `https://api.shop.example/backoffice`. +- `backofficeToken`: OAuth 2.0 client credentials; token URL `https://auth.shop.example/token`; scope `orders:write`; required by `POST /orders/{orderId}/cancel`. + +#### Dependencies +- Internal schema references: `OrderStatus`, `Order`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/openapi/package.ai.md new file mode 100644 index 00000000..8531ef20 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/openapi/package.ai.md @@ -0,0 +1,35 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:25:07Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> Defines the backoffice contract for listing, retrieving, and cancelling shop orders. + +#### Purpose +- Specify the Shop Orders API (`2.1.0`) for reading orders and requesting cancellation. + +#### Responsibilities +- Expose order listing and retrieval by ID, including status filtering and a bounded result limit. +- Expose order cancellation, protected by an OAuth 2.0 write scope. + +#### Key units +- `GET /orders` (`listOrders`) — returns an array of `Order` records, optionally filtered by `OrderStatus`. +- `GET /orders/{orderId}` (`getOrder`) — retrieves an order by ID. +- `POST /orders/{orderId}/cancel` (`cancelOrder`) — requests cancellation; documents `204` and `409` responses. +- `Order` — order ID, status, and total; also includes deprecated `couponCode`. +- `OrderStatus` — `OPEN`, `PAID`, `SHIPPED`, or `CANCELLED`. + +#### Data flow +- Backoffice clients call the API at `https://api.shop.example/backoffice`; listing and retrieval return `Order` data, while cancellation requires authorization and returns a status response. + +#### Dependencies +- `Order` references `OrderStatus`; the list and retrieval operations return `Order` data. +- `backofficeToken` uses OAuth 2.0 client credentials from `https://auth.shop.example/token`, with `orders:write` required for cancellation. + +#### Cross-cutting +- OpenAPI 3.0.3 contract; cancellation documents a `409` response, and order lookup documents a `404` response. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..992cfc3c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,66 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:25:22Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> Defines the shop’s order, checkout, fulfilment, invoicing, shipping, stock, and back-office interfaces, runtime configuration, and release deployment. + +#### Purpose +- Collects the contracts, workflows, application configuration, and infrastructure for processing and managing shop orders. +- Covers customer checkout through fulfilment and invoicing, plus back-office order access, persistence, and deployment. + +#### Responsibilities +- **Order fulfilment and shipping:** BPMN `orderFulfilment` coordinates stock reservation, payment, approval, shipping, invoicing, and out-of-stock cancellation; Groovy `ShippingRules` calculates weight-based charges and enforces parcel limits. +- **Customer and back-office experiences:** Facelets checkout collects delivery and shipping choices; JSP lists and filters orders; the OpenAPI contract defines order retrieval and cancellation. +- **Integration and enterprise services:** Apache Camel routes validate incoming orders, send eligible orders to ERP, route high-value orders for review, audit messages, and dead-letter failures; Jakarta EE descriptors configure web components, EJBs, security, and JMS. +- **Invoices, data, and stock contracts:** Kotlin invoice services issue invoices; MyBatis maps customer operations to SQL; Hibernate and Jakarta Persistence configure shipment mappings and persistence units; WSDL defines stock-level lookup. +- **Build and runtime delivery:** Docker packages the back-office application, Kubernetes deploys and exposes it, and GitHub Actions verifies, publishes, and deploys releases. + +#### Key units +- `orderFulfilment`, `reserveStock`, `waitForPayment`, `amountCheck`, `shipOrder`, `createInvoice` — BPMN process and steps coordinating order completion or cancellation. +- `ShippingRules`, `ParcelTooHeavyException` — shipping-price rules and overweight-parcel error. +- `checkoutForm`, `checkoutBean`, `order-list.jsp` — customer checkout and back-office order listing. +- `InvoiceService`, `InvoiceLine`, `InvoiceResult`, `InvoiceNumber` — invoice issuance, calculations, and issuance outcome types. +- `incomingOrders`, `toErp`, `manualReview`, `orderValidator`, `invoiceTranslator` — Camel intake, routing, ERP, review, and translation components. +- `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener`, `ReportDownloadServlet` — configured enterprise services and report endpoint. +- `shop.customer.CustomerMapper`, `customerResult` — MyBatis customer SQL operations and result mapping. +- `Shipment`, `ExpressShipment`, `Shipment.undelivered`, `Shipment.countByCarrier` — shipment ORM mappings and queries. +- `StockService`, `StockPortType`, `StockLevelRequest`, `StockLevelResponse`, `UnknownSkuFault` — SOAP stock lookup contract. +- `listOrders`, `getOrder`, `cancelOrder`, `Order`, `OrderStatus` — Shop Orders API operations and data types. +- `Dockerfile`, `Deployment/orders-backoffice`, `Service/orders-backoffice`, `Ingress/orders-backoffice`, `release-backoffice` — container build, Kubernetes runtime exposure, and release workflow. + +#### Data flow +- Checkout captures address and shipping selection, recalculates the EUR total, and submits the order; the BPMN process reserves stock, waits for payment, routes large orders for approval, then ships and invokes invoicing, or cancels on `OutOfStock`. +- Incoming JMS orders are validated, audited, and routed by configured total threshold to manual review or ERP; ERP failures are sent to the dead-letter queue. +- Invoice issuance validates completed-order lines, creates and saves an invoice, and returns an issued or rejected result; persistence mappings route shop and reporting work to their respective data sources. +- Back-office API and JSP interfaces expose order information and cancellation; Kubernetes routes host traffic to the application container, which is built and deployed through the release workflow. + +#### Dependencies +- **Shop domain:** `shop.Order`, `shop.OrderFilter`, `shop.customer.Customer`, `CompletedOrder`, `Invoice`, `InvoiceRepository`, shipment and parcel types, and stock, checkout, event, audit, and web application classes. +- **Messaging and integration:** Apache Camel, JMS queues, `PaymentReceived`, the `shipping` external-task topic, ERP HTTPS endpoint, and invoicing process. +- **Persistence and runtime:** MyBatis, Hibernate, Jakarta Persistence, PostgreSQL configuration, `jdbc/ShopDS`, `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`, and `orders-db`. +- **Web and API contracts:** Jakarta Faces, Jakarta Tags, OpenAPI, SOAP/WSDL, and the configured OAuth 2.0 token endpoint. +- **Delivery tooling:** Maven, Java 21, Docker images, GitHub Actions, Kubernetes, and the `orders-db-credentials` Secret. + +#### Cross-cutting +- Shop-specific configuration spans XML descriptors, `integration.properties`, persistence settings, OpenAPI, WSDL, Docker, and Kubernetes manifests. +- Operational behavior includes JMS redelivery, Camel dead-letter handling, EJB timing interception, JTA and resource-local persistence units, and health/readiness probes. +- Notable implementation caveats in the summaries: Kotlin invoice-number sequencing is unsynchronized; MyBatis `search` substitutes `sortColumn` with unescaped `${}`; a permitted parcel outside all shipping-price tiers may lack a matching tier. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..1e5e0ce9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,40 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:23:47Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps shipment persistence, including shipment fields, order and parcel relationships, express-shipment inheritance, and queries for undelivered shipments and carrier counts. + +#### Purpose +- Defines Hibernate object-relational mappings and queries for shipment data. + +#### Type +- Hibernate mapping (`*.hbm.xml`); root element `hibernate-mapping`; no XML namespace declared. + +#### Definitions +- Entity `shop.shipping.Shipment` → table `SHIPMENT`; `id` maps to `SHIPMENT_ID`, generated by sequence `SHIPMENT_SEQ`. +- Fields: `trackingCode` → `TRACKING_CODE` (length `40`, not null); `carrier` → `CARRIER` (length `12`); `shippedAt` → `SHIPPED_AT` (`timestamp`). +- Associations: `order` → `shop.Order` via `ORDER_ID` (not null); `parcels` → one-to-many `Parcel` via `SHIPMENT_ID`, inverse with `all-delete-orphan` cascade. +- Joined subclass `ExpressShipment` → table `EXPRESS_SHIPMENT`; key `SHIPMENT_ID`; field `deliveryWindow` → `DELIVERY_WINDOW`. +- Named query `Shipment.undelivered` → selects shipments with null `deliveredAt` and `shippedAt` before `:cutoff`. +- Native SQL query `Shipment.countByCarrier` → selects `CARRIER` and row count, grouped by `CARRIER`. + +#### Configuration +- Sequence generator: `class="sequence"`, `sequence_name=SHIPMENT_SEQ`. +- `trackingCode`: length `40`, `not-null="true"`. +- `carrier`: length `12`. +- `shippedAt`: type `timestamp`. +- `order`: `not-null="true"`. +- `parcels`: `inverse="true"`, `cascade="all-delete-orphan"`. + +#### Dependencies +- Hibernate Mapping DTD 3.0: `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. +- Mapped classes: `shop.shipping.Shipment`, `shop.Order`, `Parcel`, `ExpressShipment`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/persistence/package.ai.md new file mode 100644 index 00000000..2815a51c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/persistence/package.ai.md @@ -0,0 +1,44 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:25:12Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Configures shop and reporting persistence while mapping shipment records, their order and parcel relationships, and shipment queries. + +#### Purpose +- Defines Hibernate mappings for shipment storage and Jakarta Persistence units for shop transactions and reporting. +- Connects managed domain classes to separate shop and reporting data sources. + +#### Responsibilities +- **Shipment ORM:** Maps `Shipment` and joined-subclass `ExpressShipment` to shipment tables, including fields and order/parcel associations. +- **Persistence setup:** Configures JTA `shop` and resource-local `reporting` units, their managed classes, data sources, and Hibernate properties. +- **Shipment queries:** Defines queries for undelivered shipments and shipment counts grouped by carrier. + +#### Key units +- `shop.shipping.Shipment` — maps shipment ID, tracking code, carrier, shipment timestamp, required `shop.Order` association, and parcel collection to `SHIPMENT`. +- `ExpressShipment` — maps the joined subclass to `EXPRESS_SHIPMENT`, including `deliveryWindow`. +- `Shipment.undelivered` — selects shipments with no `deliveredAt` and `shippedAt` before `:cutoff`. +- `Shipment.countByCarrier` — returns shipment counts grouped by `CARRIER`. +- Persistence unit `shop` — JTA unit managing `shop.Order`, `shop.OrderLine`, and `shop.Customer`. +- Persistence unit `reporting` — resource-local unit managing `shop.reporting.DailyRevenue`. + +#### Data flow +- Jakarta Persistence routes shop work through `java:/jdbc/ShopDS` and reporting work through `java:/jdbc/ReportingDS`. +- Hibernate maps shipment entities to `SHIPMENT` and `EXPRESS_SHIPMENT`; shipment parcels use inverse one-to-many mapping with `all-delete-orphan` cascade. +- The `shop` unit loads `META-INF/order-queries.xml` for additional mappings. + +#### Dependencies +- Hibernate ORM and Jakarta Persistence; the configured provider is `org.hibernate.jpa.HibernatePersistenceProvider`. +- Data sources `java:/jdbc/ShopDS` and `java:/jdbc/ReportingDS`. +- Domain classes `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue`, `Parcel`, and `ExpressShipment`. +- Shipment mapping uses sequence `SHIPMENT_SEQ`; the shop persistence unit references `META-INF/order-queries.xml`. + +#### Cross-cutting +- Hibernate settings specify PostgreSQL dialect and JDBC batch size `50`; connection credentials are configured in the persistence descriptor. +- Shipment IDs use sequence generation; `trackingCode` and the order association are non-null. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..3fd1f652 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/persistence/persistence.xml.ai.md @@ -0,0 +1,38 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:23:42Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Defines JTA persistence for shop orders and customers, plus a resource-local persistence unit for reporting data. + +#### Purpose +- Configures two Jakarta Persistence units with separate data sources and managed classes. +- Supplies Hibernate settings and an external named-query mapping for the shop unit. + +#### Type +- Jakarta Persistence descriptor; root element `persistence`. +- Namespace: default `https://jakarta.ee/xml/ns/persistence`. + +#### Definitions +- Persistence unit `shop`: transaction type `JTA`; provider `org.hibernate.jpa.HibernatePersistenceProvider`; JTA data source `java:/jdbc/ShopDS`; mapping file `META-INF/order-queries.xml`; managed classes `shop.Order`, `shop.OrderLine`, `shop.Customer`. +- Persistence unit `reporting`: transaction type `RESOURCE_LOCAL`; non-JTA data source `java:/jdbc/ReportingDS`; managed class `shop.reporting.DailyRevenue`; excludes unlisted classes. + +#### Configuration +- `hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect` +- `hibernate.jdbc.batch_size=50` +- `hibernate.connection.username=shop_app` +- `hibernate.connection.password=***` + +#### Dependencies +- Mapping file: `META-INF/order-queries.xml` +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS` +- Provider class: `org.hibernate.jpa.HibernatePersistenceProvider` +- Managed classes: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..2b234f85 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,35 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:23:52Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Defines a SOAP stock-level lookup service that accepts an SKU, returns its available quantity, and can report an unknown-SKU fault. + +#### Type +- WSDL; root element `definitions`; service namespace `http://shop.example/stock`. +- Namespaces: default `http://schemas.xmlsoap.org/wsdl/`; `soap` → `http://schemas.xmlsoap.org/wsdl/soap/`; `tns` → `http://shop.example/stock`; `xs` → `http://www.w3.org/2001/XMLSchema`. + +#### Definitions +- Service `StockService`; port `StockPort` uses binding `tns:StockSoapBinding`. +- Port type `StockPortType`; operation `GetStockLevel`: + - Input `tns:GetStockLevelInput`; output `tns:GetStockLevelOutput`; fault `UnknownSku` uses `tns:UnknownSku`. +- Binding `StockSoapBinding`: document-style SOAP over HTTP; operation `GetStockLevel` uses literal input, output, and `UnknownSku` fault. +- Messages: `GetStockLevelInput` carries element `tns:StockLevelRequest`; `GetStockLevelOutput` carries element `tns:StockLevelResponse`; `UnknownSku` carries type `tns:UnknownSkuFault`. +- Embedded schema: `StockLevelRequest` contains `sku` (`xs:string`); `StockLevelResponse` contains `available` (`xs:int`); `UnknownSkuFault` contains `sku` (`xs:string`). + +#### Configuration +- SOAP address: `https://erp.shop.example/soap/stock`. +- SOAP action for `GetStockLevel`: `http://shop.example/stock/GetStockLevel`. +- SOAP transport: `http://schemas.xmlsoap.org/soap/http`; message use: `literal`. + +#### Dependencies +- External SOAP endpoint: `https://erp.shop.example/soap/stock`. +- Referenced SOAP and XML Schema namespaces: `http://schemas.xmlsoap.org/wsdl/soap/`, `http://www.w3.org/2001/XMLSchema`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/wsdl/package.ai.md new file mode 100644 index 00000000..fc1b6e4a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/other/wsdl/package.ai.md @@ -0,0 +1,37 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:25:18Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Provides a SOAP interface for retrieving a stock item’s available quantity by SKU and reporting unknown-SKU faults. + +#### Purpose +- Defines the `StockService` contract for stock-level lookup. + +#### Responsibilities +- Accept an SKU in `StockLevelRequest` and return its available quantity in `StockLevelResponse`. +- Describe the `UnknownSku` fault, which carries the SKU associated with the lookup failure. + +#### Key units +- `StockService` — exposes the `StockPort` endpoint. +- `StockPortType` — defines the `GetStockLevel` operation and its input, output, and fault. +- `StockSoapBinding` — binds the operation to document-style SOAP over HTTP with literal messages. +- `StockLevelRequest` — schema type containing `sku` (`xs:string`). +- `StockLevelResponse` — schema type containing `available` (`xs:int`). +- `UnknownSkuFault` — schema type containing `sku` (`xs:string`). + +#### Data flow +- `GetStockLevelInput` carries `StockLevelRequest` with an SKU; `GetStockLevelOutput` carries `StockLevelResponse` with the available quantity. +- An unknown SKU is reported through the `UnknownSku` fault message. + +#### Dependencies +- SOAP endpoint: `https://erp.shop.example/soap/stock`. +- Uses WSDL SOAP and XML Schema namespaces. + +#### Cross-cutting +- SOAP messages use document style and literal encoding; `GetStockLevel` has SOAP action `http://shop.example/stock/GetStockLevel`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..f13c1146 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/package.ai.md @@ -0,0 +1,57 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:25:34Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> Supports the shop order lifecycle from checkout and fulfilment through shipping, invoicing, back-office cancellation, and operational deployment. + +#### Purpose +- Define the shop’s order-processing workflows, interfaces, persistence mappings, and runtime configuration. +- Provide customer checkout and back-office order management, including cancellation, refunds, cleanup, and audit tracking. + +#### Responsibilities +- **Checkout and fulfilment:** Capture delivery and shipping choices; coordinate stock reservation, payment, approval, shipping, invoicing, and out-of-stock cancellation. +- **Order intake and integration:** Validate and audit incoming JMS orders, route them to manual review or ERP, and handle failed delivery through a dead-letter queue. +- **Shipping, stock, and invoicing:** Apply weight-based shipping charges and parcel limits; expose SOAP stock lookup; issue invoices for completed orders. +- **Customer and back-office interfaces:** Provide Facelets checkout, JSP order listing, and OpenAPI operations for retrieving and cancelling orders. +- **Persistence and runtime:** Configure MyBatis, Hibernate, Jakarta Persistence, web components, EJBs, security, JMS, and data sources. +- **Operations and delivery:** Build and deploy the back-office application with Docker, Kubernetes, and GitHub Actions; schedule cleanup of aged cancelled orders. + +#### Key units +- `orderFulfilment`, `reserveStock`, `waitForPayment`, `amountCheck`, `shipOrder`, `createInvoice` — BPMN workflow and steps for order completion or cancellation. +- `OrderResource`, `PURGE_AFTER_DAYS` — authorized back-office order operations and the 30-day cancelled-order cleanup threshold. +- `ShippingRules`, `ParcelTooHeavyException` — weight-based shipping charges, parcel limits, and overweight-parcel error. +- `checkoutForm`, `checkoutBean`, `order-list.jsp` — customer checkout and back-office order listing interfaces. +- `InvoiceService`, `InvoiceLine`, `InvoiceResult`, `InvoiceNumber` — invoice issuance, calculations, and outcomes. +- `incomingOrders`, `toErp`, `manualReview`, `orderValidator`, `invoiceTranslator` — Camel intake, validation, routing, and translation components. +- `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener`, `ReportDownloadServlet` — configured enterprise services and report endpoint. +- `shop.customer.CustomerMapper`, `customerResult` — MyBatis customer operations and result mapping. +- `Shipment`, `ExpressShipment`, `Shipment.undelivered`, `Shipment.countByCarrier` — shipment ORM mappings and queries. +- `StockService`, `StockPortType`, `StockLevelRequest`, `StockLevelResponse`, `UnknownSkuFault` — SOAP stock lookup contract. +- `listOrders`, `getOrder`, `cancelOrder`, `Order`, `OrderStatus` — Shop Orders API operations and data types. +- `Dockerfile`, `Deployment/orders-backoffice`, `Service/orders-backoffice`, `Ingress/orders-backoffice`, `release-backoffice` — container build, Kubernetes exposure, and release workflow. + +#### Data flow +- Checkout captures address and shipping selection, recalculates the EUR total, and submits an order; BPMN reserves stock, waits for payment, routes large orders for approval, then ships and invokes invoicing, or cancels on `OutOfStock`. +- JMS orders are validated and audited, then routed by total threshold to manual review or ERP; ERP failures go to the dead-letter queue. +- Invoice issuance validates completed-order lines, saves an invoice, and returns an issued or rejected result. +- Back-office cancellation retrieves an order, refunds payment, marks it `CANCELLED`, and audits `order.cancelled`; daily cleanup deletes cancelled orders older than 30 days and audits the deletion count. +- Kubernetes routes traffic to the application container built and deployed through the release workflow. + +#### Dependencies +- **Shop domain:** `Order`, `OrderFilter`, `OrderStatus`, `CompletedOrder`, `Invoice`, `InvoiceRepository`, shipment and parcel types, payment, stock, checkout, event, audit, and web application classes. +- **Messaging and integration:** Apache Camel, JMS queues, `PaymentReceived`, the `shipping` external-task topic, ERP HTTPS endpoint, and invoicing process. +- **Persistence and runtime:** MyBatis, Hibernate, Jakarta Persistence, PostgreSQL, `jdbc/ShopDS`, `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`, and `orders-db`. +- **Web and API contracts:** Jakarta Faces, Jakarta Tags, OpenAPI, SOAP/WSDL, and the configured OAuth 2.0 token endpoint. +- **Delivery tooling:** Maven, Java 21, Docker, GitHub Actions, Kubernetes, and the `orders-db-credentials` Secret. + +#### Cross-cutting +- Shop configuration spans XML descriptors, `integration.properties`, persistence settings, OpenAPI, WSDL, Docker, and Kubernetes manifests. +- Operational patterns include JMS redelivery, Camel dead-letter handling, EJB timing interception, JTA and resource-local persistence units, health/readiness probes, and role-restricted back-office access (`backoffice`, `admin`). +- Noted caveats: Kotlin invoice-number sequencing is unsynchronized; MyBatis `search` substitutes `sortColumn` with unescaped `${}`; a permitted parcel outside all shipping-price tiers may lack a matching tier. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..697990b1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-6-luna/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 0EBC48AC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:25:44Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project supports the shop order lifecycle: checkout and validation feed fulfilment, where stock and payment are handled before approval, shipping, invoicing, or cancellation. Back-office interfaces and Java services let staff query, refund, audit, and clean up orders, alongside customer, stock, shipping, and persistence integrations. Runtime configuration and container, Kubernetes, and release workflows support deploying the back-office application to production. + +#### Packages +- java — Backoffice order operations provide access to open orders, cancellation with payment refunds and audit tracking, and scheduled cleanup of aged cancelled records. +- java/shop — Backoffice order operations support querying open orders, retrieving and refunding cancellations, and purging aged cancelled records. +- other/actions/.github — Releases the orders backoffice application by verifying versioned builds, publishing container images, and deploying them to production. +- other/actions/.github/workflows — Automates release of the orders backoffice application from version-tagged builds through container publishing and production deployment. +- other/actions — Verifies, publishes, and deploys versioned orders backoffice releases to production. +- other/bpmn — Coordinates order fulfilment from stock reservation and payment through approval, shipping, invoicing, or out-of-stock cancellation. +- other/docker — Packages the Orders Backoffice Java application as a production container that serves on port 8080. +- other/facelets — Collects a customer’s delivery address and shipping choice, recalculates the euro order total, and submits the order. +- other/groovy — Determines whether an order qualifies for free delivery, calculates weight-based shipping charges, and rejects parcels exceeding the configured weight limit. +- other/integration — Processes incoming orders by validating them, directing high-value orders to manual review and eligible orders to ERP, while auditing and dead-lettering failures. +- other/jee — Configures the shop back-office web application and enterprise services for report access, admin security, stock reservations, checkout, and order-event handling. +- other/jsp — Provides an order-listing interface for searching customer orders, reviewing order totals and overdue status, and initiating cancellation. +- other/k8s — Runs the Orders backoffice application and makes it reachable over HTTP for shop operations. +- other/kotlin — Issues invoices for completed orders, applying payment terms and tax rates while rejecting orders without invoice lines. +- other/mybatis — Provides database-backed customer lookup, filtering, creation, loyalty-tier promotion, and inactive-customer cleanup. +- other/openapi — Defines the backoffice contract for listing, retrieving, and cancelling shop orders. +- other — Defines the shop’s order, checkout, fulfilment, invoicing, shipping, stock, and back-office interfaces, runtime configuration, and release deployment. +- other/persistence — Configures shop and reporting persistence while mapping shipment records, their order and parcel relationships, and shipment queries. +- other/wsdl — Provides a SOAP interface for retrieving a stock item’s available quantity by SKU and reporting unknown-SKU faults. +- . — Supports the shop order lifecycle from checkout and fulfilment through shipping, invoicing, back-office cancellation, and operational deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..9322ee9f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,44 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:26:54Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> A stateless RESTful service that manages back‑office orders, handling retrieval, cancellation with refunds, and nightly cleanup of old cancelled orders. + +#### Purpose +- Expose back‑office order APIs. +- Process order cancellations with payment refunds and audit logging. +- Periodically purge cancelled orders older than 30 days. + +#### Responsibilities +- **Order retrieval** – list open orders, fetch by ID. +- **Order cancellation** – refund payment, update status, audit event. +- **Scheduled maintenance** – nightly purge of cancelled orders, audit record. + +#### Key units +- `OrderResource` – stateless EJB, JAX‑RS resource at `/orders`. +- `EntityManager em` – JPA persistence context for `Order` entity. +- `PaymentGateway payments` – external payment service for refunds. +- `AuditLog audit` – audit event recorder. +- Named queries: `Order.open`, `Order.purgeCancelled`. + +#### Data flow +1. **GET /orders** → `openOrders()` → `em.createNamedQuery("Order.open")` → `List`. +2. **GET /orders/{id}** → `find(id)` → `em.find(Order)` → `Response` (200 or 404). +3. **POST /orders/{id}/cancel** → `cancel(id)` → `payments.refund(...)`, update status, `audit.record(...)` → `Response` (204 or 404). +4. **@Schedule nightly** → `purgeCancelled()` → `em.createNamedQuery("Order.purgeCancelled")` → `audit.record(...)`. + +#### Dependencies +- Jakarta EE: `@Stateless`, `@EJB`, `@Inject`, `@Schedule`, `@RolesAllowed`, JPA (`EntityManager`, `@PersistenceContext`), JAX‑RS (`@Path`, `@GET`, `@POST`, `@Produces`, `Response`). +- Domain: `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog`. + +#### Cross-cutting +- Stateless EJB ensures thread safety; container manages transactions. +- Security: `@RolesAllowed({"backoffice","admin"})` restricts access. +- Audit logging centralizes event recording for cancellations and purges. +- Scheduled task uses `@Schedule` for nightly cleanup without persistence. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..02724e68 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md @@ -0,0 +1,92 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:25:47Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 37CE394E +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Provides REST endpoints for back‑office order management, including listing open orders, retrieving a specific order, canceling orders, and a scheduled nightly purge of old cancelled orders. + +#### Purpose +- Exposes order back‑office REST API. +- Cancels orders and records audit events. +- Periodically purges cancelled orders older than 30 days. + +#### Type +- `public class OrderResource` + - `@Stateless`, `@Path("/orders")`, `@Produces(MediaType.APPLICATION_JSON)`, `@RolesAllowed({"backoffice","admin"})` + - Extends `Object`. + - Fields: + - `@PersistenceContext(unitName = "shop") private EntityManager em;` + - `@Inject private PaymentGateway payments;` + - `@EJB private AuditLog audit;` + - Methods: 5 (public: 4, private: 1). + +#### Input +- `openOrders()` – no input. +- `find(long id)` – path parameter `id`. +- `cancel(long id)` – path parameter `id`. +- `purgeCancelled()` – no input, scheduled by `@Schedule`. +- Dependencies: `EntityManager`, `PaymentGateway`, `AuditLog`. + +#### Output +- `openOrders()` – `List` of open orders. +- `find(long id)` – `Response` with 200 and order or 404. +- `cancel(long id)` – `Response` 204 or 404; triggers `payments.refund`, updates order status, records audit. +- `purgeCancelled()` – no HTTP response; updates DB, records audit. + +#### Core logic +- `openOrders()` + - `em.createNamedQuery("Order.open", Order.class).getResultList();` +- `find(id)` + - `em.find(Order.class, id)` → 404 if null, else 200 with order. +- `cancel(id)` + - Find order; 404 if null. + - `payments.refund(order.getPaymentReference(), order.getTotal());` + - `order.setStatus(OrderStatus.CANCELLED);` + - `audit.record("order.cancelled", id);` + - Return 204. +- `purgeCancelled()` + - `em.createNamedQuery("Order.purgeCancelled").setParameter("days", PURGE_AFTER_DAYS).executeUpdate();` + - `audit.record("order.purged", removed);` + +#### Public API +- `openOrders() -> List` – list open orders. +- `find(long) -> Response` – retrieve order by id. +- `cancel(long) -> Response` – cancel order by id. + +#### Dependencies +- `jakarta.annotation.security.RolesAllowed` +- `jakarta.ejb.EJB` +- `jakarta.ejb.Schedule` +- `jakarta.ejb.Stateless` +- `jakarta.ejb.TransactionAttribute` +- `jakarta.ejb.TransactionAttributeType` +- `jakarta.inject.Inject` +- `jakarta.persistence.EntityManager` +- `jakarta.persistence.PersistenceContext` +- `jakarta.ws.rs.GET` +- `jakarta.ws.rs.POST` +- `jakarta.ws.rs.Path` +- `jakarta.ws.rs.PathParam` +- `jakarta.ws.rs.Produces` +- `jakarta.ws.rs.core.MediaType` +- `jakarta.ws.rs.core.Response` +- `shop.Order` +- `shop.OrderStatus` +- `shop.PaymentGateway` +- `shop.AuditLog` + +#### Exceptions / Errors +- Returns `Response.Status.NOT_FOUND` if order not found. +- No explicit exception handling; relies on container transaction rollback on failure. + +#### Concurrency +- Stateless EJB; thread‑safe by container. +- `@Schedule` runs in container thread; uses non‑persistent schedule. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/java/shop/package.ai.md new file mode 100644 index 00000000..43ed09d8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/java/shop/package.ai.md @@ -0,0 +1,44 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:26:51Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Provides a stateless RESTful service for back‑office order management, handling order retrieval, cancellation, and nightly cleanup of old cancelled orders. + +#### Purpose +- Expose back‑office order APIs. +- Process order cancellations with payment refunds and audit logging. +- Periodically purge cancelled orders older than 30 days. + +#### Responsibilities +- **Order retrieval** – list open orders, fetch by ID. +- **Order cancellation** – refund payment, update status, audit event. +- **Scheduled maintenance** – nightly purge of cancelled orders, audit record. + +#### Key units +- `OrderResource` – stateless EJB, JAX‑RS resource at `/orders`. +- `EntityManager em` – JPA persistence context for `Order` entity. +- `PaymentGateway payments` – external payment service for refunds. +- `AuditLog audit` – audit event recorder. +- Named queries: `Order.open`, `Order.purgeCancelled`. + +#### Data flow +1. **GET /orders** → `openOrders()` → `em.createNamedQuery("Order.open")` → `List`. +2. **GET /orders/{id}** → `find(id)` → `em.find(Order)` → `Response` (200 or 404). +3. **POST /orders/{id}/cancel** → `cancel(id)` → `payments.refund(...)`, update status, `audit.record(...)` → `Response` (204 or 404). +4. **@Schedule nightly** → `purgeCancelled()` → `em.createNamedQuery("Order.purgeCancelled")` → `audit.record(...)`. + +#### Dependencies +- Jakarta EE: `@Stateless`, `@EJB`, `@Inject`, `@Schedule`, `@RolesAllowed`, JPA (`EntityManager`, `@PersistenceContext`), JAX‑RS (`@Path`, `@GET`, `@POST`, `@Produces`, `Response`). +- Domain: `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog`. + +#### Cross-cutting +- Stateless EJB ensures thread safety; container manages transactions. +- Security: `@RolesAllowed({"backoffice","admin"})` restricts access. +- Audit logging centralizes event recording for cancellations and purges. +- Scheduled task uses `@Schedule` for nightly cleanup without persistence. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/.github/package.ai.md new file mode 100644 index 00000000..a40df145 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/.github/package.ai.md @@ -0,0 +1,39 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:27:00Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Automates the CI/CD pipeline for the Orders Backoffice application, building Java artifacts, containerizing them, and deploying to a production Kubernetes cluster on tag pushes. + +#### Purpose +- Automate release workflow for Orders Backoffice. +- Build, test, containerize, and deploy on tag push. + +#### Responsibilities +- **CI**: compile and test Java code across multiple JDK versions. +- **Containerization**: build Docker image and push to registry. +- **Deployment**: trigger Kubernetes rollout via reusable workflow. + +#### Key units +- **Workflow `release-backoffice`**: orchestrates build, image, and deploy jobs. +- **Job `build`**: runs Maven tests on JDK 21 and 25. +- **Job `image`**: logs into `registry.shop.example`, builds image, pushes tag derived from Git tag. +- **Job `deploy`**: calls external `.github/workflows/deploy-k8s.yml` with production environment. + +#### Data flow +`push` on a tag → `build` job → `image` job (needs `build`) → `deploy` job (needs `image`) → Kubernetes cluster update. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- External workflow `.github/workflows/deploy-k8s.yml`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. + +#### Cross-cutting +- Matrix strategy for JDK versions. +- Single environment (`production`) used across image and deploy jobs. +- Secret handling for Docker registry authentication. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..f185dbc4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,39 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:26:59Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Automates the CI/CD pipeline for the Orders Backoffice application, building Java artifacts, containerizing them, and deploying to a production Kubernetes cluster on tag pushes. + +#### Purpose +- Automate release workflow for Orders Backoffice. +- Build, test, containerize, and deploy on tag push. + +#### Responsibilities +- **CI**: compile and test Java code across multiple JDK versions. +- **Containerization**: build Docker image and push to registry. +- **Deployment**: trigger Kubernetes rollout via reusable workflow. + +#### Key units +- **Workflow `release-backoffice`**: orchestrates build, image, and deploy jobs. +- **Job `build`**: runs Maven tests on JDK 21 and 25. +- **Job `image`**: logs into `registry.shop.example`, builds image, pushes tag derived from Git tag. +- **Job `deploy`**: calls external `.github/workflows/deploy-k8s.yml` with production environment. + +#### Data flow +`push` on a tag → `build` job → `image` job (needs `build`) → `deploy` job (needs `image`) → Kubernetes cluster update. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- External workflow `.github/workflows/deploy-k8s.yml`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. + +#### Cross-cutting +- Matrix strategy for JDK versions. +- Single environment (`production`) used across image and deploy jobs. +- Secret handling for Docker registry authentication. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..2c24c818 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,50 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:25:51Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds, tests, containerizes, and deploys the Orders Backoffice application to a production Kubernetes cluster when a new tag is pushed. + +#### Purpose +- Automate release pipeline for Orders Backoffice. +- Build Java artifacts, create Docker image, push to registry, and trigger Kubernetes deployment. + +#### Type +- GitHub Actions workflow +- API version: default (GitHub Actions) + +#### Definitions +- **Workflow name**: `release-backoffice` +- **Triggers**: + - `push` on tags matching `v*` + - `workflow_dispatch` +- **Jobs**: + - `build` + - `runs-on`: `ubuntu-24.04` + - `strategy.matrix.java`: `[21, 25]` + - Steps: `checkout`, `setup-java` (Temurin, `${{ matrix.java }}`), `mvn -B verify -Pci` + - `image` (needs `build`) + - `runs-on`: `ubuntu-24.04` + - `environment`: `production` + - Steps: `checkout`, `docker/login-action@v3` (registry `registry.shop.example`, credentials from secrets), `docker build` and `docker push` using tag `${GITHUB_REF_NAME#v}` + - `deploy` (needs `image`) + - Uses external workflow `.github/workflows/deploy-k8s.yml` + - Passes `environment: production` and inherits secrets + +#### Configuration +- `REGISTRY_USER` and `REGISTRY_TOKEN` secrets for Docker registry authentication. +- Docker image tag derived from tag name: `registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v}`. + +#### Dependencies +- `actions/checkout@v4` +- `actions/setup-java@v4` (Temurin distribution) +- `docker/login-action@v3` +- External workflow `.github/workflows/deploy-k8s.yml` (Kubernetes deployment). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/package.ai.md new file mode 100644 index 00000000..9e3a6247 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/actions/package.ai.md @@ -0,0 +1,39 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:27:03Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Automates the CI/CD pipeline for the Orders Backoffice application, building Java artifacts, containerizing them, and deploying to a production Kubernetes cluster on tag pushes. + +#### Purpose +- Automate release workflow for Orders Backoffice. +- Build, test, containerize, and deploy on tag push. + +#### Responsibilities +- **CI**: compile and test Java code across multiple JDK versions. +- **Containerization**: build Docker image and push to registry. +- **Deployment**: trigger Kubernetes rollout via reusable workflow. + +#### Key units +- **Workflow `release-backoffice`**: orchestrates build, image, and deploy jobs. +- **Job `build`**: runs Maven tests on JDK 21 and 25. +- **Job `image`**: logs into `registry.shop.example`, builds image, pushes tag derived from Git tag. +- **Job `deploy`**: calls external `.github/workflows/deploy-k8s.yml` with production environment. + +#### Data flow +`push` on a tag → `build` job → `image` job (needs `build`) → `deploy` job (needs `image`) → Kubernetes cluster update. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- External workflow `.github/workflows/deploy-k8s.yml`. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. + +#### Cross-cutting +- Matrix strategy for JDK versions. +- Single environment (`production`) used across image and deploy jobs. +- Secret handling for Docker registry authentication. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..d65d195c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,57 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:25:54Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 8D64B542 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1 + +> Defines a BPMN process for order fulfilment, including payment handling, stock reservation, large‑order approval, shipping, and invoicing. + +#### Purpose +- Models the order fulfilment workflow. +- Handles stock reservation, payment receipt, order approval, shipping, and invoicing. + +#### Type +- BPMN 2.0 XML (`bpmn:definitions` root). +- Namespaces: + - `bpmn` → `http://www.omg.org/spec/BPMN/20100524/MODEL` + - `bpmndi` → `http://www.omg.org/spec/BPMN/20100524/DI` + - `dc` → `http://www.omg.org/spec/DD/20100524/DC` + - `camunda` → `http://camunda.org/schema/1.0/bpmn` + +#### Definitions +- **Message**: `msgPaymentReceived` (name: `PaymentReceived`). +- **Error**: `errOutOfStock` (name: `OutOfStock`, errorCode: `STOCK_EMPTY`). +- **Process**: `orderFulfilment` (name: `Order fulfilment`, executable). + - **Start Event**: `orderPlaced` (name: `Order placed`). + - **Service Task**: `reserveStock` (class: `shop.bpm.ReserveStockDelegate`). + - **Boundary Event**: `stockMissing` (attached to `reserveStock`, errorRef: `errOutOfStock`). + - **Intermediate Catch Event**: `waitForPayment` (messageRef: `msgPaymentReceived`). + - **Exclusive Gateway**: `amountCheck` (name: `Large order?`). + - **Sequence Flow** `large` (condition: `${order.total > 1000}`) → `approveOrder`. + - **Sequence Flow** `small` (condition: `${order.total <= 1000}`) → `shipOrder`. + - **User Task**: `approveOrder` (candidateGroups: `backoffice`). + - **Service Task**: `shipOrder` (type: `external`, topic: `shipping`). + - **Call Activity**: `createInvoice` (calledElement: `invoicing`). + - **End Events**: `orderCompleted` (name: `Order completed`), `orderCancelled` (name: `Order cancelled`). +- **Diagram**: `fulfilmentDiagram` with plane `plane` containing shapes for `orderPlaced`, `reserveStock`, `shipOrder`. + +#### Configuration +- `camunda:class` on `reserveStock`: `shop.bpm.ReserveStockDelegate`. +- `camunda:candidateGroups` on `approveOrder`: `backoffice`. +- `camunda:type` on `shipOrder`: `external`. +- `camunda:topic` on `shipOrder`: `shipping`. +- `calledElement` on `createInvoice`: `invoicing`. +- Condition expressions: `${order.total > 1000}` and `${order.total <= 1000}`. + +#### Dependencies +- External service class: `shop.bpm.ReserveStockDelegate`. +- External topic: `shipping`. +- Called element: `invoicing`. +- BPMN diagram layout references (`bpmndi`, `dc` bounds). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/bpmn/package.ai.md new file mode 100644 index 00000000..1520cf92 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/bpmn/package.ai.md @@ -0,0 +1,50 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:27:05Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> Provides a BPMN‑based order‑fulfilment workflow that reserves stock, processes payments, approves large orders, ships items, and creates invoices. + +#### Purpose +- Model the end‑to‑end order fulfilment process. +- Coordinate stock reservation, payment receipt, approval, shipping, and invoicing. + +#### Responsibilities +- **Order Placement** – start event triggers the workflow. +- **Stock Management** – service task `reserveStock` with error handling for out‑of‑stock. +- **Payment Handling** – intermediate catch event waiting for `msgPaymentReceived`. +- **Order Approval** – exclusive gateway splits large vs. small orders; user task for back‑office approval. +- **Shipping** – external task `shipOrder` on topic `shipping`. +- **Invoicing** – call activity invoking the `invoicing` process. +- **Completion** – end events for successful or cancelled orders. + +#### Key units +- **Process** `orderFulfilment` – executable BPMN process. +- **Delegate** `shop.bpm.ReserveStockDelegate` – Java class for stock reservation. +- **Message** `msgPaymentReceived` – signals payment receipt. +- **Error** `errOutOfStock` – triggers cancellation when stock is unavailable. +- **Topic** `shipping` – external task queue for shipping service. +- **Called Element** `invoicing` – sub‑process for invoice creation. + +#### Data flow +1. Order placed → `reserveStock` (delegate) → success or `errOutOfStock`. +2. On success, wait for `msgPaymentReceived`. +3. Evaluate `order.total` at `amountCheck` gateway. +4. Large orders → `approveOrder` (back‑office); small orders → `shipOrder` (external). +5. After approval or shipping, call `createInvoice` (invoicing). +6. End with `orderCompleted` or `orderCancelled`. + +#### Dependencies +- **Internal**: BPMN definitions, diagram layout (`bpmndi`, `dc`). +- **External**: Java delegate `shop.bpm.ReserveStockDelegate`, external task topic `shipping`, called process `invoicing`. + +#### Cross-cutting +- Error handling via boundary event on `reserveStock`. +- Conditional expressions `${order.total > 1000}` and `${order.total <= 1000}`. +- Camunda extensions (`camunda:class`, `camunda:type`, `camunda:topic`, `camunda:candidateGroups`). +- Single executable process with clear start and end events. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..6bca5541 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/docker/Dockerfile.ai.md @@ -0,0 +1,49 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:26:00Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds a Java back‑office application, packages it with Maven, and runs it in an Alpine JRE container exposing port 8080 with a health check. + +#### Purpose +- Compile and package the `orders-backoffice` Java application. +- Deploy the resulting JAR as a containerized service. + +#### Type +- `Dockerfile` + Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine` + Build stage: `build` + Runtime stage: default + +#### Definitions +- **Stages** + - `build`: uses `maven:3.9-eclipse-temurin-21` + - default: uses `eclipse-temurin:21-jre-alpine` +- **Build commands** + - `mvn -B dependency:go-offline` + - `mvn -B package -DskipTests` +- **Runtime commands** + - `addgroup -S shop && adduser -S backoffice -G shop` + - `COPY --from=build /src/target/orders-backoffice.jar /opt/shop/orders-backoffice.jar` + - `EXPOSE 8080` + - `USER backoffice` + - `HEALTHCHECK --interval=30s CMD wget -qO- http://localhost:8080/health/live || exit 1` + - `ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"]` + +#### Configuration +- `ARG APP_VERSION=2.1.0` +- `ENV JAVA_OPTS="-XX:MaxRAMPercentage=75"` +- `ENV SHOP_PROFILE=production` + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine` +- Maven project `pom.xml` and source `src/` +- JAR produced: `orders-backoffice.jar` (copied from build stage) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/docker/package.ai.md new file mode 100644 index 00000000..0b063a26 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/docker/package.ai.md @@ -0,0 +1,39 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:27:09Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> A Dockerfile that builds and deploys a Java back‑office service for order management. + +#### Purpose +- Compile the `orders-backoffice` Java application with Maven. +- Package the resulting JAR into a lightweight Alpine JRE container. + +#### Responsibilities +- **Build stage**: resolve dependencies, compile, and package the application. +- **Runtime stage**: set up a non‑root user, expose service port, provide health check, and launch the JAR. + +#### Key units +- `orders-backoffice.jar` – the compiled Spring Boot application. +- `mvn -B dependency:go-offline` – pre‑fetch Maven dependencies. +- `mvn -B package -DskipTests` – build the JAR. +- `HEALTHCHECK` – verifies `/health/live` endpoint. +- `ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"]` – starts the application. + +#### Data flow +Source code → Maven build → `orders-backoffice.jar` → copied to runtime image → container starts JAR → exposes port 8080 → health check monitors `/health/live`. + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21` (build), `eclipse-temurin:21-jre-alpine` (runtime). +- Maven project files (`pom.xml`, `src/`). +- Environment variables: `JAVA_OPTS`, `SHOP_PROFILE`. + +#### Cross-cutting +- Uses multi‑stage Docker build to keep runtime image small. +- Non‑root user (`backoffice`) for security. +- Health check ensures service readiness before traffic routing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..5998a196 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,50 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:26:03Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> A checkout page that collects shipping address, selects shipping method, shows total, and submits the order. + +#### Purpose +- Collect shipping address and method. +- Display calculated total. +- Submit order. + +#### Type +- Facelets page (`.xhtml`), template `"/WEB-INF/templates/shop.xhtml"`. +- Namespaces: `h` = Jakarta Faces HTML, `f` = Jakarta Faces Core, `ui` = Jakarta Faces Facelets. + +#### Data +- `checkoutBean.address.street` (input, required). +- `checkoutBean.address.zip` (input, regex `[0-9]{5}`). +- `checkoutBean.shippingMethod` (selectOneMenu). +- `checkoutBean.shippingMethods` (selectItems collection). +- `checkoutBean.total` (outputText, currency EUR). +- `checkoutBean.recalculate` (ajax listener). +- `checkoutBean.placeOrder` (commandButton action). + +#### Actions +- `` submits to `checkoutBean.placeOrder`. +- `` updates total on shipping change. +- Commented `` for `checkoutBean.saveCart` (inactive). + +#### Structure +- Uses template `"/WEB-INF/templates/shop.xhtml"`. +- Defines `content` section. +- Includes `/WEB-INF/includes/payment-hints.xhtml`. + +#### Server code +- No scriptlets or expressions beyond EL. + +#### Dependencies +- Tag libraries: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- Included file: `/WEB-INF/includes/payment-hints.xhtml`. +- Bean: `checkoutBean`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/facelets/package.ai.md new file mode 100644 index 00000000..38a3d31e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/facelets/package.ai.md @@ -0,0 +1,41 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:27:12Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> A web‑frontend page that gathers a customer’s shipping details, lets them pick a shipping method, shows the order total, and submits the order. + +#### Purpose +- Capture shipping address and method. +- Compute and display order total. +- Submit the order to the backend. + +#### Responsibilities +- **User input collection** – shipping address fields, shipping method selector. +- **Dynamic total calculation** – AJAX listener updates total when shipping changes. +- **Order submission** – form posts to `checkoutBean.placeOrder`. + +#### Key units +- **`checkout.xhtml`** – Facelets page, template `"/WEB-INF/templates/shop.xhtml"`, defines the checkout form and UI. +- **`checkoutBean`** – Managed bean backing the page; properties: `address.street`, `address.zip`, `shippingMethod`, `shippingMethods`, `total`; methods: `recalculate()`, `placeOrder()`. + +#### Data flow +1. User enters `address.street` and `address.zip` (validated with regex). +2. User selects `shippingMethod` from `shippingMethods` list. +3. Changing `shippingMethod` triggers ``, updating `checkoutBean.total`. +4. User clicks the submit button, invoking `checkoutBean.placeOrder()` to process the order. + +#### Dependencies +- Jakarta Faces tag libraries: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- Includes `/WEB-INF/includes/payment-hints.xhtml` for payment guidance. +- Relies on the `checkoutBean` managed bean for state and business logic. + +#### Cross-cutting +- Uses EL expressions for binding and method calls. +- AJAX partial rendering for real‑time total updates. +- Validation via EL regex on `address.zip`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..d62b12bd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,57 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:26:05Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Calculates shipping cost based on order weight and total, applying free‑shipping threshold and rejecting overweight parcels. + +#### Purpose +- Implements shipping cost calculation with tiered pricing. +- Provides unit tests for shipping rules. + +#### Type +- `class ShippingRulesSpec` – test class extending `spock.lang.Specification`. +- `class ShippingRules` – shipping rule engine, `@CompileStatic`. + +#### Input +- `ShippingRules` constructor: `carrier: String`, `maxParcelKg: BigDecimal`. +- `ShippingRules.costFor(Order order)` – `Order` with `total: BigDecimal`, `weightKg: BigDecimal`. + +#### Output +- `ShippingRules.costFor` returns `BigDecimal` cost or `0` for free shipping. +- Throws `ParcelTooHeavyException` when `order.weightKg > maxParcelKg`. + +#### Core logic +- If `order.weightKg > maxParcelKg` → throw `ParcelTooHeavyException`. +- If `order.total >= ShippingRulesSpec.FREE_SHIPPING_THRESHOLD` → return `0`. +- Define `tiers` list: `[[upTo: 2, price: 4.99], [upTo: 10, price: 9.99], [upTo: 31.5, price: 19.99]]`. +- Find first tier where `order.weightKg <= tier.upTo` and return `tier.price` as `BigDecimal`. + +#### Public API +- `ShippingRulesSpec."orders above the threshold ship for free"() -> void` – test. +- `ShippingRulesSpec."a parcel of #weight kg costs #expected"() -> void` – parameterized test. +- `ShippingRulesSpec."an overweight parcel is rejected"() -> void` – test. +- `ShippingRulesSpec.heavyOrder(BigDecimal kg) -> Order` – private helper. +- `ShippingRules.costFor(Order order) -> BigDecimal` – public method. + +#### Dependencies +- `groovy.transform.CompileStatic` +- `spock.lang.Specification` +- `spock.lang.Unroll` +- `Order` (external) +- `ParcelTooHeavyException` (external) + +#### Exceptions / Errors +- `ParcelTooHeavyException` thrown for overweight parcels. +- No explicit null checks; relies on Groovy null safety. + +#### Concurrency +- None. All operations are synchronous and stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/groovy/package.ai.md new file mode 100644 index 00000000..6eb1ae5b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/groovy/package.ai.md @@ -0,0 +1,40 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:27:14Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> Calculates shipping cost for orders, applying free‑shipping thresholds and tiered rates while rejecting parcels that exceed a maximum weight. + +#### Purpose +- Provide a shipping cost engine that determines fees based on order weight and total. +- Offer unit tests validating the shipping logic. + +#### Responsibilities +- **Shipping cost calculation** – determine fee or free shipping, enforce weight limits. +- **Testing** – verify free‑shipping threshold, tiered pricing, and overweight rejection. + +#### Key units +- **`ShippingRules`** – statically compiled engine; constructor takes `carrier` and `maxParcelKg`; method `costFor(Order)` returns `BigDecimal` or throws `ParcelTooHeavyException`. +- **`ShippingRulesSpec`** – Spock specification testing `ShippingRules`; contains parameterized tests for tiered pricing, free‑shipping, and overweight handling. + +#### Data flow +1. `ShippingRulesSpec` creates a `ShippingRules` instance with a carrier and `maxParcelKg`. +2. For each test order, `ShippingRules.costFor(order)` is invoked. +3. The method checks weight against `maxParcelKg`; if exceeded, throws `ParcelTooHeavyException`. +4. If the order total meets or exceeds `FREE_SHIPPING_THRESHOLD`, returns `0`. +5. Otherwise, selects the first tier where `order.weightKg <= tier.upTo` and returns the tier’s price. + +#### Dependencies +- **Groovy**: `@CompileStatic` for type safety. +- **Spock**: `Specification`, `Unroll` for testing. +- **External types**: `Order`, `ParcelTooHeavyException`. + +#### Cross-cutting +- No concurrency; all operations are synchronous and stateless. +- Uses Groovy’s null‑safe calls; no explicit null checks. +- Exception handling is limited to `ParcelTooHeavyException` for overweight parcels. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..01ca18c4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md @@ -0,0 +1,62 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:26:07Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Configures Camel integration routes for order processing, validation, and ERP communication. + +#### Purpose +- Defines order validation, translation, and routing logic. +- Handles exceptions and dead‑letter routing. +- Splits orders for manual review and audits. + +#### Type +- Spring XML configuration (`` root). +- Declares namespaces: `http://www.springframework.org/schema/beans` (default), `http://camel.apache.org/schema/spring` (Camel). +- Includes Camel schema location. + +#### Definitions +- **Beans** + - `orderValidator` → `shop.integration.OrderValidator` + - `invoiceTranslator` → `shop.integration.InvoiceTranslator` +- **Camel Context** `orderIntegration` + - **Property placeholder** `properties` → `classpath:integration.properties` + - **Exception handling** for `shop.integration.ErpUnavailableException` + - Redelivery: max 5, delay 2000 ms, exponential back‑off. + - Handled → `true`; sends to `jms:queue:orders.deadletter`. + - **Routes** + - `incomingOrders` + - From `jms:queue:{{orders.incoming.queue}}` + - Bean `orderValidator.validate` + - Choice: if `${body.total} > {{orders.review.threshold}}` → `direct:manualReview`; else → `direct:toErp`. + - WireTap to `seda:orderAudit`. + - `toErp` + - From `direct:toErp` + - Bean `invoiceTranslator` + - Dynamic to `https://{{erp.host}}/api/orders/${header.orderId}`. + - `manualReview` + - From `direct:manualReview` + - Split on `${body.lines}`; each part sent to `jms:queue:review.lines`. + - (Commented `legacyFtpImport` route omitted.) + +#### Configuration +- Property placeholders: + - `orders.incoming.queue` + - `orders.review.threshold` + - `erp.host` +- Exception policy values: + - `maximumRedeliveries="5"` + - `redeliveryDelay="2000"` + - `useExponentialBackOff="true"` + +#### Dependencies +- External classes: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `shop.integration.ErpUnavailableException`. +- External systems: JMS queues (`orders.deadletter`, `review.lines`), SEDA channel (`orderAudit`), HTTP endpoint `https://{{erp.host}}/api/orders/...`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/integration/package.ai.md new file mode 100644 index 00000000..132fae6e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/integration/package.ai.md @@ -0,0 +1,47 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:27:18Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Provides Camel‑based integration for order validation, audit, and ERP submission with dead‑letter handling. + +#### Purpose +- Configure order processing routes in Camel. +- Validate orders, audit, and route to ERP or manual review. +- Handle ERP unavailability with retries and dead‑letter queue. + +#### Responsibilities +- **Order Validation** – bean `orderValidator` checks order integrity. +- **Audit & Review** – split orders for manual review and audit logging. +- **ERP Communication** – translate orders via `invoiceTranslator` and POST to ERP API. +- **Error Handling** – retry logic for `ErpUnavailableException` and dead‑letter routing. + +#### Key units +- `orderValidator` (`shop.integration.OrderValidator`) – validates order payload. +- `invoiceTranslator` (`shop.integration.InvoiceTranslator`) – converts order to ERP format. +- `ErpUnavailableException` (`shop.integration.ErpUnavailableException`) – signals ERP connectivity issues. +- Camel context `orderIntegration` – hosts routes and exception policy. +- Routes: `incomingOrders`, `toErp`, `manualReview`. + +#### Data flow +1. **Incoming**: `jms:queue:{{orders.incoming.queue}}` → `orderValidator.validate`. +2. **Decision**: if `body.total > {{orders.review.threshold}}` → `direct:manualReview`; else → `direct:toErp`. +3. **Audit**: `wireTap` to `seda:orderAudit`. +4. **ERP Path**: `direct:toErp` → `invoiceTranslator` → HTTP POST to `https://{{erp.host}}/api/orders/${header.orderId}`. +5. **Manual Review**: split `body.lines` → `jms:queue:review.lines`. + +#### Dependencies +- **Spring** – XML configuration, property placeholders. +- **Camel** – routes, exception handling, SEDA, JMS, HTTP. +- **External classes** – `OrderValidator`, `InvoiceTranslator`, `ErpUnavailableException`. +- **External systems** – JMS queues (`orders.deadletter`, `review.lines`), SEDA channel (`orderAudit`), ERP HTTP endpoint. + +#### Cross-cutting +- Property placeholders (`orders.incoming.queue`, `orders.review.threshold`, `erp.host`). +- Exception policy: 5 redeliveries, 2000 ms delay, exponential back‑off. +- Dead‑letter queue `jms:queue:orders.deadletter` for unprocessable orders. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..04524579 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,40 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:26:11Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Configures Jakarta EE EJB components, their environment, transactions, and interceptors for a shop application. + +#### Purpose +- Declares EJBs and message-driven bean for stock reservation, checkout, and order events. +- Sets environment entry, local reference, activation config, transaction attributes, and interceptor bindings. + +#### Type +- Jakarta EE descriptor (`ejb-jar.xml`), root element `ejb-jar` with namespace `https://jakarta.ee/xml/ns/jakartaee` version `4.0`. + +#### Definitions +- **Session Beans** + - `StockReservationBean` (`shop.stock.StockReservationBean`), `Stateless`, env-entry `reservationMinutes` (`java.lang.Integer`, value `45`). + - `CheckoutSessionBean` (`shop.checkout.CheckoutSessionBean`), `Stateful`, local reference `ejb/StockReservation` to `shop.stock.StockReservation`. +- **Message-Driven Bean** + - `OrderPlacedListener` (`shop.events.OrderPlacedListener`), activation property `destinationLookup` = `java:/jms/queue/OrderPlaced`. +- **Interceptors** + - `shop.audit.TimingInterceptor` applied globally via `` and `` for all EJBs. +- **Container Transaction** + - Method `reserve` of `StockReservationBean` uses `RequiresNew`. + +#### Configuration +- `reservationMinutes` = `45`. +- `destinationLookup` = `java:/jms/queue/OrderPlaced`. +- Transaction attribute for `reserve` = `RequiresNew`. + +#### Dependencies +- Java classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`, `shop.stock.StockReservation`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jee/package.ai.md new file mode 100644 index 00000000..172da467 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jee/package.ai.md @@ -0,0 +1,46 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:27:20Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> Provides the Jakarta EE configuration for a shop application, wiring EJB services, JMS listeners, and web components with security, transactions, and resource references. + +#### Purpose +- Declares and configures EJB session beans, a message‑driven bean, and web module components for a shop system. + +#### Responsibilities +- **EJB configuration** – session beans for stock reservation and checkout, a JMS listener for order events, and global timing interceptor. +- **Web configuration** – servlet for report downloads, request‑ID filter, startup audit listener, security constraints for admin area, and JDBC data source reference. + +#### Key units +- `shop.stock.StockReservationBean` – stateless EJB, `reserve` method runs in a new transaction, uses `reservationMinutes` env‑entry. +- `shop.checkout.CheckoutSessionBean` – stateful EJB, references `StockReservation`. +- `shop.events.OrderPlacedListener` – message‑driven bean listening on `java:/jms/queue/OrderPlaced`. +- `shop.audit.TimingInterceptor` – interceptor applied to all EJBs. +- `shop.web.ReportDownloadServlet` – handles `/reports/*` requests, loads on startup. +- `shop.web.RequestIdFilter` – filter applied to all requests. +- `shop.web.StartupAuditListener` – context listener for startup audit. +- `jdbc/ShopDS` – JNDI data source for database access. + +#### Data flow +1. **Order placement** → JMS queue `OrderPlaced` → `OrderPlacedListener` processes event. +2. **Stock reservation** → `StockReservationBean.reserve()` invoked by `CheckoutSessionBean` during checkout. +3. **Report download** → client requests `/reports/*` → `ReportDownloadServlet` serves files from `/var/shop/reports`. +4. **Request handling** → `RequestIdFilter` injects request IDs into all servlet calls. +5. **Startup** → `StartupAuditListener` performs audit initialization. + +#### Dependencies +- **Internal**: EJBs reference each other (`CheckoutSessionBean` → `StockReservation`), interceptor applied globally. +- **External**: JMS queue `java:/jms/queue/OrderPlaced`, JDBC data source `jdbc/ShopDS`, servlet container for web descriptors. + +#### Cross-cutting +- Global `TimingInterceptor` for performance logging on all EJB methods. +- Environment entry `reservationMinutes` shared by `StockReservationBean`. +- Security constraint restricts `/admin/*` to role `admin`. +- Session timeout set to 20 minutes for web module. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jee/web.xml.ai.md new file mode 100644 index 00000000..4eb0b0c0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jee/web.xml.ai.md @@ -0,0 +1,59 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:26:13Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Configures servlet mappings, filters, listeners, security constraints, and resource references for the shop‑backoffice web application. + +#### Purpose +- Defines servlet, filter, listener, and security configuration for a Jakarta EE web module. + +#### Type +- Jakarta EE web descriptor (`web.xml`) + Root element: `web-app` + Namespace: `https://jakarta.ee/xml/ns/jakartaee` (prefix `jakartaee` implied) + +#### Definitions +- **Context parameter** + - `shop.reportDirectory` → `/var/shop/reports` +- **Servlet** + - `ReportDownloadServlet` (`shop.web.ReportDownloadServlet`) – load‑on‑startup `1` + - (LegacyExportServlet commented out) +- **Servlet mapping** + - `ReportDownloadServlet` → `/reports/*` +- **Filter** + - `RequestIdFilter` (`shop.web.RequestIdFilter`) +- **Filter mapping** + - `RequestIdFilter` → `/*` +- **Listener** + - `shop.web.StartupAuditListener` +- **Session config** + - Timeout: `20` minutes +- **Security constraint** + - Resource collection `backoffice` → `/admin/*` + - Auth constraint: role `admin` +- **Security role** + - `admin` +- **Resource reference** + - Name: `jdbc/ShopDS` + - Type: `javax.sql.DataSource` + +#### Configuration +- `shop.reportDirectory` = `/var/shop/reports` +- `load-on-startup` for `ReportDownloadServlet` = `1` +- Session timeout = `20` +- URL patterns: `/reports/*`, `/*`, `/admin/*` + +#### Dependencies +- Servlet class: `shop.web.ReportDownloadServlet` +- Filter class: `shop.web.RequestIdFilter` +- Listener class: `shop.web.StartupAuditListener` +- DataSource JNDI name: `jdbc/ShopDS` (type `javax.sql.DataSource`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..47e36a9b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,48 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:26:16Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> Displays a list of open orders with search and cancel options. + +#### Purpose +- Show orders filtered by customer email and status. +- Allow cancellation of individual orders. + +#### Type +- JSP page +- Content type: `text/html;charset=UTF-8` +- Tag libraries: `c` (`jakarta.tags.core`), `fmt` (`jakarta.tags.fmt`) + +#### Data +- Request attribute `orderFilter` → `OrderFilter filter` +- Request attribute `orders` → collection iterated as `order` +- Request parameter `customerEmail` → used in search form value +- Request parameter `status` → used in search form select +- `filter.getPageSize()` → displayed as page size + +#### Actions +- Search form: `GET` to `${pageContext.request.contextPath}/orders/search` + - Fields: `customerEmail` (text), `status` (select) +- Cancel link: `orders/${order.id}/cancel` (GET) + +#### Structure +- Includes header fragment `/WEB-INF/jspf/header.jspf` +- Includes footer fragment `/WEB-INF/jspf/footer.jspf` + +#### Server code +- Scriptlet imports `java.util.List`, `shop.Order`, `shop.OrderFilter` +- Scriptlet retrieves `OrderFilter` from request and calculates `pageSize` + +#### Dependencies +- Tag libraries: `jakarta.tags.core`, `jakarta.tags.fmt` +- Included files: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf` +- Beans/Classes: `shop.Order`, `shop.OrderFilter` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jsp/package.ai.md new file mode 100644 index 00000000..575b6073 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/jsp/package.ai.md @@ -0,0 +1,40 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:27:28Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> A JSP page that lists open orders, lets users filter by customer email or status, and cancel individual orders. + +#### Purpose +- Render a searchable list of open orders. +- Provide a cancel link for each order. + +#### Responsibilities +- **Order filtering** – read `customerEmail` and `status` from request, display them in a search form. +- **Order display** – iterate over `orders` (a collection of `shop.Order`) and show details. +- **Order cancellation** – generate a cancel URL for each order. + +#### Key units +- **`order-list.jsp`** – main view page; uses JSTL core (`c`) and fmt tags. +- **`OrderFilter`** – request attribute holding filter criteria and pagination size. +- **`shop.Order`** – domain object representing an order. + +#### Data flow +1. **Request** → `order-list.jsp` receives `orderFilter` and `orders` attributes. +2. **Search form** submits to `/orders/search` with `customerEmail` and `status`. +3. **Cancel link** points to `/orders/{id}/cancel` for each order. + +#### Dependencies +- JSTL core (`jakarta.tags.core`) and fmt (`jakarta.tags.fmt`) libraries. +- Header/footer fragments: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf`. +- Domain classes: `shop.Order`, `shop.OrderFilter`. + +#### Cross-cutting +- Uses EL expressions for dynamic values (`${order.id}`, `${filter.pageSize}`, etc.). +- Standard JSP scriptlet for importing Java classes and retrieving the filter object. +- Consistent page layout via included header/footer fragments. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..3b37b0c2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,55 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:26:20Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the `orders-backoffice` application as a Kubernetes Deployment, Service, and Ingress. + +#### Purpose +- Runs the orders back‑office microservice. +- Exposes it internally via a Service and externally via an Ingress. + +#### Type +- Kubernetes `Deployment`, `Service`, and `Ingress` manifests (apiVersion `apps/v1`, `v1`, `networking.k8s.io/v1`). + +#### Definitions +- **Deployment** `orders-backoffice` + - 3 replicas. + - Container `backoffice` + - Image `registry.shop.example/orders-backoffice:2.1.0`. + - Port `8080`. + - Env: + - `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop`. + - `SHOP_DB_PASSWORD` from secret `orders-db-credentials` key `password`. + - Readiness probe: HTTP GET `/health/ready` on port `8080`. + - Resources limits: `memory: 768Mi`, `cpu: "1"`. +- **Service** `orders-backoffice` + - Selector `app: orders-backoffice`. + - Exposes port `80` mapped to target port `8080`. +- **Ingress** `orders-backoffice` + - Host `backoffice.shop.example`. + - Path `/` (Prefix) routes to Service `orders-backoffice` port `80`. + +#### Configuration +- `replicas=3` +- `containerPort=8080` +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD` from `orders-db-credentials.password` +- `readinessProbe.path=/health/ready` +- `resources.limits.memory=768Mi` +- `resources.limits.cpu="1"` +- Service port `80` → target `8080` +- Ingress host `backoffice.shop.example`, path `/` + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0`. +- Secret `orders-db-credentials` (key `password`). +- Service `orders-backoffice` (used by Ingress). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/k8s/package.ai.md new file mode 100644 index 00000000..744ab80d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/k8s/package.ai.md @@ -0,0 +1,41 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:27:31Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Deploys and exposes the orders‑backoffice microservice on Kubernetes, handling database connectivity, health checks, and external routing. + +#### Purpose +- Run the orders‑backoffice application in a scalable, containerized environment. +- Provide internal service discovery and external HTTP access. + +#### Responsibilities +- **Deployment**: orchestrate pod replicas, container image, environment, probes, and resource limits. +- **Service**: expose the pods on a stable cluster IP and port. +- **Ingress**: route external traffic to the service with host/path rules. + +#### Key units +- **Deployment `orders-backoffice`** – 3 replicas, container `backoffice` (image `registry.shop.example/orders-backoffice:2.1.0`), port `8080`, readiness probe `/health/ready`, env `SHOP_DB_URL` and `SHOP_DB_PASSWORD` from secret. +- **Service `orders-backoffice`** – selector `app: orders-backoffice`, port `80` → target `8080`. +- **Ingress `orders-backoffice`** – host `backoffice.shop.example`, path `/` → Service `orders-backoffice` port `80`. + +#### Data flow +1. **Ingress** receives HTTP requests on `backoffice.shop.example/`. +2. Routes to **Service** `orders-backoffice` on port `80`. +3. Service forwards to one of the **Deployment** pods on port `8080`. +4. Pod reads `SHOP_DB_URL` and `SHOP_DB_PASSWORD` (from secret) to connect to the orders database. + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0`. +- Kubernetes secret `orders-db-credentials` (key `password`). +- PostgreSQL database reachable at `orders-db:5432`. + +#### Cross-cutting +- Consistent use of environment variables for database configuration. +- Health‑check via HTTP readiness probe to ensure pod readiness before traffic is routed. +- Resource limits (`memory: 768Mi`, `cpu: "1"`) enforce pod sizing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..adc9ded2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,92 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:26:22Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Generates and stores invoices for completed orders, applying tax rules and payment terms. + +#### Purpose +- Issues invoices for completed orders. +- Applies reduced tax rate for specific categories. +- Stores invoices via `InvoiceRepository`. + +#### Type +- `final class InvoiceService` (class) + - Extends `Any`. + - Implements no interfaces. + - Modifiers: none. + - Annotations: none. +- `value class InvoiceNumber` (value class) + - Modifiers: `@JvmInline`. +- `data class InvoiceLine` (data class) + - Modifiers: none. +- `sealed interface InvoiceResult` (interface) + - Modifiers: none. + - Subtypes: + - `data class Issued` (data class) + - `data class Rejected` (data class) + +#### Input +- `InvoiceService` constructor: `repository: InvoiceRepository`, `clock: () -> LocalDate = LocalDate::now`. +- `issue(order: CompletedOrder)` parameter: `order: CompletedOrder`. +- `taxRate(category: String)` parameter: `category: String`. +- `nextNumber()` uses internal `sequence` and `PREFIX`. +- `List.total()` operates on list of `InvoiceLine`. + +#### Output +- `issue(order)` returns `InvoiceResult` (`Issued` or `Rejected`). +- `taxRate` returns `BigDecimal`. +- `nextNumber` returns `InvoiceNumber`. +- `List.total()` returns `BigDecimal`. +- Side effect: `repository.save(invoice)` writes invoice. + +#### Core logic +- `issue(order)` + - If `order.lines.isEmpty()` → return `Rejected` with message. + - Generate `number` via `nextNumber()`. + - Create `Invoice(number, order.customerId, order.lines, clock().plusDays(PAYMENT_TERM_DAYS.toLong()))`. + - Call `repository.save(invoice)`. + - Return `Issued(number, invoice.dueDate)`. +- `taxRate(category)` + - If `category` in `REDUCED_TAX_CATEGORIES` → `0.07`; else `0.19`. +- `nextNumber()` + - Increment `sequence`; format `"INV-${sequence}"`. +- `List.total()` + - Fold over lines summing `line.amount`. + +#### Public API +- `InvoiceService.issue(order: CompletedOrder) -> InvoiceResult` – issue invoice for order. +- `InvoiceService.taxRate(category: String) -> BigDecimal` – get tax rate. +- `InvoiceNumber.value: String` – invoice number string. +- `InvoiceLine.sku: String` – product SKU. +- `InvoiceLine.quantity: Int` – quantity. +- `InvoiceLine.unitPrice: BigDecimal` – unit price. +- `InvoiceLine.amount: BigDecimal` – line total. +- `InvoiceResult.Issued.number: InvoiceNumber` – issued number. +- `InvoiceResult.Issued.dueDate: LocalDate` – due date. +- `InvoiceResult.Rejected.reason: String` – rejection reason. +- `List.total() -> BigDecimal` – total amount of lines. + +#### Dependencies +- `java.math.BigDecimal` +- `java.time.LocalDate` +- `kotlinx.coroutines.Dispatchers` +- `kotlinx.coroutines.withContext` +- `shop.billing.InvoiceRepository` (assumed) +- `shop.billing.CompletedOrder` (assumed) +- `shop.billing.Invoice` (assumed) + +#### Exceptions / Errors +- None declared; `issue` returns `Rejected` for empty lines. + +#### Concurrency +- `issue` runs in `Dispatchers.IO` context. +- No explicit synchronization; `sequence` is mutable but accessed only within coroutine context. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/kotlin/package.ai.md new file mode 100644 index 00000000..cc654eb0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/kotlin/package.ai.md @@ -0,0 +1,49 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:27:38Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> Generates and stores invoices for completed orders, applying tax rules and payment terms. + +#### Purpose +- Issue invoices for completed orders. +- Apply reduced tax rates for specific product categories. +- Persist invoices via `InvoiceRepository`. + +#### Responsibilities +- **Invoice generation** – create `Invoice` objects with unique numbers and due dates. +- **Tax calculation** – determine tax rate per product category. +- **Validation** – reject orders with no line items. +- **Persistence** – save invoices asynchronously to a repository. + +#### Key units +- `InvoiceService` – orchestrates invoice creation, validation, tax lookup, and persistence. +- `InvoiceNumber` – inline value class wrapping the invoice identifier string. +- `InvoiceLine` – data class holding SKU, quantity, unit price, and line total. +- `InvoiceResult` (sealed interface) – outcome of an invoice attempt: + - `Issued` – contains `InvoiceNumber` and due date. + - `Rejected` – contains a rejection reason. +- Extension `List.total()` – sums line amounts. + +#### Data flow +1. `issue(order: CompletedOrder)` receives a completed order. +2. Validates that `order.lines` is non‑empty; otherwise returns `Rejected`. +3. Generates a new `InvoiceNumber` via `nextNumber()`. +4. Builds an `Invoice` with customer ID, lines, and a due date calculated from the current date plus `PAYMENT_TERM_DAYS`. +5. Persists the invoice with `repository.save(invoice)` inside a `Dispatchers.IO` coroutine. +6. Returns `Issued(number, dueDate)`. + +#### Dependencies +- **Internal** – `InvoiceRepository`, `CompletedOrder`, `Invoice` (assumed in `shop.billing`). +- **External** – `java.math.BigDecimal`, `java.time.LocalDate`, `kotlinx.coroutines.Dispatchers`, `kotlinx.coroutines.withContext`. + +#### Cross-cutting +- **Concurrency** – `issue` runs in `Dispatchers.IO`; mutable `sequence` is accessed only within this coroutine context. +- **Error handling** – no exceptions; business failures are represented by `InvoiceResult.Rejected`. +- **Configuration** – tax rates are hard‑coded (`REDUCED_TAX_CATEGORIES` → 0.07, others → 0.19); payment term days are a constant. +- **Utility** – `List.total()` provides a reusable total calculation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..a4341925 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,58 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:26:30Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Defines MyBatis SQL mappings for the `shop.customer.CustomerMapper` namespace, including CRUD operations and dynamic queries for customer data. + +#### Purpose +- Maps SQL statements to Java methods for customer persistence. +- Provides dynamic filtering and ordering in search queries. + +#### Type +- MyBatis mapper XML +- Root element: `mapper` +- Namespace: `shop.customer.CustomerMapper` +- Declares DTD: `mybatis-3-mapper.dtd` + +#### Definitions +- **ResultMap** `customerResult` (type `shop.customer.Customer`): + - `id` → `CUSTOMER_ID` + - `email` → `EMAIL` + - `loyaltyTier` → `LOYALTY_TIER` +- **SQL fragment** `customerColumns`: `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT` +- **Select** `findByEmail`: + - Uses `customerResult` + - Query: `select from CUSTOMER where EMAIL = #{email}` +- **Select** `search`: + - Uses `customerResult` + - Dynamic `WHERE` clauses: + - `LOYALTY_TIER = #{tier}` if `tier` not null + - `CREATED_AT >= #{createdAfter}` if `createdAfter` not null + - Order by `${sortColumn}` +- **Insert** `insert`: + - `useGeneratedKeys="true"`, `keyProperty="id"` + - Query: `insert into CUSTOMER (EMAIL, LOYALTY_TIER, CREATED_AT) values (#{email}, #{loyaltyTier}, now())` +- **Update** `promote`: + - Sets `LOYALTY_TIER = #{tier}` + - `WHERE CUSTOMER_ID in (#{id}, …)` via `` +- **Delete** `deleteInactive`: + - `WHERE LAST_ORDER_AT < #{cutoff}` + +#### Configuration +- `useGeneratedKeys="true"` on `insert` +- `keyProperty="id"` on `insert` +- `open="("`, `separator=","`, `close=")"` on `` in `promote` + +#### Dependencies +- Java class `shop.customer.Customer` (result type) +- SQL table `CUSTOMER` +- Columns: `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/mybatis/package.ai.md new file mode 100644 index 00000000..82048fa2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/mybatis/package.ai.md @@ -0,0 +1,47 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:27:40Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Provides MyBatis SQL mappings for customer persistence, enabling CRUD operations and dynamic queries on the `CUSTOMER` table. + +#### Purpose +- Map SQL statements to Java methods for customer data access. +- Offer dynamic filtering and ordering in customer search. + +#### Responsibilities +- **Data Access Layer**: CRUD operations for `shop.customer.Customer`. +- **Dynamic Query Builder**: Conditional `WHERE` clauses and ordering in search. +- **Batch Operations**: Promote multiple customers in a single statement. + +#### Key units +- **Mapper** `shop.customer.CustomerMapper` – interface backed by `CustomerMapper.xml`. +- **ResultMap** `customerResult` – maps `CUSTOMER` columns to `shop.customer.Customer` fields. +- **SQL Fragment** `customerColumns` – reusable column list for selects/updates. +- **Select** `findByEmail` – fetch a customer by email. +- **Select** `search` – dynamic search with optional tier, creation date, and sort column. +- **Insert** `insert` – add a new customer, auto‑generating `CUSTOMER_ID`. +- **Update** `promote` – batch update loyalty tier for a list of IDs. +- **Delete** `deleteInactive` – remove customers inactive before a cutoff date. + +#### Data flow +1. **Input**: Method parameters (`email`, `tier`, `createdAfter`, `sortColumn`, `id` list, `cutoff`). +2. **Mapper XML**: Translates parameters into SQL via placeholders (`#{}`) and fragments. +3. **Execution**: MyBatis runs the SQL against the `CUSTOMER` table. +4. **Output**: Result objects (`shop.customer.Customer`) or affected row counts. + +#### Dependencies +- **Java**: `shop.customer.Customer` (result type). +- **Database**: `CUSTOMER` table with columns `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`. +- **MyBatis**: XML mapper runtime, DTD `mybatis-3-mapper.dtd`. + +#### Cross-cutting +- **Generated Keys**: `useGeneratedKeys="true"` and `keyProperty="id"` for inserts. +- **Dynamic SQL**: ``, ``, and `${}` for runtime query composition. +- **Result Mapping**: Single `ResultMap` reused across selects. +- **Fragment Inclusion**: `` for column lists, promoting DRYness. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..39dd3f3a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,45 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:26:33Z +- G: +- A: 0.0.0 +- X: file +- P: 30325B28 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> Provides endpoints for listing, retrieving, and canceling shop orders, exposing order status and total amounts. + +#### Purpose +- List orders with optional status filter and limit. +- Retrieve a single order by ID. +- Cancel an order (requires write scope). + +#### Type +- OpenAPI 3.0.3 +- Title: `Shop Orders API` +- Version: `2.1.0` +- Server URL: `https://api.shop.example/backoffice` + +#### Operations +- `GET /orders` – `listOrders` – query `status` (`OrderStatus`), `limit` (integer ≤200) – 200: array of `Order`. +- `GET /orders/{orderId}` – `getOrder` – path `orderId` (string) – 200: `Order`; 404: no such order. +- `POST /orders/{orderId}/cancel` – `cancelOrder` – path `orderId` (string) – security `backofficeToken` with scope `orders:write` – 204: cancelled; 409: already shipped. + +#### Schemas +- `OrderStatus` – enum: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order` – object, required: `orderId`, `status`, `total`; properties: + - `orderId`: string + - `status`: `OrderStatus` + - `total`: number (double) + - `couponCode`: string (deprecated) + +#### Security and servers +- Security scheme `backofficeToken`: OAuth2 client credentials, token URL `https://auth.shop.example/token`, scope `orders:write` (change orders). +- Server: `https://api.shop.example/backoffice`. + +#### Dependencies +- None. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/openapi/package.ai.md new file mode 100644 index 00000000..fdaf3b88 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/openapi/package.ai.md @@ -0,0 +1,40 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:27:44Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> Provides a REST API for back‑office order management, exposing listing, retrieval, and cancellation of shop orders. + +#### Purpose +- Expose order data and state transitions to back‑office clients. +- Enforce OAuth2 security for write operations. + +#### Responsibilities +- **Order retrieval** – list orders with optional status filter and pagination. +- **Order detail** – fetch a single order by its identifier. +- **Order cancellation** – transition an order to `CANCELLED` when allowed. + +#### Key units +- **`orders-api.yaml`** – OpenAPI 3.0.3 definition of the Shop Orders API (v2.1.0). +- **`Order` schema** – represents an order with `orderId`, `status`, `total`, and deprecated `couponCode`. +- **`OrderStatus` enum** – possible order states: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- **`backofficeToken` security scheme** – OAuth2 client‑credentials flow with `orders:write` scope. + +#### Data flow +1. **List**: client sends `GET /orders` with optional `status` and `limit`; server returns an array of `Order`. +2. **Retrieve**: client sends `GET /orders/{orderId}`; server returns the matching `Order` or 404. +3. **Cancel**: client sends `POST /orders/{orderId}/cancel` with a valid `backofficeToken`; server returns 204 on success or 409 if already shipped. + +#### Dependencies +- OAuth2 token endpoint `https://auth.shop.example/token`. +- Base API server `https://api.shop.example/backoffice`. + +#### Cross-cutting +- All write operations require `orders:write` scope via `backofficeToken`. +- The `couponCode` field is marked deprecated, indicating a planned removal. +- Pagination is limited to a maximum of 200 items per request. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..768ac24a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,74 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:27:57Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> A comprehensive, multi‑layered e‑commerce platform that manages orders, inventory, shipping, invoicing, and reporting across CI/CD, BPMN, Camel, Jakarta EE, and Kubernetes environments. + +#### Purpose +- Deliver a fully automated order‑fulfilment lifecycle from placement to invoicing. +- Provide CI/CD, containerization, and cloud deployment for the back‑office service. +- Expose REST and SOAP APIs for external integration and internal microservices. + +#### Responsibilities +- **CI/CD & Deployment** – GitHub Actions, Docker, Kubernetes manifests. +- **Business Process** – Camunda BPMN workflow for order fulfilment. +- **Integration** – Camel routes for validation, audit, ERP posting, and dead‑letter handling. +- **Enterprise Java** – Jakarta EE configuration of EJBs, JMS listeners, servlets, and security. +- **Persistence** – Hibernate/JPA entities, MyBatis mappers, and reporting queries. +- **Web UI** – Facelets and JSP pages for checkout and order management. +- **Shipping & Invoicing** – Groovy shipping rules, Kotlin invoice service. +- **API Exposure** – OpenAPI REST contract and SOAP WSDL for stock queries. + +#### Key units +- **GitHub Workflow `release-backoffice`** – orchestrates build, image, and deploy jobs. +- **BPMN Process `orderFulfilment`** – executable order lifecycle. +- **Camel Context `orderIntegration`** – routes `incomingOrders`, `toErp`, `manualReview`. +- **EJBs** – `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener`. +- **Servlets** – `ReportDownloadServlet`, `RequestIdFilter`. +- **Hibernate Entities** – `Shipment`, `ExpressShipment`. +- **MyBatis Mapper** – `shop.customer.CustomerMapper`. +- **Groovy Class** – `ShippingRules`. +- **Kotlin Service** – `InvoiceService`. +- **OpenAPI Spec** – `orders-api.yaml`. +- **WSDL** – `StockService.wsdl`. + +#### Data flow +1. **Tag push** → GitHub Actions build → Docker image → Kubernetes rollout. +2. **Order placed** → BPMN `reserveStock` → wait for `msgPaymentReceived` → approval or shipping → invoicing → completion. +3. **Camel route** receives JMS order → validates → audits → routes to ERP or manual review → handles retries and dead‑letter. +4. **EJB layer** processes checkout, reserves stock, listens to order events, serves reports. +5. **Web UI** collects shipping info, calculates totals via Groovy rules, submits order. +6. **API layer** exposes order data; OpenAPI endpoints enforce OAuth2 scopes. +7. **SOAP service** answers stock level queries; faults for unknown SKUs. + +#### Dependencies +- **External**: Docker registry, Kubernetes cluster, ERP HTTP/SOAP endpoints, JMS broker, OAuth2 auth server, PostgreSQL database. +- **Internal**: Camunda engine, Apache Camel, Jakarta EE container, Spring Boot (back‑office), MyBatis, Hibernate, Groovy, Kotlin coroutines. +- **Configuration**: Secrets (`REGISTRY_USER`, `REGISTRY_TOKEN`, `orders-db-credentials`), property placeholders (`orders.incoming.queue`, `erp.host`), JNDI resources (`jdbc/ShopDS`, `jdbc/ReportingDS`). + +#### Cross‑cutting +- **Security**: OAuth2 for REST writes, role‑based access for `/admin/*`, request‑ID propagation. +- **Error handling**: BPMN boundary events, Camel exception policy (5 retries, exponential back‑off), `ParcelTooHeavyException`, `ErpUnavailableException`. +- **Concurrency**: Stateless services, stateless EJBs, coroutine‑based invoice persistence. +- **Configuration**: Environment variables for Docker, Kubernetes secrets for DB credentials, property placeholders for Camel routes. +- **Health & readiness**: Docker `HEALTHCHECK`, Kubernetes readiness probe `/health/ready`. +- **Logging & metrics**: Global `TimingInterceptor` on EJBs, Camel `wireTap` for audit logging. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..cd7fc354 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,50 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:26:38Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps the `shop.shipping.Shipment` entity and its subclasses to database tables, defines relationships, and provides HQL/SQL queries for shipment data. + +#### Purpose +- Persist `Shipment` and related entities. +- Provide queries for undelivered shipments and carrier counts. + +#### Type +- Hibernate mapping (`` root). +- Namespace: none. +- Declares package `shop.shipping`. + +#### Definitions +- **Class** `Shipment` mapped to table `SHIPMENT` + - `id` (`SHIPMENT_ID`) generated by sequence `SHIPMENT_SEQ`. + - `trackingCode` (`TRACKING_CODE`, length 40, not‑null). + - `carrier` (`CARRIER`, length 12). + - `shippedAt` (`SHIPPED_AT`, type `timestamp`). + - `order` (`ORDER_ID`, many‑to‑one to `shop.Order`, not‑null). + - `parcels` (`` inverse, cascade `all-delete-orphan`, key `SHIPMENT_ID`, one‑to‑many `Parcel`). +- **Joined subclass** `ExpressShipment` mapped to `EXPRESS_SHIPMENT` + - Key `SHIPMENT_ID`. + - `deliveryWindow` (`DELIVERY_WINDOW`). +- **Query** `Shipment.undelivered` (HQL) + - `from Shipment s where s.deliveredAt is null and s.shippedAt < :cutoff`. +- **SQL query** `Shipment.countByCarrier` + - `select CARRIER, count(*) from SHIPMENT group by CARRIER`. + +#### Configuration +- Sequence generator: `sequence_name = SHIPMENT_SEQ`. +- Cascade: `all-delete-orphan` on `parcels`. +- Query parameter: `:cutoff` for `Shipment.undelivered`. + +#### Dependencies +- `shop.Order` (many‑to‑one). +- `Parcel` (one‑to‑many). +- Database tables: `SHIPMENT`, `EXPRESS_SHIPMENT`. +- Sequence: `SHIPMENT_SEQ`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/persistence/package.ai.md new file mode 100644 index 00000000..e45976eb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/persistence/package.ai.md @@ -0,0 +1,47 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:27:50Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Provides Hibernate‑based persistence for the Shop application, mapping shipment entities, configuring JPA units, and supplying queries for shipment status and carrier statistics. + +#### Purpose +- Persist shipment and order data using Hibernate. +- Expose JPA persistence units for application and reporting layers. + +#### Responsibilities +- **Entity mapping** – `Shipment`, `ExpressShipment`, and related associations to `Order` and `Parcel`. +- **Query provision** – HQL for undelivered shipments and SQL for carrier counts. +- **JPA configuration** – Two persistence units (`shop`, `reporting`) with data sources, entity classes, and Hibernate settings. + +#### Key units +- **`Shipment` entity** – maps to `SHIPMENT` table, includes `trackingCode`, `carrier`, `shippedAt`, `deliveredAt`, and a many‑to‑one to `shop.Order`. +- **`ExpressShipment` subclass** – joined‑table strategy, adds `deliveryWindow`. +- **`Shipment.undelivered` HQL query** – selects shipments with null `deliveredAt` before a cutoff. +- **`Shipment.countByCarrier` SQL query** – aggregates shipment counts per carrier. +- **`persistence.xml`** – defines `shop` (JTA, Hibernate provider, `ShopDS`) and `reporting` (RESOURCE_LOCAL, `ReportingDS`) units, lists entity classes, and sets Hibernate properties. + +#### Data flow +1. **Persisting**: `Shipment` objects are saved via the `shop` persistence unit; `ExpressShipment` instances use joined inheritance. +2. **Retrieval**: + - `Shipment.undelivered` is executed to fetch pending shipments. + - `Shipment.countByCarrier` aggregates carrier statistics for reporting. +3. **Reporting**: `reporting` unit accesses `shop.reporting.DailyRevenue` and other reporting entities using `ReportingDS`. + +#### Dependencies +- **Domain entities**: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue`. +- **Hibernate**: `org.hibernate.jpa.HibernatePersistenceProvider`, PostgreSQL dialect. +- **Data sources**: `java:/jdbc/ShopDS` (JTA), `java:/jdbc/ReportingDS` (RESOURCE_LOCAL). +- **Database objects**: tables `SHIPMENT`, `EXPRESS_SHIPMENT`; sequence `SHIPMENT_SEQ`. + +#### Cross-cutting +- **Inheritance strategy**: joined subclass mapping for `ExpressShipment`. +- **Cascade rules**: `all-delete-orphan` on `Shipment.parcels`. +- **Configuration properties**: batch size, dialect, connection credentials, and mapping file inclusion (`META-INF/order-queries.xml`). +- **Exception handling**: relies on Hibernate/JPA standard transaction and persistence exceptions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..0b13b906 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md @@ -0,0 +1,48 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:26:36Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Configures two Jakarta Persistence units for the Shop application, specifying data sources, entity classes, and Hibernate settings. + +#### Purpose +- Define persistence units for application data and reporting. +- Configure Hibernate provider and connection properties. + +#### Type +- Jakarta Persistence XML (`persistence.xml`) +- Root element: `persistence` +- Namespace: `https://jakarta.ee/xml/ns/persistence` + +#### Definitions +- **Persistence Unit `shop`** + - `transaction-type="JTA"` + - `provider`: `org.hibernate.jpa.HibernatePersistenceProvider` + - `jta-data-source`: `java:/jdbc/ShopDS` + - `mapping-file`: `META-INF/order-queries.xml` + - Entity classes: `shop.Order`, `shop.OrderLine`, `shop.Customer` +- **Persistence Unit `reporting`** + - `transaction-type="RESOURCE_LOCAL"` + - `non-jta-data-source`: `java:/jdbc/ReportingDS` + - Entity class: `shop.reporting.DailyRevenue` + - `exclude-unlisted-classes`: `true` + +#### Configuration +- `hibernate.dialect`: `org.hibernate.dialect.PostgreSQLDialect` +- `hibernate.jdbc.batch_size`: `50` +- `hibernate.connection.username`: `shop_app` +- `hibernate.connection.password`: `***` + +#### Dependencies +- Hibernate JPA provider (`org.hibernate.jpa.HibernatePersistenceProvider`) +- PostgreSQL JDBC driver (implied by dialect) +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS` +- Mapping file: `META-INF/order-queries.xml` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..4e525071 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,61 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:26:43Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Defines a SOAP web service for querying stock levels by SKU. + +#### Purpose +- Exposes a `GetStockLevel` operation that returns available quantity. +- Declares a fault for unknown SKUs. + +#### Type +- WSDL 1.1 +- Root element: `definitions` +- Namespaces: + - `xmlns` → `http://schemas.xmlsoap.org/wsdl/` + - `xmlns:soap` → `http://schemas.xmlsoap.org/wsdl/soap/` + - `xmlns:tns` → `http://shop.example/stock` + - `xmlns:xs` → `http://www.w3.org/2001/XMLSchema` + +#### Definitions +- **Types** + - `xs:element` `StockLevelRequest` – contains `sku` (`xs:string`). + - `xs:element` `StockLevelResponse` – contains `available` (`xs:int`). + - `xs:complexType` `UnknownSkuFault` – contains `sku` (`xs:string`). +- **Messages** + - `GetStockLevelInput` – part `parameters` of element `tns:StockLevelRequest`. + - `GetStockLevelOutput` – part `parameters` of element `tns:StockLevelResponse`. + - `UnknownSku` – fault part `fault` of type `tns:UnknownSkuFault`. +- **PortType** + - `StockPortType` with operation `GetStockLevel`: + - input `tns:GetStockLevelInput` + - output `tns:GetStockLevelOutput` + - fault `UnknownSku` with message `tns:UnknownSku`. +- **Binding** + - `StockSoapBinding` (document style, HTTP transport): + - operation `GetStockLevel`: + - `soapAction` `http://shop.example/stock/GetStockLevel` + - input body `use="literal"` + - output body `use="literal"` + - fault `UnknownSku` with `soap:fault` `use="literal"`. +- **Service** + - `StockService` with port `StockPort` bound to `tns:StockSoapBinding`: + - `soap:address` location `https://erp.shop.example/soap/stock`. + +#### Configuration +- `soap:binding` style `document`, transport `http://schemas.xmlsoap.org/soap/http`. +- `soap:operation` action `http://shop.example/stock/GetStockLevel`. +- `soap:address` location `https://erp.shop.example/soap/stock`. + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema` for type definitions. +- SOAP namespace `http://schemas.xmlsoap.org/wsdl/soap/` for binding and address. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/wsdl/package.ai.md new file mode 100644 index 00000000..587e5c5b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/other/wsdl/package.ai.md @@ -0,0 +1,42 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:27:55Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Provides a SOAP web service for querying stock levels by SKU. + +#### Purpose +- Exposes a `GetStockLevel` operation that returns the available quantity for a given SKU. +- Declares an `UnknownSku` fault for SKUs that are not found. + +#### Responsibilities +- **Service contract**: defines the WSDL structure, messages, port type, binding, and service endpoint. +- **Data model**: declares request/response elements and fault type using XML Schema. +- **Error handling**: specifies a fault message for unknown SKUs. + +#### Key units +- **`StockService.wsdl`** – WSDL 1.1 document defining the stock query service. +- **`StockLevelRequest` / `StockLevelResponse`** – XSD elements for request and response payloads. +- **`UnknownSkuFault`** – XSD complex type for the fault payload. +- **`GetStockLevel` operation** – port type operation with input, output, and fault messages. +- **`StockSoapBinding`** – SOAP binding configuration (document style, HTTP transport). +- **`StockService`** – service definition with endpoint `https://erp.shop.example/soap/stock`. + +#### Data flow +1. Client sends a SOAP request containing a `StockLevelRequest` (SKU). +2. Service processes the request and returns a `StockLevelResponse` with the available quantity. +3. If the SKU is unknown, the service returns an `UnknownSkuFault` via the `UnknownSku` fault message. + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema` for type definitions. +- SOAP namespace `http://schemas.xmlsoap.org/wsdl/soap/` for binding and address. +- HTTP transport `http://schemas.xmlsoap.org/wsdl/soap/http` for message exchange. + +#### Cross-cutting +- Uses WSDL 1.1 document style SOAP binding. +- Fault handling follows standard SOAP fault structure with literal encoding. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..e2afa8d7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,45 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:28:03Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> A stateless back‑office order service that exposes REST APIs for order retrieval, cancellation with payment refunds, and nightly cleanup of old cancelled orders, integrated into a larger e‑commerce platform with CI/CD, BPMN workflows, Camel integration, and Kubernetes deployment. + +#### Purpose +- Provide RESTful endpoints for back‑office order management. +- Handle order cancellations with payment refunds and audit logging. +- Periodically purge cancelled orders older than 30 days. + +#### Responsibilities +- **Order Retrieval** – list open orders, fetch by ID. +- **Order Cancellation** – process refunds, update status, record audit events. +- **Scheduled Maintenance** – nightly purge of cancelled orders, audit record. + +#### Key units +- `OrderResource` – stateless JAX‑RS resource at `/orders`. +- `EntityManager em` – JPA persistence context for `shop.Order`. +- `PaymentGateway payments` – external service for refunds. +- `AuditLog audit` – audit event recorder. +- Named queries: `Order.open`, `Order.purgeCancelled`. + +#### Data flow +1. `GET /orders` → `openOrders()` → `em.createNamedQuery("Order.open")` → `List`. +2. `GET /orders/{id}` → `find(id)` → `em.find(Order)` → `Response` (200/404). +3. `POST /orders/{id}/cancel` → `cancel(id)` → `payments.refund(...)`, status update, `audit.record(...)` → `Response` (204/404). +4. `@Schedule` nightly → `purgeCancelled()` → `em.createNamedQuery("Order.purgeCancelled")` → `audit.record(...)`. + +#### Dependencies +- Jakarta EE: `@Stateless`, `@EJB`, `@Inject`, `@Schedule`, `@RolesAllowed`, JPA (`EntityManager`), JAX‑RS (`@Path`, `@GET`, `@POST`, `@Produces`). +- Domain: `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog`. + +#### Cross-cutting +- Stateless EJB ensures thread safety; container manages transactions. +- Security: `@RolesAllowed({"backoffice","admin"})` restricts access. +- Audit logging centralizes event recording for cancellations and purges. +- Scheduled task uses `@Schedule` for nightly cleanup without persistence. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..68b9f06d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run1/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 3B050084 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:28:25Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project exposes a stateless RESTful back‑office order service that retrieves, cancels (with payment refunds), and nightly cleans up cancelled orders, and is documented via OpenAPI. A BPMN workflow orchestrates order fulfilment by reserving stock, processing payments, approving large orders, shipping items, and generating invoices, while a Camel integration layer validates orders, audits them, and submits to ERP with dead‑letter handling. The Jakarta EE configuration wires EJB services, JMS listeners, and web components, with MyBatis and Hibernate persistence for customers and shipments, and a Docker/Kubernetes deployment stack that includes health checks, routing, and database connectivity. The front‑end consists of Facelets and JSP pages for order entry and management, and a Groovy script calculates shipping costs with tiered rates and free‑shipping thresholds. + +#### Packages +- java — A stateless RESTful service that manages back‑office orders, handling retrieval, cancellation with refunds, and nightly cleanup of old cancelled orders. +- java/shop — Provides a stateless RESTful service for back‑office order management, handling order retrieval, cancellation, and nightly cleanup of old cancelled orders. +- other/actions/.github — Automates the CI/CD pipeline for the Orders Backoffice application, building Java artifacts, containerizing them, and deploying to a production Kubernetes cluster on tag pushes. +- other/actions/.github/workflows — Automates the CI/CD pipeline for the Orders Backoffice application, building Java artifacts, containerizing them, and deploying to a production Kubernetes cluster on tag pushes. +- other/actions — Automates the CI/CD pipeline for the Orders Backoffice application, building Java artifacts, containerizing them, and deploying to a production Kubernetes cluster on tag pushes. +- other/bpmn — Provides a BPMN‑based order‑fulfilment workflow that reserves stock, processes payments, approves large orders, ships items, and creates invoices. +- other/docker — A Dockerfile that builds and deploys a Java back‑office service for order management. +- other/facelets — A web‑frontend page that gathers a customer’s shipping details, lets them pick a shipping method, shows the order total, and submits the order. +- other/groovy — Calculates shipping cost for orders, applying free‑shipping thresholds and tiered rates while rejecting parcels that exceed a maximum weight. +- other/integration — Provides Camel‑based integration for order validation, audit, and ERP submission with dead‑letter handling. +- other/jee — Provides the Jakarta EE configuration for a shop application, wiring EJB services, JMS listeners, and web components with security, transactions, and resource references. +- other/jsp — A JSP page that lists open orders, lets users filter by customer email or status, and cancel individual orders. +- other/k8s — Deploys and exposes the orders‑backoffice microservice on Kubernetes, handling database connectivity, health checks, and external routing. +- other/kotlin — Generates and stores invoices for completed orders, applying tax rules and payment terms. +- other/mybatis — Provides MyBatis SQL mappings for customer persistence, enabling CRUD operations and dynamic queries on the `CUSTOMER` table. +- other/openapi — Provides a REST API for back‑office order management, exposing listing, retrieval, and cancellation of shop orders. +- other — A comprehensive, multi‑layered e‑commerce platform that manages orders, inventory, shipping, invoicing, and reporting across CI/CD, BPMN, Camel, Jakarta EE, and Kubernetes environments. +- other/persistence — Provides Hibernate‑based persistence for the Shop application, mapping shipment entities, configuring JPA units, and supplying queries for shipment status and carrier statistics. +- other/wsdl — Provides a SOAP web service for querying stock levels by SKU. +- . — A stateless back‑office order service that exposes REST APIs for order retrieval, cancellation with payment refunds, and nightly cleanup of old cancelled orders, integrated into a larger e‑commerce platform with CI/CD, BPMN workflows, Camel integration, and Kubernetes deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/meta/gpt-6-luna.json new file mode 100644 index 00000000..ab39b8e4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/meta/gpt-6-luna.json @@ -0,0 +1,108 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "avro-facts.tsv": "e6583308a5fcb3d9faedb51121dce0aff932776a05d8c948a0c8430172f9aa31", + "bpmn-facts.tsv": "c8866122184147e94cb14970a4f6e02dcf9e147ebb4b809885273aef8c4f0a31", + "compose-facts.tsv": "2d193b8ea01e46c1d184b7014e23daa07da545c2f756c07d8f6e0473cd86229a", + "dmn-facts.tsv": "825a542139ca18f05785b950d48eb810e4b1ed1b4ffc1d6b8f22cb3b2aed4f90", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "gradle-facts.tsv": "72890901e1506738b2578cdc11d7ca294ba4c663e4b36ca1b23c5c1f7112d6ad", + "graphql-facts.tsv": "98e82ef81dae468917392d60b0c60b8dd62037dedea84960af2ecaa6664b40c1", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "700ac765c97b6fb49a18f21691ad0b16de43ffc126073c2498d38512331d6ed6", + "java-facts.tsv": "368639880755328cc631124f71567c5fc7ac483fcb4ec887512e63cb3c272b61", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "properties-facts.tsv": "a7c7c2313792923e1f4fa576b2caa191377d5049455b0259a91122edbec4562c", + "proto-facts.tsv": "0d163bfbd7752fb9f736ed1ea4d7874ba1c58c1b182e6f5f9be3cafd3ba13e62", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "scala-facts.tsv": "019420f060147ac67c90c8d0690889021b20426f50ff148bcc025e1b3cc89fdf", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "terraform-facts.tsv": "a5fa06308874b12d69fff284ab0ea3e3868b151cb4d82fd7a82d83b46b2de6e3", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:28:27Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 118.1, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 115.7, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.0, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:32:24Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 28242, + "cachedPromptTokens": 28191, + "completionTokens": 9808, + "seconds": 117.4330237 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.005191, + "costUsd": 0.009516, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/meta/gpt-oss-20b.json new file mode 100644 index 00000000..bc2b5fe5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/meta/gpt-oss-20b.json @@ -0,0 +1,108 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "avro-facts.tsv": "e6583308a5fcb3d9faedb51121dce0aff932776a05d8c948a0c8430172f9aa31", + "bpmn-facts.tsv": "c8866122184147e94cb14970a4f6e02dcf9e147ebb4b809885273aef8c4f0a31", + "compose-facts.tsv": "2d193b8ea01e46c1d184b7014e23daa07da545c2f756c07d8f6e0473cd86229a", + "dmn-facts.tsv": "825a542139ca18f05785b950d48eb810e4b1ed1b4ffc1d6b8f22cb3b2aed4f90", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "gradle-facts.tsv": "72890901e1506738b2578cdc11d7ca294ba4c663e4b36ca1b23c5c1f7112d6ad", + "graphql-facts.tsv": "98e82ef81dae468917392d60b0c60b8dd62037dedea84960af2ecaa6664b40c1", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "700ac765c97b6fb49a18f21691ad0b16de43ffc126073c2498d38512331d6ed6", + "java-facts.tsv": "368639880755328cc631124f71567c5fc7ac483fcb4ec887512e63cb3c272b61", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "properties-facts.tsv": "a7c7c2313792923e1f4fa576b2caa191377d5049455b0259a91122edbec4562c", + "proto-facts.tsv": "0d163bfbd7752fb9f736ed1ea4d7874ba1c58c1b182e6f5f9be3cafd3ba13e62", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "scala-facts.tsv": "019420f060147ac67c90c8d0690889021b20426f50ff148bcc025e1b3cc89fdf", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "terraform-facts.tsv": "a5fa06308874b12d69fff284ab0ea3e3868b151cb4d82fd7a82d83b46b2de6e3", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:32:25Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 188.4, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 109.8, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.7, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:37:26Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 29304, + "cachedPromptTokens": 13936, + "completionTokens": 12446, + "seconds": 187.7241524 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.002497, + "costUsd": 0.00701, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..bb39826b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,40 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:30:31Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> Backoffice staff can inspect and cancel orders, issue refunds, audit order changes, and automatically purge cancelled orders after a retention period. + +#### Purpose +- Provides role-restricted backoffice order lookup and cancellation. +- Removes aged cancelled orders through scheduled retention cleanup. + +#### Responsibilities +- **Order access:** List open orders and retrieve orders by ID. +- **Cancellation and audit:** Refund payment, mark orders cancelled, and record cancellation events. +- **Retention cleanup:** Purge cancelled orders on schedule and audit the removal count. +- **Access control:** Restrict order endpoints to `backoffice` and `admin` roles. + +#### Key units +- `OrderResource` — stateless JAX-RS resource at `/orders` for order operations and scheduled cleanup. +- `PURGE_AFTER_DAYS` — retention period passed to the cancelled-order purge query. +- `Order.open` — named query for listing open orders. +- `Order.purgeCancelled` — named query for purging aged cancelled orders. + +#### Data flow +- `openOrders()` runs `Order.open` and returns a `List`; `find(id)` returns `404` when absent or `200` with the order. +- `cancel(id)` loads the order, refunds through `PaymentGateway`, sets `OrderStatus.CANCELLED`, records `order.cancelled`, and returns `204`; missing orders return `404`. +- `purgeCancelled()` runs at 02:15, executes `Order.purgeCancelled` with the retention period, and records `order.purged` with the removed-row count. + +#### Dependencies +- Jakarta EE: JAX-RS, EJB, CDI injection, JPA, and security annotations. +- Project types: `Order`, `OrderStatus`, `PaymentGateway`, and `AuditLog`. + +#### Cross-cutting +- Cancellation uses a required transaction; scheduled cleanup uses a non-persistent EJB timer. +- Missing orders produce `404 NOT_FOUND`; refund and persistence failures are not caught by the resource. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..b4c46841 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/java/shop/OrderResource.java.ai.md @@ -0,0 +1,64 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:28:28Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 37CE394E +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Backoffice users can list and retrieve orders, cancel them with payment refunds, and automatically purge old cancelled orders. + +#### Purpose +- Provides `/orders` backoffice operations for open-order listing, order lookup, cancellation, and scheduled cleanup. +- Restricts access to users with the `backoffice` or `admin` role. + +#### Type +- `public class OrderResource` — class; annotated `@Stateless`, `@Path("/orders")`, `@Produces(MediaType.APPLICATION_JSON)`, `@RolesAllowed({"backoffice", "admin"})`. +- `PURGE_AFTER_DAYS` — package-private `static final int`; retention period for cancelled orders. + +#### Input +- `find(long id)`, `cancel(long id)` — order ID from the `{id}` path parameter. +- `openOrders()` — named query `Order.open`. +- `purgeCancelled()` — named query `Order.purgeCancelled`; supplies `PURGE_AFTER_DAYS` as the `days` parameter. +- Injected resources: `EntityManager em` for persistence, `PaymentGateway payments` for refunds, and `AuditLog audit` for event recording. + +#### Output +- `openOrders()` returns `List`. +- `find(long id)` and `cancel(long id)` return JAX-RS `Response`. +- `cancel(long id)` updates the order status and records an audit event; successful cancellation returns no content. +- `purgeCancelled()` deletes matching orders and records the removed-row count. + +#### Core logic +- `openOrders()` executes `em.createNamedQuery("Order.open", Order.class).getResultList()`. +- `find(long id)` calls `em.find(Order.class, id)`; returns `404 NOT_FOUND` if absent, otherwise `200 OK` with the order. +- `cancel(long id)` runs with `@TransactionAttribute(TransactionAttributeType.REQUIRED)`: + - Calls `em.find(Order.class, id)`; returns `404 NOT_FOUND` if absent. + - Calls `payments.refund(order.getPaymentReference(), order.getTotal())`. + - Sets `order.setStatus(OrderStatus.CANCELLED)`. + - Calls `audit.record("order.cancelled", id)` and returns `204 No Content`. +- `purgeCancelled()` runs at 02:15 via `@Schedule(hour = "2", minute = "15", persistent = false)`: + - Executes `em.createNamedQuery("Order.purgeCancelled").setParameter("days", PURGE_AFTER_DAYS).executeUpdate()`. + - Stores the result in `removed` and calls `audit.record("order.purged", removed)`. + +#### Public API +- `openOrders() -> List` — list open orders. +- `find(long id) -> Response` — retrieve order by ID. +- `cancel(long id) -> Response` — refund and cancel order. + +#### Dependencies +- Jakarta: `RolesAllowed`, `EJB`, `Schedule`, `Stateless`, `TransactionAttribute`, `TransactionAttributeType`, `Inject`, `EntityManager`, `PersistenceContext`, `GET`, `POST`, `Path`, `PathParam`, `Produces`, `MediaType`, `Response`. +- Java: `List`. +- Project types: `Order`, `OrderStatus`, `PaymentGateway`, `AuditLog`. + +#### Exceptions / Errors +- Missing order IDs produce `404 NOT_FOUND` in `find` and `cancel`. +- Refund and persistence failures are not caught in this file. + +#### Concurrency +- `@Stateless` resource; cancellation uses a required transaction. +- Scheduled purge is non-persistent. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/java/shop/package.ai.md new file mode 100644 index 00000000..b5399904 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/java/shop/package.ai.md @@ -0,0 +1,39 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:30:26Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Backoffice staff can manage order lookup and cancellation, issue refunds, audit order events, and automatically remove aged cancelled orders. + +#### Purpose +- Exposes order listing, retrieval, and cancellation operations for backoffice users. +- Schedules cleanup of cancelled orders after a configured retention period. + +#### Responsibilities +- **Order access:** List open orders and retrieve an order by ID. +- **Cancellation:** Refund payment, mark the order cancelled, and record an audit event. +- **Retention cleanup:** Periodically delete aged cancelled orders and audit the deletion count. +- **Access control:** Restrict endpoints to the `backoffice` and `admin` roles. + +#### Key units +- `OrderResource` — stateless JAX-RS resource at `/orders`; implements order operations and scheduled cleanup. +- `PURGE_AFTER_DAYS` — retention period supplied to the cancelled-order purge query. + +#### Data flow +- `openOrders()` executes `Order.open` and returns `List`; `find(id)` loads an order and returns `404` if absent or `200` with the order. +- `cancel(id)` loads the order, refunds its payment through `PaymentGateway`, sets `OrderStatus.CANCELLED`, records `order.cancelled`, and returns `204`; absent orders return `404`. +- `purgeCancelled()` runs at 02:15, executes `Order.purgeCancelled` with the retention-days parameter, and records `order.purged` with the removed-row count. + +#### Dependencies +- Jakarta EE: JAX-RS, EJB, CDI injection, JPA, and security annotations. +- Project types: `Order`, `OrderStatus`, `PaymentGateway`, and `AuditLog`; named queries `Order.open` and `Order.purgeCancelled`. + +#### Cross-cutting +- `OrderResource` is `@Stateless`; cancellation uses a required transaction. +- Scheduled cleanup uses a non-persistent EJB timer. +- Missing order IDs produce `404 NOT_FOUND`; refund and persistence failures are not caught here. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/.github/package.ai.md new file mode 100644 index 00000000..6a8ecf2e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/.github/package.ai.md @@ -0,0 +1,39 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:30:40Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Version-tagged orders backoffice releases are built and verified, published as container images, and handed off for production deployment. + +#### Purpose +- Automate verification and release of the orders backoffice. +- Publish release images and trigger Kubernetes deployment. + +#### Responsibilities +- **Build and verification:** Run `mvn -B verify -Pci` on Java 21 and 25. +- **Image publishing:** Push the versioned image to `registry.shop.example`. +- **Production deployment:** Call the reusable Kubernetes deployment workflow. + +#### Key units +- `release-backoffice` — Workflow triggered by `v*` tag pushes or manual dispatch. +- `build` — Java matrix build and verification job. +- `image` — Production-environment container publication job. +- `deploy` — Job invoking `./.github/workflows/deploy-k8s.yml`. + +#### Data flow +- Tag or manual trigger → Java matrix build and verification → publish `orders-backoffice` image with the `v` prefix removed → production deployment workflow. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. +- Registry and image: `registry.shop.example/orders-backoffice`. +- Build command: `mvn -B verify -Pci`. + +#### Cross-cutting +- Uses an Ubuntu 24.04 runner; permissions are `contents: read` and `packages: write`. +- Registry credentials are supplied as secrets; deployment inherits secrets. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..b941049f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,40 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:30:36Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Automates verification, container publication, and production deployment of the orders backoffice on version-tagged releases. + +#### Purpose +- Build and test the orders backoffice using Java 21 and 25. +- Publish its version-tagged container image and invoke production deployment. + +#### Responsibilities +- **Build and verification:** Run `mvn -B verify -Pci` with Temurin Java 21 and 25. +- **Image publishing:** Log in to the registry and push the orders backoffice image. +- **Production deployment:** Invoke the reusable Kubernetes deployment workflow after image publication. + +#### Key units +- `release-backoffice` — GitHub Actions workflow triggered by `v*` tag pushes or manual dispatch. +- `build` — Matrix build and verification job. +- `image` — Production-environment job that publishes the container image. +- `deploy` — Job that calls `./.github/workflows/deploy-k8s.yml` with `environment: production`. + +#### Data flow +- Tag or manual trigger → Java matrix build and verification → container image push to `registry.shop.example/orders-backoffice` using the version without the `v` prefix → reusable production deployment workflow. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. +- Container registry: `registry.shop.example`; image: `orders-backoffice`. +- Maven build command: `mvn -B verify -Pci`. + +#### Cross-cutting +- Workflow permissions: `contents: read`, `packages: write`. +- Registry credentials are provided as secrets; deployment inherits secrets. +- Build uses an Ubuntu 24.04 runner and a Java 21/25 matrix. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..8caa5e15 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,56 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:28:41Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds and tests the orders backoffice with Java 21 and 25, publishes a version-tagged container image, and deploys it to production. + +#### Purpose +- Release workflow for the orders backoffice application. +- Builds and verifies the project, pushes its container image, then invokes the Kubernetes deployment workflow. + +#### Type +- GitHub Actions workflow named `release-backoffice`. + +#### Definitions +- Triggers: + - `push` tags matching `v*`. + - `workflow_dispatch`. +- Workflow permissions: `contents: read`, `packages: write`. +- Job `build`: + - Runner: `ubuntu-24.04`; matrix: `java` values `21`, `25`. + - Steps, in order: + 1. `actions/checkout@v4`. + 2. `actions/setup-java@v4` with `distribution: temurin` and `java-version: ${{ matrix.java }}`. + 3. `Build and test`: `mvn -B verify -Pci`. +- Job `image`: + - Needs `build`; runner: `ubuntu-24.04`; environment: `production`. + - Steps, in order: + 1. `actions/checkout@v4`. + 2. `Log in to the registry`: `docker/login-action@v3`. + 3. `Push the image`: builds and pushes `registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v}`. +- Job `deploy`: + - Needs `image`; reuses `./.github/workflows/deploy-k8s.yml`. + - Passes `environment: production`; inherits secrets. + +#### Configuration +- `strategy.matrix.java`: `[21, 25]`. +- `distribution`: `temurin`. +- Registry: `registry.shop.example`. +- Registry credentials: `REGISTRY_USER=***`, `REGISTRY_TOKEN=***`. +- Image tag: `${GITHUB_REF_NAME#v}`. +- Reusable workflow input `environment`: `production`. + +#### Dependencies +- Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. +- Registry and image: `registry.shop.example/orders-backoffice`. +- Build command: `mvn -B verify -Pci`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/package.ai.md new file mode 100644 index 00000000..d1040bc4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/actions/package.ai.md @@ -0,0 +1,39 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:30:44Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Automates verification, container-image publication, and production deployment of versioned orders backoffice releases. + +#### Purpose +- Release the orders backoffice from version-tagged or manually dispatched builds. +- Verify the application, publish its container image, and hand it off for Kubernetes deployment. + +#### Responsibilities +- **Build and verification:** Run `mvn -B verify -Pci` across Java 21 and 25. +- **Image publishing:** Publish the versioned `orders-backoffice` image to the production registry. +- **Deployment handoff:** Invoke the reusable Kubernetes deployment workflow. + +#### Key units +- `release-backoffice` — Workflow triggered by `v*` tag pushes or manual dispatch. +- `build` — Java matrix build and verification job. +- `image` — Production-environment image publication job. +- `deploy` — Job calling `./.github/workflows/deploy-k8s.yml`. + +#### Data flow +- Tag or manual dispatch → Java matrix verification → publish `registry.shop.example/orders-backoffice` with the `v` prefix removed → Kubernetes deployment workflow. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. +- Container registry: `registry.shop.example`. +- Build command: `mvn -B verify -Pci`. + +#### Cross-cutting +- Runs on Ubuntu 24.04; permissions include `contents: read` and `packages: write`. +- Registry credentials use secrets; deployment inherits secrets. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..233a36e0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,47 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:28:58Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 8D64B542 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1 + +> Defines an executable order-fulfilment process that reserves stock, waits for payment, routes large orders for approval, ships and invoices orders, and cancels orders when stock is unavailable. + +#### Purpose +- Models the order-fulfilment lifecycle, including payment, amount-based approval, shipping, invoicing, and out-of-stock cancellation. +- Declares the payment message and stock error used by the process. + +#### Type +- BPMN process definition; root element `bpmn:definitions`. +- Namespaces: `bpmn` → `http://www.omg.org/spec/BPMN/20100524/MODEL`; `bpmndi` → `http://www.omg.org/spec/BPMN/20100524/DI`; `dc` → `http://www.omg.org/spec/DD/20100524/DC`; `camunda` → `http://camunda.org/schema/1.0/bpmn`. + +#### Definitions +- Process `orderFulfilment` (`Order fulfilment`), executable: + - Start event `orderPlaced` → service task `reserveStock` (`Reserve stock`; class `shop.bpm.ReserveStockDelegate`). + - Boundary error event `stockMissing` on `reserveStock`, referencing `errOutOfStock`; sequence flow `toCancelled` leads to end event `orderCancelled` (`Order cancelled`). + - Normal path: `reserveStock` → intermediate message catch event `waitForPayment` (`Wait for payment`; message `msgPaymentReceived`) → exclusive gateway `amountCheck` (`Large order?`). + - Gateway flow `large` routes to user task `approveOrder` (`Approve large order`) when `${order.total > 1000}`; candidate group `backoffice`. Flow `approvedToShip` leads to `shipOrder`. + - Gateway flow `small` routes directly to `shipOrder` when `${order.total <= 1000}`. + - Service task `shipOrder` (`Ship order`; external type, topic `shipping`) → call activity `createInvoice` (`Create invoice`; called element `invoicing`) → end event `orderCompleted` (`Order completed`). +- Message `msgPaymentReceived` (`PaymentReceived`). +- Error `errOutOfStock` (`OutOfStock`), error code `STOCK_EMPTY`. + +#### Configuration +- Process executable: `isExecutable="true"`. +- Large-order condition: `${order.total > 1000}`; small-order condition: `${order.total <= 1000}`. +- `reserveStock` delegate class: `shop.bpm.ReserveStockDelegate`. +- `approveOrder` candidate group: `backoffice`. +- `shipOrder` external-task topic: `shipping`. +- `createInvoice` called element: `invoicing`. + +#### Dependencies +- Delegate class: `shop.bpm.ReserveStockDelegate`. +- External task worker topic: `shipping`. +- Called process element: `invoicing`. +- Referenced BPMN message: `msgPaymentReceived`; error: `errOutOfStock`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/bpmn/package.ai.md new file mode 100644 index 00000000..96502227 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/bpmn/package.ai.md @@ -0,0 +1,44 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:30:48Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> Coordinates order fulfilment from stock reservation and payment through approval, shipping, invoicing, or out-of-stock cancellation. + +#### Purpose +- Defines the executable `orderFulfilment` lifecycle, including payment handling and amount-based approval. +- Routes orders to completion or cancellation based on stock availability. + +#### Responsibilities +- **Order processing:** Reserve stock, wait for `PaymentReceived`, evaluate order total, and ship approved or small orders. +- **Exceptions and completion:** Cancel orders on `OutOfStock`; otherwise call invoicing and complete the process. + +#### Key units +- `orderFulfilment` — executable BPMN process for the order lifecycle. +- `reserveStock` — service task bound to `shop.bpm.ReserveStockDelegate`, with boundary error `stockMissing`. +- `amountCheck` — exclusive gateway routing totals over `1000` to `approveOrder` and totals at or below `1000` directly to shipping. +- `approveOrder` — user task assigned to candidate group `backoffice`. +- `shipOrder` — external task using topic `shipping`. +- `createInvoice` — call activity invoking process element `invoicing`. +- `msgPaymentReceived` — message caught while the process waits for payment. +- `errOutOfStock` — error with code `STOCK_EMPTY`, leading to `orderCancelled`. + +#### Data flow +- `orderPlaced` starts the process and triggers stock reservation. +- Successful reservation leads to a wait for `PaymentReceived`, then order-total routing; large orders require approval before shipping. +- Shipping calls `invoicing` and ends at `orderCompleted`; a stock error instead leads to `orderCancelled`. + +#### Dependencies +- Java delegate: `shop.bpm.ReserveStockDelegate`. +- External task worker topic: `shipping`. +- Called process element: `invoicing`. +- BPMN message and error: `msgPaymentReceived`, `errOutOfStock`. + +#### Cross-cutting +- Routing conditions use `${order.total > 1000}` and `${order.total <= 1000}`. +- Approval is assigned to `backoffice`; the process is marked executable. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..fad28699 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/docker/Dockerfile.ai.md @@ -0,0 +1,42 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:29:04Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds and runs the Shop orders backoffice Java application as a non-root service on port 8080. + +#### Purpose +- Packages `orders-backoffice.jar` in a Maven build stage, then runs it in a lightweight Java 21 runtime image. + +#### Type +- Multi-stage Dockerfile. + +#### Definitions +- `build` stage: `maven:3.9-eclipse-temurin-21`; working directory `/src`. + - Copies `pom.xml`; runs `mvn -B dependency:go-offline`. + - Copies `src` to `/src/src`; runs `mvn -B package -DskipTests`. +- Runtime stage: `eclipse-temurin:21-jre-alpine`. + - Creates group `shop` and user `backoffice` in that group. + - Copies `/src/target/orders-backoffice.jar` to `/opt/shop/orders-backoffice.jar`. + - Exposes port `8080`; runs as `backoffice`. + - Healthcheck: every 30 seconds, `wget -qO- http://localhost:8080/health/live || exit 1`. + - Entrypoint: `sh -c "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"`. + +#### Configuration +- `ARG APP_VERSION=2.1.0` (declared but not otherwise used). +- `JAVA_OPTS="-XX:MaxRAMPercentage=75"`. +- `SHOP_PROFILE=production`. + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine`. +- Build inputs: `pom.xml`, `src`. +- Runtime artifact: `/src/target/orders-backoffice.jar`. +- Health endpoint: `http://localhost:8080/health/live`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/docker/package.ai.md new file mode 100644 index 00000000..3ea6b06b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/docker/package.ai.md @@ -0,0 +1,33 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:30:53Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> Packages the Shop orders backoffice Java application for production deployment and runtime health monitoring. + +#### Purpose +- Builds `orders-backoffice.jar` with Maven and runs it on a Java 21 runtime image. +- Exposes the service on port `8080` as the non-root `backoffice` user. + +#### Responsibilities +- Multi-stage container build: resolves Maven dependencies, packages the application with tests skipped, and copies the JAR into a lightweight runtime image. +- Runtime setup: sets production profile and JVM memory configuration, and checks `/health/live` every 30 seconds. + +#### Key units +- `Dockerfile`: defines the `build` and runtime stages, service user, port, healthcheck, and Java entrypoint. + +#### Data flow +- `pom.xml` and `src` → Maven package step → `/src/target/orders-backoffice.jar` → `/opt/shop/orders-backoffice.jar` → Java process on port `8080`. + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21` and `eclipse-temurin:21-jre-alpine`. +- Build inputs: `pom.xml` and `src`; runtime healthcheck depends on `http://localhost:8080/health/live`. + +#### Cross-cutting +- Runtime runs as non-root user `backoffice`, in group `shop`. +- Configuration includes `JAVA_OPTS="-XX:MaxRAMPercentage=75"` and `SHOP_PROFILE=production`; `APP_VERSION=2.1.0` is declared but otherwise unused. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..6cfdd3e5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,47 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:29:08Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> Customers enter a delivery address, choose shipping, review the EUR total, and place an order. + +#### Purpose +- Collect checkout address and shipping details, update the displayed total, and submit the order. + +#### Type +- Facelets page; XHTML content type. +- `h` = Jakarta Faces HTML; `f` = Jakarta Faces core; `ui` = Jakarta Faces Facelets. + +#### Data +- `checkoutBean.address.street` — address street, required text input. +- `checkoutBean.address.zip` — ZIP code text input. +- `checkoutBean.shippingMethod` — selected shipping method. +- `checkoutBean.shippingMethods` — collection supplying shipping menu items. +- `checkoutBean.total` — displayed order total. +- Iteration: `f:selectItems` reads `checkoutBean.shippingMethods`; no explicit iteration variable. + +#### Actions +- `checkoutForm` — Faces form; no explicit action or method. +- `shipping` selection — AJAX listener `checkoutBean.recalculate`; rerenders `total`. +- `Place order` button — invokes `checkoutBean.placeOrder`. +- `zip` — regex validator `[0-9]{5}`. +- `total` — currency converter with type `currency`, currency code `EUR`. +- Commented-out `Save cart` button is not active. + +#### Structure +- Uses template `/WEB-INF/templates/shop.xhtml`; defines `content`. +- Includes `/WEB-INF/includes/payment-hints.xhtml`. + +#### Dependencies +- Tag libraries: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- Template: `/WEB-INF/templates/shop.xhtml`. +- Included file: `/WEB-INF/includes/payment-hints.xhtml`. +- Bean: `checkoutBean`; methods: `recalculate`, `placeOrder`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/facelets/package.ai.md new file mode 100644 index 00000000..07f15641 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/facelets/package.ai.md @@ -0,0 +1,35 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:30:57Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> Customers provide delivery details, select shipping, review the EUR order total, and submit an order. + +#### Purpose +- Provide the checkout page for entering an address, choosing a shipping method, and placing an order. +- Display the order total and recalculate it when shipping selection changes. + +#### Responsibilities +- Collect street and ZIP code, with a five-digit ZIP validator. +- Populate shipping choices from `checkoutBean.shippingMethods`; show the total in EUR. +- Submit the order and refresh the total through Faces actions. +- Render checkout content within the shop template and include payment hints. + +#### Key units +- `checkout.xhtml` — Facelets checkout form bound to `checkoutBean`. +- `checkoutBean.recalculate` — AJAX listener for shipping changes, rerendering the total. +- `checkoutBean.placeOrder` — action invoked by the Place order button. + +#### Data flow +- Address fields and shipping selection bind to `checkoutBean`; shipping choices come from `checkoutBean.shippingMethods`. +- Changing shipping invokes `recalculate` and updates the rendered total; the Place order button invokes `placeOrder`. + +#### Dependencies +- Jakarta Faces HTML, core, and Facelets tag libraries. +- `checkoutBean` and its `recalculate` and `placeOrder` methods. +- Template `/WEB-INF/templates/shop.xhtml` and include `/WEB-INF/includes/payment-hints.xhtml`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..9b293c98 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,63 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:29:14Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Calculates parcel shipping charges by weight, waives shipping above an order-value threshold, and rejects parcels above the carrier’s weight limit. + +#### Purpose +- `ShippingRulesSpec` verifies free shipping, weight-tier pricing, and overweight rejection. +- `ShippingRules` calculates shipping costs for `Order` instances. + +#### Type +- `ShippingRulesSpec` — class; extends `spock.lang.Specification`. +- `ShippingRules` — class; annotated `@CompileStatic`; no declared supertypes. + +#### Input +- `ShippingRules.carrier: String` and `ShippingRules.maxParcelKg: BigDecimal` configure the carrier and maximum parcel weight. +- `ShippingRules.costFor(Order order)` consumes an order’s `weightKg` and `total`. +- `ShippingRulesSpec` initializes `rules` with `carrier: 'DHL'` and `maxParcelKg: 31.5`. +- `ShippingRulesSpec` test data includes order totals and weights; the data-driven test supplies weights `1`, `10`, and `30`. + +#### Output +- `costFor(Order)` returns a `BigDecimal` shipping charge, or throws `ParcelTooHeavyException`. +- `ShippingRulesSpec` produces pass/fail results through Spock assertions and exception expectations. + +#### Core logic +- `ShippingRules.costFor(Order order)`: + - Throws `ParcelTooHeavyException` with the parcel weight and maximum weight if `order.weightKg > maxParcelKg`. + - Returns `0` if `order.total >= ShippingRulesSpec.FREE_SHIPPING_THRESHOLD`. + - Otherwise finds the first matching entry in local `tiers` and returns its `price` as `BigDecimal`: up to `2` kg costs `4.99`, up to `10` kg costs `9.99`, and up to `31.5` kg costs `19.99`. +- `ShippingRulesSpec` checks that a `75.00` order ships free; `@Unroll` tests the three weight/price pairs; the overweight test expects `ParcelTooHeavyException`. +- Private helper `heavyOrder(BigDecimal kg)` constructs an `Order(total: 10, weightKg: kg)`; it is not called by the shown tests. +- `FREE_SHIPPING_THRESHOLD` is `50.00`. + +#### Public API +- `FREE_SHIPPING_THRESHOLD: BigDecimal` — free-shipping order total. +- `getFREE_SHIPPING_THRESHOLD()` -> `BigDecimal` — reads threshold. +- `getRules()`/`setRules(Object)` -> `rules` property. +- `"orders above the threshold ship for free"()` -> `def` — verifies free shipping. +- `"a parcel of #weight kg costs #expected"()` -> `def` — verifies weight-tier prices. +- `"an overweight parcel is rejected"()` -> `def` — verifies overweight exception. +- `getCarrier()`/`setCarrier(String)` -> `carrier` property. +- `getMaxParcelKg()`/`setMaxParcelKg(BigDecimal)` -> `maxParcelKg` property. +- `costFor(Order)` -> `BigDecimal` — calculates shipping charge. + +#### Dependencies +- Imports: `groovy.transform.CompileStatic`, `spock.lang.Specification`, `spock.lang.Unroll`. +- Referenced types: `Order`, `ParcelTooHeavyException`, `BigDecimal`. + +#### Exceptions / Errors +- `costFor` throws `ParcelTooHeavyException` when parcel weight exceeds `maxParcelKg`. +- No explicit null handling or caught exceptions. + +#### Concurrency +- No concurrency or synchronization behavior shown. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/groovy/package.ai.md new file mode 100644 index 00000000..f692ab40 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/groovy/package.ai.md @@ -0,0 +1,39 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:31:00Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> Calculates parcel shipping charges from order value and weight, applying free-shipping eligibility, weight-tier rates, and carrier weight limits. + +#### Purpose +- Defines `ShippingRules` shipping-charge behavior and verifies it with Spock tests. +- Covers free shipping, tiered pricing, and rejection of parcels exceeding the configured maximum weight. + +#### Responsibilities +- Shipping calculation: `ShippingRules` checks parcel weight, waives charges for qualifying order totals, and selects a weight-tier price otherwise. +- Behavioral tests: `ShippingRulesSpec` asserts free-shipping, three weight/price pairs, and the overweight exception. + +#### Key units +- `ShippingRules` — configures a carrier and maximum parcel weight, then computes a `BigDecimal` charge for an `Order`. +- `ShippingRules.costFor(Order)` — throws `ParcelTooHeavyException` for overweight parcels, returns zero at or above the `50.00` free-shipping threshold, or applies a tier price. +- `ShippingRulesSpec` — Spock specification using DHL and a `31.5` kg limit to test the shipping rules. +- `ShippingRulesSpec.FREE_SHIPPING_THRESHOLD` — order-total threshold for free shipping (`50.00`). + +#### Data flow +- `costFor` reads `Order.weightKg` and `Order.total`. +- It rejects weight above `maxParcelKg`; otherwise, it returns zero when the order total meets the threshold, or selects the first matching weight tier: up to 2 kg (`4.99`), 10 kg (`9.99`), or 31.5 kg (`19.99`). +- `ShippingRulesSpec` supplies test orders and checks resulting charges or the expected exception. + +#### Dependencies +- Uses `Order`, `ParcelTooHeavyException`, and `BigDecimal`. +- Tests use Spock `Specification` and `Unroll`; `ShippingRules` uses Groovy `CompileStatic`. + +#### Cross-cutting +- Shipping calculations use `BigDecimal` for weights, thresholds, and prices. +- `ShippingRules` is annotated `@CompileStatic`; tests use Spock assertions and exception expectations. +- No concurrency or explicit null handling is shown. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..69aef918 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/integration/order-routes.xml.ai.md @@ -0,0 +1,41 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:29:23Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Defines Camel order-processing routes that validate incoming orders, route high-value orders for manual review, and send other orders to an ERP system. + +#### Purpose +- Processes orders from a configurable JMS queue, applying validation and threshold-based routing. +- Retries ERP-unavailable failures, sends handled failures to a dead-letter queue, and copies incoming orders to an audit channel. + +#### Type +- Apache Camel Spring integration configuration; root element `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` = `http://www.w3.org/2001/XMLSchema-instance`; `camelContext` declares the default namespace `http://camel.apache.org/schema/spring`. +- Schema locations: Spring Beans `https://www.springframework.org/schema/beans/spring-beans.xsd`; Camel Spring `https://camel.apache.org/schema/spring/camel-spring.xsd`. + +#### Definitions +- Beans: `orderValidator` → `shop.integration.OrderValidator`; `invoiceTranslator` → `shop.integration.InvoiceTranslator`. +- Camel context `orderIntegration`; property placeholder source `classpath:integration.properties`. +- Route `incomingOrders`: consumes `jms:queue:{{orders.incoming.queue}}`; calls `orderValidator.validate`; if `${body.total} > {{orders.review.threshold}}`, sends to `direct:manualReview`, otherwise to `direct:toErp`; then wire-taps to `seda:orderAudit`. +- Route `toErp`: consumes `direct:toErp`; calls `invoiceTranslator`; sends dynamically to `https://{{erp.host}}/api/orders/${header.orderId}`. +- Route `manualReview`: consumes `direct:manualReview`; splits `${body.lines}` and sends each part to `jms:queue:review.lines`. +- Exception handling: catches `shop.integration.ErpUnavailableException`; retries with configured redelivery policy; marks the exception handled and sends to `jms:queue:orders.deadletter`. + +#### Configuration +- `maximumRedeliveries=5`; `redeliveryDelay=2000`; `useExponentialBackOff=true`. +- Placeholders: `orders.incoming.queue`, `orders.review.threshold`, `erp.host`; values supplied through `classpath:integration.properties`. +- Dynamic URI expression: `${header.orderId}` in the ERP order URL. + +#### Dependencies +- Classes: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `shop.integration.ErpUnavailableException`. +- Property file: `classpath:integration.properties`. +- External endpoints: configurable incoming JMS queue; `jms:queue:review.lines`; `jms:queue:orders.deadletter`; `seda:orderAudit`; ERP HTTPS API at `{{erp.host}}/api/orders/${header.orderId}`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/integration/package.ai.md new file mode 100644 index 00000000..af681f89 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/integration/package.ai.md @@ -0,0 +1,45 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:31:06Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Validates and routes incoming orders to ERP processing or manual review, while auditing orders and isolating failed deliveries. + +#### Purpose +- Applies validation and review-threshold rules to orders received from a configurable JMS queue. +- Sends eligible orders to the ERP, routes high-value order lines for manual review, and handles processing failures. + +#### Responsibilities +- **Order intake and routing:** `incomingOrders` validates orders, selects manual review or ERP processing based on the configured total threshold, and copies messages to an audit channel. +- **ERP integration:** `toErp` translates orders and submits them to an order-specific ERP HTTPS endpoint. +- **Manual review:** `manualReview` splits order lines and sends each to a review JMS queue. +- **Failure handling:** Retries ERP-unavailable failures, then marks them handled and sends them to a dead-letter queue. + +#### Key units +- `orderIntegration` — Camel context with routes and property placeholders. +- `incomingOrders` — consumes incoming orders, validates and branches them, and wire-taps them to audit. +- `toErp` — translates orders and dynamically addresses the ERP API using the order ID. +- `manualReview` — splits orders into lines for review. +- `orderValidator` (`shop.integration.OrderValidator`) — validates incoming orders. +- `invoiceTranslator` (`shop.integration.InvoiceTranslator`) — translates orders for ERP submission. +- `shop.integration.ErpUnavailableException` — exception handled by the configured retry and dead-letter policy. + +#### Data flow +- Configured JMS queue → `OrderValidator.validate` → threshold check → `direct:manualReview` or `direct:toErp`; incoming messages are also wire-tapped to `seda:orderAudit`. +- Manual-review branch → split order lines → `jms:queue:review.lines`. +- ERP branch → `InvoiceTranslator` → `https://{{erp.host}}/api/orders/${header.orderId}`. +- `ErpUnavailableException` → configured redelivery attempts → `jms:queue:orders.deadletter`. + +#### Dependencies +- `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, and `shop.integration.ErpUnavailableException`. +- `classpath:integration.properties` supplies `orders.incoming.queue`, `orders.review.threshold`, and `erp.host`. +- Camel endpoints: incoming JMS queue, `direct:manualReview`, `direct:toErp`, `seda:orderAudit`, review and dead-letter JMS queues, and the ERP HTTPS API. + +#### Cross-cutting +- Spring/Camel XML configuration with property placeholders sourced from `classpath:integration.properties`. +- ERP-unavailable redelivery policy: maximum 5 retries, 2000 ms delay, exponential backoff enabled. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..f30a9f78 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,38 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:29:29Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Configures shop session beans, an order-placement message listener, audit interception, and transaction behavior. + +#### Purpose +- Declares EJBs for stock reservation, checkout, and order-placement events. +- Configures the shared timing interceptor and a transaction rule for stock reservations. + +#### Type +- Jakarta EE EJB deployment descriptor; root element `ejb-jar`. +- Namespace: default — `https://jakarta.ee/xml/ns/jakartaee`. + +#### Definitions +- Session bean `StockReservationBean`: class `shop.stock.StockReservationBean`; `Stateless`. +- Session bean `CheckoutSessionBean`: class `shop.checkout.CheckoutSessionBean`; `Stateful`; local EJB reference `ejb/StockReservation` to `shop.stock.StockReservation`. +- Message-driven bean `OrderPlacedListener`: class `shop.events.OrderPlacedListener`; activation property `destinationLookup` is `java:/jms/queue/OrderPlaced`. +- Interceptor: `shop.audit.TimingInterceptor`; bound to all EJBs via `ejb-name` `*`. +- Transaction attribute: `RequiresNew` for method `reserve` on `StockReservationBean`. + +#### Configuration +- `reservationMinutes`: type `java.lang.Integer`, value `45`. +- `destinationLookup`: `java:/jms/queue/OrderPlaced`. + +#### Dependencies +- Classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`. +- Local EJB interface: `shop.stock.StockReservation`. +- JMS destination: `java:/jms/queue/OrderPlaced`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jee/package.ai.md new file mode 100644 index 00000000..f37f176e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jee/package.ai.md @@ -0,0 +1,45 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:31:12Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> Configures the shop back-office web application and its EJB services for report access, checkout, stock reservation, and order-placement event handling. + +#### Purpose +- Declares web and EJB components, their runtime settings, and access controls for the shop application. +- Connects report and admin endpoints to web infrastructure, and checkout and inventory services to EJB and JMS configuration. + +#### Responsibilities +- **Web application:** Maps report downloads, applies a request filter, runs a startup listener, configures session lifetime and report directory, and protects admin URLs by role. +- **Business services and events:** Declares stateless stock reservation and stateful checkout beans, plus a message-driven listener for order-placement events. +- **Cross-cutting EJB configuration:** Binds a timing interceptor to all EJBs and configures `reserve` to use `RequiresNew` transactions. + +#### Key units +- `ReportDownloadServlet` — serves requests mapped to `/reports/*`. +- `RequestIdFilter` — filters requests mapped to `/*`. +- `StartupAuditListener` — web application startup listener. +- `StockReservationBean` — stateless bean for stock reservation; `reserve` has a `RequiresNew` transaction rule. +- `CheckoutSessionBean` — stateful checkout bean with a local reference to `StockReservation`. +- `OrderPlacedListener` — message-driven bean configured for the order-placed queue. +- `TimingInterceptor` — interceptor bound to all EJBs. +- `jdbc/ShopDS` — web application resource reference to a `javax.sql.DataSource`. +- `admin` — role permitted to access `/admin/*`. + +#### Data flow +- Web requests pass through `RequestIdFilter`; report requests are routed to `ReportDownloadServlet`. +- Checkout has a local EJB reference to `StockReservation`; order-placement events are handled by `OrderPlacedListener` through the configured JMS destination. + +#### Dependencies +- Application classes: `shop.web.ReportDownloadServlet`, `shop.web.RequestIdFilter`, `shop.web.StartupAuditListener`, `shop.stock.StockReservationBean`, `shop.stock.StockReservation`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`. +- Runtime resources: JMS queue `java:/jms/queue/OrderPlaced` and data source `jdbc/ShopDS`. +- Web settings include `shop.reportDirectory` set to `/var/shop/reports` and a 20-minute session timeout; EJB environment entry `reservationMinutes` is `45`. + +#### Cross-cutting +- Jakarta EE deployment descriptors define both web and EJB components. +- Admin access is restricted to the `admin` role; `TimingInterceptor` applies across EJBs. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jee/web.xml.ai.md new file mode 100644 index 00000000..474e8147 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jee/web.xml.ai.md @@ -0,0 +1,41 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:29:33Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Configures the shop back-office web application’s report endpoint, request filtering, startup audit, session lifetime, admin access control, and data-source reference. + +#### Purpose +- Defines web application settings and components for `shop-backoffice`. +- Protects admin URLs and exposes report downloads. + +#### Type +- Jakarta EE web application descriptor; root element `web-app`. +- Namespace: default `https://jakarta.ee/xml/ns/jakartaee`. + +#### Definitions +- Servlet `ReportDownloadServlet` — class `shop.web.ReportDownloadServlet`; URL pattern `/reports/*`. +- Filter `RequestIdFilter` — class `shop.web.RequestIdFilter`; URL pattern `/*`. +- Listener — class `shop.web.StartupAuditListener`. +- Session timeout: `20` minutes. +- Resource reference `jdbc/ShopDS` — type `javax.sql.DataSource`. +- Security role `admin`; constraint protects `/admin/*` and permits role `admin`. + +#### Configuration +- Display name: `shop-backoffice`. +- Context parameter `shop.reportDirectory`: `/var/shop/reports`. +- Servlet `ReportDownloadServlet` load-on-startup: `1`. + +#### Dependencies +- Servlet class `shop.web.ReportDownloadServlet`. +- Filter class `shop.web.RequestIdFilter`. +- Listener class `shop.web.StartupAuditListener`. +- Data source resource `jdbc/ShopDS` (`javax.sql.DataSource`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..47813eb8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,49 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:29:37Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> Lists customer orders for review and lets staff search by customer email or status and cancel an order. + +#### Purpose +- Display orders with their number, total, overdue status, and cancellation link. +- Search orders by customer email and status. + +#### Type +- JSP page; `text/html;charset=UTF-8`. +- `c` = Jakarta Tags core (`jakarta.tags.core`); `fmt` = Jakarta Tags formatting (`jakarta.tags.fmt`). +- Uses JSP standard actions via `jsp`. + +#### Data +- Request attribute `orderFilter`; scriptlet calls `getPageSize()`. +- `${orders}` iterated as `order`. +- `order.number`, `order.total`, `order.overdue`, `order.id`. +- Request parameter `param.customerEmail`. + +#### Actions +- GET form to `${pageContext.request.contextPath}/orders/search`; fields: `customerEmail` (text), `status` (select: `OPEN`, `SHIPPED`). +- Cancel link to `orders/${order.id}/cancel`. +- No validators or converters shown. + +#### Structure +- Includes `/WEB-INF/jspf/header.jspf` via include directive. +- Includes `/WEB-INF/jspf/footer.jspf` via `jsp:include`. + +#### Server code +- Imports `java.util.List`, `shop.Order`, and `shop.OrderFilter`. +- Reads request attribute `orderFilter` as `OrderFilter`; computes `pageSize` as 25 when the filter is null, otherwise calls `getPageSize()`. + +#### Dependencies +- `/WEB-INF/jspf/header.jspf` +- `/WEB-INF/jspf/footer.jspf` +- `shop.Order`, `shop.OrderFilter` +- `${pageContext.request.contextPath}/orders/search` +- `orders/${order.id}/cancel` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jsp/package.ai.md new file mode 100644 index 00000000..c3827bcc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/jsp/package.ai.md @@ -0,0 +1,33 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:31:18Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> Provides staff with a searchable view of customer orders and links to cancel individual orders. + +#### Purpose +- Display order numbers, totals, and overdue status for staff review. +- Search orders by customer email and status, and expose order cancellation links. + +#### Responsibilities +- Render the order list and search form using Jakarta Tags core and formatting tags. +- Set page size from the `orderFilter` request attribute, defaulting to 25 when absent. + +#### Key units +- `order-list.jsp` — JSP page that renders orders and provides search and cancellation actions. +- `shop.Order` — order data referenced by the page. +- `shop.OrderFilter` — filter data used to determine page size. + +#### Data flow +- Reads `orderFilter` from the request and computes `pageSize`; reads `customerEmail` from request parameters. +- Iterates over `${orders}` to display each order’s `number`, `total`, and `overdue` values. +- Submits search criteria by GET to `/orders/search`; links each order to `orders/${order.id}/cancel`. + +#### Dependencies +- Includes `/WEB-INF/jspf/header.jspf` and `/WEB-INF/jspf/footer.jspf`. +- Uses `shop.Order`, `shop.OrderFilter`, Jakarta Tags core, and Jakarta Tags formatting. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..16d79492 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,46 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:29:43Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the orders backoffice application with three replicas, internal service access, and HTTP ingress at `backoffice.shop.example`. + +#### Purpose +- Runs the orders backoffice application in Kubernetes and exposes it through a Service and Ingress. + +#### Type +- Kubernetes multi-document manifest: Deployment (`apps/v1`), Service (`v1`), Ingress (`networking.k8s.io/v1`). + +#### Definitions +- Deployment `orders-backoffice`: + - 3 replicas; selector and pod label `app: orders-backoffice`. + - Container `backoffice`, image `registry.shop.example/orders-backoffice:2.1.0`; port `8080`. + - Environment: `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop`; `SHOP_DB_PASSWORD` from secret `orders-db-credentials`, key `password`. + - Readiness probe: HTTP `GET /health/ready` on port `8080`. + - Resource limits: memory `768Mi`, CPU `1`. +- Service `orders-backoffice`: + - Selects pods with `app: orders-backoffice`; port `80` targets port `8080`. +- Ingress `orders-backoffice`: + - Host `backoffice.shop.example`; path `/` with `Prefix` routing to Service `orders-backoffice` on port `80`. + +#### Configuration +- `replicas=3` +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD=***` (reference: `orders-db-credentials`, key `password`) +- Readiness path `/health/ready`; port `8080` +- Resource limits: `memory=768Mi`, `cpu=1` +- Ingress host `backoffice.shop.example`; path `/`; `pathType=Prefix` + +#### Dependencies +- Image: `registry.shop.example/orders-backoffice:2.1.0` +- Database endpoint: `orders-db:5432` +- Secret: `orders-db-credentials` (key `password`) +- Ingress backend Service: `orders-backoffice` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/k8s/package.ai.md new file mode 100644 index 00000000..bc94ba75 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/k8s/package.ai.md @@ -0,0 +1,36 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:31:22Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Runs the orders backoffice application and makes it available internally and at `backoffice.shop.example`. + +#### Purpose +- Deploys the orders backoffice application on Kubernetes with database configuration and HTTP access. + +#### Responsibilities +- Define the application Deployment, including replicas, container image, port, readiness probe, and resource limits. +- Provide pod access through a Service and route external HTTP traffic through an Ingress. + +#### Key units +- `Deployment/orders-backoffice` — runs three `backoffice` replicas on port `8080`. +- `Service/orders-backoffice` — exposes selected pods on port `80`, targeting `8080`. +- `Ingress/orders-backoffice` — routes `/` requests for `backoffice.shop.example` to the Service. + +#### Data flow +- Ingress traffic for `backoffice.shop.example/` routes through Service `orders-backoffice` to application pods on port `8080`. +- The application receives its database URL and a password from Secret `orders-db-credentials`. + +#### Dependencies +- Container image: `registry.shop.example/orders-backoffice:2.1.0`. +- Database endpoint: `orders-db:5432`. +- Secret: `orders-db-credentials`, key `password`. + +#### Cross-cutting +- Readiness is checked with HTTP `GET /health/ready` on port `8080`. +- Container resource limits are `768Mi` memory and `1` CPU. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..0ab7651f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,80 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:29:52Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Completed orders with invoice lines receive a numbered invoice, a 14-day payment deadline, and persistent storage. + +#### Purpose +- `InvoiceService` issues invoices for completed orders and selects reduced tax rates for configured categories. +- `InvoiceLine.total()` sums line amounts. + +#### Type +- `InvoiceNumber` — value class; wraps `String`; annotated `@JvmInline`. +- `InvoiceLine` — data class; constructor properties `sku: String`, `quantity: Int`, `unitPrice: BigDecimal`. +- `InvoiceResult` — sealed interface. +- `InvoiceResult.Issued` — data class implementing `InvoiceResult`; `number: InvoiceNumber`, `dueDate: LocalDate`. +- `InvoiceResult.Rejected` — data class implementing `InvoiceResult`; `reason: String`. +- `InvoiceService` — class; constructor dependencies `InvoiceRepository` and `() -> LocalDate`. +- `InvoiceService.Companion` — companion object of `InvoiceService`. +- No declared supertype for `InvoiceService`; no annotations beyond those noted above. + +#### Input +- `InvoiceService` constructor: `repository: InvoiceRepository`; `clock: () -> LocalDate`, defaulting to `LocalDate::now`. +- `InvoiceService.issue(order: CompletedOrder)` consumes the order’s `lines`, `id`, and `customerId`. +- `InvoiceService.taxRate(category: String)` consumes a category name. +- `InvoiceLine` constructor consumes SKU, quantity, and unit price. +- `InvoiceNumber` constructor consumes a string value. +- Top-level `PAYMENT_TERM_DAYS` and companion `REDUCED_TAX_CATEGORIES` provide payment-term and reduced-tax configuration. + +#### Output +- `issue` returns `InvoiceResult.Issued` with invoice number and due date, or `InvoiceResult.Rejected` for orders without lines. +- `taxRate` returns `BigDecimal`. +- `InvoiceLine.amount` and `List.total()` return `BigDecimal`. +- `issue` saves the constructed `Invoice` through `repository.save(invoice)`. +- `defaultCurrency` is a mutable, uninitialized `lateinit` property; no use is shown. + +#### Core logic +- `issue` switches to `Dispatchers.IO` with `withContext`. +- If `order.lines.isEmpty()`, returns `InvoiceResult.Rejected("order ${order.id} has no lines")` without numbering or saving. +- Otherwise, calls private `nextNumber()`, builds `Invoice` from the number, `order.customerId`, `order.lines`, and `clock().plusDays(PAYMENT_TERM_DAYS.toLong())`, then calls `repository.save(invoice)` and returns `InvoiceResult.Issued(number, invoice.dueDate)`. +- `nextNumber()` increments `sequence` and formats an `InvoiceNumber` as `"$PREFIX-${++sequence}"`; `PREFIX` is `"INV"`. +- `taxRate` returns `BigDecimal("0.07")` when `category` is in `REDUCED_TAX_CATEGORIES` (`"books"`, `"food"`); otherwise returns `BigDecimal("0.19")`. +- `InvoiceLine.amount` multiplies `unitPrice` by `BigDecimal(quantity)`. +- `List.total()` folds from `BigDecimal.ZERO`, adding each `line.amount`. + +#### Public API +- `PAYMENT_TERM_DAYS: Int` — payment term in days. +- `InvoiceNumber(value: String)` — invoice-number value type. +- `InvoiceLine(sku: String, quantity: Int, unitPrice: BigDecimal)` — invoice line data. +- `amount: BigDecimal` — calculated line amount. +- `InvoiceResult.Issued(number: InvoiceNumber, dueDate: LocalDate)` — issued result. +- `InvoiceResult.Rejected(reason: String)` — rejection result. +- `InvoiceService(repository: InvoiceRepository, clock: () -> LocalDate)` — create invoice service. +- `REDUCED_TAX_CATEGORIES: Set` — reduced-rate categories. +- `defaultCurrency: String` — get/set default currency. +- `issue(order: CompletedOrder): InvoiceResult` — issue and store invoice. +- `taxRate(category: String): BigDecimal` — select category tax rate. +- `List.total(): BigDecimal` — sum line amounts. + +#### Dependencies +- `java.math.BigDecimal` +- `java.time.LocalDate` +- `kotlinx.coroutines.Dispatchers`, `kotlinx.coroutines.withContext` +- `InvoiceRepository`, `CompletedOrder`, `Invoice` in `shop.billing` + +#### Exceptions / Errors +- Empty order lines produce `InvoiceResult.Rejected`; no exception handling is shown. +- Accessing `defaultCurrency` before initialization can fail because it is `lateinit`. + +#### Concurrency +- `issue` executes its body on `Dispatchers.IO`. +- Mutable `sequence` has no synchronization; concurrent calls may race. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/kotlin/package.ai.md new file mode 100644 index 00000000..ef7f02c6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/kotlin/package.ai.md @@ -0,0 +1,42 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:31:26Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> Completed orders with invoice lines are assigned numbered invoices with payment deadlines, tax rates, and persistent storage. + +#### Purpose +- Issue and store invoices for completed orders, rejecting orders with no lines. +- Calculate invoice-line totals and select reduced or standard tax rates by category. + +#### Responsibilities +- Invoice creation: number eligible orders, set a 14-day payment deadline, and save the invoice. +- Invoice calculations and policy: compute line amounts and totals, and choose tax rates for configured categories. + +#### Key units +- `InvoiceService` — issues invoices through `InvoiceRepository` and selects tax rates. +- `InvoiceNumber` — value type wrapping an invoice number string. +- `InvoiceLine` — stores SKU, quantity, and unit price; exposes its calculated amount. +- `InvoiceResult` — sealed result with `Issued` (number and due date) and `Rejected` (reason) variants. +- `List.total()` — sums line amounts. +- `PAYMENT_TERM_DAYS` — configures the payment term; `REDUCED_TAX_CATEGORIES` — identifies reduced-rate categories (`books`, `food`). +- `defaultCurrency` — mutable `lateinit` property; its use is not shown. + +#### Data flow +- `issue(order)` rejects orders with no lines; otherwise it generates an `INV` number, builds an invoice from the order’s customer and lines with a clock-based due date, saves it, and returns `Issued`. +- `InvoiceLine.amount` multiplies unit price by quantity; `total()` adds line amounts from `BigDecimal.ZERO`. +- `taxRate(category)` returns `0.07` for reduced-tax categories and `0.19` otherwise. + +#### Dependencies +- `InvoiceService` collaborates with `InvoiceRepository` and consumes `CompletedOrder`, creating an `Invoice` from `shop.billing`. +- Uses `BigDecimal`, `LocalDate`, and Kotlin coroutines (`Dispatchers.IO`, `withContext`). + +#### Cross-cutting +- `issue` runs on `Dispatchers.IO`; the injected clock defaults to `LocalDate::now`. +- Invoice sequence mutation is unsynchronized and may race across concurrent calls. +- Empty orders produce `InvoiceResult.Rejected`; accessing `defaultCurrency` before initialization may fail. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..1c062b90 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,37 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:30:01Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Defines customer database mappings and CRUD/search operations for the shop customer repository. + +#### Type +- MyBatis mapper; root element `mapper`; namespace `shop.customer.CustomerMapper`. + +#### Definitions +- Result map `customerResult` maps `shop.customer.Customer`: `id` → `CUSTOMER_ID`, `email` → `EMAIL`, `loyaltyTier` → `LOYALTY_TIER`. +- SQL fragment `customerColumns`: `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`. +- `select` `findByEmail`: selects the shared customer columns from `CUSTOMER`, matching `EMAIL` to `#{email}`; uses `customerResult`. +- `select` `search`: selects the shared columns from `CUSTOMER`; conditionally filters by `tier` and `createdAfter`; orders by `${sortColumn}`; uses `customerResult`. +- `insert` `insert`: writes `EMAIL`, `LOYALTY_TIER`, and `CREATED_AT` to `CUSTOMER`; uses `#{email}`, `#{loyaltyTier}`, and `now()`; returns generated key to `id`. +- `update` `promote`: updates `CUSTOMER.LOYALTY_TIER` to `#{tier}` for IDs in `ids`. +- `delete` `deleteInactive`: deletes from `CUSTOMER` where `LAST_ORDER_AT` is before `#{cutoff}`. +- `${sortColumn}` is spliced into the search SQL unescaped. + +#### Configuration +- `insert`: `useGeneratedKeys="true"`; `keyProperty="id"`. +- `search`: `tier` and `createdAfter` filters apply only when their values are non-null; sort column is supplied by `sortColumn`. +- `promote`: `ids` values are bound as a comma-separated `IN` list. + +#### Dependencies +- Java type `shop.customer.Customer`. +- Database table `CUSTOMER`; columns `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`. +- MyBatis mapper DTD: `https://mybatis.org/dtd/mybatis-3-mapper.dtd`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/mybatis/package.ai.md new file mode 100644 index 00000000..e69dc855 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/mybatis/package.ai.md @@ -0,0 +1,39 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:31:33Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Provides database-backed customer lookup, search, creation, promotion, and inactive-customer cleanup for the shop. + +#### Purpose +- Maps customer repository operations to SQL against the `CUSTOMER` table. +- Returns customer records and supports customer lifecycle updates. + +#### Responsibilities +- Customer retrieval and search: find by email or search with optional loyalty-tier and creation-date filters. +- Customer maintenance: insert customers with generated IDs, promote selected customers, and delete customers with stale orders. + +#### Key units +- `shop.customer.CustomerMapper` — MyBatis mapper namespace for customer operations. +- `customerResult` — maps `CUSTOMER_ID`, `EMAIL`, and `LOYALTY_TIER` to `shop.customer.Customer`. +- `customerColumns` — shared projection of customer ID, email, loyalty tier, and creation timestamp. +- `findByEmail`, `search`, `insert`, `promote`, `deleteInactive` — customer lookup, filtered search, insertion, tier update, and inactive-customer deletion statements. + +#### Data flow +- Mapper parameters drive SQL predicates and writes; query results use `customerResult` to populate `shop.customer.Customer`. +- `search` applies non-null `tier` and `createdAfter` filters, then orders by the supplied sort column. +- `insert` writes customer details and returns the generated key to `id`; `promote` binds IDs in an `IN` list. + +#### Dependencies +- Java type `shop.customer.Customer`. +- Database table `CUSTOMER` and columns `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`. +- MyBatis mapper DTD. + +#### Cross-cutting +- Reuses the `customerColumns` SQL fragment in both select statements. +- `search` interpolates `${sortColumn}` directly into SQL without escaping. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..32ead0b0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,36 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:30:07Z +- G: +- A: 0.0.0 +- X: file +- P: 30325B28 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> Specifies shop backoffice order lookup, listing, and cancellation, exchanging orders and order-status values. + +#### Purpose +- Defines operations to list and retrieve shop orders and cancel an order. + +#### Type +- OpenAPI 3.0.3; title `Shop Orders API`, version `2.1.0`. + +#### Operations +- `GET /orders` — `listOrders`; query parameters `status` (`OrderStatus`) and `limit` (integer, maximum 200); `200` returns an array of `Order`. +- `GET /orders/{orderId}` — `getOrder`; required path parameter `orderId` (string); `200` returns `Order`; `404` has no schema specified. +- `POST /orders/{orderId}/cancel` — `cancelOrder`; required path parameter `orderId` (string); requires `backofficeToken` scope `orders:write`; `204` and `409` have no schemas specified. + +#### Schemas +- `OrderStatus` — string enum: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order` — object; required fields: `orderId` (string), `status` (`OrderStatus`), `total` (number, format `double`); optional `couponCode` (string, deprecated). + +#### Security and servers +- Server: `https://api.shop.example/backoffice`. +- `backofficeToken` — OAuth 2.0 client credentials; token URL `https://auth.shop.example/token`; scope `orders:write`; required by `cancelOrder`. + +#### Dependencies +- None. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/openapi/package.ai.md new file mode 100644 index 00000000..6ba9b594 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/openapi/package.ai.md @@ -0,0 +1,37 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:31:37Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> Defines the backoffice contract for listing, retrieving, and cancelling shop orders. + +#### Purpose +- Specifies the Shop Orders API (`2.1.0`) for order lookup and cancellation. + +#### Responsibilities +- Order access: list orders by optional status and limit, or retrieve an order by ID. +- Order cancellation: cancel by order ID, requiring OAuth authorization. + +#### Key units +- `GET /orders` (`listOrders`) — returns an array of `Order` values. +- `GET /orders/{orderId}` (`getOrder`) — retrieves an `Order` by ID. +- `POST /orders/{orderId}/cancel` (`cancelOrder`) — cancels an order; documents `204` and `409` responses. +- `Order` — order ID, `OrderStatus`, total, and optional deprecated `couponCode`. +- `OrderStatus` — `OPEN`, `PAID`, `SHIPPED`, or `CANCELLED`. + +#### Data flow +- Clients send order queries or an order ID to the backoffice API; successful lookup operations return `Order` data. +- Cancellation requests use an order ID and an authorized token, with success and conflict responses documented. + +#### Dependencies +- Base server: `https://api.shop.example/backoffice`. +- OAuth 2.0 client-credentials token endpoint: `https://auth.shop.example/token`. + +#### Cross-cutting +- `cancelOrder` requires `backofficeToken` with the `orders:write` scope. +- `listOrders` supports a `limit` capped at 200; `couponCode` is deprecated. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..c638a84a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,68 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:31:56Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> Supports the shop’s order lifecycle across checkout, fulfilment, shipping, invoicing, customer data, integrations, and back-office deployment. + +#### Purpose +- Defines the shop’s order and back-office capabilities, from customer checkout and order processing to invoicing, reporting, and cancellation. +- Groups application contracts, persistence and integration configuration, and build and runtime deployment assets. + +#### Responsibilities +- **Order lifecycle and staff operations:** BPMN order fulfilment routes stock reservation, payment, approval, shipping, invoicing, and out-of-stock cancellation; JSP and OpenAPI expose order search, lookup, and cancellation. +- **Checkout, shipping, and billing:** Facelets collects delivery details and shipping choices; Groovy `ShippingRules` calculates parcel charges; Kotlin invoice services issue invoices and calculate tax and totals. +- **Customer and order data:** MyBatis maps customer lookup, search, creation, promotion, and cleanup to `CUSTOMER`; JPA/Hibernate configures shipment mappings and shop and reporting persistence units. +- **External processing and service contracts:** Camel routes validate and audit incoming orders, send them to ERP or manual review, and handle failures; WSDL defines stock lookup and unknown-SKU faults. +- **Application operations:** Jakarta EE descriptors configure web and EJB components, while Docker, Kubernetes, and GitHub Actions package, publish, and deploy the backoffice. + +#### Key units +- `orderFulfilment` — BPMN process coordinating stock reservation, payment, approval, shipping, invoicing, and cancellation. +- `checkout.xhtml` — checkout form bound to `checkoutBean` for address entry, shipping selection, total refresh, and order submission. +- `ShippingRules` — computes parcel charges from order value and weight, enforcing carrier limits and free-shipping eligibility. +- `InvoiceService` — issues invoices for completed orders, calculates tax rates, and persists invoices through `InvoiceRepository`. +- `CustomerMapper` — MyBatis operations mapping customer queries and lifecycle updates to the `CUSTOMER` table. +- `Shipment` and `ExpressShipment` — Hibernate mappings for shipment records and their joined express-shipment subtype. +- `orderIntegration` — Camel context routing validated orders to ERP or manual review, with audit and failure handling. +- `OrderPlacedListener`, `StockReservationBean`, and `CheckoutSessionBean` — EJB components for order events, stock reservation, and checkout. +- Shop Orders OpenAPI — contract for listing, retrieving, and cancelling orders. +- `StockService` and `StockPortType` — SOAP contract exposing stock-level lookup and an `UnknownSku` fault. +- `release-backoffice`, `Dockerfile`, and Kubernetes `orders-backoffice` resources — build, package, publish, and run the backoffice application. + +#### Data flow +- Customers enter delivery details and select shipping at checkout; `ShippingRules` calculates charges, and order placement feeds the fulfilment and event-processing capabilities. +- `orderFulfilment` reserves stock, waits for payment, routes high-value orders for approval, then ships and invokes invoicing; stock errors lead to cancellation. +- Incoming integration orders are validated and audited, then routed by configured value threshold to ERP submission or per-line manual review; ERP-unavailable failures are retried and dead-lettered. +- Completed orders with lines are converted into numbered invoices, assigned payment deadlines, and saved; customer and shipment records are handled by mapper and persistence configurations. +- Back-office build and release workflows verify the application, publish its container image, and invoke Kubernetes deployment; Kubernetes routes HTTP traffic to application pods. + +#### Dependencies +- Application types and services include `shop.bpm.ReserveStockDelegate`, `checkoutBean`, `Order`, `InvoiceRepository`, `CompletedOrder`, `shop.customer.Customer`, and `shop.integration` validator, translator, and exception types. +- Data infrastructure includes `CUSTOMER`, `SHIPMENT`, `EXPRESS_SHIPMENT`, `SHIPMENT_SEQ`, `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`, and the `orders-db` Kubernetes endpoint. +- Messaging and integration endpoints include JMS order, review, and dead-letter queues; Camel audit and direct routes; ERP HTTPS; and the BPMN `shipping` task topic and `invoicing` process. +- API and service contracts include OAuth 2.0 for order cancellation and SOAP-over-HTTP stock lookup. +- Deployment tooling includes Maven, Java 21/25 CI builds, the `registry.shop.example` container registry, and Kubernetes Deployment, Service, and Ingress resources. + +#### Cross-cutting +- Order totals, shipping prices, invoice amounts, and tax calculations use monetary values including `BigDecimal`; shipping and invoice rules apply explicit thresholds and policies. +- Jakarta EE, Spring/Camel, MyBatis, and Hibernate provide application configuration and persistence; the shop persistence unit is JTA, while reporting is resource-local. +- Configuration spans integration property placeholders, EJB transaction and interceptor settings, Kubernetes secrets and probes, and production container settings. +- Failure handling includes BPMN out-of-stock cancellation, ERP retry and dead-letter routing, overweight-parcel exceptions, and rejected invoices for empty orders. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..b7e094dc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,45 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:30:15Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps shipment persistence, including its order and parcel relationships, express-shipment inheritance, and shipment lookup queries. + +#### Purpose +- Defines Hibernate ORM mappings for shipments and express shipments. +- Provides HQL and native SQL queries for undelivered shipments and carrier counts. + +#### Type +- Hibernate mapping (`*.hbm.xml`); root element `hibernate-mapping`; no XML namespace declared. +- Declares Hibernate Mapping DTD 3.0, with system ID `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. + +#### Definitions +- Entity `shop.shipping.Shipment` maps to table `SHIPMENT`. + - ID `id` maps to `SHIPMENT_ID`; sequence generator uses `SHIPMENT_SEQ`. + - `trackingCode` → `TRACKING_CODE`, length `40`, not null. + - `carrier` → `CARRIER`, length `12`. + - `shippedAt` → `SHIPPED_AT`, type `timestamp`. + - Many-to-one `order` references `shop.Order` via `ORDER_ID`, not null. + - Set `parcels` is inverse with cascade `all-delete-orphan`; key `SHIPMENT_ID`; one-to-many class `Parcel`. +- Joined subclass `ExpressShipment` maps to `EXPRESS_SHIPMENT`; key `SHIPMENT_ID`; property `deliveryWindow` → `DELIVERY_WINDOW`. +- Named query `Shipment.undelivered`: selects shipments where `deliveredAt` is null and `shippedAt` precedes `:cutoff`. +- Native SQL query `Shipment.countByCarrier`: selects `CARRIER` and row count from `SHIPMENT`, grouped by `CARRIER`. + +#### Configuration +- Package: `shop.shipping`. +- ID generation: sequence `SHIPMENT_SEQ`. +- `trackingCode` length `40`, required; `carrier` length `12`. +- `parcels` cascade: `all-delete-orphan`. + +#### Dependencies +- Referenced classes: `shop.Order`, `Parcel`, `ExpressShipment`. +- External mapping DTD: Hibernate Mapping DTD 3.0 at `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. +- Database tables: `SHIPMENT`, `EXPRESS_SHIPMENT`; sequence: `SHIPMENT_SEQ`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/persistence/package.ai.md new file mode 100644 index 00000000..3224d6a8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/persistence/package.ai.md @@ -0,0 +1,45 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:31:41Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Configures persistence for shop orders, customers, shipments, and reporting data, including shipment mappings and lookup queries. + +#### Purpose +- Maps `shop.shipping.Shipment` and joined `ExpressShipment` persistence, with parcel and order relationships. +- Defines separate JTA shop and resource-local reporting persistence units. + +#### Responsibilities +- Shipment ORM: maps shipment fields, sequence-generated IDs, joined inheritance, and parcel ownership/cascade behavior. +- Persistence-unit setup: configures entity classes, transaction modes, data sources, Hibernate provider, and shop database properties. +- Shipment queries: provides undelivered-shipment lookup and carrier shipment counts. + +#### Key units +- `Shipment` — maps to `SHIPMENT`, with required `trackingCode`, carrier and timestamp fields, an order reference, and parcel collection. +- `ExpressShipment` — joined subclass stored in `EXPRESS_SHIPMENT`, with a delivery-window property. +- `Shipment.undelivered` — selects shipments with no delivery timestamp shipped before a supplied cutoff. +- `Shipment.countByCarrier` — groups shipment row counts by carrier. +- `shop` persistence unit — JTA unit for `Order`, `OrderLine`, and `Customer`, with `META-INF/order-queries.xml`. +- `reporting` persistence unit — resource-local unit for `DailyRevenue`, excluding unlisted classes. + +#### Data flow +- Hibernate maps shipment records from `SHIPMENT` and `EXPRESS_SHIPMENT`; shipment IDs use `SHIPMENT_SEQ`. +- Shipment associations connect each shipment to an `Order` and its `Parcel` collection; parcel changes cascade with orphan deletion. +- The `shop` and `reporting` persistence units route persistence through their respective JTA and non-JTA data sources. + +#### Dependencies +- Shipment mappings reference `shop.Order`, `Parcel`, and `ExpressShipment`; tables `SHIPMENT` and `EXPRESS_SHIPMENT`; sequence `SHIPMENT_SEQ`. +- Persistence units use `org.hibernate.jpa.HibernatePersistenceProvider` and PostgreSQL dialect configuration. +- Data sources: `java:/jdbc/ShopDS` and `java:/jdbc/ReportingDS`. +- The `shop` unit references `META-INF/order-queries.xml`. + +#### Cross-cutting +- Hibernate ORM configuration is used for shipment mappings and as the provider for the JPA persistence units. +- Persistence is split by transaction mode: JTA for `shop`, `RESOURCE_LOCAL` for `reporting`. +- Shop configuration sets JDBC batch size to `50`; its configured database password is masked. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..0eb6fda8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/persistence/persistence.xml.ai.md @@ -0,0 +1,37 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:30:11Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Defines JTA persistence for shop orders and customers, plus resource-local persistence for reporting data. + +#### Purpose +- Configures two Jakarta Persistence units with separate data sources and entity classes. + +#### Type +- Jakarta Persistence descriptor (`persistence.xml`); root element `persistence`. +- Namespace: default `https://jakarta.ee/xml/ns/persistence`. + +#### Definitions +- Persistence unit `shop`: transaction type `JTA`; provider `org.hibernate.jpa.HibernatePersistenceProvider`; entities `shop.Order`, `shop.OrderLine`, `shop.Customer`; mapping file `META-INF/order-queries.xml`. +- Persistence unit `reporting`: transaction type `RESOURCE_LOCAL`; entity `shop.reporting.DailyRevenue`; unlisted classes excluded. + +#### Configuration +- `shop`: JTA data source `java:/jdbc/ShopDS`. +- `shop`: `hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect`; `hibernate.jdbc.batch_size=50`; `hibernate.connection.username=shop_app`; `hibernate.connection.password=***`. +- `reporting`: non-JTA data source `java:/jdbc/ReportingDS`; `exclude-unlisted-classes=true`. + +#### Dependencies +- Mapping file: `META-INF/order-queries.xml`. +- Provider class: `org.hibernate.jpa.HibernatePersistenceProvider`. +- Entity classes: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue`. +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`. +- Hibernate dialect class: `org.hibernate.dialect.PostgreSQLDialect`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..846e30e7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,37 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:30:21Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Defines a SOAP stock lookup service that accepts an SKU, returns its available quantity, and can report an unknown-SKU fault. + +#### Type +- WSDL; root `definitions`, named `StockService`. +- Namespaces: default `http://schemas.xmlsoap.org/wsdl/`; `soap` = `http://schemas.xmlsoap.org/wsdl/soap/`; `tns` = `http://shop.example/stock`; `xs` = `http://www.w3.org/2001/XMLSchema`. + +#### Definitions +- Target namespace: `http://shop.example/stock`. +- Schema elements: `StockLevelRequest` contains `sku` (`xs:string`); `StockLevelResponse` contains `available` (`xs:int`). +- Schema complex type: `UnknownSkuFault` contains `sku` (`xs:string`). +- Messages: `GetStockLevelInput` uses `StockLevelRequest`; `GetStockLevelOutput` uses `StockLevelResponse`; `UnknownSku` carries `UnknownSkuFault`. +- Port type `StockPortType`: operation `GetStockLevel`, input `GetStockLevelInput`, output `GetStockLevelOutput`, fault `UnknownSku` (`UnknownSku` message). +- Binding `StockSoapBinding`: document-style SOAP over HTTP; operation `GetStockLevel` uses literal input, output, and `UnknownSku` fault. +- Service `StockService`: port `StockPort` bound to `StockSoapBinding`, address `https://erp.shop.example/soap/stock`. + +#### Configuration +- SOAP transport: `http://schemas.xmlsoap.org/soap/http`. +- SOAP action: `http://shop.example/stock/GetStockLevel`. +- SOAP body and fault use: `literal`. +- Service address: `https://erp.shop.example/soap/stock`. + +#### Dependencies +- XML Schema built-in types: `xs:string`, `xs:int`. +- WSDL messages reference `StockLevelRequest`, `StockLevelResponse`, and `UnknownSkuFault` in `http://shop.example/stock`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/wsdl/package.ai.md new file mode 100644 index 00000000..a5d4bc72 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/other/wsdl/package.ai.md @@ -0,0 +1,38 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:31:48Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Defines the SOAP contract for retrieving a stock quantity by SKU and reporting unknown-SKU faults. + +#### Purpose +- Specifies the request, response, and fault contract for stock-level lookup. +- Publishes the service endpoint and SOAP-over-HTTP binding. + +#### Responsibilities +- Define stock lookup messages and schema types. +- Bind the `GetStockLevel` operation to document-style, literal SOAP input, output, and fault. +- Expose the operation through the `StockPort` endpoint. + +#### Key units +- `StockService` — WSDL service exposing `StockPort` at `https://erp.shop.example/soap/stock`. +- `StockPortType` — declares `GetStockLevel` with input, output, and `UnknownSku` fault. +- `StockSoapBinding` — configures document-style SOAP over HTTP with literal bodies and fault. +- `StockLevelRequest` — carries the requested `sku` as `xs:string`. +- `StockLevelResponse` — returns `available` as `xs:int`. +- `UnknownSkuFault` — carries the unrecognized `sku` as `xs:string`. + +#### Data flow +- `GetStockLevelInput` references `StockLevelRequest`; the operation returns `GetStockLevelOutput` referencing `StockLevelResponse`, or the `UnknownSku` fault referencing `UnknownSkuFault`. + +#### Dependencies +- Uses XML Schema built-in types `xs:string` and `xs:int`. +- Defines its contract in target namespace `http://shop.example/stock`; SOAP action is `http://shop.example/stock/GetStockLevel`. + +#### Cross-cutting +- SOAP transport is HTTP; request, response, and fault use literal encoding. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..76f300e2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/package.ai.md @@ -0,0 +1,60 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:32:07Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> Supports the shop order lifecycle from checkout and fulfilment through invoicing, back-office cancellation, integration, and deployment. + +#### Purpose +- Provides customer-facing checkout and order processing alongside staff order lookup, cancellation, and retention cleanup. +- Defines the persistence, service contracts, integrations, and deployment assets needed to operate shop and back-office order capabilities. + +#### Responsibilities +- **Checkout and fulfilment:** Collect delivery and shipping choices; coordinate stock reservation, payment, approval, shipping, invoicing, and out-of-stock cancellation. +- **Order integration:** Validate and audit incoming orders, route them to ERP or manual review, and handle retries and dead-letter failures. +- **Back-office operations:** Expose order listing, lookup, and cancellation; refund cancelled orders, audit changes, and purge aged cancellations. +- **Shipping, billing, and customer data:** Calculate shipping charges and invoice amounts; map customer and shipment records to persistence. +- **Contracts and operations:** Define order and stock service contracts, configure application components and data sources, and build, publish, and deploy the back-office application. + +#### Key units +- `orderFulfilment` — BPMN process coordinating stock reservation, payment, approval, shipping, invoicing, and cancellation. +- `OrderResource` — JAX-RS `/orders` resource for back-office order operations and scheduled cancelled-order cleanup. +- `Order.open` / `Order.purgeCancelled` — named queries for listing open orders and purging aged cancelled orders. +- `checkout.xhtml` / `checkoutBean` — checkout form and backing component for delivery details, shipping selection, totals, and order submission. +- `ShippingRules` — calculates parcel charges subject to carrier limits and free-shipping eligibility. +- `InvoiceService` — creates invoices for completed orders and calculates tax and totals through `InvoiceRepository`. +- `CustomerMapper` — MyBatis customer queries and lifecycle updates against `CUSTOMER`. +- `Shipment` / `ExpressShipment` — Hibernate mappings for shipment records and the joined express-shipment subtype. +- `orderIntegration` — Camel routes for order validation, auditing, ERP/manual-review routing, and failure handling. +- `OrderPlacedListener`, `StockReservationBean`, `CheckoutSessionBean` — EJB components for order events, stock reservation, and checkout. +- Shop Orders OpenAPI — contract for listing, retrieving, and cancelling orders; cancellation uses OAuth 2.0. +- `StockService` / `StockPortType` — SOAP stock lookup contract with an `UnknownSku` fault. +- `release-backoffice`, `Dockerfile`, and Kubernetes `orders-backoffice` resources — build, package, publish, and deploy the back-office application. + +#### Data flow +- Checkout captures delivery and shipping choices, calculates charges with `ShippingRules`, and submits orders into fulfilment and event processing. +- `orderFulfilment` reserves stock, waits for payment, routes high-value orders for approval, then ships and invokes invoicing; stock errors lead to cancellation. +- Integration orders are validated and audited before routing by value threshold to ERP submission or manual review; ERP-unavailable failures are retried and dead-lettered. +- Completed orders with lines are converted into numbered invoices with payment deadlines; customer and shipment data use mapper and persistence configurations. +- Back-office cancellation refunds payment, marks the order cancelled, and records an audit event; scheduled cleanup records the count of purged orders. +- CI verifies and publishes the application container, then invokes Kubernetes deployment, where ingress routes HTTP traffic to application pods. + +#### Dependencies +- Application collaborators include `Order`, `OrderStatus`, `PaymentGateway`, `AuditLog`, `shop.bpm.ReserveStockDelegate`, `CompletedOrder`, `InvoiceRepository`, and `shop.customer.Customer`. +- Persistence includes `CUSTOMER`, `SHIPMENT`, `EXPRESS_SHIPMENT`, `SHIPMENT_SEQ`, `java:/jdbc/ShopDS`, and `java:/jdbc/ReportingDS`. +- Messaging and integration use JMS order, review, and dead-letter queues; Camel audit and direct routes; ERP HTTPS; and BPMN `shipping` and `invoicing` endpoints. +- Jakarta EE APIs support JAX-RS, EJB, CDI, JPA, and security; other application infrastructure includes Spring/Camel, MyBatis, and Hibernate. +- Deployment uses Maven, Java 21/25 CI builds, `registry.shop.example`, Kubernetes resources, and the `orders-db` endpoint. + +#### Cross-cutting +- Monetary calculations use `BigDecimal`; shipping and invoicing apply explicit thresholds and policies. +- The shop persistence unit is JTA; reporting persistence is resource-local. +- Configuration spans integration property placeholders, EJB transaction and interceptor settings, Kubernetes secrets and probes, and production container settings. +- Failure handling includes out-of-stock cancellation, ERP retry and dead-letter routing, overweight-parcel exceptions, and rejection of invoices for empty orders. +- Back-office cancellation uses a required transaction; scheduled purge uses a non-persistent EJB timer. Missing orders return `404`; refund and persistence failures are not caught by the resource. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..748f6759 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-6-luna/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: E5A980DA +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:32:22Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project covers the shop order lifecycle, from customer checkout and shipping-charge calculation through stock reservation, payment, approval, fulfilment, and invoicing. Java back-office services and staff views support order lookup, cancellation, refunds, and auditing, alongside customer and order persistence, ERP integration, and API contracts. Docker and Kubernetes package and run the back office, while release workflows verify, publish, and deploy it. + +#### Packages +- java — Backoffice staff can inspect and cancel orders, issue refunds, audit order changes, and automatically purge cancelled orders after a retention period. +- java/shop — Backoffice staff can manage order lookup and cancellation, issue refunds, audit order events, and automatically remove aged cancelled orders. +- other/actions/.github — Version-tagged orders backoffice releases are built and verified, published as container images, and handed off for production deployment. +- other/actions/.github/workflows — Automates verification, container publication, and production deployment of the orders backoffice on version-tagged releases. +- other/actions — Automates verification, container-image publication, and production deployment of versioned orders backoffice releases. +- other/bpmn — Coordinates order fulfilment from stock reservation and payment through approval, shipping, invoicing, or out-of-stock cancellation. +- other/docker — Packages the Shop orders backoffice Java application for production deployment and runtime health monitoring. +- other/facelets — Customers provide delivery details, select shipping, review the EUR order total, and submit an order. +- other/groovy — Calculates parcel shipping charges from order value and weight, applying free-shipping eligibility, weight-tier rates, and carrier weight limits. +- other/integration — Validates and routes incoming orders to ERP processing or manual review, while auditing orders and isolating failed deliveries. +- other/jee — Configures the shop back-office web application and its EJB services for report access, checkout, stock reservation, and order-placement event handling. +- other/jsp — Provides staff with a searchable view of customer orders and links to cancel individual orders. +- other/k8s — Runs the orders backoffice application and makes it available internally and at `backoffice.shop.example`. +- other/kotlin — Completed orders with invoice lines are assigned numbered invoices with payment deadlines, tax rates, and persistent storage. +- other/mybatis — Provides database-backed customer lookup, search, creation, promotion, and inactive-customer cleanup for the shop. +- other/openapi — Defines the backoffice contract for listing, retrieving, and cancelling shop orders. +- other — Supports the shop’s order lifecycle across checkout, fulfilment, shipping, invoicing, customer data, integrations, and back-office deployment. +- other/persistence — Configures persistence for shop orders, customers, shipments, and reporting data, including shipment mappings and lookup queries. +- other/wsdl — Defines the SOAP contract for retrieving a stock quantity by SKU and reporting unknown-SKU faults. +- . — Supports the shop order lifecycle from checkout and fulfilment through invoicing, back-office cancellation, integration, and deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..dc4ae587 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,49 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:36:12Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> A back‑office order management service that exposes REST APIs for querying, canceling, and auditing orders, with nightly cleanup of cancelled records. + +#### Purpose +- Provide JAX‑RS endpoints for order operations. +- Handle order cancellation and audit logging. +- Schedule nightly purge of cancelled orders. + +#### Responsibilities +- **Order querying** – list open orders, retrieve by ID. +- **Order cancellation** – process refunds, update status, log audit. +- **Scheduled cleanup** – nightly purge of cancelled orders. +- **Audit trail** – record all state changes. + +#### Key units +- **OrderResource** – stateless EJB, JAX‑RS resource at `/orders`; methods: `openOrders()`, `find(long)`, `cancel(long)`, `purgeCancelled()`. +- **PaymentGateway** – external service for processing refunds. +- **AuditLog** – central audit recorder. +- **Order** – JPA entity with named query `Order.purgeCancelled`. +- **OrderStatus** – enum of order states. + +#### Data flow +1. `openOrders()` → JPA query `Order.open` → `List`. +2. `find(id)` → `em.find(Order)` → HTTP 200 or 404. +3. `cancel(id)` → `em.find(Order)` → `payments.refund(...)` → status update → `audit.record(...)` → HTTP 204 or 404. +4. `purgeCancelled()` → `em.createNamedQuery("Order.purgeCancelled")` → `executeUpdate()` → `audit.record(...)`. + +#### Dependencies +- Jakarta EE: `@Stateless`, `@Schedule`, `@RolesAllowed`, `@Inject`, `@EJB`, `@PersistenceContext`. +- JAX‑RS: `@Path`, `@GET`, `@POST`, `@Produces`, `@PathParam`. +- JPA: `EntityManager`, named query `Order.purgeCancelled`. +- External services: `shop.PaymentGateway`, `shop.AuditLog`. +- Domain entities: `shop.Order`, `shop.OrderStatus`. + +#### Cross-cutting +- Stateless EJB ensures thread safety. +- Security enforced by `@RolesAllowed`. +- Transactions via `@TransactionAttribute`. +- Scheduled nightly cleanup with `@Schedule`. +- Audit logging applied to all state changes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..48c0d7ea --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md @@ -0,0 +1,80 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:32:25Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 37CE394E +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Provides REST endpoints for back‑office order management, including listing, retrieving, canceling orders, and a scheduled purge of old cancellations. + +#### Purpose +- Exposes order operations via JAX‑RS. +- Handles cancellation and audit logging. +- Schedules nightly purge of cancelled orders. + +#### Type +- `public class OrderResource` + - `@Stateless`, `@Path("/orders")`, `@Produces(MediaType.APPLICATION_JSON)`, `@RolesAllowed({"backoffice","admin"})` + - Extends `Object`. + - Fields: + - `@PersistenceContext(unitName = "shop") private EntityManager em;` + - `@Inject private PaymentGateway payments;` + - `@EJB private AuditLog audit;` + - Methods: 5 (`openOrders`, `find`, `cancel`, `purgeCancelled`, implicit constructor). + +#### Input +- `openOrders()` – no parameters. +- `find(long id)` – path param `id`. +- `cancel(long id)` – path param `id`. +- `purgeCancelled()` – no parameters, scheduled by `@Schedule`. +- Dependencies: `EntityManager em`, `PaymentGateway payments`, `AuditLog audit`. + +#### Output +- `openOrders()` – `List` of open orders. +- `find(long)` – `Response` with 200 and order or 404. +- `cancel(long)` – `Response` 204 or 404; triggers `payments.refund`, updates order status, records audit. +- `purgeCancelled()` – no return; records audit with removed count. + +#### Core logic +- `openOrders`: query `Order.open` via `em`. +- `find`: `em.find(Order.class, id)`; return 404 if null. +- `cancel`: + 1. `em.find(Order.class, id)` → `order`. + 2. If null → 404. + 3. `payments.refund(order.getPaymentReference(), order.getTotal())`. + 4. `order.setStatus(OrderStatus.CANCELLED)`. + 5. `audit.record("order.cancelled", id)`. + 6. Return 204. +- `purgeCancelled`: + 1. `em.createNamedQuery("Order.purgeCancelled")` with `days = PURGE_AFTER_DAYS`. + 2. `executeUpdate()` → `removed`. + 3. `audit.record("order.purged", removed)`. + +#### Public API +- `openOrders() -> List` – list open orders. +- `find(long) -> Response` – get order by id. +- `cancel(long) -> Response` – cancel order. + +#### Dependencies +- `jakarta.annotation.security.RolesAllowed` +- `jakarta.ejb.EJB`, `Schedule`, `Stateless`, `TransactionAttribute`, `TransactionAttributeType` +- `jakarta.inject.Inject` +- `jakarta.persistence.EntityManager`, `PersistenceContext` +- `jakarta.ws.rs.GET`, `POST`, `Path`, `PathParam`, `Produces` +- `jakarta.ws.rs.core.MediaType`, `Response` +- `java.util.List` +- `shop.PaymentGateway`, `shop.AuditLog`, `shop.Order`, `shop.OrderStatus` + +#### Exceptions / Errors +- Returns `Response.Status.NOT_FOUND` when order missing. +- No explicit exceptions thrown; relies on container transaction rollback on failure. + +#### Concurrency +- Stateless EJB; thread‑safe by container. +- `purgeCancelled` runs non‑persistent scheduled task. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/java/shop/package.ai.md new file mode 100644 index 00000000..bc8eafe7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/java/shop/package.ai.md @@ -0,0 +1,47 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:35:34Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Provides REST endpoints for back‑office order management, including listing, retrieving, canceling orders, and a scheduled purge of old cancellations. + +#### Purpose +- Exposes order operations via JAX‑RS. +- Handles cancellation and audit logging. +- Schedules nightly purge of cancelled orders. + +#### Responsibilities +- REST API for order queries (`openOrders`, `find`). +- Order cancellation workflow (`cancel`). +- Scheduled cleanup of cancelled orders (`purgeCancelled`). +- Audit trail integration (`AuditLog`). + +#### Key units +- **OrderResource** – stateless EJB, JAX‑RS resource at `/orders`, role‑restricted to `backoffice`/`admin`. + - Fields: `EntityManager em`, `PaymentGateway payments`, `AuditLog audit`. + - Methods: `openOrders()`, `find(long)`, `cancel(long)`, `purgeCancelled()`. + +#### Data flow +- `openOrders()` → `em` query `Order.open` → `List`. +- `find(id)` → `em.find(Order)` → `Response` 200 or 404. +- `cancel(id)` → `em.find(Order)` → `payments.refund(...)` → update status → `audit.record(...)` → `Response` 204 or 404. +- `purgeCancelled()` → `em.createNamedQuery("Order.purgeCancelled")` → `executeUpdate()` → `audit.record(...)`. + +#### Dependencies +- Jakarta EE annotations: `@Stateless`, `@Schedule`, `@RolesAllowed`, `@Inject`, `@EJB`, `@PersistenceContext`. +- JAX‑RS: `@Path`, `@GET`, `@POST`, `@Produces`, `@PathParam`. +- JPA: `EntityManager`, named query `Order.purgeCancelled`. +- External services: `shop.PaymentGateway`, `shop.AuditLog`. +- Domain entities: `shop.Order`, `shop.OrderStatus`. + +#### Cross-cutting +- Stateless EJB ensures thread safety. +- Security via `@RolesAllowed`. +- Transactional behavior via `@TransactionAttribute`. +- Scheduled task (`@Schedule`) runs nightly for cleanup. +- Audit logging is central to all state changes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/.github/package.ai.md new file mode 100644 index 00000000..c3c986c0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/.github/package.ai.md @@ -0,0 +1,38 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:36:18Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Automates the continuous delivery of the back‑office Java service from source to a Kubernetes cluster. + +#### Purpose +- Provide a CI/CD pipeline that builds, tests, containerizes, and deploys the back‑office application. + +#### Responsibilities +- **Build**: compile Java artifacts and run tests across multiple Java versions. +- **Containerize**: create and publish Docker images to a private registry. +- **Deploy**: trigger a reusable Kubernetes deployment workflow. + +#### Key units +- **Workflow `release-backoffice`** (`.github/workflows/release.yml`): orchestrates the full pipeline. +- **Job `build`**: Maven `verify` on Java 21 and 25. +- **Job `image`**: Docker login, build `orders-backoffice:`, push to `registry.shop.example`. +- **Job `deploy`**: calls reusable `.github/workflows/deploy-k8s.yml` for production. + +#### Data flow +`push` → `build` → `image` → `deploy` → Kubernetes cluster. + +#### Dependencies +- GitHub Actions: `checkout`, `setup-java`, `docker/login-action`. +- Docker registry: `registry.shop.example`. +- Reusable workflow: `.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Matrix strategy for Java versions. +- Secrets `REGISTRY_USER` and `REGISTRY_TOKEN` for registry authentication. +- Permissions block for deployment access. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..0c2947a5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,38 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:36:15Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Automates the build, containerization, and Kubernetes deployment of the back‑office service. + +#### Purpose +- Continuous delivery pipeline for the back‑office application. + +#### Responsibilities +- **Build**: compile Java artifacts and run tests across multiple Java versions. +- **Containerize**: build and push Docker images to a private registry. +- **Deploy**: trigger a reusable Kubernetes deployment workflow. + +#### Key units +- **Workflow `release-backoffice`** (`.github/workflows/release.yml`): orchestrates build, image, and deploy jobs. +- **Job `build`**: runs Maven `verify` on Java 21 and 25. +- **Job `image`**: logs into `registry.shop.example`, builds image `orders-backoffice:`, pushes to registry. +- **Job `deploy`**: invokes `.github/workflows/deploy-k8s.yml` with production environment. + +#### Data flow +`push` to a tag → `build` → `image` → `deploy` → Kubernetes cluster. + +#### Dependencies +- GitHub Actions: `checkout`, `setup-java`, `docker/login-action`. +- Docker registry: `registry.shop.example`. +- Reusable workflow: `.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Uses matrix strategy for Java versions. +- Secrets `REGISTRY_USER` and `REGISTRY_TOKEN` for registry authentication. +- Permissions block ensures required access for deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..f7614324 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,43 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:32:32Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds, tests, containerizes, and deploys the back‑office service to production Kubernetes. + +#### Purpose +- Automate release of the back‑office application. +- Build Java artifacts, create Docker image, and deploy to Kubernetes. + +#### Type +- GitHub Actions workflow (`.github/workflows/release.yml`), API v3. + +#### Definitions +- **Workflow name**: `release-backoffice`. +- **Triggers**: + - `push` on tags matching `v*`. + - `workflow_dispatch` manual trigger. +- **Jobs**: + - `build`: runs on `ubuntu-24.04`, matrix `java: [21, 25]`. + - Steps: checkout, setup Java (`temurin`, `${{ matrix.java }}`), run `mvn -B verify -Pci`. + - `image`: depends on `build`, runs on `ubuntu-24.04`, environment `production`. + - Steps: checkout, login to `registry.shop.example` with `REGISTRY_USER` and `REGISTRY_TOKEN`, build and push image `registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v}`. + - `deploy`: depends on `image`, uses reusable workflow `.github/workflows/deploy-k8s.yml` with `environment: production`, inherits secrets. + +#### Configuration +- `java-version`: `${{ matrix.java }}` (21, 25). +- Docker image tag: `${GITHUB_REF_NAME#v}` (tag without leading `v`). +- Registry credentials: `REGISTRY_USER`, `REGISTRY_TOKEN` from secrets. + +#### Dependencies +- Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Docker registry: `registry.shop.example`. +- Reusable workflow: `.github/workflows/deploy-k8s.yml`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/package.ai.md new file mode 100644 index 00000000..121f7ee6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/actions/package.ai.md @@ -0,0 +1,38 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:36:19Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Automates the continuous delivery of the back‑office Java service from source to a Kubernetes cluster. + +#### Purpose +- Provide a CI/CD pipeline that builds, tests, containerizes, and deploys the back‑office application. + +#### Responsibilities +- **Build**: compile Java artifacts and run tests across multiple Java versions. +- **Containerize**: create and publish Docker images to a private registry. +- **Deploy**: trigger a reusable Kubernetes deployment workflow. + +#### Key units +- **Workflow `release-backoffice`** (`.github/workflows/release.yml`): orchestrates the full pipeline. +- **Job `build`**: Maven `verify` on Java 21 and 25. +- **Job `image`**: Docker login, build `orders-backoffice:`, push to `registry.shop.example`. +- **Job `deploy`**: calls reusable `.github/workflows/deploy-k8s.yml` for production. + +#### Data flow +`push` → `build` → `image` → `deploy` → Kubernetes cluster. + +#### Dependencies +- GitHub Actions: `checkout`, `setup-java`, `docker/login-action`. +- Docker registry: `registry.shop.example`. +- Reusable workflow: `.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Matrix strategy for Java versions. +- Secrets `REGISTRY_USER` and `REGISTRY_TOKEN` for registry authentication. +- Permissions block for deployment access. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..b87e2f12 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,49 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:32:35Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 8D64B542 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1 + +> Defines a BPMN process for order fulfilment with payment, stock reservation, approval, shipping, and invoicing. + +#### Purpose +- Models the order fulfilment workflow. +- Handles stock reservation, payment wait, large‑order approval, shipping, and invoice creation. + +#### Type +- BPMN 2.0 XML (`bpmn:definitions` root). +- Namespaces: `bpmn`, `bpmndi`, `dc`, `camunda`. + +#### Definitions +- **Messages**: `msgPaymentReceived` (name: `PaymentReceived`). +- **Errors**: `errOutOfStock` (name: `OutOfStock`, code: `STOCK_EMPTY`). +- **Process** `orderFulfilment` (executable): + - `startEvent` `orderPlaced`. + - `serviceTask` `reserveStock` (`camunda:class="shop.bpm.ReserveStockDelegate"`). + - `boundaryEvent` `stockMissing` (error `errOutOfStock`). + - `intermediateCatchEvent` `waitForPayment` (message `msgPaymentReceived`). + - `exclusiveGateway` `amountCheck` (condition `${order.total > 1000}` → `approveOrder`; `${order.total <= 1000}` → `shipOrder`). + - `userTask` `approveOrder` (`camunda:candidateGroups="backoffice"`). + - `serviceTask` `shipOrder` (`camunda:type="external"`, topic `shipping`). + - `callActivity` `createInvoice` (`calledElement="invoicing"`). + - `endEvent` `orderCompleted`. + - `endEvent` `orderCancelled` (via `stockMissing`). +- **Diagram** `fulfilmentDiagram` with shapes for `orderPlaced`, `reserveStock`, `shipOrder`. + +#### Configuration +- `camunda:class` on `reserveStock`: `shop.bpm.ReserveStockDelegate`. +- `camunda:candidateGroups` on `approveOrder`: `backoffice`. +- `camunda:type` on `shipOrder`: `external`. +- `camunda:topic` on `shipOrder`: `shipping`. + +#### Dependencies +- Java class `shop.bpm.ReserveStockDelegate`. +- External task topic `shipping`. +- Called element `invoicing` (likely another BPMN process or service). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/bpmn/package.ai.md new file mode 100644 index 00000000..f5f84943 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/bpmn/package.ai.md @@ -0,0 +1,51 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:36:21Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> A BPMN‑based order‑fulfilment workflow that reserves stock, waits for payment, handles large‑order approval, ships goods, and creates invoices. + +#### Purpose +- Model the end‑to‑end order fulfilment process. +- Coordinate stock reservation, payment receipt, approval, shipping, and invoicing. + +#### Responsibilities +- **Process orchestration** – defines the sequence of tasks, gateways, and events. +- **Error handling** – manages out‑of‑stock scenarios. +- **External integration** – delegates stock reservation, external shipping, and invoicing services. + +#### Key units +- **Process** `orderFulfilment` – executable BPMN flow for order handling. +- **ServiceTask** `reserveStock` – Java delegate `shop.bpm.ReserveStockDelegate`. +- **BoundaryEvent** `stockMissing` – triggers `errOutOfStock`. +- **IntermediateCatchEvent** `waitForPayment` – listens for `msgPaymentReceived`. +- **ExclusiveGateway** `amountCheck` – routes based on `${order.total > 1000}`. +- **UserTask** `approveOrder` – assigned to `backoffice` group. +- **ServiceTask** `shipOrder` – external task on topic `shipping`. +- **CallActivity** `createInvoice` – invokes `invoicing` service/process. +- **Messages** `msgPaymentReceived` – payment notification. +- **Errors** `errOutOfStock` – out‑of‑stock signal. + +#### Data flow +1. **OrderPlaced** → `reserveStock` (Java delegate) → success → `waitForPayment`. +2. On **PaymentReceived** → `amountCheck` → + - If total > 1000 → `approveOrder` → `shipOrder`. + - Else → `shipOrder` directly. +3. `shipOrder` (external task) → `createInvoice` (call activity) → `orderCompleted`. +4. If `errOutOfStock` occurs → `orderCancelled`. + +#### Dependencies +- Java class `shop.bpm.ReserveStockDelegate`. +- External task topic `shipping`. +- Called element `invoicing` (another BPMN or service). +- Camunda BPM engine (namespaces `bpmn`, `camunda`). + +#### Cross‑cutting +- **Camunda annotations** (`camunda:class`, `camunda:type`, `camunda:topic`, `camunda:candidateGroups`) drive task behavior. +- **Error boundary** on `reserveStock` ensures graceful cancellation. +- **Message event** `msgPaymentReceived` coordinates asynchronous payment confirmation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..c112b129 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/docker/Dockerfile.ai.md @@ -0,0 +1,51 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:32:39Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds and runs the `orders-backoffice` Java application in a Docker container for the shop backend. + +#### Purpose +- Compile the Java project with Maven. +- Package the application into a JAR. +- Run the JAR in a lightweight Alpine JRE container. + +#### Type +- Dockerfile + Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine` + Build stage: `build` + Runtime stage: default + +#### Definitions +- **Stages** + - `build`: `maven:3.9-eclipse-temurin-21` + - default: `eclipse-temurin:21-jre-alpine` +- **Build commands** + - `RUN mvn -B dependency:go-offline` + - `RUN mvn -B package -DskipTests` +- **Runtime commands** + - `RUN addgroup -S shop && adduser -S backoffice -G shop` + - `COPY --from=build /src/target/orders-backoffice.jar /opt/shop/orders-backoffice.jar` + - `EXPOSE 8080` + - `USER backoffice` + - `HEALTHCHECK --interval=30s CMD wget -qO- http://localhost:8080/health/live || exit 1` + - `ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"]` + +#### Configuration +- `ARG APP_VERSION=2.1.0` +- `ENV JAVA_OPTS="-XX:MaxRAMPercentage=75"` +- `ENV SHOP_PROFILE=production` + +#### Dependencies +- Maven dependencies resolved in build stage (`dependency:go-offline`). +- Runtime JRE: `eclipse-temurin:21-jre-alpine`. +- Application JAR: `orders-backoffice.jar` (built from `pom.xml` and `src/`). +- Health endpoint: `http://localhost:8080/health/live`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/docker/package.ai.md new file mode 100644 index 00000000..1321b151 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/docker/package.ai.md @@ -0,0 +1,38 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:36:27Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> Builds and runs the `orders-backoffice` Java application in a Docker container for the shop backend. + +#### Purpose +- Compile the Java project with Maven. +- Package the application into a JAR. +- Run the JAR in a lightweight Alpine JRE container. + +#### Responsibilities +- **Build pipeline**: Maven dependency resolution, compilation, and packaging. +- **Container runtime**: User creation, environment configuration, health checking, and application launch. + +#### Key units +- **Dockerfile** – orchestrates multi‑stage build: `build` stage (`maven:3.9-eclipse-temurin-21`) and runtime stage (`eclipse-temurin:21-jre-alpine`). +- **Build commands** – `mvn -B dependency:go-offline`, `mvn -B package -DskipTests`. +- **Runtime commands** – `addgroup`, `adduser`, `COPY`, `EXPOSE 8080`, `USER backoffice`, `HEALTHCHECK`, `ENTRYPOINT`. + +#### Data flow +Source → Maven build → JAR (`orders-backoffice.jar`) → Docker build → Runtime container → HTTP health endpoint. + +#### Dependencies +- Maven dependencies resolved during build. +- Runtime JRE: `eclipse-temurin:21-jre-alpine`. +- Health endpoint: `http://localhost:8080/health/live`. + +#### Cross-cutting +- Multi‑stage Docker build pattern. +- Environment variables: `JAVA_OPTS`, `SHOP_PROFILE`. +- Healthcheck via `wget` on `/health/live`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..b5fe7d55 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,43 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:32:43Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> A checkout page that collects shipping address, selects shipping method, shows total, and places an order. + +#### Purpose +- Collect shipping address and method. +- Display calculated total. +- Submit order. + +#### Type +- Facelets page (`checkout.xhtml`), template `shop.xhtml`. +- Uses namespaces: `h` = Jakarta Faces HTML, `f` = Jakarta Faces Core, `ui` = Facelets. + +#### Data +- `checkoutBean.address.street` (input, required). +- `checkoutBean.address.zip` (input, regex `[0-9]{5}`). +- `checkoutBean.shippingMethod` (selectOneMenu). +- `checkoutBean.shippingMethods` (selectItems source). +- `checkoutBean.total` (outputText, currency EUR). + +#### Actions +- Form `checkoutForm` submits to `checkoutBean.placeOrder` via `h:commandButton`. +- Ajax on `shipping` menu: listener `checkoutBean.recalculate`, renders component `total`. + +#### Structure +- Defines `content` in `shop.xhtml` template. +- Includes `/WEB-INF/includes/payment-hints.xhtml`. + +#### Dependencies +- Tag libraries: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- Template: `/WEB-INF/templates/shop.xhtml`. +- Include: `/WEB-INF/includes/payment-hints.xhtml`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/facelets/package.ai.md new file mode 100644 index 00000000..a30239f3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/facelets/package.ai.md @@ -0,0 +1,41 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:36:29Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> A Jakarta Faces checkout page that gathers shipping details, selects a shipping method, shows the total, and submits an order. + +#### Purpose +- Collect shipping address and method. +- Display calculated total. +- Submit order. + +#### Responsibilities +- **User input collection** – shipping address fields and shipping method selection. +- **Dynamic calculation** – recalculate total when shipping method changes. +- **Order submission** – invoke `checkoutBean.placeOrder` on form submit. + +#### Key units +- **`checkout.xhtml`** – Facelets page, template `shop.xhtml`, contains form `checkoutForm`, fields `address.street`, `address.zip`, `shippingMethod`, and output `total`. +- **`checkoutBean`** – backing bean with properties `address`, `shippingMethod`, `shippingMethods`, `total`; methods `recalculate()` and `placeOrder()`. + +#### Data flow +1. User enters `address.street` and `address.zip` (validated by regex). +2. User selects `shippingMethod` from `shippingMethods` list. +3. Ajax listener `checkoutBean.recalculate` updates `total` and re-renders the total component. +4. On form submit, `checkoutBean.placeOrder` processes the order. + +#### Dependencies +- Jakarta Faces tag libraries: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- Template: `/WEB-INF/templates/shop.xhtml`. +- Include: `/WEB-INF/includes/payment-hints.xhtml`. + +#### Cross-cutting +- Uses EL expressions for data binding and method calls. +- Ajax partial rendering for dynamic total update. +- Validation via EL regex on `address.zip`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..69e7b50f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,55 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:32:45Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Calculates shipping cost based on order weight and total, with free shipping over a threshold and heavy‑parcel rejection. + +#### Purpose +- Implements shipping cost calculation with weight tiers and free‑shipping threshold. +- Provides unit tests for the shipping logic. + +#### Type +- `class ShippingRulesSpec` – Spock specification, extends `Specification`. +- `class ShippingRules` – Groovy class, `@CompileStatic`, properties `carrier: String`, `maxParcelKg: BigDecimal`. + +#### Input +- `ShippingRules` constructor: `carrier`, `maxParcelKg`. +- `costFor(Order order)` parameters: `Order` with `total: BigDecimal`, `weightKg: BigDecimal`. +- Test data: `weight` and `expected` values in `where` block. + +#### Output +- `costFor` returns `BigDecimal` cost or `0` for free shipping. +- Throws `ParcelTooHeavyException` when `order.weightKg > maxParcelKg`. + +#### Core logic +- `costFor`: + 1. If `order.weightKg > maxParcelKg` → `throw ParcelTooHeavyException`. + 2. If `order.total >= ShippingRulesSpec.FREE_SHIPPING_THRESHOLD` → `return 0`. + 3. Define `tiers = [[upTo: 2, price: 4.99], [upTo: 10, price: 9.99], [upTo: 31.5, price: 19.99]]`. + 4. Find first tier where `order.weightKg <= tier.upTo` and return `tier.price` as `BigDecimal`. + +#### Public API +- `costFor(order: Order) -> BigDecimal` – compute shipping cost. + +#### Dependencies +- `groovy.transform.CompileStatic` +- `spock.lang.Specification` +- `spock.lang.Unroll` +- `shop.shipping.Order` (assumed) +- `shop.shipping.ParcelTooHeavyException` (assumed) + +#### Exceptions / Errors +- Throws `ParcelTooHeavyException` for overweight parcels. +- No other explicit exceptions. + +#### Concurrency +- No concurrency constructs; single‑threaded logic. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/groovy/package.ai.md new file mode 100644 index 00000000..4c663235 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/groovy/package.ai.md @@ -0,0 +1,40 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:36:31Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> Calculates shipping cost for orders, applying weight tiers, free‑shipping thresholds, and rejecting overweight parcels. + +#### Purpose +- Provide a reusable shipping cost calculator. +- Verify its behavior with Spock tests. + +#### Responsibilities +- **ShippingRules**: encapsulates carrier info, maximum parcel weight, and cost calculation logic. +- **ShippingRulesSpec**: defines unit tests covering normal, free‑shipping, and overweight scenarios. + +#### Key units +- `ShippingRules` – `@CompileStatic` class; `costFor(order: Order): BigDecimal` computes cost or throws `ParcelTooHeavyException`. +- `ShippingRulesSpec` – Spock specification; uses `@Unroll` to test multiple weight cases. + +#### Data flow +1. `ShippingRules` instantiated with `carrier` and `maxParcelKg`. +2. `costFor` receives an `Order` (with `total` and `weightKg`). +3. Checks weight against `maxParcelKg`; throws if exceeded. +4. Checks `total` against `FREE_SHIPPING_THRESHOLD`; returns `0` if met. +5. Otherwise selects first tier where `weightKg <= tier.upTo` and returns the tier price. + +#### Dependencies +- Groovy `@CompileStatic` for type safety. +- Spock framework (`Specification`, `Unroll`) for testing. +- Domain types: `shop.shipping.Order`, `shop.shipping.ParcelTooHeavyException`. + +#### Cross-cutting +- Static type checking ensures compile‑time safety. +- Consistent exception handling via `ParcelTooHeavyException`. +- No concurrency; logic is deterministic and stateless. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..d7390936 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md @@ -0,0 +1,59 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:32:50Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Configures Camel integration routes for order processing, validation, and ERP communication. + +#### Purpose +- Define order validation and translation beans. +- Set up Camel routes for incoming orders, manual review, and ERP submission. +- Handle ERP unavailability with redelivery and dead‑letter queue. + +#### Type +- Spring XML configuration (`` root). +- Declares namespaces: `http://www.springframework.org/schema/beans` (default), `http://camel.apache.org/schema/spring` (Camel). +- Includes `propertyPlaceholder` for external properties. + +#### Definitions +- **Beans** + - `orderValidator` – class `shop.integration.OrderValidator`. + - `invoiceTranslator` – class `shop.integration.InvoiceTranslator`. +- **Camel Context** `orderIntegration` + - **Property placeholder** `properties` – `location="classpath:integration.properties"`. + - **Exception handling** for `shop.integration.ErpUnavailableException`: + - Redelivery: max 5, delay 2000 ms, exponential back‑off. + - Handled, send to `jms:queue:orders.deadletter`. + - **Routes** + - `incomingOrders` + - From `jms:queue:{{orders.incoming.queue}}`. + - Bean `orderValidator.validate`. + - Choice: if `${body.total} > {{orders.review.threshold}}` → `direct:manualReview`; else → `direct:toErp`. + - WireTap to `seda:orderAudit`. + - `toErp` + - From `direct:toErp`. + - Bean `invoiceTranslator`. + - Dynamic to `https://{{erp.host}}/api/orders/${header.orderId}`. + - `manualReview` + - From `direct:manualReview`. + - Split on `${body.lines}`; each part sent to `jms:queue:review.lines`. + - (Commented) `legacyFtpImport` route. + +#### Configuration +- `orders.incoming.queue` – JMS queue name for incoming orders. +- `orders.review.threshold` – numeric threshold for manual review. +- `erp.host` – host for ERP API. +- `orders.deadletter` – JMS queue for dead‑letter messages. + +#### Dependencies +- External properties file `classpath:integration.properties`. +- Camel Spring schema `https://camel.apache.org/schema/spring/camel-spring.xsd`. +- Spring beans schema `https://www.springframework.org/schema/beans/spring-beans.xsd`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/integration/package.ai.md new file mode 100644 index 00000000..b41898c2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/integration/package.ai.md @@ -0,0 +1,51 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:36:34Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Provides Camel‑based integration for order ingestion, validation, audit, and ERP submission with retry and dead‑letter handling. + +#### Purpose +- Configure order validation, translation, and routing. +- Manage ERP communication and failure recovery. + +#### Responsibilities +- **Order Validation** – bean `orderValidator` checks order integrity. +- **Invoice Translation** – bean `invoiceTranslator` converts orders for ERP. +- **Routing** – Camel routes for incoming orders, manual review, ERP submission, and audit. +- **Error Handling** – retry logic for `ErpUnavailableException` and dead‑letter queue. + +#### Key units +- `orderValidator` (`shop.integration.OrderValidator`) – validates order payloads. +- `invoiceTranslator` (`shop.integration.InvoiceTranslator`) – translates orders to ERP format. +- `orderIntegration` (Camel context) – orchestrates routes and exception handling. +- `incomingOrders` route – consumes from `orders.incoming.queue`, validates, routes to review or ERP. +- `toErp` route – translates and posts to ERP API. +- `manualReview` route – splits large orders for line‑by‑line review. +- `orders.deadletter` queue – receives messages after max redelivery attempts. + +#### Data flow +1. **Receive** order from `orders.incoming.queue`. +2. **Validate** via `orderValidator`. +3. **Decision**: if total > `orders.review.threshold` → `manualReview`; else → `toErp`. +4. **Audit**: wire‑tap to `orderAudit` (Seda). +5. **ERP Path**: translate with `invoiceTranslator`, POST to `erp.host/api/orders/{orderId}`. +6. **Review Path**: split lines, send each to `review.lines` queue. +7. **Failure**: on `ErpUnavailableException`, retry up to 5 times, then dead‑letter. + +#### Dependencies +- External `integration.properties` for queue names, thresholds, and ERP host. +- Spring and Camel XML schemas. +- JMS queues: `orders.incoming.queue`, `orders.deadletter`, `review.lines`. +- ERP REST endpoint: `https://{erp.host}/api/orders/{orderId}`. + +#### Cross-cutting +- Property placeholders (`{{…}}`) for configuration. +- Unified exception handling with exponential back‑off. +- Wire‑tap for audit logging. +- Use of `direct:` endpoints for internal routing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..5bcfb191 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,55 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:32:53Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Configures Jakarta EE EJB components, their environment entries, references, activation settings, and transaction/interceptor behavior. + +#### Purpose +- Declares EJBs and their deployment descriptors. +- Specifies transaction attributes and interceptor bindings. + +#### Type +- Jakarta EE descriptor (`ejb-jar.xml`), root element `ejb-jar` version `4.0`. +- Namespace: `https://jakarta.ee/xml/ns/jakartaee` (default). + +#### Definitions +- **Enterprise Beans** + - `session` + - `ejb-name`: `StockReservationBean` + - `ejb-class`: `shop.stock.StockReservationBean` + - `session-type`: `Stateless` + - `env-entry`: `reservationMinutes` (`java.lang.Integer`, value `45`) + - `session` + - `ejb-name`: `CheckoutSessionBean` + - `ejb-class`: `shop.checkout.CheckoutSessionBean` + - `session-type`: `Stateful` + - `ejb-local-ref`: `ejb/StockReservation` → `shop.stock.StockReservation` + - `message-driven` + - `ejb-name`: `OrderPlacedListener` + - `ejb-class`: `shop.events.OrderPlacedListener` + - `activation-config` + - `destinationLookup`: `java:/jms/queue/OrderPlaced` +- **Interceptors** + - `shop.audit.TimingInterceptor` +- **Assembly Descriptor** + - `container-transaction` + - `method` for `StockReservationBean.reserve` → `RequiresNew` + - `interceptor-binding` for all EJBs (`*`) → `shop.audit.TimingInterceptor` + +#### Configuration +- `env-entry-value` for `reservationMinutes`: `45` +- `activation-config-property-value` for `destinationLookup`: `java:/jms/queue/OrderPlaced` +- Transaction attribute `RequiresNew` for `StockReservationBean.reserve` + +#### Dependencies +- Java classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`, `shop.stock.StockReservation` +- JMS destination: `java:/jms/queue/OrderPlaced` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jee/package.ai.md new file mode 100644 index 00000000..62b6c937 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jee/package.ai.md @@ -0,0 +1,49 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:36:38Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> Provides Jakarta EE EJB and web configuration for a shop application, wiring business beans, JMS listeners, servlets, filters, and security. + +#### Purpose +- Deploys EJB components (stateless, stateful, message‑driven) with transaction and interceptor settings. +- Configures web module with servlet, filter, listener, session timeout, security, and JDBC resource. + +#### Responsibilities +- **EJB Deployment** – declares `StockReservationBean`, `CheckoutSessionBean`, and `OrderPlacedListener`; sets environment entries, activation config, and container transactions. +- **Interception** – applies `shop.audit.TimingInterceptor` to all EJBs. +- **Web Configuration** – maps `ReportDownloadServlet` to `/reports/*`, applies `RequestIdFilter` globally, registers `StartupAuditListener`, and secures `/admin/*` for role `admin`. +- **Resource Management** – references JDBC data source `jdbc/ShopDS` and sets session timeout to 20 min. + +#### Key units +- `shop.stock.StockReservationBean` – stateless EJB, method `reserve` runs in `RequiresNew` transaction. +- `shop.checkout.CheckoutSessionBean` – stateful EJB, local reference to `StockReservation`. +- `shop.events.OrderPlacedListener` – message‑driven bean listening on `java:/jms/queue/OrderPlaced`. +- `shop.audit.TimingInterceptor` – interceptor applied to all EJBs. +- `shop.web.ReportDownloadServlet` – servlet handling `/reports/*`. +- `shop.web.RequestIdFilter` – filter applied to all requests. +- `shop.web.StartupAuditListener` – listener for application startup. +- `jdbc/ShopDS` – JDBC data source referenced by the web module. + +#### Data flow +1. **Order Placement** → JMS queue `OrderPlaced` → `OrderPlacedListener` processes event. +2. **Stock Reservation** → `StockReservationBean.reserve` invoked by `CheckoutSessionBean` during checkout. +3. **Report Download** → client requests `/reports/*` → `ReportDownloadServlet` serves files from `/var/shop/reports`. +4. **Request Handling** → `RequestIdFilter` injects request ID into each request before servlet processing. +5. **Application Startup** → `StartupAuditListener` performs audit initialization. + +#### Dependencies +- **Internal**: EJB classes (`shop.stock.*`, `shop.checkout.*`, `shop.events.*`), interceptor (`shop.audit.*`), web classes (`shop.web.*`). +- **External**: JMS destination `java:/jms/queue/OrderPlaced`, JDBC data source `jdbc/ShopDS`, Jakarta EE container (EJB, web, security). + +#### Cross-cutting +- **Interceptors**: `TimingInterceptor` applied universally to EJBs via ``. +- **Transactions**: `StockReservationBean.reserve` uses `RequiresNew`; other methods inherit container defaults. +- **Security**: `/admin/*` protected by role `admin`; role declared in ``. +- **Configuration**: Context parameter `shop.reportDirectory` and session timeout set in `web.xml`; environment entry `reservationMinutes` set in `ejb-jar.xml`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jee/web.xml.ai.md new file mode 100644 index 00000000..cdd73d22 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jee/web.xml.ai.md @@ -0,0 +1,51 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:32:55Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Configures servlet mappings, filters, listeners, session timeout, security constraints, and a JDBC resource reference for a Jakarta EE web application. + +#### Purpose +- Defines servlet, filter, listener, and resource configurations for the web module. +- Sets session timeout and security roles for protected resources. + +#### Type +- Jakarta EE web descriptor (`web.xml`), root element `web-app` with namespace `https://jakarta.ee/xml/ns/jakartaee` version `6.0`. + +#### Definitions +- **Servlets** + - `ReportDownloadServlet` → class `shop.web.ReportDownloadServlet`, load‑on‑startup `1`. +- **Servlet‑mappings** + - `ReportDownloadServlet` → URL pattern `/reports/*`. +- **Filters** + - `RequestIdFilter` → class `shop.web.RequestIdFilter`. +- **Filter‑mappings** + - `RequestIdFilter` → URL pattern `/*`. +- **Listeners** + - `shop.web.StartupAuditListener`. +- **Session Config** + - Timeout `20` minutes. +- **Security Constraints** + - Resource collection `backoffice` → URL pattern `/admin/*`. + - Auth constraint role `admin`. +- **Security Roles** + - `admin`. +- **Resource References** + - Name `jdbc/ShopDS`, type `javax.sql.DataSource`. + +#### Configuration +- Context param `shop.reportDirectory` = `/var/shop/reports`. + +#### Dependencies +- Servlet class `shop.web.ReportDownloadServlet`. +- Filter class `shop.web.RequestIdFilter`. +- Listener class `shop.web.StartupAuditListener`. +- JDBC resource `jdbc/ShopDS`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..048997ca --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,52 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:32:56Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> Displays a list of open orders with search and cancel options. + +#### Purpose +- Show orders filtered by customer email and status. +- Allow cancellation of individual orders. + +#### Type +- JSP page +- Content type: `text/html;charset=UTF-8` +- Tag libraries: `c` = `jakarta.tags.core`, `fmt` = `jakarta.tags.fmt` + +#### Data +- `request` attribute `orderFilter` → `OrderFilter filter` +- `filter` used for `pageSize` (default 25) +- Request parameter `customerEmail` (used in search form) +- Request parameter `status` (used in search form) +- Request attribute `orders` (iterated as `order`) + - `order.number` + - `order.total` + - `order.overdue` + - `order.id` + +#### Actions +- Search form: `GET` to `${pageContext.request.contextPath}/orders/search` + - Fields: `customerEmail` (text), `status` (select) +- Cancel link: `orders/${order.id}/cancel` (GET) + +#### Structure +- Includes `/WEB-INF/jspf/header.jspf` +- Includes `/WEB-INF/jspf/footer.jspf` + +#### Server code +- Scriptlet imports: `java.util.List`, `shop.Order`, `shop.OrderFilter` +- Scriptlet retrieves `orderFilter` and calculates `pageSize` + +#### Dependencies +- Tag libraries: `jakarta.tags.core`, `jakarta.tags.fmt` +- Included files: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf` +- Beans/Classes: `shop.Order`, `shop.OrderFilter` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jsp/package.ai.md new file mode 100644 index 00000000..8daeada4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/jsp/package.ai.md @@ -0,0 +1,41 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:36:42Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> Provides a JSP view for listing, searching, and canceling open orders in a shop application. + +#### Purpose +- Render a searchable table of open orders. +- Offer a cancel link for each order. + +#### Responsibilities +- **Order display** – iterate over `request.attribute.orders` to show order number, total, overdue flag, and cancel link. +- **Search form** – capture `customerEmail` and `status` parameters and submit to `/orders/search`. +- **Pagination support** – use `OrderFilter.pageSize` (default 25) to control list size. + +#### Key units +- **`order-list.jsp`** – JSP page that builds the UI, uses JSTL core (`c`) and fmt (`fmt`) tags, and includes header/footer fragments. +- **`OrderFilter`** – bean providing `pageSize` and other filter criteria. +- **`Order`** – domain model with `number`, `total`, `overdue`, `id`. + +#### Data flow +1. **Request** → `orderFilter` attribute → determines `pageSize`. +2. **Request parameters** (`customerEmail`, `status`) → submitted via search form to `/orders/search`. +3. **Controller** populates `orders` attribute → JSP iterates and renders each order. +4. **Cancel link** → `orders/{id}/cancel` triggers order cancellation. + +#### Dependencies +- **Tag libraries**: `jakarta.tags.core` (`c`), `jakarta.tags.fmt` (`fmt`). +- **Included fragments**: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf`. +- **Domain classes**: `shop.Order`, `shop.OrderFilter`. + +#### Cross-cutting +- Uses JSTL for conditional rendering and iteration. +- Relies on standard JSP request attributes for data passing. +- Consistent use of context path in URLs for portability. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..7ca2a012 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,56 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:33:00Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the `orders-backoffice` application in a Kubernetes cluster, exposing it via a Service and Ingress. + +#### Purpose +- Runs the orders back‑office microservice. +- Provides external HTTP access through an Ingress. + +#### Type +- Kubernetes `Deployment`, `Service`, and `Ingress` manifests (apiVersion `apps/v1`, `v1`, `networking.k8s.io/v1`). + +#### Definitions +- **Deployment** `orders-backoffice` + - 3 replicas. + - Container `backoffice`: + - Image `registry.shop.example/orders-backoffice:2.1.0`. + - Port `8080`. + - Env: + - `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop`. + - `SHOP_DB_PASSWORD` from secret `orders-db-credentials` key `password`. + - Readiness probe: HTTP GET `/health/ready` on port `8080`. + - Resources limits: `memory: 768Mi`, `cpu: "1"`. +- **Service** `orders-backoffice` + - Selector `app: orders-backoffice`. + - Exposes port `80` mapped to target port `8080`. +- **Ingress** `orders-backoffice` + - Host `backoffice.shop.example`. + - Path `/` (Prefix) routes to Service `orders-backoffice` port `80`. + +#### Configuration +- `replicas=3` +- `image=registry.shop.example/orders-backoffice:2.1.0` +- `containerPort=8080` +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD=***` (from secret `orders-db-credentials` key `password`) +- `readinessProbe.path=/health/ready` +- `resources.limits.memory=768Mi` +- `resources.limits.cpu="1"` +- Service port `80` → target `8080` +- Ingress host `backoffice.shop.example`, path `/` + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0`. +- Secret `orders-db-credentials` (key `password`). +- Service `orders-backoffice` (used by Ingress). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/k8s/package.ai.md new file mode 100644 index 00000000..6200098f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/k8s/package.ai.md @@ -0,0 +1,40 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:36:45Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Deploys and exposes the orders‑backoffice microservice in a Kubernetes cluster, providing external HTTP access via an Ingress. + +#### Purpose +- Run the orders‑backoffice application. +- Expose it externally through a Service and Ingress. + +#### Responsibilities +- **Deployment**: manage pod replicas, container image, environment, probes, and resource limits. +- **Service**: expose the application internally on port 80. +- **Ingress**: route external traffic from `backoffice.shop.example` to the Service. + +#### Key units +- **Deployment `orders-backoffice`** – 3 replicas, container `backoffice` (image `registry.shop.example/orders-backoffice:2.1.0`, port 8080, env `SHOP_DB_URL`, secret‑backed `SHOP_DB_PASSWORD`), readiness probe `/health/ready`, resources limits `memory: 768Mi`, `cpu: 1`. +- **Service `orders-backoffice`** – selector `app: orders-backoffice`, port 80 → target 8080. +- **Ingress `orders-backoffice`** – host `backoffice.shop.example`, path `/` → Service `orders-backoffice` port 80. + +#### Data flow +1. External request to `backoffice.shop.example/` → Ingress forwards to Service `orders-backoffice` port 80. +2. Service routes to one of the 3 pod replicas. +3. Pod serves HTTP on port 8080, using `SHOP_DB_URL` and `SHOP_DB_PASSWORD` to connect to the orders database. + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0`. +- Kubernetes secret `orders-db-credentials` (key `password`). +- PostgreSQL database at `orders-db:5432`. + +#### Cross-cutting +- Environment variables for database connectivity. +- Readiness probe ensures pod is healthy before receiving traffic. +- Resource limits enforce CPU and memory constraints. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..518ab907 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,94 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:33:03Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Issues invoices for completed orders, assigns numbers, applies tax rates, and stores them. + +#### Purpose +- Assigns sequential invoice numbers. +- Calculates due dates using a 14‑day payment term. +- Stores invoices via `InvoiceRepository`. +- Applies reduced tax rates for books and food. + +#### Type +- `value class InvoiceNumber(val value: String)` – value class, final, property `value: String`. +- `data class InvoiceLine(val sku: String, val quantity: Int, val unitPrice: BigDecimal)` – data class, final, properties `sku`, `quantity`, `unitPrice`; computed property `amount: BigDecimal`. +- `sealed interface InvoiceResult` – sealed interface, final, nested data classes: + - `data class Issued(val number: InvoiceNumber, val dueDate: LocalDate)` – data class, final, properties `number`, `dueDate`. + - `data class Rejected(val reason: String)` – data class, final, property `reason`. +- `class InvoiceService` – final class, constructor `private val repository: InvoiceRepository`, `private val clock: () -> LocalDate = LocalDate::now`; companion object: + - `private const val PREFIX = "INV"` + - `val REDUCED_TAX_CATEGORIES = setOf("books", "food")` + - private var `sequence = 0` + - `lateinit var defaultCurrency: String` + - `suspend fun issue(order: CompletedOrder): InvoiceResult` + - `fun taxRate(category: String): BigDecimal` + - `private fun nextNumber(): InvoiceNumber` +- `fun List.total(): BigDecimal` – top‑level extension function. +- `const val PAYMENT_TERM_DAYS = 14` – top‑level constant. + +#### Input +- Constructor: `repository: InvoiceRepository`, `clock: () -> LocalDate`. +- `issue(order: CompletedOrder)` – uses `order.lines`, `order.id`, `order.customerId`. +- `taxRate(category: String)` – uses `REDUCED_TAX_CATEGORIES`. +- `nextNumber()` – no parameters. +- `total()` – no parameters. + +#### Output +- `issue` returns `InvoiceResult.Issued` or `InvoiceResult.Rejected`; mutates `repository` via `save`; increments `sequence`. +- `taxRate` returns `BigDecimal`. +- `total` returns `BigDecimal`. +- `nextNumber` returns `InvoiceNumber`. +- `defaultCurrency` is a mutable public property. + +#### Core logic +- `issue`: + 1. If `order.lines.isEmpty()` → `InvoiceResult.Rejected("order ${order.id} has no lines")`. + 2. `number = nextNumber()`. + 3. `invoice = Invoice(number, order.customerId, order.lines, clock().plusDays(PAYMENT_TERM_DAYS.toLong()))`. + 4. `repository.save(invoice)`. + 5. Return `InvoiceResult.Issued(number, invoice.dueDate)`. +- `taxRate`: + - If `category in REDUCED_TAX_CATEGORIES` → `BigDecimal("0.07")`; else `BigDecimal("0.19")`. +- `nextNumber`: + - Increment `sequence`; return `InvoiceNumber("$PREFIX-${++sequence}")`. +- `total`: + - `fold(BigDecimal.ZERO) { sum, line -> sum + line.amount }`. + +#### Public API +- `InvoiceNumber(value: String)` → value class +- `InvoiceLine(sku: String, quantity: Int, unitPrice: BigDecimal)` → data class +- `InvoiceLine.amount: BigDecimal` → property +- `InvoiceResult.Issued(number: InvoiceNumber, dueDate: LocalDate)` → data class +- `InvoiceResult.Rejected(reason: String)` → data class +- `InvoiceService(issue(order: CompletedOrder): InvoiceResult)` → suspend +- `InvoiceService(taxRate(category: String): BigDecimal)` → function +- `InvoiceService.defaultCurrency: String` → property +- `InvoiceService.REDUCED_TAX_CATEGORIES: Set` → property +- `List.total(): BigDecimal` → extension function +- `PAYMENT_TERM_DAYS: Int` → constant + +#### Dependencies +- `java.math.BigDecimal` +- `java.time.LocalDate` +- `kotlinx.coroutines.Dispatchers` +- `kotlinx.coroutines.withContext` +- `InvoiceRepository` +- `CompletedOrder` +- `Invoice` + +#### Exceptions / Errors +- `issue` returns `InvoiceResult.Rejected` if `order.lines.isEmpty()`. +- `defaultCurrency` is `lateinit`; accessing before initialization throws `UninitializedPropertyAccessException`. + +#### Concurrency +- `issue` executes in `withContext(Dispatchers.IO)`; coroutine context for I/O. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/kotlin/package.ai.md new file mode 100644 index 00000000..15168afc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/kotlin/package.ai.md @@ -0,0 +1,50 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:36:46Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> Generates and stores invoices for completed orders, applying tax rules and payment terms. + +#### Purpose +- Issue sequential invoice numbers. +- Compute due dates (14‑day term). +- Persist invoices via `InvoiceRepository`. +- Apply reduced tax rates for books and food. + +#### Responsibilities +- **Invoice numbering** – generates unique `InvoiceNumber` values. +- **Tax calculation** – provides tax rates per category. +- **Invoice creation** – builds `Invoice` objects from `CompletedOrder` data. +- **Persistence** – saves invoices asynchronously to the repository. +- **Utility** – calculates line totals and overall invoice totals. + +#### Key units +- `InvoiceNumber` – value class wrapping a string identifier. +- `InvoiceLine` – data class for line items; `amount` computed from `quantity * unitPrice`. +- `InvoiceResult` (sealed) – `Issued` (success) and `Rejected` (failure) outcomes. +- `InvoiceService` – core service with `issue`, `taxRate`, `nextNumber`; holds `repository`, `clock`, `defaultCurrency`, and tax‑category set. +- `List.total()` – extension for summing line amounts. +- `PAYMENT_TERM_DAYS` – constant (14). + +#### Data flow +1. `issue(order)` receives a `CompletedOrder`. +2. Validates non‑empty lines; otherwise returns `Rejected`. +3. Calls `nextNumber()` to get a new `InvoiceNumber`. +4. Builds an `Invoice` with customer ID, lines, and due date (`clock() + 14 days`). +5. Persists the invoice via `repository.save` inside `withContext(Dispatchers.IO)`. +6. Returns `Issued(number, dueDate)`. + +#### Dependencies +- **Internal**: `InvoiceRepository`, `CompletedOrder`, `Invoice`. +- **External**: `java.math.BigDecimal`, `java.time.LocalDate`, `kotlinx.coroutines.Dispatchers`, `kotlinx.coroutines.withContext`. + +#### Cross-cutting +- **Concurrency**: `issue` runs in `Dispatchers.IO` for I/O safety. +- **Error handling**: `Rejected` encapsulates validation failures; `defaultCurrency` is a `lateinit` property, throwing if accessed before init. +- **Configuration**: `REDUCED_TAX_CATEGORIES` and `PREFIX` are static constants; `defaultCurrency` is mutable and public. +- **Utility**: `total()` aggregates line amounts, used for invoice totals. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..d6e65203 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,58 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:35:13Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Maps customer data to SQL operations for the `shop.customer.CustomerMapper` namespace. + +#### Purpose +- Provides CRUD and search operations for `shop.customer.Customer` entities. + +#### Type +- MyBatis mapper XML + Root element: `mapper` + Namespace: `shop.customer.CustomerMapper` + Declared DTD: `mybatis-3-mapper.dtd` + +#### Definitions +- **ResultMap** `customerResult` + - `id` → `CUSTOMER_ID` + - `result` `email` → `EMAIL` + - `result` `loyaltyTier` → `LOYALTY_TIER` +- **SQL fragment** `customerColumns` → `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT` +- **Select** `findByEmail` + - ResultMap: `customerResult` + - SQL: `select from CUSTOMER where EMAIL = #{email}` +- **Select** `search` + - ResultMap: `customerResult` + - SQL: `select from CUSTOMER` + - Conditional clauses: + - `LOYALTY_TIER = #{tier}` if `tier != null` + - `and CREATED_AT >= #{createdAfter}` if `createdAfter != null` + - Order by `${sortColumn}` +- **Insert** `insert` + - `useGeneratedKeys="true"` + - `keyProperty="id"` + - SQL: `insert into CUSTOMER (EMAIL, LOYALTY_TIER, CREATED_AT) values (#{email}, #{loyaltyTier}, now())` +- **Update** `promote` + - SQL: `update CUSTOMER set LOYALTY_TIER = #{tier} where CUSTOMER_ID in (#{id}, …)` +- **Delete** `deleteInactive` + - SQL: `delete from CUSTOMER where LAST_ORDER_AT < #{cutoff}` + +#### Configuration +- `useGeneratedKeys="true"` on `insert` +- `keyProperty="id"` on `insert` +- `order by ${sortColumn}` in `search` (parameterized column name) + +#### Dependencies +- SQL tables: `CUSTOMER` +- Columns referenced: `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT` +- Java class: `shop.customer.Customer` (used in `resultMap` type) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/mybatis/package.ai.md new file mode 100644 index 00000000..358c80b9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/mybatis/package.ai.md @@ -0,0 +1,53 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:36:51Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Provides SQL mapping for customer data persistence and querying in a shop application. + +#### Purpose +- Exposes CRUD and search operations for `shop.customer.Customer` entities via MyBatis. + +#### Responsibilities +- **Data Access Layer**: maps SQL statements to Java methods for customer CRUD. +- **Query Building**: supports dynamic filtering and ordering in search queries. +- **Result Mapping**: translates database rows to `shop.customer.Customer` objects. + +#### Key units +- **Mapper XML** `shop.customer.CustomerMapper` + - Namespace for all customer SQL operations. +- **ResultMap** `customerResult` + - Maps `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER` to `shop.customer.Customer` fields. +- **SQL Fragment** `customerColumns` + - Reusable column list: `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT`. +- **Select** `findByEmail` + - Retrieves a single customer by email. +- **Select** `search` + - Dynamic search with optional `tier`, `createdAfter`, and sortable column. +- **Insert** `insert` + - Persists a new customer, auto‑generates `CUSTOMER_ID`. +- **Update** `promote` + - Batch updates loyalty tier for given customer IDs. +- **Delete** `deleteInactive` + - Removes customers whose last order predates a cutoff date. + +#### Data flow +1. **Input**: method parameters (`email`, `tier`, `createdAfter`, `sortColumn`, `id`, `cutoff`). +2. **Mapper**: MyBatis translates parameters into SQL via ``, ``, and `${}` placeholders. +3. **Execution**: SQL runs against `CUSTOMER` table. +4. **Output**: Result rows mapped to `shop.customer.Customer` objects or affected row counts. + +#### Dependencies +- **Database**: `CUSTOMER` table with columns `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`. +- **Java**: `shop.customer.Customer` class used in `customerResult`. +- **MyBatis**: XML mapper, DTD `mybatis-3-mapper.dtd`, dynamic SQL tags. + +#### Cross-cutting +- **Dynamic SQL**: `` conditions for optional filters; `${sortColumn}` for runtime ordering. +- **Key Generation**: `useGeneratedKeys="true"` with `keyProperty="id"` for inserts. +- **Fragment Reuse**: `customerColumns` included in multiple statements to avoid duplication. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..2978ea3b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,47 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:35:18Z +- G: +- A: 0.0.0 +- X: file +- P: 30325B28 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> Provides endpoints for listing, retrieving, and canceling shop orders, exposing order status and total amounts. + +#### Purpose +- List orders with optional status filter and limit. +- Retrieve a single order by ID. +- Cancel an order (requires write scope). + +#### Type +- OpenAPI 3.0.3 +- Title: `Shop Orders API` +- Version: `2.1.0` +- Server: `https://api.shop.example/backoffice` + +#### Operations +- `GET /orders` – `listOrders` – query `status` (`OrderStatus`), `limit` (int, max 200); 200 → array of `Order`. +- `GET /orders/{orderId}` – `getOrder` – path `orderId` (string); 200 → `Order`; 404 → no such order. +- `POST /orders/{orderId}/cancel` – `cancelOrder` – path `orderId` (string); security `backofficeToken` with scope `orders:write`; 204 → cancelled; 409 → already shipped. + +#### Schemas +- `OrderStatus` – enum: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order` – object, required: `orderId`, `status`, `total`; properties: + - `orderId`: string + - `status`: `OrderStatus` + - `total`: number (double) + - `couponCode`: string (deprecated) + +#### Security and servers +- Security scheme `backofficeToken`: OAuth2 client credentials, token URL `https://auth.shop.example/token`, scope `orders:write` (change orders). +- Operation `cancelOrder` requires `backofficeToken` with `orders:write`. +- Server: `https://api.shop.example/backoffice`. + +#### Dependencies +- `$ref: '#/components/schemas/OrderStatus'` +- `$ref: '#/components/schemas/Order'` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/openapi/package.ai.md new file mode 100644 index 00000000..bd4b41fc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/openapi/package.ai.md @@ -0,0 +1,41 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:36:57Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> Provides a RESTful API for managing shop orders, including listing, retrieving, and canceling orders with status filtering and security controls. + +#### Purpose +- Expose order data to back‑office clients. +- Allow cancellation of orders that have not shipped. + +#### Responsibilities +- **Order Retrieval** – list orders with optional status and limit, fetch single order by ID. +- **Order Cancellation** – cancel an order, enforcing write‑scope authentication. +- **Security** – OAuth2 client‑credentials flow with `orders:write` scope. + +#### Key units +- **`orders-api.yaml`** – OpenAPI 3.0.3 definition, title *Shop Orders API*, version *2.1.0*. +- **`OrderStatus`** – enum (`OPEN`, `PAID`, `SHIPPED`, `CANCELLED`). +- **`Order`** – object schema with `orderId`, `status`, `total`, and deprecated `couponCode`. +- **`backofficeToken`** – OAuth2 security scheme, token URL `https://auth.shop.example/token`, scope `orders:write`. + +#### Data flow +1. Client calls `GET /orders` → server returns array of `Order` filtered by `status` and limited by `limit`. +2. Client calls `GET /orders/{orderId}` → server returns single `Order` or 404. +3. Client calls `POST /orders/{orderId}/cancel` with valid `backofficeToken` → server cancels order, returns 204 or 409 if already shipped. + +#### Dependencies +- Internal references to `OrderStatus` and `Order` schemas. +- External OAuth2 provider at `https://auth.shop.example/token`. +- Server base URL `https://api.shop.example/backoffice`. + +#### Cross-cutting +- All endpoints use the same OpenAPI 3.0.3 structure. +- Security is centralized via the `backofficeToken` scheme. +- Deprecated field `couponCode` indicates versioning strategy. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..b8670015 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,78 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:37:05Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> A shop back‑office system that builds, tests, containerises, and deploys a Java order‑fulfilment service, exposes REST and SOAP APIs, orchestrates BPMN workflows, integrates with ERP, and manages persistence, shipping, invoicing, and reporting. + +#### Purpose +- Continuous delivery of the orders‑backoffice Java service to Kubernetes. +- Expose order management APIs and SOAP stock queries. +- Orchestrate order fulfilment via BPMN and Camel routes. +- Persist and query shop data with Hibernate/MyBatis. + +#### Responsibilities +- **CI/CD** – GitHub Actions workflow for build, test, Docker image, and K8s deployment. +- **Containerisation** – Dockerfile for multi‑stage build and runtime image. +- **Kubernetes** – Deployment, Service, Ingress, and secrets for the back‑office pod. +- **Web APIs** – OpenAPI 3.0.3 REST spec and WSDL for stock lookup. +- **Business Process** – Camunda BPMN `orderFulfilment` with Java delegates, external tasks, and error handling. +- **Integration** – Camel routes for order ingestion, validation, ERP posting, and audit. +- **Persistence** – Hibernate mappings for `Shipment` hierarchy and MyBatis mappers for `Customer`. +- **Domain Services** – Groovy shipping calculator, Kotlin invoice generator, Jakarta EE EJBs for stock reservation and checkout. +- **UI** – Jakarta Faces checkout page and JSP order list view. + +#### Key units +- **GitHub Actions**: `release-backoffice` workflow, `build`, `image`, `deploy` jobs. +- **Docker**: `Dockerfile` (multi‑stage, Alpine JRE). +- **K8s**: `orders-backoffice` Deployment, Service, Ingress. +- **OpenAPI**: `orders-api.yaml` (orders CRUD, cancel, OAuth2). +- **WSDL**: `StockService.wsdl` (GetStockLevel, UnknownSku fault). +- **BPMN**: `orderFulfilment` process, delegates `ReserveStockDelegate`, external task `shipping`, call activity `createInvoice`. +- **Camel**: `orderIntegration` context, routes `incomingOrders`, `toErp`, `manualReview`, `orders.deadletter`. +- **Hibernate**: `Shipment` entity, `ExpressShipment` subclass, queries `undelivered`, `countByCarrier`. +- **MyBatis**: `shop.customer.CustomerMapper` with CRUD, search, batch promote, deleteInactive. +- **Groovy**: `ShippingRules` cost calculator, `ShippingRulesSpec` tests. +- **Kotlin**: `InvoiceService` with `issue`, `nextNumber`, tax logic, `InvoiceRepository`. +- **Jakarta EE**: `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener`, `TimingInterceptor`, `ReportDownloadServlet`, `RequestIdFilter`, `StartupAuditListener`. + +#### Data flow +1. **Source commit** → GitHub Actions `build` → Maven artifacts → `image` job builds `orders-backoffice` Docker image → `deploy` job triggers K8s workflow. +2. **Client** calls REST (`/orders`) or SOAP (`GetStockLevel`) → back‑office service processes request. +3. **Order placement** → JMS `OrderPlaced` → `OrderPlacedListener` → `CheckoutSessionBean` → `StockReservationBean.reserve`. +4. **BPMN**: `orderFulfilment` reserves stock, waits for payment, routes large orders to approval, ships via external task, creates invoice. +5. **Camel**: `incomingOrders` route validates, audits, routes to ERP or manual review, handles retries and dead‑letter. +6. **Persistence**: Hibernate manages `Shipment` entities; MyBatis handles `Customer` CRUD. +7. **UI**: Faces checkout page submits order; JSP lists open orders and allows cancellation. + +#### Dependencies +- **External**: Docker registry `registry.shop.example`, Kubernetes cluster, PostgreSQL (`orders-db`), OAuth2 provider `auth.shop.example`, ERP REST endpoint, JMS queues, SOAP endpoint `erp.shop.example/soap/stock`. +- **Internal**: GitHub Actions plugins (`checkout`, `setup-java`, `docker/login-action`), Camunda BPM engine, Apache Camel, Spring, Jakarta EE container, Hibernate, MyBatis, Groovy/Spock, Kotlin coroutines. +- **Configuration**: `integration.properties`, `persistence.xml`, `orders-api.yaml`, `StockService.wsdl`, Kubernetes secrets, Dockerfile env vars. + +#### Cross‑cutting +- **Security**: OAuth2 client‑credentials (`orders:write`), Jakarta EE role `admin` for `/admin/*`. +- **Transactions & Interceptors**: `TimingInterceptor` on all EJBs, `RequiresNew` on `StockReservationBean.reserve`. +- **Error handling**: BPMN boundary events (`errOutOfStock`), Camel exception handling with retry/back‑off, Groovy `ParcelTooHeavyException`, OpenAPI 409 for already shipped orders. +- **Configuration & Properties**: Use of placeholders (`{{…}}`), environment variables (`SHOP_DB_URL`, `SHOP_DB_PASSWORD`, `JAVA_OPTS`, `SHOP_PROFILE`). +- **Testing**: Spock specs for shipping rules, unit tests implied for BPMN delegates and Camel routes. +- **Performance**: Hibernate batch size, Docker healthcheck, Kubernetes readiness probe, Kotlin `Dispatchers.IO` for I/O. +- **Logging & Auditing**: Camel wire‑tap to `orderAudit`, Jakarta EE startup audit listener, request ID filter. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..06548cb2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,49 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:35:24Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps the `shop.shipping.Shipment` entity and its subclasses to database tables, defines relationships, queries, and persistence behavior. + +#### Purpose +- Configures Hibernate mapping for the `Shipment` entity hierarchy. +- Declares queries for undelivered shipments and carrier counts. + +#### Type +- Hibernate mapping (`` root). +- Namespace: none. +- Declares DTD `hibernate-mapping-3.0.dtd`. + +#### Definitions +- **Class** `Shipment` (table `SHIPMENT`) + - `id` (`SHIPMENT_ID`) generated by sequence `SHIPMENT_SEQ`. + - `trackingCode` (`TRACKING_CODE`, length 40, not‑null). + - `carrier` (`CARRIER`, length 12). + - `shippedAt` (`SHIPPED_AT`, type `timestamp`). + - `order` (`ORDER_ID`, many‑to‑one to `shop.Order`, not‑null). + - `parcels` (`` inverse, cascade `all-delete-orphan`, key `SHIPMENT_ID`, one‑to‑many to `Parcel`). +- **Joined‑subclass** `ExpressShipment` (table `EXPRESS_SHIPMENT`) + - Key `SHIPMENT_ID`. + - `deliveryWindow` (`DELIVERY_WINDOW`). +- **Query** `Shipment.undelivered` + - HQL: `from Shipment s where s.deliveredAt is null and s.shippedAt < :cutoff`. +- **SQL Query** `Shipment.countByCarrier` + - SQL: `select CARRIER, count(*) from SHIPMENT group by CARRIER`. + +#### Configuration +- Sequence generator: `sequence_name = SHIPMENT_SEQ`. +- Cascade: `all-delete-orphan` on `parcels` set. +- Query parameters: `:cutoff` in `Shipment.undelivered`. + +#### Dependencies +- External DTD: `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. +- Referenced classes: `shop.Order`, `Parcel`, `ExpressShipment`. +- Database tables: `SHIPMENT`, `EXPRESS_SHIPMENT`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/persistence/package.ai.md new file mode 100644 index 00000000..23f28185 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/persistence/package.ai.md @@ -0,0 +1,47 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:36:59Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Provides Hibernate persistence configuration for a shop application, mapping the `Shipment` entity hierarchy and defining two JPA persistence units for application and reporting data. + +#### Purpose +- Configure Hibernate mappings for `Shipment` and its subclasses. +- Define JPA persistence units `shop` and `reporting` with data sources, entities, and Hibernate settings. + +#### Responsibilities +- **Entity mapping**: `Shipment` hierarchy, relationships, and queries. +- **Persistence unit definition**: JTA and resource‑local units, data source wiring, and Hibernate properties. +- **Query provisioning**: HQL and SQL queries for undelivered shipments and carrier counts. + +#### Key units +- **`Shipment` entity** – maps to `SHIPMENT` table, includes `trackingCode`, `carrier`, `shippedAt`, `deliveredAt`, `order` FK, and a one‑to‑many `parcels` set. +- **`ExpressShipment` subclass** – joined‑subclass in `EXPRESS_SHIPMENT` table, adds `deliveryWindow`. +- **`Shipment.undelivered` HQL query** – selects shipments with null `deliveredAt` before a cutoff. +- **`Shipment.countByCarrier` SQL query** – aggregates shipment counts per carrier. +- **`persistence.xml`** – defines `shop` (JTA, Hibernate provider, `ShopDS`) and `reporting` (resource‑local, `ReportingDS`) units, lists entity classes, and sets Hibernate properties. + +#### Data flow +1. **Application startup** loads `persistence.xml`, creating two `EntityManagerFactory` instances. +2. **Hibernate** reads `Shipment.hbm.xml` to map `Shipment` and `ExpressShipment` to tables, establishing relationships and cascade rules. +3. **Queries** (`Shipment.undelivered`, `Shipment.countByCarrier`) are registered and can be invoked via `EntityManager` or `Session`. + +#### Dependencies +- **Hibernate** (`org.hibernate.jpa.HibernatePersistenceProvider`, `hibernate-dialect` PostgreSQL). +- **JPA** (`jakarta.persistence`). +- **Database**: PostgreSQL via `java:/jdbc/ShopDS` and `java:/jdbc/ReportingDS`. +- **Entities**: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue`, `Parcel`. +- **Mapping file**: `META-INF/order-queries.xml`. + +#### Cross-cutting +- **Sequence generation**: `SHIPMENT_SEQ` for `Shipment.id`. +- **Cascade strategy**: `all-delete-orphan` on `parcels` set. +- **Query parameters**: `:cutoff` for undelivered shipments. +- **Batching**: `hibernate.jdbc.batch_size=50` for performance. +- **Exception handling**: standard JPA/Hibernate transaction and persistence exceptions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..041c2caa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md @@ -0,0 +1,48 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:35:21Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Configures two Jakarta Persistence units for a shop application, specifying data sources, entity classes, and Hibernate settings. + +#### Purpose +- Define persistence units for application and reporting. +- Provide Hibernate configuration and entity mappings. + +#### Type +- Jakarta Persistence XML (`persistence.xml`). +- Root element: `persistence`. +- Namespace: `https://jakarta.ee/xml/ns/persistence`. + +#### Definitions +- **Persistence unit `shop`** + - `transaction-type="JTA"` + - `provider`: `org.hibernate.jpa.HibernatePersistenceProvider` + - `jta-data-source`: `java:/jdbc/ShopDS` + - `mapping-file`: `META-INF/order-queries.xml` + - Entity classes: `shop.Order`, `shop.OrderLine`, `shop.Customer` +- **Persistence unit `reporting`** + - `transaction-type="RESOURCE_LOCAL"` + - `non-jta-data-source`: `java:/jdbc/ReportingDS` + - Entity class: `shop.reporting.DailyRevenue` + - `exclude-unlisted-classes`: `true` + +#### Configuration +- `hibernate.dialect`: `org.hibernate.dialect.PostgreSQLDialect` +- `hibernate.jdbc.batch_size`: `50` +- `hibernate.connection.username`: `shop_app` +- `hibernate.connection.password`: `***` + +#### Dependencies +- Hibernate JPA provider (`org.hibernate.jpa.HibernatePersistenceProvider`). +- PostgreSQL JDBC driver (implied by dialect). +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`. +- Mapping file: `META-INF/order-queries.xml`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..f2d992d5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,63 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:35:29Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Defines a SOAP web service for querying stock levels, including request/response messages, a fault for unknown SKUs, and the binding and endpoint configuration. + +#### Purpose +- Exposes a `GetStockLevel` operation to retrieve stock availability by SKU. +- Provides a fault `UnknownSku` for invalid or missing SKUs. + +#### Type +- WSDL 1.1 (`` root) +- Namespaces: + - `xmlns="http://schemas.xmlsoap.org/wsdl/"` + - `xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"` + - `xmlns:tns="http://shop.example/stock"` + - `xmlns:xs="http://www.w3.org/2001/XMLSchema"` + +#### Definitions +- **Schema** (`` targetNamespace=`http://shop.example/stock`): + - Elements: + - `StockLevelRequest` – complex type with `sku` (`xs:string`) + - `StockLevelResponse` – complex type with `available` (`xs:int`) + - ComplexType: + - `UnknownSkuFault` – sequence with `sku` (`xs:string`) +- **Messages**: + - `GetStockLevelInput` – part `parameters` referencing `tns:StockLevelRequest` + - `GetStockLevelOutput` – part `parameters` referencing `tns:StockLevelResponse` + - `UnknownSku` – fault part `fault` of type `tns:UnknownSkuFault` +- **PortType** `StockPortType`: + - Operation `GetStockLevel`: + - Input: `tns:GetStockLevelInput` + - Output: `tns:GetStockLevelOutput` + - Fault: `UnknownSku` (`tns:UnknownSku`) +- **Binding** `StockSoapBinding` (type `tns:StockPortType`): + - SOAP binding: style `document`, transport `http://schemas.xmlsoap.org/soap/http` + - Operation `GetStockLevel`: + - SOAP action `http://shop.example/stock/GetStockLevel` + - Input body `use="literal"` + - Output body `use="literal"` + - Fault `UnknownSku` with SOAP fault `use="literal"` +- **Service** `StockService`: + - Port `StockPort` bound to `tns:StockSoapBinding` + - SOAP address `location="https://erp.shop.example/soap/stock"` + +#### Configuration +- SOAP transport: `http://schemas.xmlsoap.org/soap/http` +- SOAP action: `http://shop.example/stock/GetStockLevel` +- Endpoint URL: `https://erp.shop.example/soap/stock` + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema` +- SOAP namespace `http://schemas.xmlsoap.org/wsdl/soap/` +- Target namespace `http://shop.example/stock` (used for types, messages, binding, service). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/wsdl/package.ai.md new file mode 100644 index 00000000..f0c5d1e2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/other/wsdl/package.ai.md @@ -0,0 +1,45 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:37:01Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Provides a SOAP web service for querying stock availability by SKU, including fault handling for unknown SKUs. + +#### Purpose +- Exposes a `GetStockLevel` operation to retrieve stock quantity for a given SKU. +- Supplies an `UnknownSku` fault for invalid or missing SKUs. + +#### Responsibilities +- **Service definition**: Declares the WSDL structure, namespaces, and endpoint. +- **Message contracts**: Defines request/response and fault message parts. +- **Operation contract**: Specifies input, output, and fault for `GetStockLevel`. +- **Binding & transport**: Configures SOAP document style over HTTP with literal encoding. +- **Endpoint configuration**: Sets the service URL for client consumption. + +#### Key units +- **`StockService.wsdl`** – WSDL 1.1 document defining the service. +- **`StockPortType`** – Port type exposing `GetStockLevel`. +- **`StockSoapBinding`** – SOAP binding for `StockPortType`. +- **`GetStockLevelInput` / `GetStockLevelOutput`** – Message parts for request/response. +- **`UnknownSkuFault`** – Complex type for fault payload. +- **`UnknownSku`** – Fault message part. + +#### Data flow +1. Client sends `StockLevelRequest` (containing `sku`) to `https://erp.shop.example/soap/stock`. +2. Service processes request and returns `StockLevelResponse` with `available` quantity. +3. If SKU is invalid, service returns `UnknownSkuFault` via the `UnknownSku` fault. + +#### Dependencies +- XML Schema (`http://www.w3.org/2001/XMLSchema`) for type definitions. +- SOAP namespace (`http://schemas.xmlsoap.org/wsdl/soap/`) for binding and transport. +- Target namespace `http://shop.example/stock` for all types, messages, and service elements. + +#### Cross-cutting +- Uses WSDL 1.1 document structure with a single port and SOAP 1.1 binding. +- All messages and faults are defined with literal XML encoding. +- Endpoint URL is hard‑coded, implying a fixed deployment location. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..16062392 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,63 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:37:13Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> A comprehensive back‑office system that manages orders, stock, shipping, invoicing, and reporting, exposing REST and SOAP APIs, orchestrating BPMN workflows, and delivering the service via CI/CD to Kubernetes. + +#### Purpose +- Deliver a fully‑featured order‑fulfilment microservice. +- Provide REST/SOAP interfaces for order and stock operations. +- Automate build, test, containerisation, and deployment to Kubernetes. + +#### Responsibilities +- **CI/CD** – GitHub Actions workflow for building, testing, Docker image creation, and K8s deployment. +- **API Exposure** – OpenAPI 3.0.3 REST spec for orders, WSDL for stock lookup. +- **Business Process** – Camunda BPMN `orderFulfilment` with Java delegates, external tasks, and error handling. +- **Integration** – Camel routes for order ingestion, validation, ERP posting, and audit. +- **Persistence** – Hibernate for shipment hierarchy, MyBatis for customer CRUD. +- **Domain Services** – Groovy shipping calculator, Kotlin invoice generator, Jakarta EE EJBs for stock reservation and checkout. +- **UI** – Jakarta Faces checkout page and JSP order list view. + +#### Key units +- **GitHub Actions**: `release-backoffice` workflow (build, image, deploy jobs). +- **Docker**: multi‑stage `Dockerfile` (Alpine JRE runtime). +- **Kubernetes**: `orders-backoffice` Deployment, Service, Ingress, secrets. +- **OpenAPI**: `orders-api.yaml` (orders CRUD, cancel, OAuth2). +- **WSDL**: `StockService.wsdl` (GetStockLevel, UnknownSku fault). +- **BPMN**: `orderFulfilment` process, delegates `ReserveStockDelegate`, external task `shipping`, call activity `createInvoice`. +- **Camel**: `orderIntegration` context, routes `incomingOrders`, `toErp`, `manualReview`, `orders.deadletter`. +- **Hibernate**: `Shipment` entity, `ExpressShipment` subclass, queries `undelivered`, `countByCarrier`. +- **MyBatis**: `shop.customer.CustomerMapper` (CRUD, search, batch promote, deleteInactive). +- **Groovy**: `ShippingRules` cost calculator, `ShippingRulesSpec` tests. +- **Kotlin**: `InvoiceService` (issue, nextNumber, tax logic, `InvoiceRepository`). +- **Jakarta EE**: `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener`, `TimingInterceptor`, `ReportDownloadServlet`, `RequestIdFilter`, `StartupAuditListener`. + +#### Data flow +1. **Commit → CI/CD**: GitHub Actions builds Maven artifacts → Docker image → K8s deployment. +2. **Client request**: REST (`/orders`) or SOAP (`GetStockLevel`) → back‑office service. +3. **Order placement**: JMS `OrderPlaced` → `OrderPlacedListener` → `CheckoutSessionBean` → `StockReservationBean.reserve`. +4. **BPMN**: `orderFulfilment` reserves stock, waits for payment, routes large orders for approval, ships via external task, creates invoice. +5. **Camel**: `incomingOrders` validates, audits, routes to ERP or manual review, handles retries and dead‑letter. +6. **Persistence**: Hibernate manages `Shipment` entities; MyBatis handles `Customer` CRUD. +7. **UI**: Faces checkout submits order; JSP lists open orders and allows cancellation. + +#### Dependencies +- **External**: Docker registry, Kubernetes cluster, PostgreSQL (`orders-db`), OAuth2 provider, ERP REST endpoint, JMS queues, SOAP stock endpoint. +- **Internal**: GitHub Actions plugins, Camunda BPM engine, Apache Camel, Spring, Jakarta EE container, Hibernate, MyBatis, Groovy/Spock, Kotlin coroutines. +- **Configuration**: `integration.properties`, `persistence.xml`, `orders-api.yaml`, `StockService.wsdl`, Kubernetes secrets, Dockerfile env vars. + +#### Cross‑cutting +- **Security**: OAuth2 client‑credentials (`orders:write`), Jakarta EE role `admin` for `/admin/*`. +- **Transactions & Interceptors**: `TimingInterceptor` on all EJBs, `RequiresNew` on `StockReservationBean.reserve`. +- **Error handling**: BPMN boundary events (`errOutOfStock`), Camel retry/back‑off, Groovy `ParcelTooHeavyException`, OpenAPI 409 for already shipped orders. +- **Configuration & Properties**: Placeholders (`{{…}}`), environment variables (`SHOP_DB_URL`, `SHOP_DB_PASSWORD`, `JAVA_OPTS`, `SHOP_PROFILE`). +- **Testing**: Spock specs for shipping rules; unit tests for BPMN delegates and Camel routes. +- **Performance**: Hibernate batch size, Docker healthcheck, Kubernetes readiness probe, Kotlin `Dispatchers.IO` for I/O. +- **Logging & Auditing**: Camel wire‑tap to `orderAudit`, Jakarta EE startup audit listener, request ID filter. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..de768f33 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run2/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: E7238B94 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:37:23Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The back‑office system orchestrates order fulfilment through a BPMN workflow that reserves stock, waits for payment, handles large‑order approval, ships goods, and generates invoices. RESTful APIs (OpenAPI) and a SOAP service expose order and stock operations, while Jakarta EE components wire business beans, JMS listeners, and security into the shop application. Persistence is handled via Hibernate and MyBatis, with separate JPA units for application and reporting data, and shipping costs are calculated by a Groovy script. Continuous delivery pipelines build, containerise, and deploy the `orders-backoffice` microservice to Kubernetes, exposing it through an Ingress. + +#### Packages +- java — A back‑office order management service that exposes REST APIs for querying, canceling, and auditing orders, with nightly cleanup of cancelled records. +- java/shop — Provides REST endpoints for back‑office order management, including listing, retrieving, canceling orders, and a scheduled purge of old cancellations. +- other/actions/.github — Automates the continuous delivery of the back‑office Java service from source to a Kubernetes cluster. +- other/actions/.github/workflows — Automates the build, containerization, and Kubernetes deployment of the back‑office service. +- other/actions — Automates the continuous delivery of the back‑office Java service from source to a Kubernetes cluster. +- other/bpmn — A BPMN‑based order‑fulfilment workflow that reserves stock, waits for payment, handles large‑order approval, ships goods, and creates invoices. +- other/docker — Builds and runs the `orders-backoffice` Java application in a Docker container for the shop backend. +- other/facelets — A Jakarta Faces checkout page that gathers shipping details, selects a shipping method, shows the total, and submits an order. +- other/groovy — Calculates shipping cost for orders, applying weight tiers, free‑shipping thresholds, and rejecting overweight parcels. +- other/integration — Provides Camel‑based integration for order ingestion, validation, audit, and ERP submission with retry and dead‑letter handling. +- other/jee — Provides Jakarta EE EJB and web configuration for a shop application, wiring business beans, JMS listeners, servlets, filters, and security. +- other/jsp — Provides a JSP view for listing, searching, and canceling open orders in a shop application. +- other/k8s — Deploys and exposes the orders‑backoffice microservice in a Kubernetes cluster, providing external HTTP access via an Ingress. +- other/kotlin — Generates and stores invoices for completed orders, applying tax rules and payment terms. +- other/mybatis — Provides SQL mapping for customer data persistence and querying in a shop application. +- other/openapi — Provides a RESTful API for managing shop orders, including listing, retrieving, and canceling orders with status filtering and security controls. +- other — A shop back‑office system that builds, tests, containerises, and deploys a Java order‑fulfilment service, exposes REST and SOAP APIs, orchestrates BPMN workflows, integrates with ERP, and manages persistence, shipping, invoicing, and reporting. +- other/persistence — Provides Hibernate persistence configuration for a shop application, mapping the `Shipment` entity hierarchy and defining two JPA persistence units for application and reporting data. +- other/wsdl — Provides a SOAP web service for querying stock availability by SKU, including fault handling for unknown SKUs. +- . — A comprehensive back‑office system that manages orders, stock, shipping, invoicing, and reporting, exposing REST and SOAP APIs, orchestrating BPMN workflows, and delivering the service via CI/CD to Kubernetes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/meta/gpt-6-luna.json new file mode 100644 index 00000000..3cee3e60 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/meta/gpt-6-luna.json @@ -0,0 +1,108 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "avro-facts.tsv": "e6583308a5fcb3d9faedb51121dce0aff932776a05d8c948a0c8430172f9aa31", + "bpmn-facts.tsv": "c8866122184147e94cb14970a4f6e02dcf9e147ebb4b809885273aef8c4f0a31", + "compose-facts.tsv": "2d193b8ea01e46c1d184b7014e23daa07da545c2f756c07d8f6e0473cd86229a", + "dmn-facts.tsv": "825a542139ca18f05785b950d48eb810e4b1ed1b4ffc1d6b8f22cb3b2aed4f90", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "gradle-facts.tsv": "72890901e1506738b2578cdc11d7ca294ba4c663e4b36ca1b23c5c1f7112d6ad", + "graphql-facts.tsv": "98e82ef81dae468917392d60b0c60b8dd62037dedea84960af2ecaa6664b40c1", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "700ac765c97b6fb49a18f21691ad0b16de43ffc126073c2498d38512331d6ed6", + "java-facts.tsv": "368639880755328cc631124f71567c5fc7ac483fcb4ec887512e63cb3c272b61", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "properties-facts.tsv": "a7c7c2313792923e1f4fa576b2caa191377d5049455b0259a91122edbec4562c", + "proto-facts.tsv": "0d163bfbd7752fb9f736ed1ea4d7874ba1c58c1b182e6f5f9be3cafd3ba13e62", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "scala-facts.tsv": "019420f060147ac67c90c8d0690889021b20426f50ff148bcc025e1b3cc89fdf", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "terraform-facts.tsv": "a5fa06308874b12d69fff284ab0ea3e3868b151cb4d82fd7a82d83b46b2de6e3", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:37:26Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 99.8, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 107.9, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.5, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:40:58Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 28242, + "cachedPromptTokens": 28191, + "completionTokens": 9653, + "seconds": 99.1371594 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.005114, + "costUsd": 0.010805, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/meta/gpt-oss-20b.json new file mode 100644 index 00000000..a3b843d8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/meta/gpt-oss-20b.json @@ -0,0 +1,108 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-enterprise", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": true, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "actions-facts.tsv": "ba9d8c1f95ecd1fbc32fdf4ec18daa94f12a9b8dc3e3884c5d7ce009a58b52d2", + "avro-facts.tsv": "e6583308a5fcb3d9faedb51121dce0aff932776a05d8c948a0c8430172f9aa31", + "bpmn-facts.tsv": "c8866122184147e94cb14970a4f6e02dcf9e147ebb4b809885273aef8c4f0a31", + "compose-facts.tsv": "2d193b8ea01e46c1d184b7014e23daa07da545c2f756c07d8f6e0473cd86229a", + "dmn-facts.tsv": "825a542139ca18f05785b950d48eb810e4b1ed1b4ffc1d6b8f22cb3b2aed4f90", + "dockerfile-facts.tsv": "7d5d139a58ba1bb85600ebed31ac288b45a2c94ae33962b6808e22c1a430bffe", + "facelets-facts.tsv": "1db492bf8bf6a18c968f6407e30ef9cb76078a76001bf059ca51baacf81fab9d", + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "gradle-facts.tsv": "72890901e1506738b2578cdc11d7ca294ba4c663e4b36ca1b23c5c1f7112d6ad", + "graphql-facts.tsv": "98e82ef81dae468917392d60b0c60b8dd62037dedea84960af2ecaa6664b40c1", + "groovy-facts.tsv": "506ac5bdc214fb46de7d9ab1be2e5574237bf216c789044da6dd26b479e59f02", + "integration-facts.tsv": "5fa88940bca9b1b66d28e1d6a79ff0b12711e9553df00c1ce76e7ecbfdfe2c61", + "java-ee-facts.tsv": "700ac765c97b6fb49a18f21691ad0b16de43ffc126073c2498d38512331d6ed6", + "java-facts.tsv": "368639880755328cc631124f71567c5fc7ac483fcb4ec887512e63cb3c272b61", + "jee-facts.tsv": "70ac3df0f4a77c53605d9bb109b510b2573ed645f0f849bacd9c6a0cc716d02c", + "jsp-facts.tsv": "0adf99680b51d1f739e7a207a1eefe9efef5a993ca35c420762d52f026159c93", + "k8s-facts.tsv": "9e2d5971c5b5c84f6491e17078acd783ee27fc52d7c10d9493cf73f9b4e5b117", + "kotlin-facts.tsv": "d3264090ed3d7ab20537f3f8b72a8544657cd6b79011f18511fd2416bf6b3894", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "mybatis-facts.tsv": "6860c15983745066ffba89bd6e633524c97550ce0fb82dd22a194190551be5e5", + "openapi-facts.tsv": "51d7ae42bcf48d8783cf57307c3c595f35aa17eadaeb6178fe707e2e57c31dc3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "perl-facts.tsv": "c5481772535c34862cbd0bd061527dce3856767d7c74ce8a1e06ab4ec08a7aec", + "persistence-facts.tsv": "46731d2f46731f63dc7d3374321cb7ad9ff48b1d1573951a84919cef4db2425b", + "pom-facts.tsv": "99d0f1f43472152ed80946ad3743b5bee42760f2f51661a3d76d5cbfaa1207b0", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "properties-facts.tsv": "a7c7c2313792923e1f4fa576b2caa191377d5049455b0259a91122edbec4562c", + "proto-facts.tsv": "0d163bfbd7752fb9f736ed1ea4d7874ba1c58c1b182e6f5f9be3cafd3ba13e62", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7", + "scala-facts.tsv": "019420f060147ac67c90c8d0690889021b20426f50ff148bcc025e1b3cc89fdf", + "shell-facts.tsv": "5fe10f31f0d40738533b1b7b8b4c7e8f468ae583e4dcc12a79eb5daac48efbfb", + "sql-facts.tsv": "758a4073153452b9ef190d082bf8b1df2fff4a10787937119ea3d52d10569bd0", + "terraform-facts.tsv": "a5fa06308874b12d69fff284ab0ea3e3868b151cb4d82fd7a82d83b46b2de6e3", + "wsdl-facts.tsv": "5ce11a4188eab548c3779bcbf00ae461b66927c10d04899c94e300c0fad6bf61", + "xml-facts.tsv": "2f479b71d865c5b7c3ac12a62ddd7b14d5eb4b1b9a7e481bb093ce4b377550ca" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:40:58Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 65.1, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 80.0, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 4.2, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:43:28Z", + "fileTokens": { + "files": 17, + "written": 17, + "unchanged": 0, + "failed": 0, + "calls": 17, + "promptTokens": 29330, + "cachedPromptTokens": 22752, + "completionTokens": 8862, + "seconds": 64.4426953 + }, + "finishReasons": { + "stop": 17 + }, + "tokenCostUsd": 0.002032, + "costUsd": 0.005245, + "files": 38 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/java/package.ai.md new file mode 100644 index 00000000..f3a39b09 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/java/package.ai.md @@ -0,0 +1,41 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:39:13Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> Backoffice staff can manage order lifecycles, including retrieving open orders, processing cancellation refunds, and purging aged cancellations. + +#### Purpose +- Provides secured order-management operations for backoffice and admin users. +- Coordinates order cancellation with payment refunds and audit logging, and removes cancelled orders older than 30 days. + +#### Responsibilities +- **Order access:** List open orders and retrieve orders by ID, returning HTTP 404 when an order is missing. +- **Cancellation:** Refund payment, mark the order `CANCELLED`, record an audit event, and return HTTP 204. +- **Scheduled cleanup:** Purge eligible cancelled orders at 02:15 and audit the removal count. + +#### Key units +- `OrderResource` — stateless JAX-RS resource at `/orders` for retrieval, cancellation, and scheduled cleanup. +- `Order.open` — named query for listing open orders. +- `Order.purgeCancelled` — named update query for purging eligible cancelled orders. + +#### Data flow +- `openOrders()` executes `Order.open` through the `shop` persistence unit and returns its results. +- `find(id)` loads an `Order` and returns HTTP 200 with the order or HTTP 404. +- `cancel(id)` loads the order, refunds its payment reference and total, marks it cancelled, records `order.cancelled`, and returns HTTP 204. +- `purgeCancelled()` passes the 30-day threshold to `Order.purgeCancelled` and records the removed count as `order.purged`. + +#### Dependencies +- `EntityManager` and the `shop` persistence unit for order lookup and named queries. +- `PaymentGateway` for refunds; `AuditLog` for cancellation and purge events. +- Application types `Order` and `OrderStatus`; Jakarta EE APIs for REST, injection, EJB, scheduling, transactions, and role-based security. + +#### Cross-cutting +- All resource operations require the `backoffice` or `admin` role. +- Cancellation uses `TransactionAttributeType.REQUIRED`; the purge schedule is non-persistent. +- Missing orders produce HTTP 404; no other explicit exception handling is noted. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..32cc4d1f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/java/shop/OrderResource.java.ai.md @@ -0,0 +1,60 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:37:27Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 37CE394E +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Backoffice users can list and inspect orders, cancel orders with refunds, and purge old cancelled orders nightly. + +#### Purpose +- Provides secured order-management operations for open-order retrieval, order lookup, cancellation, and scheduled cleanup. +- Refunds payment and records audit events when an order is cancelled; records the number of orders purged. + +#### Type +- `public class OrderResource` — class; `@Stateless`, `@Path("/orders")`, `@Produces(MediaType.APPLICATION_JSON)`, `@RolesAllowed({"backoffice", "admin"})`. +- No explicit supertypes or generics. + +#### Input +- Injected `EntityManager em` from persistence unit `"shop"` via `@PersistenceContext`. +- Injected `PaymentGateway payments` via `@Inject`; `AuditLog audit` via `@EJB`. +- `find(long id)` and `cancel(long id)` receive an order ID from `{id}`. +- `purgeCancelled()` reads `PURGE_AFTER_DAYS` and passes it as the query parameter `days`. + +#### Output +- `openOrders()` returns the result list of `Order.open`. +- `find(long id)` returns HTTP 404 when no order exists, otherwise HTTP 200 with the order. +- `cancel(long id)` returns HTTP 404 when no order exists; otherwise refunds payment, marks the order cancelled, audits the event, and returns HTTP 204. +- `purgeCancelled()` executes the purge update and audits the number removed. +- `cancel` runs with `TransactionAttributeType.REQUIRED`. + +#### Core logic +- `openOrders()` calls `em.createNamedQuery("Order.open", Order.class).getResultList()`. +- `find(long id)` calls `em.find(Order.class, id)`; builds `Response.status(Response.Status.NOT_FOUND)` for a missing order or `Response.ok(order)` otherwise. +- `cancel(long id)` calls `em.find(Order.class, id)`; if found, calls `payments.refund(order.getPaymentReference(), order.getTotal())`, sets `OrderStatus.CANCELLED`, calls `audit.record("order.cancelled", id)`, and returns `Response.noContent()`. +- Scheduled `purgeCancelled()` runs at 02:15 with `persistent = false`; calls `em.createNamedQuery("Order.purgeCancelled").setParameter("days", PURGE_AFTER_DAYS).executeUpdate()`, then calls `audit.record("order.purged", removed)`. +- `PURGE_AFTER_DAYS` is `30`. + +#### Public API +- `openOrders() -> List` — list open orders. +- `find(long id) -> Response` — retrieve order by ID. +- `cancel(long id) -> Response` — cancel order and refund payment. + +#### Dependencies +- Jakarta APIs: `RolesAllowed`, `EJB`, `Schedule`, `Stateless`, `TransactionAttribute`, `TransactionAttributeType`, `Inject`, `EntityManager`, `PersistenceContext`, `GET`, `POST`, `Path`, `PathParam`, `Produces`, `MediaType`, `Response`. +- `java.util.List`. +- Application types: `Order`, `OrderStatus`, `PaymentGateway`, `AuditLog`. + +#### Exceptions / Errors +- Missing orders produce HTTP 404 in `find` and `cancel`. +- No explicit exception handling or null checks beyond the missing-order checks. + +#### Concurrency +- Stateless EJB; cancellation uses a required transaction. +- Purge is a non-persistent scheduled task. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/java/shop/package.ai.md new file mode 100644 index 00000000..0bf8625d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/java/shop/package.ai.md @@ -0,0 +1,42 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:39:07Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Backoffice staff can manage order lifecycles by viewing orders, cancelling them with payment refunds, and removing old cancellations. + +#### Purpose +- Exposes secured order-management operations for backoffice and admin users. +- Coordinates cancellation refunds and audit records, and periodically purges cancelled orders. + +#### Responsibilities +- **Order access:** List open orders and retrieve an order by ID, returning HTTP 404 when it is missing. +- **Cancellation:** Refund the order payment, mark the order cancelled, record an audit event, and return HTTP 204. +- **Scheduled cleanup:** Purge cancelled orders older than 30 days at 02:15 and audit the number removed. + +#### Key units +- `OrderResource` — stateless JAX-RS resource at `/orders`, secured for `backoffice` and `admin`; provides order retrieval, cancellation, and scheduled cleanup. +- `Order.open` — named query used to list open orders. +- `Order.purgeCancelled` — named update query used to purge eligible cancelled orders. + +#### Data flow +- `openOrders()` runs `Order.open` through the `shop` persistence unit and returns its result list. +- `find(id)` loads an `Order` by ID and returns either HTTP 404 or the order in HTTP 200. +- `cancel(id)` loads the order; if present, refunds its payment reference and total, marks it `CANCELLED`, records `order.cancelled`, and returns HTTP 204. +- `purgeCancelled()` supplies `PURGE_AFTER_DAYS` (30) to `Order.purgeCancelled`, then records the removed count as `order.purged`. + +#### Dependencies +- `EntityManager` for order lookup and named queries; persistence unit `shop`. +- `PaymentGateway` for cancellation refunds and `AuditLog` for cancellation and purge events. +- Application types: `Order`, `OrderStatus`. +- Jakarta EE APIs for JAX-RS, injection, EJB, scheduling, transactions, and role-based security. + +#### Cross-cutting +- `OrderResource` is a stateless EJB and all resource operations require the `backoffice` or `admin` role. +- Cancellation uses `TransactionAttributeType.REQUIRED`. +- The purge schedule is non-persistent; missing orders are handled with HTTP 404, with no other explicit exception handling noted. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/.github/package.ai.md new file mode 100644 index 00000000..641e9384 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/.github/package.ai.md @@ -0,0 +1,37 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:39:22Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Automates verification, versioned container publishing, and production deployment for the orders backoffice. + +#### Purpose +- Releases the orders backoffice when a version tag is pushed or the workflow is manually dispatched. + +#### Responsibilities +- **Build and test:** Runs Maven verification with the `ci` profile on Java 21 and 25. +- **Publish and deploy:** Publishes a version-tagged image, then delegates production deployment to a Kubernetes workflow. + +#### Key units +- `release-backoffice` — GitHub Actions workflow coordinating sequential `build`, `image`, and `deploy` jobs. +- `build` — Checks out the repository and runs `mvn -B verify -Pci` across the Java version matrix. +- `image` — Publishes `registry.shop.example/orders-backoffice` with the version tag stripped of its `v` prefix. +- `deploy` — Calls `./.github/workflows/deploy-k8s.yml` for the production environment. + +#### Data flow +- A version-tag push or manual dispatch starts the workflow; successful Java matrix builds gate image publishing, which in turn gates deployment. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Maven and `./.github/workflows/deploy-k8s.yml`. +- Registry: `registry.shop.example/orders-backoffice`. + +#### Cross-cutting +- Permissions are `contents: read` and `packages: write`. +- Image publishing uses `REGISTRY_USER` and `REGISTRY_TOKEN`; deployment inherits secrets. +- Publishing and deployment use the `production` environment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..f40c63ad --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,41 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:39:17Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Validates the orders backoffice across supported Java versions, publishes a version-tagged container image, and delegates production Kubernetes deployment. + +#### Purpose +- Automates release verification, container publishing, and production deployment for the orders backoffice. +- Runs on version-tag pushes (`v*`) or manual dispatch. + +#### Responsibilities +- **Build and test:** Runs Maven `verify` with the `ci` profile on Java 21 and 25. +- **Publish and deploy:** Pushes the version-tagged image to the registry, then invokes the production deployment workflow. + +#### Key units +- `release-backoffice` — GitHub Actions release workflow with sequential `build`, `image`, and `deploy` jobs. +- `build` — Checks out the repository and verifies it using Temurin Java versions from the matrix. +- `image` — Logs in to `registry.shop.example` and pushes `orders-backoffice:${GITHUB_REF_NAME#v}`. +- `deploy` — Calls `./.github/workflows/deploy-k8s.yml` for the production environment. + +#### Data flow +- A version-tag push or manual dispatch starts the workflow. +- The `build` matrix runs `mvn -B verify -Pci` on Java 21 and 25. +- After successful builds, `image` authenticates to the registry and publishes the image tagged with the version without the `v` prefix. +- After image publishing, `deploy` passes control to the Kubernetes deployment workflow with production environment and inherited secrets. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. +- Build tool: Maven; container registry and image: `registry.shop.example/orders-backoffice`. + +#### Cross-cutting +- Workflow permissions are `contents: read` and `packages: write`. +- Image publishing uses `REGISTRY_USER` and `REGISTRY_TOKEN` secrets; deployment inherits secrets. +- Build matrix covers Java 21 and 25; publishing and deployment use the `production` environment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..96382950 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,51 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:37:34Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds and tests the orders backoffice on Java 21 and 25, publishes a version-tagged container image, and invokes the production Kubernetes deployment workflow. + +#### Purpose +- Release workflow for the orders backoffice application. +- Verifies the application, pushes its container image, then delegates production deployment. + +#### Type +- GitHub Actions workflow. + +#### Definitions +- Workflow `release-backoffice`. +- Triggers: push tags matching `v*`; `workflow_dispatch`. +- Permissions: `contents: read`, `packages: write`. +- Job `build`: runs on `ubuntu-24.04`; matrix `java` values `21`, `25`. + - `actions/checkout@v4` + - `actions/setup-java@v4`: `distribution: temurin`, `java-version: ${{ matrix.java }}` + - `Build and test`: `mvn -B verify -Pci` +- Job `image`: needs `build`; runs on `ubuntu-24.04`; environment `production`. + - `actions/checkout@v4` + - `Log in to the registry`: `docker/login-action@v3`; registry `registry.shop.example`; username `${{ secrets.REGISTRY_USER }}`; password `${{ secrets.REGISTRY_TOKEN }}` + - `Push the image`: builds and pushes `registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v}` +- Job `deploy`: needs `image`; calls `./.github/workflows/deploy-k8s.yml` with `environment: production`; inherits secrets. + +#### Configuration +- `java`: matrix values `21`, `25`. +- `distribution: temurin`. +- Maven build: `-B verify -Pci`. +- `registry: registry.shop.example`. +- Image tag: `${GITHUB_REF_NAME#v}`. +- `environment: production`. +- `REGISTRY_USER=***` (`secrets.REGISTRY_USER`). +- `REGISTRY_TOKEN=***` (`secrets.REGISTRY_TOKEN`). + +#### Dependencies +- Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Reusable workflow: `./.github/workflows/deploy-k8s.yml`. +- Registry and image: `registry.shop.example/orders-backoffice`. +- Build tool: Maven. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/package.ai.md new file mode 100644 index 00000000..9a9875e7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/actions/package.ai.md @@ -0,0 +1,38 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:39:27Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Automates verification, versioned container publishing, and production deployment for the orders backoffice. + +#### Purpose +- Releases the orders backoffice on a version-tag push or manual workflow dispatch. +- Gates publishing and deployment on successful CI verification. + +#### Responsibilities +- **Build and test:** Runs Maven verification with the `ci` profile on Java 21 and 25. +- **Publish and deploy:** Publishes a version-tagged container image, then delegates production deployment to Kubernetes. + +#### Key units +- `release-backoffice` — GitHub Actions workflow coordinating sequential `build`, `image`, and `deploy` jobs. +- `build` — Checks out the repository and runs `mvn -B verify -Pci` across the Java version matrix. +- `image` — Publishes `registry.shop.example/orders-backoffice` using the version tag without its `v` prefix. +- `deploy` — Invokes `./.github/workflows/deploy-k8s.yml` for production. + +#### Data flow +- A version-tag push or manual dispatch starts the workflow; successful matrix builds gate image publishing, which gates deployment. + +#### Dependencies +- GitHub Actions: `actions/checkout@v4`, `actions/setup-java@v4`, and `docker/login-action@v3`. +- Maven and `./.github/workflows/deploy-k8s.yml`. +- Container registry: `registry.shop.example/orders-backoffice`. + +#### Cross-cutting +- Workflow permissions are `contents: read` and `packages: write`. +- Image publishing uses `REGISTRY_USER` and `REGISTRY_TOKEN`; deployment inherits secrets. +- Publishing and deployment use the `production` environment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..8f63aaf2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,47 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:37:38Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 8D64B542 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1 + +> Defines an executable order-fulfilment process that reserves stock, handles payment and large-order approval, ships orders, creates invoices, and cancels orders when stock is unavailable. + +#### Purpose +- Models the order lifecycle, including payment receipt, conditional approval, shipping, invoicing, and out-of-stock cancellation. +- Declares the messages and error used by the process. + +#### Type +- BPMN process; root element `bpmn:definitions`. +- Namespaces: `bpmn` = `http://www.omg.org/spec/BPMN/20100524/MODEL`; `bpmndi` = `http://www.omg.org/spec/BPMN/20100524/DI`; `dc` = `http://www.omg.org/spec/DD/20100524/DC`; `camunda` = `http://camunda.org/schema/1.0/bpmn`. + +#### Definitions +- Process `orderFulfilment` (`Order fulfilment`), executable: + - Starts at `orderPlaced`; sequence flow `toReserve` leads to `reserveStock`. + - Service task `reserveStock` invokes `shop.bpm.ReserveStockDelegate`. Boundary event `stockMissing` catches `errOutOfStock` and flows via `toCancelled` to end event `orderCancelled`. + - Flow `toWaitPayment` leads to message catch event `waitForPayment`, which waits for `msgPaymentReceived`; flow `toAmountCheck` leads to exclusive gateway `amountCheck`. + - Gateway flow `large` proceeds to user task `approveOrder` when `${order.total > 1000}`; `approveOrder` has candidate group `backoffice`. Flow `approvedToShip` leads to `shipOrder`. + - Gateway flow `small` proceeds directly to `shipOrder` when `${order.total <= 1000}`. + - Service task `shipOrder` is an external task on topic `shipping`; flow `toInvoice` leads to call activity `createInvoice`, which calls `invoicing`; flow `toEnd` leads to end event `orderCompleted`. +- Message `msgPaymentReceived` has name `PaymentReceived`. +- Error `errOutOfStock` has name `OutOfStock` and error code `STOCK_EMPTY`. + +#### Configuration +- `orderFulfilment`: `isExecutable="true"`. +- `amountCheck` thresholds: `order.total > 1000` for `large`; `order.total <= 1000` for `small`. +- `reserveStock`: `camunda:class="shop.bpm.ReserveStockDelegate"`. +- `approveOrder`: `camunda:candidateGroups="backoffice"`. +- `shipOrder`: `camunda:type="external"`; `camunda:topic="shipping"`. +- `createInvoice`: `calledElement="invoicing"`. + +#### Dependencies +- Delegate class: `shop.bpm.ReserveStockDelegate`. +- External task topic: `shipping`. +- Called process: `invoicing`. +- Message reference: `msgPaymentReceived`; error reference: `errOutOfStock`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/bpmn/package.ai.md new file mode 100644 index 00000000..b1850ba4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/bpmn/package.ai.md @@ -0,0 +1,40 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:39:30Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> Coordinates order fulfilment from stock reservation and payment through approval, shipping, invoicing, or cancellation when stock is unavailable. + +#### Purpose +- Defines the executable `orderFulfilment` process and its order-completion and out-of-stock paths. +- Routes large orders for back-office approval before shipping. + +#### Responsibilities +- **Order intake and stock handling:** Start on order placement, reserve stock, and cancel the order if `OutOfStock` is raised. +- **Payment and approval:** Wait for `PaymentReceived`; route orders over 1000 to `backoffice` approval and smaller orders directly to shipping. +- **Fulfilment and billing:** Dispatch shipping as an external task, call the `invoicing` process, and complete the order. + +#### Key units +- `orderFulfilment` — executable BPMN process for the order lifecycle. +- `reserveStock` — service task bound to `shop.bpm.ReserveStockDelegate`; its `stockMissing` boundary event catches `errOutOfStock`. +- `amountCheck` — exclusive gateway routing by `order.total` threshold of 1000. +- `approveOrder` — user task assigned to candidate group `backoffice`. +- `shipOrder` — external task on topic `shipping`. +- `createInvoice` — call activity invoking `invoicing`. +- `msgPaymentReceived` / `errOutOfStock` — payment message and stock error (`STOCK_EMPTY`). + +#### Data flow +- `orderPlaced` → `reserveStock` → wait for `PaymentReceived` → evaluate `order.total`. +- Orders over 1000 pass through `approveOrder`; other orders proceed directly to `shipOrder`. +- Shipping → `createInvoice` → `orderCompleted`; a stock error instead routes to `orderCancelled`. + +#### Dependencies +- `shop.bpm.ReserveStockDelegate` for stock reservation. +- External task worker topic `shipping`. +- Called process `invoicing`. +- BPMN message `msgPaymentReceived` and error `errOutOfStock`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..8d57e697 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/docker/Dockerfile.ai.md @@ -0,0 +1,43 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:37:45Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds and runs the Shop orders back-office application as a Java 21 container service on port 8080. + +#### Purpose +- Packages `orders-backoffice.jar` with Maven, then runs it on a Java 21 JRE Alpine image. +- Configures a non-root runtime user and an HTTP liveness health check. + +#### Type +- Dockerfile; Maven 3.9 with Eclipse Temurin 21 for building, Eclipse Temurin 21 JRE Alpine for runtime. + +#### Definitions +- Build stage `build`, based on `maven:3.9-eclipse-temurin-21`: + - `WORKDIR /src` + - Copies `pom.xml` to `/src/pom.xml`; runs `mvn -B dependency:go-offline`. + - Copies `src` to `/src/src`; runs `mvn -B package -DskipTests`. +- Runtime stage, based on `eclipse-temurin:21-jre-alpine`: + - Creates group `shop` and user `backoffice` in that group. + - Copies `/src/target/orders-backoffice.jar` to `/opt/shop/orders-backoffice.jar` from `build`. + - Exposes port `8080`; runs as `backoffice`. + - Health check: `wget -qO- http://localhost:8080/health/live || exit 1`, interval `30s`. + - Entrypoint: `sh -c "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"`. + +#### Configuration +- `ARG APP_VERSION=2.1.0` +- `JAVA_OPTS="-XX:MaxRAMPercentage=75"` +- `SHOP_PROFILE=production` + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21`, `eclipse-temurin:21-jre-alpine`. +- Build inputs: `pom.xml`, `src`. +- Runtime artifact: `/src/target/orders-backoffice.jar` (copied to `/opt/shop/orders-backoffice.jar`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/docker/package.ai.md new file mode 100644 index 00000000..dc495a36 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/docker/package.ai.md @@ -0,0 +1,33 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:39:35Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> Packages and runs the Shop orders back-office service as a production-configured Java container. + +#### Purpose +- Builds `orders-backoffice.jar` with Maven and deploys it in a Java 21 JRE Alpine container. +- Exposes the service on port `8080` with a non-root runtime user and HTTP liveness check. + +#### Responsibilities +- **Image build and runtime packaging:** Separates Maven build and Java runtime stages; copies the packaged artifact into the runtime image. +- **Container operation:** Sets production environment configuration, launches the JAR, and checks `/health/live`. + +#### Key units +- `Dockerfile`: Defines the two-stage build, runtime user `backoffice`, port `8080`, health check, and Java entrypoint. + +#### Data flow +- `pom.xml` and `src` → Maven package build → `/src/target/orders-backoffice.jar` → `/opt/shop/orders-backoffice.jar` → Java process in the runtime container. + +#### Dependencies +- Build image: `maven:3.9-eclipse-temurin-21`; runtime image: `eclipse-temurin:21-jre-alpine`. +- Build inputs: `pom.xml`, `src`; runtime artifact: `orders-backoffice.jar`. + +#### Cross-cutting +- Runtime configuration: `SHOP_PROFILE=production`, `JAVA_OPTS="-XX:MaxRAMPercentage=75"`, and `APP_VERSION=2.1.0`. +- Runs as non-root user `backoffice`; liveness check runs every `30s`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..85267713 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,46 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:37:49Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> The checkout page collects a delivery address and shipping method, updates the order total, and submits the order. + +#### Purpose +- Enter delivery details and select shipping before placing an order. +- Display the total in euros and include payment hints. + +#### Type +- Facelets page; XHTML. +- `h` = Jakarta Faces HTML; `f` = Jakarta Faces core; `ui` = Jakarta Faces Facelets. + +#### Data +- `checkoutBean.address.street` — delivery street. +- `checkoutBean.address.zip` — delivery ZIP code. +- `checkoutBean.shippingMethod` — selected shipping method. +- `checkoutBean.shippingMethods` — options for the shipping method menu. +- `checkoutBean.total` — order total. + +#### Actions +- `checkoutForm` submits through `checkoutBean.placeOrder` via the “Place order” command button. +- Changing `shipping` invokes `checkoutBean.recalculate` via Ajax and rerenders `total`. +- `zip` uses `f:validateRegex` with pattern `[0-9]{5}`. +- `total` uses `f:convertNumber` with currency type and `EUR`. +- Commented-out “Save cart” button references `checkoutBean.saveCart`; it is not active. + +#### Structure +- Uses template `/WEB-INF/templates/shop.xhtml`; defines `content`. +- Includes `/WEB-INF/includes/payment-hints.xhtml`. + +#### Dependencies +- `checkoutBean` +- `/WEB-INF/templates/shop.xhtml` +- `/WEB-INF/includes/payment-hints.xhtml` +- `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/facelets/package.ai.md new file mode 100644 index 00000000..0baf041e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/facelets/package.ai.md @@ -0,0 +1,38 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:39:39Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> Collects delivery details and shipping preferences, recalculates the order total, and submits the order for checkout. + +#### Purpose +- Provide the checkout form for entering an address and choosing a shipping method. +- Show the total in euros and payment hints. + +#### Responsibilities +- Address and shipping input, including ZIP-code validation and shipping-method selection. +- Order-total display and recalculation when the shipping method changes. +- Order submission through the checkout form. + +#### Key units +- `checkout.xhtml` — Facelets page binding delivery, shipping, and total fields to `checkoutBean`. + +#### Data flow +- Form inputs bind to `checkoutBean.address.street`, `checkoutBean.address.zip`, and `checkoutBean.shippingMethod`; shipping options come from `checkoutBean.shippingMethods`. +- Changing the shipping method invokes `checkoutBean.recalculate` via Ajax and rerenders the total. +- The displayed `checkoutBean.total` is formatted as EUR; submitting invokes `checkoutBean.placeOrder`. + +#### Dependencies +- `checkoutBean` — supplies checkout data and actions. +- `/WEB-INF/templates/shop.xhtml` — page template providing the `content` insertion point. +- `/WEB-INF/includes/payment-hints.xhtml` — included payment hints. +- Jakarta Faces HTML, core, and Facelets namespaces. + +#### Cross-cutting +- ZIP input uses `f:validateRegex` with the five-digit pattern `[0-9]{5}`. +- Uses Facelets templating and an included fragment; the “Save cart” button is commented out and inactive. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..359f9c19 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,60 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:37:53Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Shipping rules determine order delivery charges from parcel weight and order value, including free shipping and rejection of overweight parcels. + +#### Purpose +- `ShippingRulesSpec` verifies free-shipping eligibility, weight-based prices, and overweight-parcel rejection. +- `ShippingRules` calculates shipping cost using carrier settings, parcel weight, and order total. + +#### Type +- `ShippingRulesSpec` — class extending `Specification`; Spock specification. +- `ShippingRules` — class; `@CompileStatic`; no explicit superclass or interfaces. + +#### Input +- `ShippingRules.carrier: String` and `ShippingRules.maxParcelKg: BigDecimal` — configurable properties. +- `ShippingRules.costFor(Order order)` — order total and weight. +- `ShippingRulesSpec` fixture initializes `rules` with carrier `'DHL'` and maximum parcel weight `31.5`. +- Test data supplies order totals and weights; `heavyOrder(BigDecimal kg)` constructs an order with total `10`. + +#### Output +- `ShippingRules.costFor(Order)` returns a `BigDecimal` shipping price or throws `ParcelTooHeavyException`. +- `ShippingRulesSpec` assertions verify a zero price, tier prices, and the overweight exception. + +#### Core logic +- `costFor` first compares `order.weightKg` with `maxParcelKg`; if over the limit, throws `ParcelTooHeavyException` with parcel and limit weights. +- If `order.total >= ShippingRulesSpec.FREE_SHIPPING_THRESHOLD`, returns `0`. +- Otherwise defines `tiers` with maximum weights/prices `(2, 4.99)`, `(10, 9.99)`, and `(31.5, 19.99)`; finds the first tier where `order.weightKg <= tier.upTo` and casts its `price` to `BigDecimal`. +- `ShippingRulesSpec` checks free shipping for total `75.00`; unrolled cases check weights `1`, `10`, and `30`; overweight case checks weight `40`. +- `heavyOrder` constructs `new Order(total: 10, weightKg: kg)`; it is not called by the shown tests. + +#### Public API +- `FREE_SHIPPING_THRESHOLD: BigDecimal` — free-shipping cutoff. +- `rules: ShippingRules` — specification fixture. +- `"orders above the threshold ship for free"()` -> `void` — verifies free shipping. +- `"a parcel of #weight kg costs #expected"()` -> `void` — verifies tier prices. +- `"an overweight parcel is rejected"()` -> `void` — verifies overweight rejection. +- `getCarrier()`/`setCarrier(String)` -> `String` — carrier property. +- `getMaxParcelKg()`/`setMaxParcelKg(BigDecimal)` -> `BigDecimal` — maximum parcel weight. +- `costFor(Order)` -> `BigDecimal` — calculate shipping cost. + +#### Dependencies +- `groovy.transform.CompileStatic` +- `spock.lang.Specification` +- `spock.lang.Unroll` +- `Order` +- `ParcelTooHeavyException` + +#### Exceptions / Errors +- Throws `ParcelTooHeavyException` when parcel weight exceeds `maxParcelKg`. +- No explicit handling for a weight that matches no tier after the maximum-weight check. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/groovy/package.ai.md new file mode 100644 index 00000000..6b787d73 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/groovy/package.ai.md @@ -0,0 +1,36 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:39:43Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> Calculates order delivery charges from parcel weight and order value, including free-shipping eligibility and rejection of overweight parcels. + +#### Purpose +- Determines shipping costs using order totals, parcel weights, and configured carrier limits. +- Specifies expected free-shipping, weight-tier pricing, and overweight-rejection behavior. + +#### Responsibilities +- **Shipping calculation:** `ShippingRules` checks the parcel weight limit, applies free shipping above the threshold, and otherwise selects a weight-based price tier. +- **Behavior verification:** `ShippingRulesSpec` tests free shipping, tier prices for weights 1, 10, and 30 kg, and rejection of a 40 kg parcel. + +#### Key units +- `ShippingRules` — holds carrier and maximum parcel weight settings; calculates a shipping price or throws `ParcelTooHeavyException`. +- `ShippingRulesSpec` — Spock specification for shipping rule behavior; defines `FREE_SHIPPING_THRESHOLD` and a `heavyOrder` fixture helper. + +#### Data flow +- `costFor(Order)` checks `Order.weightKg` against `maxParcelKg`; over-limit parcels raise `ParcelTooHeavyException`. +- For parcels within the limit, `Order.total` at or above the free-shipping threshold yields `0`; otherwise, the first matching weight tier supplies the price. + +#### Dependencies +- Domain types: `Order`, `ParcelTooHeavyException`. +- Test framework: `spock.lang.Specification`, `spock.lang.Unroll`. +- Language support: `groovy.transform.CompileStatic`. + +#### Cross-cutting +- `ShippingRules` uses `@CompileStatic`. +- Shipping tiers are defined by maximum weights and prices: 2 kg / 4.99, 10 kg / 9.99, and 31.5 kg / 19.99. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..1eec9f7e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/integration/order-routes.xml.ai.md @@ -0,0 +1,51 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:38:02Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Defines order-message validation, review routing, ERP submission, line-item review delivery, auditing, and retry/dead-letter handling. + +#### Purpose +- Routes incoming JMS orders to manual review or the ERP according to order total. +- Translates and submits ERP orders; handles ERP outages with retries and dead-letter delivery. + +#### Type +- Spring bean configuration with Apache Camel routes; root element `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` = `http://www.w3.org/2001/XMLSchema-instance`; nested Camel context uses `http://camel.apache.org/schema/spring`. + +#### Definitions +- Beans: + - `orderValidator` — `shop.integration.OrderValidator`. + - `invoiceTranslator` — `shop.integration.InvoiceTranslator`. +- Property placeholder `properties` loads `classpath:integration.properties`. +- Exception handling for `shop.integration.ErpUnavailableException`: retries with configured redelivery policy, marks handled, then sends to `jms:queue:orders.deadletter`. +- Route `incomingOrders`: + - Consumes `jms:queue:{{orders.incoming.queue}}`. + - Calls `orderValidator.validate`. + - Routes orders with `${body.total} > {{orders.review.threshold}}` to `direct:manualReview`; otherwise to `direct:toErp`. + - Wire-taps to `seda:orderAudit`. +- Route `toErp`: + - Consumes `direct:toErp`. + - Calls `invoiceTranslator`. + - Dynamically sends to `https://{{erp.host}}/api/orders/${header.orderId}`. +- Route `manualReview`: + - Consumes `direct:manualReview`. + - Splits `${body.lines}` and sends each item to `jms:queue:review.lines`. + +#### Configuration +- `maximumRedeliveries="5"`, `redeliveryDelay="2000"`, `useExponentialBackOff="true"`. +- Placeholders: `{{orders.incoming.queue}}`, `{{orders.review.threshold}}`, `{{erp.host}}`. +- Dynamic URI expression: `${header.orderId}`; route condition: `${body.total} > {{orders.review.threshold}}`. + +#### Dependencies +- `classpath:integration.properties`. +- Classes: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `shop.integration.ErpUnavailableException`. +- External systems and endpoints: JMS queues `orders.incoming.queue` (configured), `orders.deadletter`, `review.lines`; SEDA endpoint `orderAudit`; ERP HTTPS API at `{{erp.host}}`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/integration/package.ai.md new file mode 100644 index 00000000..88b41797 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/integration/package.ai.md @@ -0,0 +1,43 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:39:47Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Processes incoming orders by validating them, routing high-value orders for line-item review, and submitting other orders to the ERP with failure recovery. + +#### Purpose +- Orchestrates order intake, review, ERP submission, and audit routing. +- Recovers from ERP outages through configured retries and dead-letter delivery. + +#### Responsibilities +- **Order validation and routing:** Validate incoming JMS orders and route by configured total threshold. +- **Review and ERP processing:** Split review orders into line items for JMS delivery; translate other orders and send them to the ERP API. +- **Audit and failure handling:** Wire-tap incoming orders to an audit endpoint and handle ERP-unavailable errors with retry and dead-letter behavior. + +#### Key units +- `incomingOrders` — consumes the configured incoming JMS queue, validates orders, routes them by total, and wire-taps to `seda:orderAudit`. +- `toErp` — invokes `invoiceTranslator` and sends orders to the ERP endpoint using the order ID header. +- `manualReview` — splits order lines and sends each item to `jms:queue:review.lines`. +- `orderValidator` — Spring bean for order validation, implemented by `shop.integration.OrderValidator`. +- `invoiceTranslator` — Spring bean for ERP order translation, implemented by `shop.integration.InvoiceTranslator`. +- `shop.integration.ErpUnavailableException` handler — retries failed ERP operations and sends handled failures to `jms:queue:orders.deadletter`. + +#### Data flow +- Incoming JMS orders are validated, then routed to manual review when `body.total` exceeds `orders.review.threshold`, or to ERP submission otherwise. +- Incoming orders are also wire-tapped to `seda:orderAudit`. +- The review route splits `body.lines` into individual JMS messages; the ERP route translates the order and sends it to the configured HTTPS API using `header.orderId`. +- ERP-unavailable failures trigger up to five retries with a 2-second delay and exponential backoff, followed by dead-letter delivery. + +#### Dependencies +- `classpath:integration.properties` supplies route placeholders, including the incoming queue, review threshold, and ERP host. +- Uses Apache Camel with Spring bean configuration, JMS queues, a SEDA audit endpoint, and the ERP HTTPS API. +- Depends on `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, and `shop.integration.ErpUnavailableException`. + +#### Cross-cutting +- Queue names, review threshold, and ERP host are externally configured through property placeholders. +- ERP failure handling uses a configured redelivery policy and dead-letter queue. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..ab7b4fbf --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,42 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:38:07Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Configures stock reservation, checkout, and order-placement EJBs, including reservation settings, JMS activation, auditing, and transaction behavior. + +#### Purpose +- Declares session and message-driven beans for shop stock and checkout operations. +- Configures an interceptor, a local EJB reference, and a transaction attribute for stock reservations. + +#### Type +- Jakarta EE EJB descriptor; root element `ejb-jar`. +- Namespace: default `https://jakarta.ee/xml/ns/jakartaee`. + +#### Definitions +- Session bean `StockReservationBean`: class `shop.stock.StockReservationBean`; type `Stateless`. + - Environment entry `reservationMinutes`: type `java.lang.Integer`, value `45`. +- Session bean `CheckoutSessionBean`: class `shop.checkout.CheckoutSessionBean`; type `Stateful`. + - Local EJB reference `ejb/StockReservation` to `shop.stock.StockReservation`. +- Message-driven bean `OrderPlacedListener`: class `shop.events.OrderPlacedListener`. + - Activation property `destinationLookup`: `java:/jms/queue/OrderPlaced`. +- Interceptor: `shop.audit.TimingInterceptor`; bound to all beans via `ejb-name` `*`. +- Transaction attribute: `RequiresNew` for `StockReservationBean` method `reserve`. + +#### Configuration +- `reservationMinutes` = `45`. +- `destinationLookup` = `java:/jms/queue/OrderPlaced`. +- `StockReservationBean.reserve` transaction attribute = `RequiresNew`. + +#### Dependencies +- Classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`. +- Local interface: `shop.stock.StockReservation`. +- JMS destination lookup: `java:/jms/queue/OrderPlaced`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jee/package.ai.md new file mode 100644 index 00000000..f2c64555 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jee/package.ai.md @@ -0,0 +1,46 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:39:53Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> Configures the shop back-office and commerce services for report access, stock reservation, checkout, and order-event handling. + +#### Purpose +- Defines Jakarta EE deployment settings for shop web components and EJB services. +- Configures web access control, resource references, request processing, and transactional stock reservation. + +#### Responsibilities +- **Commerce services:** Declares stock reservation and checkout session beans, plus an order-placed message-driven bean and its JMS destination. +- **Back-office web application:** Configures report downloads, request ID filtering, startup auditing, session lifetime, and the report directory. +- **Operations and access:** Applies auditing, transaction behavior, admin-role protection, and a data-source reference. + +#### Key units +- `StockReservationBean` — stateless bean with a 45-minute reservation setting; `reserve` uses `RequiresNew`. +- `CheckoutSessionBean` — stateful checkout bean with a local reference to `StockReservation`. +- `OrderPlacedListener` — message-driven bean activated for `java:/jms/queue/OrderPlaced`. +- `TimingInterceptor` — interceptor bound to all beans. +- `ReportDownloadServlet` — report endpoint mapped to `/reports/*`, loaded at startup. +- `RequestIdFilter` — filter mapped to all web requests (`/*`). +- `StartupAuditListener` — web application startup listener. +- `jdbc/ShopDS` — web application resource reference of type `javax.sql.DataSource`. + +#### Data flow +- Web requests pass through `RequestIdFilter`; report requests under `/reports/*` are handled by `ReportDownloadServlet`, configured with `/var/shop/reports`. +- Checkout can reference stock reservation through `shop.stock.StockReservation`; the reservation operation runs with `RequiresNew`. +- Order-placed messages are received by `OrderPlacedListener` from the configured JMS destination. + +#### Dependencies +- Application classes and interface: `shop.stock.StockReservationBean`, `shop.stock.StockReservation`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`, `shop.web.ReportDownloadServlet`, `shop.web.RequestIdFilter`, `shop.web.StartupAuditListener`. +- Container resources: `java:/jms/queue/OrderPlaced` and `jdbc/ShopDS`. +- Jakarta EE EJB and web application descriptors. + +#### Cross-cutting +- `TimingInterceptor` applies to all EJBs. +- Web security protects `/admin/*` for role `admin`; the web session timeout is 20 minutes. +- EJB configuration sets `reservationMinutes` to `45`; report configuration sets `shop.reportDirectory` to `/var/shop/reports`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jee/web.xml.ai.md new file mode 100644 index 00000000..2e52df83 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jee/web.xml.ai.md @@ -0,0 +1,47 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:38:12Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Configures the shop back-office web application’s report endpoint, request filtering, startup audit, session lifetime, admin access control, and data-source reference. + +#### Purpose +- Defines web application settings and components for `shop-backoffice`. +- Protects `/admin/*` for the `admin` role and configures report downloads at `/reports/*`. + +#### Type +- Jakarta EE web application descriptor; root element `web-app`. +- Namespace: default `https://jakarta.ee/xml/ns/jakartaee`. + +#### Definitions +- Display name: `shop-backoffice`. +- Servlet `ReportDownloadServlet`: class `shop.web.ReportDownloadServlet`; load-on-startup `1`; mapped to `/reports/*`. +- Filter `RequestIdFilter`: class `shop.web.RequestIdFilter`; mapped to `/*`. +- Listener: `shop.web.StartupAuditListener`. +- Session timeout: `20` minutes. +- Security constraint `backoffice`: protects `/admin/*`; requires role `admin`. +- Security role: `admin`. +- Resource reference `jdbc/ShopDS`: type `javax.sql.DataSource`. +- Context parameter `shop.reportDirectory`: `/var/shop/reports`. + +#### Configuration +- `shop.reportDirectory` = `/var/shop/reports`. +- `session-timeout` = `20`. +- `load-on-startup` for `ReportDownloadServlet` = `1`. +- URL mappings: `ReportDownloadServlet` → `/reports/*`; `RequestIdFilter` → `/*`. +- Security URL pattern `/admin/*` requires `admin`. + +#### Dependencies +- Servlet class: `shop.web.ReportDownloadServlet`. +- Filter class: `shop.web.RequestIdFilter`. +- Listener class: `shop.web.StartupAuditListener`. +- Data-source type: `javax.sql.DataSource`. +- Container-managed resource name: `jdbc/ShopDS`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..50dd3b6a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,46 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:38:17Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> The open-orders page lets staff search orders by customer email and status, review order totals and overdue status, and cancel an order. + +#### Purpose +- Display orders and provide search and cancellation controls. + +#### Type +- JSP page; `text/html;charset=UTF-8`. +- Tag libraries: `c` = Jakarta Tags core; `fmt` = Jakarta Tags format. + +#### Data +- Request attribute `orderFilter`: calls `getPageSize()` to display page size; defaults to `25` if absent. +- `${orders}`: iterated as `order`; reads `order.number`, `order.total`, `order.overdue`, and `order.id`. +- Request parameter `param.customerEmail`: prepopulates the customer email field. +- `${pageContext.request.contextPath}`: form action context path. + +#### Actions +- GET form to `${pageContext.request.contextPath}/orders/search`; fields: `customerEmail` (text), `status` (select with `OPEN` and `SHIPPED` options). +- Cancel link for each order: `orders/${order.id}/cancel`. + +#### Structure +- Includes `/WEB-INF/jspf/header.jspf` via JSP include directive. +- Includes `/WEB-INF/jspf/footer.jspf` via `jsp:include`. + +#### Server code +- Imports `java.util.List`, `shop.Order`, and `shop.OrderFilter`; only `OrderFilter` is used. +- Reads request attribute `orderFilter`, casts it to `OrderFilter`, and computes the displayed page size using `getPageSize()` or default `25`. + +#### Dependencies +- `/WEB-INF/jspf/header.jspf` +- `/WEB-INF/jspf/footer.jspf` +- `shop.OrderFilter` +- `/orders/search` +- `orders/${order.id}/cancel` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jsp/package.ai.md new file mode 100644 index 00000000..b8525295 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/jsp/package.ai.md @@ -0,0 +1,31 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:39:59Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> Staff can review open orders, filter them by customer email and shipping status, and cancel individual orders. + +#### Purpose +- Render the order list with search controls, order totals, and overdue indicators. +- Provide per-order cancellation links. + +#### Responsibilities +- Search interface: GET form to `/orders/search` with customer email and `OPEN` or `SHIPPED` status. +- Order review: display each order’s number, total, and overdue status, with a cancellation link. + +#### Key units +- `order-list.jsp` — renders the orders page, prepopulates the customer email from the request parameter, and displays the `OrderFilter` page size (default `25`). + +#### Data flow +- Reads `orderFilter` and `param.customerEmail` from the request; iterates `${orders}` to render order details and cancellation links. +- Submits search criteria to `/orders/search`; forms cancellation URLs from each order’s ID. + +#### Dependencies +- `shop.OrderFilter` for the displayed page size. +- `/WEB-INF/jspf/header.jspf` and `/WEB-INF/jspf/footer.jspf` for shared page content. +- Jakarta Tags core and format libraries. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..81f9e294 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,51 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:38:23Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the Orders back-office application to Kubernetes and exposes it at `backoffice.shop.example`. + +#### Purpose +- Runs three replicas of the Orders back-office application. +- Provides cluster-internal service access and external HTTP routing. + +#### Type +- Kubernetes multi-resource manifest; Deployment `apps/v1`, Service `v1`, Ingress `networking.k8s.io/v1`. + +#### Definitions +- Deployment `orders-backoffice`: + - Labels and selector: `app: orders-backoffice`. + - Replicas: `3`. + - Container `backoffice`: image `registry.shop.example/orders-backoffice:2.1.0`; container port `8080`. + - Environment: `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop`; `SHOP_DB_PASSWORD` from Secret `orders-db-credentials`, key `password`. + - Readiness probe: HTTP GET `/health/ready` on port `8080`. + - Resource limits: memory `768Mi`, CPU `"1"`. +- Service `orders-backoffice`: + - Selects `app: orders-backoffice`. + - Port `80` targets port `8080`. +- Ingress `orders-backoffice`: + - Host `backoffice.shop.example`. + - Prefix path `/` routes to Service `orders-backoffice`, port `80`. + +#### Configuration +- `spec.replicas=3` +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD` references `orders-db-credentials`, key `password`. +- Readiness endpoint: `/health/ready`, port `8080`. +- Resource limits: `memory=768Mi`, `cpu="1"`. +- Service port mapping: `80` → `8080`. +- Ingress host: `backoffice.shop.example`; path `/`, `pathType=Prefix`. + +#### Dependencies +- Image: `registry.shop.example/orders-backoffice:2.1.0` +- Secret: `orders-db-credentials`, key `password` +- Database endpoint: `orders-db:5432`, database `shop` +- Service: `orders-backoffice` (port `80`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/k8s/package.ai.md new file mode 100644 index 00000000..b9e947c5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/k8s/package.ai.md @@ -0,0 +1,36 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:40:03Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Runs the Orders back-office application on Kubernetes, connects it to the shop database, and exposes it over HTTP. + +#### Purpose +- Deploys the Orders back-office application with three replicas. +- Provides internal service access and external routing at `backoffice.shop.example`. + +#### Responsibilities +- **Workload:** Runs `orders-backoffice` with database connection settings, a readiness probe, and resource limits. +- **Networking:** Routes cluster traffic through a Service and external HTTP traffic through an Ingress. + +#### Key units +- `Deployment/orders-backoffice` — runs the `backoffice` container from `registry.shop.example/orders-backoffice:2.1.0` on port `8080`. +- `Service/orders-backoffice` — maps port `80` to container port `8080`. +- `Ingress/orders-backoffice` — routes prefix path `/` on `backoffice.shop.example` to the Service. + +#### Data flow +- The Deployment obtains its database URL from `SHOP_DB_URL` and its password from Secret `orders-db-credentials`, key `password`. +- Incoming HTTP requests for `backoffice.shop.example/` route through the Ingress to Service port `80`, then to container port `8080`. + +#### Dependencies +- PostgreSQL endpoint `orders-db:5432`, database `shop`. +- Kubernetes Secret `orders-db-credentials`, key `password`. +- Container image `registry.shop.example/orders-backoffice:2.1.0`. + +#### Cross-cutting +- Configures three replicas, resource limits of `768Mi` memory and `1` CPU, and readiness checks via `/health/ready` on port `8080`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..cf3a1029 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,74 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:38:32Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Completed orders are turned into numbered invoices with payment deadlines, stored for billing, and assigned standard or reduced tax rates. + +#### Purpose +- `InvoiceService` rejects empty orders, creates and stores invoices, and calculates category tax rates. +- `InvoiceLine` computes line amounts; `List.total()` sums them. + +#### Type +- `PAYMENT_TERM_DAYS` — top-level `const val`; public `Int`. +- `InvoiceNumber` — `value class`; `@JvmInline`; wraps `String`. +- `InvoiceLine` — `data class`; properties `sku: String`, `quantity: Int`, `unitPrice: BigDecimal`. +- `InvoiceResult` — `sealed interface`. +- `InvoiceResult.Issued` — nested `data class`; implements `InvoiceResult`; properties `number: InvoiceNumber`, `dueDate: LocalDate`. +- `InvoiceResult.Rejected` — nested `data class`; implements `InvoiceResult`; property `reason: String`. +- `InvoiceService` — `class`; constructor-injected `InvoiceRepository` and `clock: () -> LocalDate`; contains companion object. + +#### Input +- `InvoiceService(repository, clock)` — `repository: InvoiceRepository`; `clock` defaults to `LocalDate::now`. +- `issue(order: CompletedOrder)` — reads `order.lines`, `order.id`, and `order.customerId`. +- `taxRate(category: String)` — category name. +- `InvoiceLine(sku, quantity, unitPrice)` — `String`, `Int`, and `BigDecimal`. +- `InvoiceNumber(value: String)`; `InvoiceResult.Issued(number, dueDate)`; `InvoiceResult.Rejected(reason)`. +- `List.total()` — receiver list of invoice lines. +- Public mutable `defaultCurrency: String` is declared `lateinit`. + +#### Output +- `issue` returns `InvoiceResult.Issued` with invoice number and due date, or `InvoiceResult.Rejected` with a reason; saves issued invoices through `repository.save(invoice)`. +- `taxRate` returns `BigDecimal("0.07")` for reduced-tax categories, otherwise `BigDecimal("0.19")`. +- `InvoiceLine.amount` returns `unitPrice * quantity`; `total()` returns the sum of line amounts. +- `nextNumber()` increments the private `sequence`; invoice numbers use the `INV-` prefix. + +#### Core logic +- `issue` runs inside `withContext(Dispatchers.IO)`. +- If `order.lines.isEmpty()`, returns `Rejected("order ${order.id} has no lines")` without numbering or saving. +- Otherwise calls `nextNumber()`, constructs `Invoice` from the number, customer ID, order lines, and `clock().plusDays(PAYMENT_TERM_DAYS.toLong())`, then calls `repository.save(invoice)`. +- Returns `Issued(number, invoice.dueDate)` after saving. +- `taxRate` checks membership in `REDUCED_TAX_CATEGORIES`, which contains `"books"` and `"food"`. +- `nextNumber()` creates `InvoiceNumber("$PREFIX-${++sequence}")`; `PREFIX` is `"INV"`. +- `total()` folds from `BigDecimal.ZERO`, adding each `line.amount`. + +#### Public API +- `InvoiceNumber(value: String)` — wraps invoice identifier. +- `InvoiceLine(sku: String, quantity: Int, unitPrice: BigDecimal)` — creates line item. +- `amount: BigDecimal` — calculated line amount. +- `InvoiceResult.Issued(number: InvoiceNumber, dueDate: LocalDate)` — issued outcome. +- `InvoiceResult.Rejected(reason: String)` — rejected outcome. +- `InvoiceService(repository: InvoiceRepository, clock: () -> LocalDate)` — configures invoice issuance. +- `defaultCurrency: String` — get/set default currency. +- `REDUCED_TAX_CATEGORIES: Set` — reduced-rate categories. +- `issue(order: CompletedOrder): InvoiceResult` — issues and stores invoice. +- `taxRate(category: String): BigDecimal` — returns category tax rate. +- `PAYMENT_TERM_DAYS: Int` — payment term constant. +- `List.total(): BigDecimal` — sums line amounts. + +#### Dependencies +- `java.math.BigDecimal`, `java.time.LocalDate` +- `kotlinx.coroutines.Dispatchers`, `kotlinx.coroutines.withContext` +- `InvoiceRepository`, `CompletedOrder`, `Invoice` (referenced, not declared in this file) + +#### Concurrency +- `issue` switches execution to `Dispatchers.IO`. +- `sequence` is mutable and unsynchronized; concurrent calls have no explicit sequence-safety mechanism. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/kotlin/package.ai.md new file mode 100644 index 00000000..69936312 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/kotlin/package.ai.md @@ -0,0 +1,46 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:40:07Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> Completed customer orders are converted into numbered invoices with payment deadlines, persisted for billing, and assigned category-based tax rates. + +#### Purpose +- Issue invoices for nonempty completed orders and return either an issued result or a rejection. +- Calculate invoice line totals and apply standard or reduced tax rates. + +#### Responsibilities +- **Invoice issuance:** Validate order lines, assign an invoice number and due date, and save the invoice through `InvoiceRepository`. +- **Invoice calculations:** Compute line amounts and sum invoice lines; select reduced rates for books and food. +- **Invoice result modeling:** Represent successful issuance or rejection with a sealed result type. + +#### Key units +- `InvoiceService` — issues invoices, determines tax rates, and generates sequential `INV-` numbers. +- `InvoiceNumber` — value class wrapping an invoice identifier. +- `InvoiceLine` — stores SKU, quantity, and unit price; exposes the calculated `amount`. +- `InvoiceResult` — sealed interface with `Issued(number, dueDate)` and `Rejected(reason)` outcomes. +- `PAYMENT_TERM_DAYS` — payment deadline interval used when calculating invoice due dates. +- `REDUCED_TAX_CATEGORIES` — set of reduced-rate categories: `"books"` and `"food"`. +- `List.total()` — sums line amounts from `BigDecimal.ZERO`. + +#### Data flow +- `issue(order)` rejects orders with no lines without numbering or saving. +- For nonempty orders, it generates an invoice number, builds an `Invoice` from the order’s customer ID and lines, and sets the due date from the injected clock plus `PAYMENT_TERM_DAYS`. +- The service saves the invoice through `InvoiceRepository` and returns `InvoiceResult.Issued` with its number and due date. +- `taxRate(category)` returns `0.07` for reduced-tax categories and `0.19` otherwise; line and list calculations produce `BigDecimal` amounts and totals. + +#### Dependencies +- `InvoiceRepository` for invoice persistence; `CompletedOrder` for order ID, customer ID, and lines; `Invoice` as the persisted invoice model. +- Kotlin coroutines `withContext` and `Dispatchers.IO` for invoice issuance. +- Java `BigDecimal` and `LocalDate` for monetary values and dates. + +#### Cross-cutting +- `InvoiceService` receives its repository and clock as constructor dependencies; the clock defaults to `LocalDate::now`. +- `issue` executes on `Dispatchers.IO`. +- The mutable invoice sequence has no explicit synchronization or concurrency-safety mechanism. +- `defaultCurrency` is a public mutable `lateinit` property. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..fa0dd8f1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,32 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:38:44Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Defines customer lookup, search, insertion, promotion, and inactive-customer deletion operations for the shop customer mapper. + +#### Type +- MyBatis mapper; root element `mapper`; namespace `shop.customer.CustomerMapper`. + +#### Definitions +- Result map `customerResult` maps `shop.customer.Customer`: `id` from `CUSTOMER_ID` (id), `email` from `EMAIL`, `loyaltyTier` from `LOYALTY_TIER`. +- SQL fragment `customerColumns`: `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT`. +- Select `findByEmail`: reads `CUSTOMER`, includes `customerColumns`, filters by `EMAIL = #{email}`, uses `customerResult`. +- Select `search`: reads `CUSTOMER`, includes `customerColumns`, conditionally filters by `LOYALTY_TIER = #{tier}` and `CREATED_AT >= #{createdAfter}`, orders by `${sortColumn}`, uses `customerResult`. +- Insert `insert`: writes `CUSTOMER`; inserts `EMAIL`, `LOYALTY_TIER`, and `CREATED_AT` (`now()`); generated keys enabled with `keyProperty="id"`. +- Update `promote`: updates `LOYALTY_TIER` for `CUSTOMER_ID` values from `ids`. +- Delete `deleteInactive`: deletes from `CUSTOMER` where `LAST_ORDER_AT < #{cutoff}`. +- `${sortColumn}` is spliced into SQL unescaped. + +#### Dependencies +- Java type `shop.customer.Customer`. +- MyBatis mapper DTD at `https://mybatis.org/dtd/mybatis-3-mapper.dtd`. +- Database table `CUSTOMER`; columns `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/mybatis/package.ai.md new file mode 100644 index 00000000..cdbfa6f4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/mybatis/package.ai.md @@ -0,0 +1,38 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:40:13Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Supports customer lookup, filtering, creation, loyalty-tier promotion, and cleanup of inactive shop customers. + +#### Purpose +- Provides MyBatis database operations for the shop’s `CUSTOMER` records. +- Maps query results to `shop.customer.Customer`. + +#### Responsibilities +- Customer retrieval: find by email or search with optional loyalty-tier and creation-date filters. +- Customer lifecycle updates: insert customers, promote loyalty tiers for selected IDs, and delete customers with an old last-order date. + +#### Key units +- `shop.customer.CustomerMapper` — mapper namespace for customer database operations. +- `customerResult` — maps `CUSTOMER_ID`, `EMAIL`, and `LOYALTY_TIER` to `Customer` properties. +- `customerColumns` — shared column list used by customer selects. +- `findByEmail`, `search`, `insert`, `promote`, `deleteInactive` — lookup, search, insertion, promotion, and deletion statements. + +#### Data flow +- Selects read from `CUSTOMER`, reuse `customerColumns`, and map results through `customerResult`. +- `search` adds optional filters for tier and creation date, then orders by the supplied sort column. +- Writes insert customer details with `CREATED_AT` set to `now()` and generated keys assigned to `id`; promotion and deletion act on supplied IDs or cutoff dates. + +#### Dependencies +- Java type `shop.customer.Customer`. +- Database table `CUSTOMER` and columns `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER`, `CREATED_AT`, `LAST_ORDER_AT`. +- MyBatis mapper DTD. + +#### Cross-cutting +- Dynamic SQL supports optional search filters; `${sortColumn}` is inserted into SQL unescaped. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..a75bc60c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,35 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:38:48Z +- G: +- A: 0.0.0 +- X: file +- P: 30325B28 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> Specifies backoffice retrieval and cancellation of shop orders, including order status, totals, and coupon codes. + +#### Purpose +- Lists and retrieves shop orders, and supports cancelling an order. + +#### Type +- OpenAPI 3.0.3; `Shop Orders API` version `2.1.0`. + +#### Operations +- `GET /orders` — `listOrders`; query parameters: `status` (`OrderStatus`), `limit` (integer, maximum `200`); `200`: array of `Order`. +- `GET /orders/{orderId}` — `getOrder`; path parameter: `orderId` (string, required); `200`: `Order`; `404`: no response schema specified. +- `POST /orders/{orderId}/cancel` — `cancelOrder`; path parameter: `orderId` (string, required); `204`, `409`: no response schemas specified. + +#### Schemas +- `OrderStatus`: string enum `OPEN`, `PAID`, `SHIPPED`, `CANCELLED`. +- `Order`: object; required fields: `orderId` (string), `status` (`OrderStatus`), `total` (number, `double` format). Optional field: `couponCode` (string, deprecated). + +#### Security and servers +- Server: `https://api.shop.example/backoffice`. +- `backofficeToken`: OAuth 2.0 client credentials; token URL `https://auth.shop.example/token`; scope `orders:write`. Required by `cancelOrder`. + +#### Dependencies diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/openapi/package.ai.md new file mode 100644 index 00000000..0642d366 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/openapi/package.ai.md @@ -0,0 +1,36 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:40:18Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> Defines the backoffice API contract for retrieving shop orders and requesting order cancellations. + +#### Purpose +- Describes order listing and lookup, including order status, totals, and optional coupon codes. +- Specifies order cancellation and its success and conflict responses. + +#### Responsibilities +- Order retrieval: list orders with status and limit filters, or fetch an order by ID. +- Order cancellation: submit a cancellation request for an order. + +#### Key units +- `Shop Orders API` — OpenAPI 3.0.3 contract, version `2.1.0`. +- `listOrders` — `GET /orders`, returning an array of `Order`. +- `getOrder` — `GET /orders/{orderId}`, returning an `Order` or a `404`. +- `cancelOrder` — `POST /orders/{orderId}/cancel`, returning `204` or `409`. +- `OrderStatus` — enum of `OPEN`, `PAID`, `SHIPPED`, and `CANCELLED`. +- `Order` — schema requiring `orderId`, `status`, and `total`; optional deprecated `couponCode`. + +#### Data flow +- `GET /orders` accepts optional `status` and `limit` query parameters and returns orders. +- `GET /orders/{orderId}` uses the required order ID to retrieve one order. +- `POST /orders/{orderId}/cancel` uses the required order ID to request cancellation. + +#### Dependencies +- Server: `https://api.shop.example/backoffice`. +- `cancelOrder` requires OAuth 2.0 client-credentials security via `backofficeToken`, with token URL `https://auth.shop.example/token` and scope `orders:write`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..253c8924 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,69 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:40:33Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> Supports the shop’s order lifecycle across checkout, fulfilment, billing, back-office operations, and the deployment and data services that keep them running. + +#### Purpose +- Provides customer-facing checkout and staff-facing order operations, alongside order fulfilment, shipping, invoicing, and stock-service contracts. +- Defines the database mappings, integration routes, runtime configuration, and release workflows supporting those functions. + +#### Responsibilities +- **Order lifecycle:** Facelets checkout collects delivery and shipping details; BPMN handles stock reservation, payment, approval, shipping, invoicing, and cancellation; the OpenAPI contract exposes order retrieval and cancellation. +- **Back-office operations:** JSP supports order search and cancellation; Jakarta EE descriptors configure reports, request processing, checkout and stock beans, and order-event handling. +- **Commerce rules and billing:** Groovy shipping rules calculate charges and reject overweight parcels; Kotlin invoice services issue invoices and calculate line totals and category-based taxes. +- **Integration and service contracts:** Apache Camel routes validate and route incoming orders to review or ERP, with auditing and failure recovery; WSDL defines stock-availability queries. +- **Persistence and data access:** MyBatis handles customer lookup and lifecycle updates; Hibernate mappings and JPA units configure shipment, order, customer, and reporting persistence. +- **Delivery and deployment:** Docker packages the back-office JAR; Kubernetes runs and exposes it; GitHub Actions verifies, publishes, and deploys tagged releases. + +#### Key units +- `orderFulfilment` — BPMN process coordinating stock, payment, approval, shipping, invoicing, and cancellation. +- `checkout.xhtml` / `checkoutBean` — checkout form bindings, shipping-method recalculation, and order submission. +- `ShippingRules` — weight-limit, free-shipping, and weight-tier cost calculation. +- `InvoiceService`, `InvoiceResult`, `InvoiceLine` — invoice issuance outcomes, persisted billing data, and line calculations. +- `incomingOrders`, `toErp`, `manualReview` — Camel routes for order validation, review, audit, and ERP submission. +- `CustomerMapper` — MyBatis customer queries, inserts, loyalty promotion, and inactive-customer deletion. +- `Shipment`, `ExpressShipment`, `shop` and `reporting` persistence units — shipment mappings and application/reporting persistence configuration. +- `Shop Orders API` — OpenAPI contract for listing, retrieving, and cancelling orders. +- `StockPortType` / `StockService` — SOAP contract and endpoint for stock-level queries. +- `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener` — Jakarta EE stock, checkout, and order-event components. +- `order-list.jsp` — staff order listing, filtering controls, overdue indicators, and cancellation links. +- `release-backoffice`, `Dockerfile`, `Deployment/orders-backoffice` — release workflow, container packaging, and Kubernetes workload. + +#### Data flow +- Checkout inputs bind to `checkoutBean`; changing shipping method triggers total recalculation, and submission calls `placeOrder`. +- The BPMN lifecycle reserves stock, waits for payment, routes high-value orders for approval, then ships and invoices; an out-of-stock error leads to cancellation. +- Incoming JMS orders are validated and audited, then sent either to manual review as line-item messages or to ERP after translation; ERP failures retry before dead-letter delivery. +- Completed orders can be issued as invoices through `InvoiceRepository`; customer and shipment data are accessed through MyBatis and JPA/Hibernate persistence. +- Release workflows run Maven verification before publishing a versioned image and invoking Kubernetes deployment; Kubernetes routes HTTP traffic to the back-office container and supplies database settings. + +#### Dependencies +- **Internal components:** `checkoutBean`, `shop.bpm.ReserveStockDelegate`, `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `InvoiceRepository`, `shop.customer.Customer`, and shop order, shipment, and reporting models. +- **Messaging and services:** JMS queues, Camel, SEDA audit endpoint, `shipping` external-task topic, ERP HTTPS API, `invoicing` BPMN process, and the stock SOAP endpoint. +- **Persistence and infrastructure:** `CUSTOMER`, `SHIPMENT`, `EXPRESS_SHIPMENT`, `SHIPMENT_SEQ`, `ShopDS`, `ReportingDS`, PostgreSQL, and Kubernetes Secret `orders-db-credentials`. +- **Build and runtime:** Maven, Java 21, Docker, GitHub Actions, Kubernetes, and `registry.shop.example/orders-backoffice`. + +#### Cross-cutting +- Configuration is supplied through property placeholders, Jakarta EE descriptors, persistence-unit settings, container environment variables, and Kubernetes resources. +- Order processing uses explicit routing and failure paths, including BPMN stock-error handling and Camel ERP retries with dead-letter delivery. +- Security and operational checks include admin-role protection, API OAuth 2.0 for cancellation, container liveness and Kubernetes readiness probes, and production-environment deployment. +- Monetary values use `BigDecimal` in invoice calculations; invoice issuance uses coroutine `Dispatchers.IO`, while its mutable invoice sequence has no explicit synchronization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..e5d1bd87 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,48 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:38:56Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps shipment and express-shipment persistence to database tables, including order and parcel relationships, and defines shipment lookup queries. + +#### Purpose +- Defines Hibernate persistence mappings for shipments and the `ExpressShipment` subclass. +- Provides HQL and native SQL queries for undelivered shipments and carrier counts. + +#### Type +- Hibernate mapping (`*.hbm.xml`); root element `hibernate-mapping`. +- Declared namespaces: none. + +#### Definitions +- Entity `shop.shipping.Shipment` → table `SHIPMENT`: + - ID `id` → column `SHIPMENT_ID`; sequence generator uses `SHIPMENT_SEQ`. + - Properties: `trackingCode` → `TRACKING_CODE` (length `40`, not null); `carrier` → `CARRIER` (length `12`); `shippedAt` → `SHIPPED_AT` (type `timestamp`). + - Many-to-one `order` → class `shop.Order`, column `ORDER_ID`, not null. + - Set `parcels` → inverse, cascade `all-delete-orphan`; key `SHIPMENT_ID`; one-to-many class `Parcel`. +- Joined subclass `ExpressShipment` → table `EXPRESS_SHIPMENT`; key `SHIPMENT_ID`; property `deliveryWindow` → `DELIVERY_WINDOW`. +- Named HQL query `Shipment.undelivered`: selects shipments with `deliveredAt` null and `shippedAt` before `:cutoff`. +- Named SQL query `Shipment.countByCarrier`: selects `CARRIER` and `count(*)` from `SHIPMENT`, grouped by `CARRIER`. + +#### Configuration +- Mapping package: `shop.shipping`. +- Identifier generator: `sequence`; sequence name `SHIPMENT_SEQ`. +- `trackingCode`: length `40`, not null. +- `carrier`: length `12`. +- `shippedAt`: type `timestamp`. +- `order`: not null. +- `parcels`: inverse `true`; cascade `all-delete-orphan`. +- HQL parameter: `:cutoff`. + +#### Dependencies +- Classes: `shop.shipping.Shipment`, `shop.Order`, `Parcel`, `ExpressShipment`. +- Database tables: `SHIPMENT`, `EXPRESS_SHIPMENT`. +- Database sequence: `SHIPMENT_SEQ`. +- Hibernate Mapping DTD: `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/persistence/package.ai.md new file mode 100644 index 00000000..f8cb6eac --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/persistence/package.ai.md @@ -0,0 +1,43 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:40:22Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Persists shop shipments, orders, customers, and reporting data through Hibernate mappings and configured Jakarta Persistence units. + +#### Purpose +- Maps shipment and express-shipment records, their order and parcel relationships, and shipment lookup queries. +- Configures application and reporting persistence units with their entity classes, data sources, and Hibernate settings. + +#### Responsibilities +- **Shipment mapping and queries:** Maps `Shipment` and `ExpressShipment` to database tables, including shipment-to-order and shipment-to-parcel associations; defines undelivered-shipment and carrier-count queries. +- **Persistence-unit configuration:** Sets up the JTA `shop` unit for order and customer data and the resource-local `reporting` unit for daily revenue. + +#### Key units +- `shop.shipping.Shipment` — maps shipment identifiers, tracking code, carrier, shipment time, associated order, and parcels to `SHIPMENT`. +- `ExpressShipment` — joined subclass mapped to `EXPRESS_SHIPMENT`, with a delivery-window property. +- `Shipment.undelivered` — selects shipments whose `deliveredAt` is null and `shippedAt` precedes `:cutoff`. +- `Shipment.countByCarrier` — counts `SHIPMENT` records grouped by carrier. +- `shop` persistence unit — configures Hibernate JPA with `ShopDS`, `Order`, `OrderLine`, `Customer`, and `META-INF/order-queries.xml`. +- `reporting` persistence unit — configures resource-local persistence with `ReportingDS` and `shop.reporting.DailyRevenue`. + +#### Data flow +- Shipment persistence uses `SHIPMENT_SEQ` for IDs and stores shipment data in `SHIPMENT`; express shipments extend this mapping through `EXPRESS_SHIPMENT`. +- `Shipment` references `shop.Order` and owns an inverse `parcels` set with `all-delete-orphan` cascading. +- JPA clients use the `shop` or `reporting` persistence unit to access their configured entities through the corresponding data source. + +#### Dependencies +- Hibernate mapping references `shop.Order`, `Parcel`, `ExpressShipment`, `SHIPMENT`, `EXPRESS_SHIPMENT`, and sequence `SHIPMENT_SEQ`. +- The `shop` unit uses `java:/jdbc/ShopDS`, Hibernate’s JPA provider, PostgreSQL dialect, and `META-INF/order-queries.xml`. +- The `reporting` unit uses `java:/jdbc/ReportingDS` and `shop.reporting.DailyRevenue`. + +#### Cross-cutting +- Persistence is configured with Hibernate; the `shop` unit sets JDBC batch size to `50` and credentials for `shop_app`. +- Persistence modes differ by unit: JTA for `shop`, `RESOURCE_LOCAL` for `reporting`. +- The shipment parcel association uses `all-delete-orphan` cascading. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..f2744179 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/persistence/persistence.xml.ai.md @@ -0,0 +1,44 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:38:52Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Defines JTA persistence for shop orders and customers, plus a resource-local persistence unit for reporting data. + +#### Purpose +- Configures two Jakarta Persistence units for application and reporting data access. +- Registers entity classes, a mapping file, data sources, and Hibernate settings. + +#### Type +- Jakarta Persistence descriptor (`persistence.xml`); root element: `persistence`. +- Declares the default namespace `https://jakarta.ee/xml/ns/persistence` with no prefix. + +#### Definitions +- Persistence unit `shop`: `JTA`; provider `org.hibernate.jpa.HibernatePersistenceProvider`; data source `java:/jdbc/ShopDS`. + - Mapping file: `META-INF/order-queries.xml`. + - Classes: `shop.Order`, `shop.OrderLine`, `shop.Customer`. +- Persistence unit `reporting`: `RESOURCE_LOCAL`; non-JTA data source `java:/jdbc/ReportingDS`. + - Class: `shop.reporting.DailyRevenue`. + - Excludes unlisted classes. + +#### Configuration +- `shop` properties: + - `hibernate.dialect` = `org.hibernate.dialect.PostgreSQLDialect` + - `hibernate.jdbc.batch_size` = `50` + - `hibernate.connection.username` = `shop_app` + - `hibernate.connection.password` = `***` + +#### Dependencies +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS`. +- Provider class: `org.hibernate.jpa.HibernatePersistenceProvider`. +- Entity classes: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue`. +- Mapping file: `META-INF/order-queries.xml`. +- Database dialect: `org.hibernate.dialect.PostgreSQLDialect`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..649d77ad --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,36 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:39:02Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Defines a SOAP service for querying SKU stock availability, with an `UnknownSku` fault. + +#### Type +- WSDL; root `definitions`. +- Namespaces: default `http://schemas.xmlsoap.org/wsdl/`; `soap` = `http://schemas.xmlsoap.org/wsdl/soap/`; `tns` = `http://shop.example/stock`; `xs` = `http://www.w3.org/2001/XMLSchema`. + +#### Definitions +- Schema target namespace `http://shop.example/stock`: + - `StockLevelRequest`: `sku` (`xs:string`). + - `StockLevelResponse`: `available` (`xs:int`). + - `UnknownSkuFault`: `sku` (`xs:string`). +- Messages: `GetStockLevelInput` uses `StockLevelRequest`; `GetStockLevelOutput` uses `StockLevelResponse`; `UnknownSku` carries `UnknownSkuFault`. +- Port type `StockPortType`: operation `GetStockLevel`, input `GetStockLevelInput`, output `GetStockLevelOutput`, fault `UnknownSku`. +- Binding `StockSoapBinding` for `StockPortType`: document-style SOAP over HTTP; `GetStockLevel` uses literal input, output, and fault. +- Service `StockService`: port `StockPort` uses `StockSoapBinding`, address `https://erp.shop.example/soap/stock`. + +#### Configuration +- SOAP action: `http://shop.example/stock/GetStockLevel`. +- Service endpoint: `https://erp.shop.example/soap/stock`. +- SOAP transport: `http://schemas.xmlsoap.org/soap/http`. + +#### Dependencies +- WSDL message, operation, and binding references use the `http://shop.example/stock` namespace. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/wsdl/package.ai.md new file mode 100644 index 00000000..4e9619fc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/other/wsdl/package.ai.md @@ -0,0 +1,34 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:40:29Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Provides a SOAP interface for querying stock availability by SKU and reporting unknown SKUs. + +#### Purpose +- Defines the contract for requesting a SKU’s available stock and receiving an `UnknownSku` fault. +- Publishes the service at `https://erp.shop.example/soap/stock`. + +#### Responsibilities +- Describe request, response, and fault data in the `http://shop.example/stock` schema. +- Specify the `GetStockLevel` SOAP operation and its document-style, literal-message binding. + +#### Key units +- `StockLevelRequest` — carries the requested `sku`. +- `StockLevelResponse` — returns `available` as an integer. +- `UnknownSkuFault` — identifies an unknown `sku`. +- `StockPortType` — declares the `GetStockLevel` operation and `UnknownSku` fault. +- `StockSoapBinding` — binds the operation to document-style SOAP over HTTP. +- `StockService` / `StockPort` — expose the binding at the service endpoint. + +#### Data flow +- `GetStockLevelInput` carries `StockLevelRequest`; the operation returns `GetStockLevelOutput` with `StockLevelResponse`, or the `UnknownSku` fault with `UnknownSkuFault`. + +#### Dependencies +- WSDL messages, operation, and binding reference types in the `http://shop.example/stock` namespace. +- SOAP transport: `http://schemas.xmlsoap.org/soap/http`; SOAP action: `http://shop.example/stock/GetStockLevel`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..de70ec67 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/package.ai.md @@ -0,0 +1,60 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:40:44Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> Coordinates the shop’s order lifecycle from checkout and stock reservation through payment, fulfilment, invoicing, back-office management, and operational deployment. + +#### Purpose +- Supports customer checkout and staff order operations, including retrieval, cancellation, refunds, and cleanup. +- Integrates order processing with stock, shipping, billing, customer data, ERP, persistence, and deployment services. + +#### Responsibilities +- **Checkout and fulfilment:** Bind checkout details and recalculate shipping totals; orchestrate stock reservation, payment, approval, shipping, invoicing, and cancellation. +- **Back-office order management:** Search and retrieve orders, cancel orders with refunds and audit records, and purge aged cancellations. +- **Commerce and billing:** Apply shipping weight limits and price rules; issue invoices with line totals and category-based taxes. +- **Integration and service contracts:** Validate and route incoming orders to manual review or ERP, with audit and failure recovery; expose stock queries through SOAP. +- **Persistence and operations:** Map order, customer, shipment, and reporting data; configure runtime services and package, publish, and deploy the back-office application. + +#### Key units +- `OrderResource` — secured REST resource for open-order listing, lookup, cancellation, and scheduled purge. +- `Order.open` / `Order.purgeCancelled` — named queries for open orders and eligible cancellation cleanup. +- `orderFulfilment` — BPMN process coordinating stock, payment, approval, shipping, invoicing, and cancellation. +- `checkout.xhtml` / `checkoutBean` — checkout form bindings, shipping recalculation, and order submission. +- `ShippingRules` — enforces parcel weight limits and calculates free-shipping and weight-tier charges. +- `InvoiceService`, `InvoiceResult`, `InvoiceLine` — issue invoices and represent billing outcomes and line calculations. +- `incomingOrders`, `toErp`, `manualReview` — Camel routes for validation, audit, review, ERP translation, and failure handling. +- `CustomerMapper` — MyBatis customer lookup, insertion, loyalty promotion, and inactive-customer deletion. +- `Shipment`, `ExpressShipment`, `shop`, `reporting` — shipment mappings and application/reporting persistence configuration. +- `Shop Orders API` — OpenAPI contract for order listing, retrieval, and cancellation. +- `StockPortType` / `StockService` — SOAP contract and endpoint for stock queries. +- `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener` — Jakarta EE stock, checkout, and order-event components. +- `order-list.jsp` — staff order search, filtering, overdue indicators, and cancellation links. +- `release-backoffice`, `Dockerfile`, `Deployment/orders-backoffice` — release workflow, container packaging, and Kubernetes workload. + +#### Data flow +- Checkout inputs bind to `checkoutBean`; shipping-method changes recalculate totals, and submission places the order. +- The BPMN process reserves stock, waits for payment, routes high-value orders for approval, then ships and invoices; stock errors lead to cancellation. +- Incoming JMS orders are validated and audited, then routed to manual review or ERP; ERP failures retry before dead-letter delivery. +- Back-office operations load orders through the `shop` persistence unit; cancellation refunds the payment, marks the order cancelled, and audits the event, while scheduled cleanup removes cancellations older than 30 days and audits the count. +- Invoice issuance uses `InvoiceRepository`; customer and shipment data are accessed through MyBatis and JPA/Hibernate. +- Maven verification precedes image publication and Kubernetes deployment; the workload exposes the back-office service and receives database settings from Kubernetes. + +#### Dependencies +- **Shop components:** `Order`, `OrderStatus`, `checkoutBean`, `shop.bpm.ReserveStockDelegate`, `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `InvoiceRepository`, and `shop.customer.Customer`. +- **Order integrations:** `PaymentGateway`, `AuditLog`, JMS queues, Camel, SEDA audit endpoint, `shipping` external-task topic, ERP HTTPS API, `invoicing` BPMN process, and stock SOAP endpoint. +- **Persistence and infrastructure:** `EntityManager`, `shop` persistence unit, MyBatis, Hibernate, `CUSTOMER`, `SHIPMENT`, `EXPRESS_SHIPMENT`, `SHIPMENT_SEQ`, `ShopDS`, `ReportingDS`, PostgreSQL, and Kubernetes Secret `orders-db-credentials`. +- **Runtime and delivery:** Jakarta EE, Maven, Java 21, Docker, GitHub Actions, Kubernetes, and `registry.shop.example/orders-backoffice`. + +#### Cross-cutting +- Order APIs and staff operations use role-based security; the OpenAPI contract specifies OAuth 2.0 for cancellation. +- Cancellation is transactional; the purge schedule is non-persistent and runs at 02:15. +- Order integrations define explicit recovery paths, including BPMN stock-error handling and Camel ERP retries with dead-letter delivery. +- Configuration spans property placeholders, Jakarta EE descriptors, persistence units, container environment variables, and Kubernetes resources. +- Invoice calculations use `BigDecimal`; invoice issuance uses coroutine `Dispatchers.IO`, while the mutable invoice sequence has no explicit synchronization. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..59a0d15e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-6-luna/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 0D46D947 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:40:55Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The shop order lifecycle spans checkout, stock reservation, payment, fulfilment, shipping, and invoicing, with BPMN orchestration and integration services routing orders through approval, ERP submission, or cancellation. Back-office interfaces and an API support order lookup, filtering, cancellation refunds, and cleanup, while persistence and commerce services provide order, customer, shipment, stock, and reporting data. Java container packaging, Kubernetes deployment, and automated verification and publishing workflows support production operations. + +#### Packages +- java — Backoffice staff can manage order lifecycles, including retrieving open orders, processing cancellation refunds, and purging aged cancellations. +- java/shop — Backoffice staff can manage order lifecycles by viewing orders, cancelling them with payment refunds, and removing old cancellations. +- other/actions/.github — Automates verification, versioned container publishing, and production deployment for the orders backoffice. +- other/actions/.github/workflows — Validates the orders backoffice across supported Java versions, publishes a version-tagged container image, and delegates production Kubernetes deployment. +- other/actions — Automates verification, versioned container publishing, and production deployment for the orders backoffice. +- other/bpmn — Coordinates order fulfilment from stock reservation and payment through approval, shipping, invoicing, or cancellation when stock is unavailable. +- other/docker — Packages and runs the Shop orders back-office service as a production-configured Java container. +- other/facelets — Collects delivery details and shipping preferences, recalculates the order total, and submits the order for checkout. +- other/groovy — Calculates order delivery charges from parcel weight and order value, including free-shipping eligibility and rejection of overweight parcels. +- other/integration — Processes incoming orders by validating them, routing high-value orders for line-item review, and submitting other orders to the ERP with failure recovery. +- other/jee — Configures the shop back-office and commerce services for report access, stock reservation, checkout, and order-event handling. +- other/jsp — Staff can review open orders, filter them by customer email and shipping status, and cancel individual orders. +- other/k8s — Runs the Orders back-office application on Kubernetes, connects it to the shop database, and exposes it over HTTP. +- other/kotlin — Completed customer orders are converted into numbered invoices with payment deadlines, persisted for billing, and assigned category-based tax rates. +- other/mybatis — Supports customer lookup, filtering, creation, loyalty-tier promotion, and cleanup of inactive shop customers. +- other/openapi — Defines the backoffice API contract for retrieving shop orders and requesting order cancellations. +- other — Supports the shop’s order lifecycle across checkout, fulfilment, billing, back-office operations, and the deployment and data services that keep them running. +- other/persistence — Persists shop shipments, orders, customers, and reporting data through Hibernate mappings and configured Jakarta Persistence units. +- other/wsdl — Provides a SOAP interface for querying stock availability by SKU and reporting unknown SKUs. +- . — Coordinates the shop’s order lifecycle from checkout and stock reservation through payment, fulfilment, invoicing, back-office management, and operational deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/java/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/java/package.ai.md new file mode 100644 index 00000000..807e554e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/java/package.ai.md @@ -0,0 +1,45 @@ +### java +- H: 1.0 +- C: C0C0D071 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:42:07Z +- G: +- A: 0.0.0 +- X: package +- F: [shop/](shop/package.ai.md) +--- +> A stateless REST service that manages back‑office orders, providing listing, detail retrieval, cancellation with payment refund, and nightly cleanup of old cancelled orders. + +#### Purpose +- Expose a secure REST API for back‑office order management. +- Automate order cancellation and periodic purge of obsolete records. + +#### Responsibilities +- **Order retrieval** – list open orders, fetch a specific order. +- **Order cancellation** – process payment refunds, update status, audit the event. +- **Scheduled maintenance** – nightly purge of cancelled orders older than 30 days. + +#### Key units +- `OrderResource` – JAX‑RS resource, `@Stateless`, secured for `backoffice`/`admin`. +- `PaymentGateway` – injected service for processing refunds. +- `AuditLog` – EJB used to record audit events. +- `EntityManager` – JPA persistence context for `Order` entities. +- Named queries: `"Order.open"` (open orders), `"Order.purgeCancelled"` (old cancelled orders). + +#### Data flow +1. **GET /orders** → `openOrders()` → executes `"Order.open"` → returns `List`. +2. **GET /orders/{id}** → `find(id)` → `em.find(Order)` → 200 with `Order` or 404. +3. **POST /orders/{id}/cancel** → `cancel(id)` → find order → `payments.refund(...)` → set status to `CANCELLED` → `audit.record(...)` → 204. +4. **@Schedule purgeCancelled()** → runs nightly → executes `"Order.purgeCancelled"` with `days=30` → bulk delete → `audit.record(...)`. + +#### Dependencies +- Jakarta EE: `@Stateless`, `@EJB`, `@Inject`, `@PersistenceContext`, `@Schedule`, `@RolesAllowed`, JAX‑RS annotations. +- JPA: `EntityManager`, named queries on `Order`. +- Domain: `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog`. + +#### Cross-cutting +- **Security** – `@RolesAllowed({"backoffice","admin"})` on the resource. +- **Transactions** – container‑managed, `@TransactionAttribute` defaults to required. +- **Scheduling** – `@Schedule` for nightly purge, asynchronous execution. +- **Audit** – every state change (cancel, purge) recorded via `AuditLog`. +- **Error handling** – 404 responses for missing orders; otherwise rely on container rollback for runtime exceptions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md new file mode 100644 index 00000000..61dee51c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/java/shop/OrderResource.java.ai.md @@ -0,0 +1,92 @@ +### OrderResource.java +- H: 1.0 +- C: 84470671 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:40:59Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 37CE394E +--- +**Facts (exact, whole file):** type declarations: 1; public declarations: 4; TODO/FIXME: 0; @Override: 0; methods (approx): 4; constructors: 0; field declarations (w/ modifier): 4; EJB session beans: 1; message-driven beans: 0; JPA entities and embeddables: 0; JPA named queries: 0; injection points: 3; JAX-RS resource paths: 3; HTTP method annotations: 3; servlets, filters and listeners: 0; SOAP endpoints: 0; transaction annotations: 1; EJB timers: 1; security annotations: 1 + +> Provides REST endpoints for back‑office order management, including listing open orders, retrieving a specific order, canceling orders with payment refund, and nightly purging of old cancelled orders. + +#### Purpose +- Exposes order back‑office REST API. +- Handles order cancellation and nightly purge of cancelled orders. + +#### Type +- `public class OrderResource` + - `@Stateless`, `@Path("/orders")`, `@Produces(MediaType.APPLICATION_JSON)`, `@RolesAllowed({"backoffice","admin"})` + - Extends `Object`. + - Declares static final `int PURGE_AFTER_DAYS = 30`. + +#### Input +- `@PersistenceContext(unitName = "shop") private EntityManager em;` +- `@Inject private PaymentGateway payments;` +- `@EJB private AuditLog audit;` +- `@GET` `openOrders()` → no parameters. +- `@GET @Path("{id}") find(@PathParam("id") long id)` → path parameter `id`. +- `@POST @Path("{id}/cancel") cancel(@PathParam("id") long id)` → path parameter `id`. +- `@Schedule` `purgeCancelled()` → no parameters. + +#### Output +- `openOrders()` returns `List`. +- `find(id)` returns `Response` (200 with `Order` or 404). +- `cancel(id)` returns `Response` (204 or 404) and triggers payment refund, status update, audit record. +- `purgeCancelled()` returns `void`; performs bulk delete and audit record. + +#### Core logic +- `openOrders()` + - Executes named query `"Order.open"` to fetch open orders. +- `find(id)` + - `em.find(Order.class, id)` → if null, 404; else 200 with order. +- `cancel(id)` + - Find order; if null, 404. + - `payments.refund(order.getPaymentReference(), order.getTotal());` + - `order.setStatus(OrderStatus.CANCELLED);` + - `audit.record("order.cancelled", id);` + - Return 204. +- `purgeCancelled()` + - Execute named query `"Order.purgeCancelled"` with parameter `days = PURGE_AFTER_DAYS`. + - Capture `removed` count. + - `audit.record("order.purged", removed);`. + +#### Public API +- `openOrders() -> List` – list open orders. +- `find(long id) -> Response` – retrieve order by id. +- `cancel(long id) -> Response` – cancel order and refund. + +#### Dependencies +- `jakarta.annotation.security.RolesAllowed` +- `jakarta.ejb.EJB` +- `jakarta.ejb.Schedule` +- `jakarta.ejb.Stateless` +- `jakarta.ejb.TransactionAttribute` +- `jakarta.ejb.TransactionAttributeType` +- `jakarta.inject.Inject` +- `jakarta.persistence.EntityManager` +- `jakarta.persistence.PersistenceContext` +- `jakarta.ws.rs.GET` +- `jakarta.ws.rs.POST` +- `jakarta.ws.rs.Path` +- `jakarta.ws.rs.PathParam` +- `jakarta.ws.rs.Produces` +- `jakarta.ws.rs.core.MediaType` +- `jakarta.ws.rs.core.Response` +- `java.util.List` +- `shop.Order` +- `shop.OrderStatus` +- `shop.PaymentGateway` +- `shop.AuditLog` + +#### Exceptions / Errors +- `Response.status(Response.Status.NOT_FOUND)` when order not found. +- No explicit exception handling; relies on container transaction rollback on runtime exceptions. + +#### Concurrency +- Stateless session bean; thread‑safe by container. +- `@Schedule` runs asynchronously at 02:15 UTC nightly. +- No explicit synchronization; relies on JPA transaction boundaries. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/java/shop/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/java/shop/package.ai.md new file mode 100644 index 00000000..f1603653 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/java/shop/package.ai.md @@ -0,0 +1,45 @@ +### java/shop +- H: 1.0 +- C: 769C75B1 +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:42:04Z +- G: +- A: 0.0.0 +- X: package +- F: [OrderResource.java](OrderResource.java.ai.md) +--- +> Provides a stateless REST service for back‑office order management, handling listing, retrieval, cancellation with payment refund, and nightly purge of cancelled orders. + +#### Purpose +- Expose order‑management REST API for back‑office users. +- Automate cancellation and cleanup of orders. + +#### Responsibilities +- **Order retrieval** – list open orders, fetch a specific order. +- **Order cancellation** – refund payment, update status, audit. +- **Scheduled maintenance** – nightly purge of cancelled orders older than 30 days. + +#### Key units +- `OrderResource` – JAX‑RS resource, `@Stateless`, secured for `backoffice`/`admin`. +- `PaymentGateway` – injected service for processing refunds. +- `AuditLog` – EJB used to record audit events. +- `EntityManager` – JPA persistence context for `Order` entities. +- Named queries: `"Order.open"` (open orders), `"Order.purgeCancelled"` (old cancelled orders). + +#### Data flow +1. **GET /orders** → `openOrders()` → executes `"Order.open"` → returns `List`. +2. **GET /orders/{id}** → `find(id)` → `em.find(Order)` → 200 with `Order` or 404. +3. **POST /orders/{id}/cancel** → `cancel(id)` → find order → `payments.refund(...)` → set status to `CANCELLED` → `audit.record(...)` → 204. +4. **@Schedule purgeCancelled()** → runs nightly → executes `"Order.purgeCancelled"` with `days=30` → bulk delete → `audit.record(...)`. + +#### Dependencies +- Jakarta EE: `@Stateless`, `@EJB`, `@Inject`, `@PersistenceContext`, `@Schedule`, `@RolesAllowed`, JAX‑RS annotations. +- JPA: `EntityManager`, named queries on `Order`. +- Domain: `shop.Order`, `shop.OrderStatus`, `shop.PaymentGateway`, `shop.AuditLog`. + +#### Cross-cutting +- **Security** – `@RolesAllowed({"backoffice","admin"})` on the resource. +- **Transactions** – container‑managed, `@TransactionAttribute` defaults to required. +- **Scheduling** – `@Schedule` for nightly purge, asynchronous execution. +- **Audit** – every state change (cancel, purge) recorded via `AuditLog`. +- **Error handling** – 404 responses for missing orders; otherwise rely on container rollback for runtime exceptions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/.github/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/.github/package.ai.md new file mode 100644 index 00000000..b3ce9fe8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/.github/package.ai.md @@ -0,0 +1,43 @@ +### other/actions/.github +- H: 1.0 +- C: E39F967D +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:42:13Z +- G: +- A: 0.0.0 +- X: package +- F: [workflows/](workflows/package.ai.md) +--- +> Automates the continuous integration, containerization, and Kubernetes deployment of the Backoffice Java service. + +#### Purpose +- Orchestrate CI/CD for the Backoffice Java application. + +#### Responsibilities +- **Build & Test**: compile Java code and run unit/integration tests across multiple Java versions. +- **Containerization**: build a Docker image from the Maven output and publish it to a private registry. +- **Deployment**: trigger a reusable Kubernetes deployment workflow to roll out the new image to production. + +#### Key units +- **`release-backoffice` workflow** (`.github/workflows/release.yml`): defines triggers, jobs, and permissions for the entire release pipeline. +- **`build` job**: runs Maven (`mvn -B verify -Pci`) on Java 21 and 25. +- **`image` job**: logs into `registry.shop.example`, tags the image as `orders-backoffice:`, and pushes it. +- **`deploy` job**: calls the external `deploy-k8s.yml` workflow, passing the production environment and inheriting secrets. + +#### Data flow +1. Trigger: tag push (`v*`) or manual dispatch starts the workflow. +2. Build → Test: Maven verifies the project. +3. Image: Docker image is built from the Maven output and pushed to the registry. +4. Deploy: The image is deployed to Kubernetes via the reusable workflow. + +#### Dependencies +- GitHub Actions: `checkout@v4`, `setup-java@v4`, `docker/login-action@v3`. +- Maven profile: `ci`. +- Docker registry: `registry.shop.example`. +- External workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Matrix strategy: tests against Java 21 and 25. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. +- Permissions: read contents, write packages. +- Environment: `production` used for image tagging and deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md new file mode 100644 index 00000000..2f868740 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/package.ai.md @@ -0,0 +1,44 @@ +### other/actions/.github/workflows +- H: 1.0 +- C: 5978594B +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:42:11Z +- G: +- A: 0.0.0 +- X: package +- F: [release.yml](release.yml.ai.md) +--- +> Automates the continuous integration, containerization, and Kubernetes deployment of the Backoffice service. + +#### Purpose +- Orchestrate CI/CD for the Backoffice Java application. +- Build, test, containerize, and push artifacts to a registry, then trigger a Kubernetes rollout. + +#### Responsibilities +- **Build & Test**: Compile Java code, run unit and integration tests across multiple Java versions. +- **Containerization**: Build a Docker image from the built artifacts and publish it to a private registry. +- **Deployment**: Invoke a reusable Kubernetes deployment workflow to roll out the new image to production. + +#### Key units +- **`release-backoffice` workflow** (`.github/workflows/release.yml`): defines triggers, jobs, and permissions for the entire release pipeline. +- **`build` job**: runs Maven (`mvn -B verify -Pci`) on Java 21 and 25, ensuring compatibility. +- **`image` job**: logs into `registry.shop.example`, tags the image as `orders-backoffice:`, and pushes it. +- **`deploy` job**: calls the external `deploy-k8s.yml` workflow, passing the production environment and inheriting secrets. + +#### Data flow +1. **Trigger**: Tag push (`v*`) or manual dispatch starts the workflow. +2. **Build** → **Test**: Maven verifies the project. +3. **Image**: Docker image is built from the Maven output and pushed to the registry. +4. **Deploy**: The image is deployed to Kubernetes via the reusable workflow. + +#### Dependencies +- GitHub Actions: `checkout@v4`, `setup-java@v4`, `docker/login-action@v3`. +- Maven profiles: `ci`. +- Docker registry: `registry.shop.example`. +- External workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- **Matrix strategy**: tests against Java 21 and 25. +- **Secrets**: `REGISTRY_USER`, `REGISTRY_TOKEN` for registry authentication. +- **Permissions**: read contents, write packages. +- **Environment**: `production` used for image tagging and deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md new file mode 100644 index 00000000..bfa53a67 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/.github/workflows/release.yml.ai.md @@ -0,0 +1,61 @@ +### release.yml +- H: 1.0 +- C: 5E84EC24 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:41:05Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 653C8098 +--- +**Facts (exact, whole file):** jobs on a runner: 2; reusable workflow calls: 1; steps (approx): 6; actions used: 4; secret references: 2; cron schedules: 0; matrices: 1; permissions blocks: 1 + +> Builds, tests, containerizes, and deploys the Backoffice service to production Kubernetes. + +#### Purpose +- Automate release of Backoffice. +- Build Java artifacts, create Docker image, push to registry, trigger Kubernetes deployment. + +#### Type +- GitHub Actions workflow (`.github/workflows/release.yml`). +- API: GitHub Actions v4. + +#### Definitions +- **Workflow name**: `release-backoffice`. +- **Triggers**: + - `push` on tags matching `v*`. + - `workflow_dispatch` manual trigger. +- **Jobs**: + - `build`: + - `runs-on`: `ubuntu-24.04`. + - `strategy.matrix.java`: `[21, 25]`. + - Steps: + - `actions/checkout@v4`. + - `actions/setup-java@v4` with `distribution: temurin`, `java-version: ${{ matrix.java }}`. + - `Build and test`: `mvn -B verify -Pci`. + - `image`: + - `needs`: `build`. + - `runs-on`: `ubuntu-24.04`. + - `environment`: `production`. + - Steps: + - `actions/checkout@v4`. + - `Log in to the registry`: `docker/login-action@v3` with `registry: registry.shop.example`, `username: ${{ secrets.REGISTRY_USER }}`, `password: ${{ secrets.REGISTRY_TOKEN }}`. + - `Push the image`: builds `registry.shop.example/orders-backoffice:${GITHUB_REF_NAME#v}` and pushes it. + - `deploy`: + - `needs`: `image`. + - `uses`: `./.github/workflows/deploy-k8s.yml`. + - `with.environment`: `production`. + - `secrets`: `inherit`. + +#### Configuration +- `permissions.contents`: `read`. +- `permissions.packages`: `write`. +- `strategy.matrix.java`: `21`, `25`. +- `docker/login-action` registry: `registry.shop.example`. +- Image tag: `${GITHUB_REF_NAME#v}` (tag without leading `v`). + +#### Dependencies +- Actions: `actions/checkout@v4`, `actions/setup-java@v4`, `docker/login-action@v3`. +- Docker registry: `registry.shop.example`. +- External workflow: `./.github/workflows/deploy-k8s.yml`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/package.ai.md new file mode 100644 index 00000000..d8413f15 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/actions/package.ai.md @@ -0,0 +1,43 @@ +### other/actions +- H: 1.0 +- C: EACCDA73 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:42:15Z +- G: +- A: 0.0.0 +- X: package +- F: [.github/](.github/package.ai.md) +--- +> Automates the continuous integration, containerization, and Kubernetes deployment of the Backoffice Java service. + +#### Purpose +- Orchestrate CI/CD for the Backoffice Java application. + +#### Responsibilities +- **Build & Test**: compile Java code and run unit/integration tests across multiple Java versions. +- **Containerization**: build a Docker image from the Maven output and publish it to a private registry. +- **Deployment**: trigger a reusable Kubernetes deployment workflow to roll out the new image to production. + +#### Key units +- **`release-backoffice` workflow** (`.github/workflows/release.yml`): defines triggers, jobs, and permissions for the entire release pipeline. +- **`build` job**: runs Maven (`mvn -B verify -Pci`) on Java 21 and 25. +- **`image` job**: logs into `registry.shop.example`, tags the image as `orders-backoffice:`, and pushes it. +- **`deploy` job**: calls the external `deploy-k8s.yml` workflow, passing the production environment and inheriting secrets. + +#### Data flow +1. Trigger: tag push (`v*`) or manual dispatch starts the workflow. +2. Build → Test: Maven verifies the project. +3. Image: Docker image is built from the Maven output and pushed to the registry. +4. Deploy: The image is deployed to Kubernetes via the reusable workflow. + +#### Dependencies +- GitHub Actions: `checkout@v4`, `setup-java@v4`, `docker/login-action@v3`. +- Maven profile: `ci`. +- Docker registry: `registry.shop.example`. +- External workflow: `./.github/workflows/deploy-k8s.yml`. + +#### Cross-cutting +- Matrix strategy: tests against Java 21 and 25. +- Secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`. +- Permissions: read contents, write packages. +- Environment: `production` used for image tagging and deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md new file mode 100644 index 00000000..10c331b5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/bpmn/order-fulfilment.bpmn.ai.md @@ -0,0 +1,69 @@ +### order-fulfilment.bpmn +- H: 1.0 +- C: 15AAB284 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:41:09Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 8D64B542 +--- +**Facts (exact, whole file):** elements: 27; namespace declarations: 4; id and name attributes: 35; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; processes: 1; tasks: 3; call activities and sub-processes: 1; gateways: 1; events: 5; sequence flows: 9; messages, signals, errors and escalations (named): 2; Java delegate bindings: 1; external task topics, job types and work items: 1 + +> Defines a BPMN process for order fulfilment, including payment handling, stock reservation, approval workflow, shipping, invoicing, and error handling. + +#### Purpose +- Models the order fulfilment workflow. +- Handles stock reservation, payment receipt, large order approval, shipping, invoicing, and cancellation. + +#### Type +- BPMN 2.0 XML (`bpmn:definitions` root). +- Namespaces: + - `bpmn` → `http://www.omg.org/spec/BPMN/20100524/MODEL` + - `bpmndi` → `http://www.omg.org/spec/BPMN/20100524/DI` + - `dc` → `http://www.omg.org/spec/DD/20100524/DC` + - `camunda` → `http://camunda.org/schema/1.0/bpmn` + +#### Definitions +- **Messages** + - `msgPaymentReceived` (`name="PaymentReceived"`) +- **Errors** + - `errOutOfStock` (`name="OutOfStock"`, `errorCode="STOCK_EMPTY"`) +- **Process** `orderFulfilment` (`name="Order fulfilment"`, `isExecutable="true"`) + - **Events & Tasks** + - `orderPlaced` (start event) + - `reserveStock` (service task, `camunda:class="shop.bpm.ReserveStockDelegate"`) + - `stockMissing` (boundary error event on `reserveStock`, references `errOutOfStock`) + - `waitForPayment` (intermediate catch event, message `msgPaymentReceived`) + - `amountCheck` (exclusive gateway, `name="Large order?"`) + - `approveOrder` (user task, `camunda:candidateGroups="backoffice"`) + - `shipOrder` (service task, `camunda:type="external"`, `camunda:topic="shipping"`) + - `createInvoice` (call activity, `calledElement="invoicing"`) + - `orderCompleted` (end event) + - `orderCancelled` (end event) + - **Sequence Flows** + - `toReserve` (`orderPlaced → reserveStock`) + - `toWaitPayment` (`reserveStock → waitForPayment`) + - `toAmountCheck` (`waitForPayment → amountCheck`) + - `large` (`amountCheck → approveOrder`, condition `${order.total > 1000}`) + - `small` (`amountCheck → shipOrder`, condition `${order.total <= 1000}`) + - `approvedToShip` (`approveOrder → shipOrder`) + - `toInvoice` (`shipOrder → createInvoice`) + - `toEnd` (`createInvoice → orderCompleted`) + - `toCancelled` (`stockMissing → orderCancelled`) +- **Diagram** + - `fulfilmentDiagram` (`bpmndi:BPMNDiagram`) + - `plane` (`bpmndi:BPMNPlane`, `bpmnElement="orderFulfilment"`) + - Shapes for `orderPlaced`, `reserveStock`, `shipOrder` with bounds. + +#### Configuration +- `camunda:class="shop.bpm.ReserveStockDelegate"` +- `camunda:candidateGroups="backoffice"` +- `camunda:type="external"`, `camunda:topic="shipping"` +- `calledElement="invoicing"` + +#### Dependencies +- Java delegate class `shop.bpm.ReserveStockDelegate`. +- External topic `shipping` (Camunda external task). +- Call activity references process `invoicing` (another BPMN process). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/bpmn/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/bpmn/package.ai.md new file mode 100644 index 00000000..7050843d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/bpmn/package.ai.md @@ -0,0 +1,51 @@ +### other/bpmn +- H: 1.0 +- C: BE07010E +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:42:21Z +- G: +- A: 0.0.0 +- X: package +- F: [order-fulfilment.bpmn](order-fulfilment.bpmn.ai.md) +--- +> Orchestrates end‑to‑end order fulfilment, from stock reservation and payment capture to approval, shipping, invoicing, and error handling. + +#### Purpose +- Model the complete order fulfilment workflow. +- Coordinate stock, payment, approval, shipping, invoicing, and cancellation. + +#### Responsibilities +- **Order lifecycle management** – start, payment, approval, shipping, invoicing, completion or cancellation. +- **Stock and payment coordination** – reserve stock, wait for payment, handle out‑of‑stock errors. +- **Approval workflow** – route large orders to back‑office approval. +- **External integration** – invoke shipping via external task and invoicing via call activity. + +#### Key units +- **Process** `orderFulfilment` – executable BPMN process driving the workflow. +- **Delegate** `shop.bpm.ReserveStockDelegate` – Java class handling stock reservation. +- **External task topic** `shipping` – Camunda external task for shipping. +- **Call activity** `invoicing` – referenced process for invoice creation. +- **Message** `msgPaymentReceived` – triggers payment arrival. +- **Error** `errOutOfStock` (`STOCK_EMPTY`) – signals insufficient stock. + +#### Data flow +1. **Start**: `orderPlaced` event triggers `reserveStock` service task. +2. **Stock reservation**: `ReserveStockDelegate` reserves stock; on failure, `stockMissing` error event leads to `orderCancelled`. +3. **Payment wait**: `waitForPayment` catches `msgPaymentReceived`. +4. **Amount check**: `amountCheck` gateway routes large orders to `approveOrder` (user task) and small orders directly to `shipOrder`. +5. **Approval**: Back‑office approves large orders, then `shipOrder` is executed. +6. **Shipping**: External task `shipping` processes shipment. +7. **Invoicing**: `createInvoice` call activity invokes `invoicing` process. +8. **Completion**: `orderCompleted` end event; any error path leads to `orderCancelled`. + +#### Dependencies +- **Java**: `shop.bpm.ReserveStockDelegate` for stock logic. +- **Camunda**: external task topic `shipping`; call activity `invoicing`. +- **Messaging**: `msgPaymentReceived` for payment notification. +- **Error handling**: `errOutOfStock` for stock shortages. + +#### Cross-cutting +- **Camunda annotations**: `camunda:class`, `camunda:candidateGroups`, `camunda:type`, `camunda:topic`, `calledElement`. +- **Conditional flow**: Gateway uses `${order.total > 1000}` to distinguish large orders. +- **Error boundary**: `stockMissing` boundary event on `reserveStock`. +- **Diagram metadata**: BPMN diagram and plane definitions for visual representation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/docker/Dockerfile.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/docker/Dockerfile.ai.md new file mode 100644 index 00000000..196c27be --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/docker/Dockerfile.ai.md @@ -0,0 +1,52 @@ +### Dockerfile +- H: 1.0 +- C: FEDB5F79 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:41:13Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: 7854BFD9 +--- +**Facts (exact, whole file):** build stages: 2; RUN instructions: 3; COPY and ADD instructions: 3; environment entries: 2; exposed ports: 1; users: 1; entrypoints and commands: 1; healthchecks: 1 + +> Builds and runs the `orders-backoffice` Java application in a lightweight Alpine JRE container. + +#### Purpose +- Compile a Maven project and package it into a JAR. +- Deploy the JAR as a Docker image for the `orders-backoffice` service. + +#### Type +- `Dockerfile` + Base image: `maven:3.9-eclipse-temurin-21` (build stage) + Runtime image: `eclipse-temurin:21-jre-alpine` + Dockerfile API: Dockerfile syntax 1.4 + +#### Definitions +- **Stages** + - `build`: uses `maven:3.9-eclipse-temurin-21`; sets `/src` as workdir; copies `pom.xml`, resolves dependencies, copies source, packages JAR. + - `runtime`: uses `eclipse-temurin:21-jre-alpine`; creates group `shop` and user `backoffice`; copies JAR from `build` stage; exposes port `8080`; sets user; defines healthcheck; sets entrypoint. +- **ARG** + - `APP_VERSION=2.1.0` +- **ENV** + - `JAVA_OPTS="-XX:MaxRAMPercentage=75"` + - `SHOP_PROFILE=production` +- **User** + - `backoffice` in group `shop` +- **Healthcheck** + - `wget -qO- http://localhost:8080/health/live || exit 1` every 30s +- **Entrypoint** + - `sh -c "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"` + +#### Configuration +- `APP_VERSION=2.1.0` +- `JAVA_OPTS="-XX:MaxRAMPercentage=75"` +- `SHOP_PROFILE=production` +- Exposed port: `8080` + +#### Dependencies +- Build image: `maven:3.9-eclipse-temurin-21` +- Runtime image: `eclipse-temurin:21-jre-alpine` +- Maven project: `pom.xml` (not shown) +- JAR: `orders-backoffice.jar` (produced by Maven) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/docker/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/docker/package.ai.md new file mode 100644 index 00000000..5ddecd04 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/docker/package.ai.md @@ -0,0 +1,41 @@ +### other/docker +- H: 1.0 +- C: E886D2BC +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:42:30Z +- G: +- A: 0.0.0 +- X: package +- F: [Dockerfile](Dockerfile.ai.md) +--- +> Builds and runs the `orders-backoffice` Java application in a lightweight Alpine JRE container. + +#### Purpose +- Compile a Maven project and package it into a JAR. +- Deploy the JAR as a Docker image for the `orders-backoffice` service. + +#### Responsibilities +- **Build stage**: resolve Maven dependencies, compile source, create executable JAR. +- **Runtime stage**: configure minimal Alpine JRE environment, set user/group, expose service port, provide healthcheck and entrypoint. + +#### Key units +- **Dockerfile** – two‑stage build: `build` (Maven) → `runtime` (Alpine JRE). +- **ARG `APP_VERSION`** – version tag for the image. +- **ENV `JAVA_OPTS`** – JVM memory setting. +- **ENV `SHOP_PROFILE`** – Spring profile for production. +- **Healthcheck** – `wget` to `/health/live` every 30 s. +- **Entrypoint** – `sh -c "exec java $JAVA_OPTS -jar /opt/shop/orders-backoffice.jar"`. + +#### Data flow +1. `build` stage copies `pom.xml` → resolves dependencies → copies source → runs `mvn package` → outputs `orders-backoffice.jar`. +2. `runtime` stage copies the JAR from `build` → sets up user `backoffice` in group `shop` → exposes port `8080` → starts the application via entrypoint. + +#### Dependencies +- Base images: `maven:3.9-eclipse-temurin-21` (build), `eclipse-temurin:21-jre-alpine` (runtime). +- Maven project files (`pom.xml`, source code) – not shown but required for build. +- Generated artifact: `orders-backoffice.jar`. + +#### Cross-cutting +- Two‑stage Dockerfile pattern for Java applications. +- Use of environment variables for JVM tuning and Spring profile. +- Healthcheck and entrypoint standardization for container readiness. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md new file mode 100644 index 00000000..837f6cd6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/facelets/checkout.xhtml.ai.md @@ -0,0 +1,51 @@ +### checkout.xhtml +- H: 1.0 +- C: A3D4AA3E +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:41:15Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: 2F819391 +--- +**Facts (exact, whole file):** elements: 14; namespace declarations: 4; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; EL expressions: 7; forms: 1; input fields: 4; EL method bindings: 2; templates and includes: 2; composite component interfaces: 0 + +> A checkout page that collects shipping address, selects a shipping method, shows the total, and places an order. + +#### Purpose +- Collect shipping address and method. +- Display calculated total. +- Submit order. + +#### Type +- Facelets page (`.xhtml`), template-based. +- Uses namespaces: `h` = `jakarta.faces.html`, `f` = `jakarta.faces.core`, `ui` = `jakarta.faces.facelets`. + +#### Data +- `#{checkoutBean.address.street}` – input value. +- `#{checkoutBean.address.zip}` – input value, validated with regex `[0-9]{5}`. +- `#{checkoutBean.shippingMethod}` – selected value. +- `#{checkoutBean.shippingMethods}` – collection for ``. +- `#{checkoutBean.total}` – displayed total, formatted as EUR currency. +- `#{checkoutBean.recalculate}` – AJAX listener for shipping change. +- `#{checkoutBean.placeOrder}` – form submission action. + +#### Actions +- `` submits to `#{checkoutBean.placeOrder}` via `h:commandButton`. +- `` updates total when shipping changes. +- Commented `` (inactive). + +#### Structure +- Extends template `/WEB-INF/templates/shop.xhtml`. +- Defines `content` section. +- Includes `/WEB-INF/includes/payment-hints.xhtml` after the form. + +#### Server code +- No scriptlets or expressions beyond EL. + +#### Dependencies +- Tag libraries: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- Template: `/WEB-INF/templates/shop.xhtml`. +- Include: `/WEB-INF/includes/payment-hints.xhtml`. +- Managed bean: `checkoutBean` (assumed to be in application scope). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/facelets/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/facelets/package.ai.md new file mode 100644 index 00000000..76f449d1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/facelets/package.ai.md @@ -0,0 +1,42 @@ +### other/facelets +- H: 1.0 +- C: 2CC30F84 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:42:33Z +- G: +- A: 0.0.0 +- X: package +- F: [checkout.xhtml](checkout.xhtml.ai.md) +--- +> A JSF Facelets page that gathers a customer’s shipping details, lets them pick a shipping method, shows the order total, and submits the order. + +#### Purpose +- Capture shipping address and method. +- Show calculated total. +- Submit order to backend. + +#### Responsibilities +- **User input collection** – shipping address fields, shipping method selector. +- **Dynamic total calculation** – AJAX update when shipping method changes. +- **Order submission** – form action to place the order. +- **UI composition** – extends shop template, includes payment hints. + +#### Key units +- **`checkout.xhtml`** – Facelets page rendering the checkout form. +- **`checkoutBean`** – Managed bean backing the page (address, shippingMethod, shippingMethods, total, recalculate, placeOrder). + +#### Data flow +1. User enters address (`address.street`, `address.zip`) and selects `shippingMethod`. +2. Changing `shippingMethod` triggers `checkoutBean.recalculate` via ``, updating `total`. +3. User clicks “Place Order”, invoking `checkoutBean.placeOrder` to process the order. + +#### Dependencies +- JSF tag libraries: `jakarta.faces.html`, `jakarta.faces.core`, `jakarta.faces.facelets`. +- Template: `/WEB-INF/templates/shop.xhtml`. +- Include: `/WEB-INF/includes/payment-hints.xhtml`. +- Managed bean: `checkoutBean` (application‑scoped). + +#### Cross-cutting +- EL expressions for data binding and method calls. +- AJAX listener for real‑time total updates. +- Validation on ZIP code with regex `[0-9]{5}`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md new file mode 100644 index 00000000..5c25a478 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/groovy/ShippingRulesSpec.groovy.ai.md @@ -0,0 +1,56 @@ +### ShippingRulesSpec.groovy +- H: 1.0 +- C: 77E70BE5 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:41:17Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: FA8232C2 +--- +**Facts (exact, whole file):** type declarations: 2; methods (approx): 2; Spock feature methods: 3; Spock blocks: 7; closures with parameters (approx): 1; static type checking: 1; imports: 3 + +> Calculates shipping cost based on order weight and total, applying free‑shipping threshold and rejecting overweight parcels. + +#### Purpose +- Implements shipping cost calculation with tiered pricing. +- Provides Spock tests for shipping rules. + +#### Type +- `class ShippingRulesSpec` – Spock specification, extends `Specification`. +- `class ShippingRules` – shipping rule engine, `@CompileStatic`. + - Fields: `String carrier`, `BigDecimal maxParcelKg`. + - Method: `BigDecimal costFor(Order order)`. + +#### Input +- `ShippingRules` constructor: `carrier`, `maxParcelKg`. +- `costFor` parameters: `Order order` with `total`, `weightKg`. +- Spec test data: `Order(total, weightKg)` instances. + +#### Output +- `costFor` returns `BigDecimal` shipping cost or `0` for free shipping. +- Throws `ParcelTooHeavyException` when `order.weightKg > maxParcelKg`. + +#### Core logic +- If `order.weightKg > maxParcelKg` → throw `ParcelTooHeavyException`. +- If `order.total >= ShippingRulesSpec.FREE_SHIPPING_THRESHOLD` → return `0`. +- Define `tiers` list of maps: `upTo`, `price`. +- Find first tier where `order.weightKg <= tier.upTo` and return its `price` cast to `BigDecimal`. + +#### Public API +- `ShippingRules.costFor(Order order) -> BigDecimal` – compute shipping cost. + +#### Dependencies +- `groovy.transform.CompileStatic` +- `spock.lang.Specification` +- `spock.lang.Unroll` +- `shop.shipping.Order` (assumed) +- `shop.shipping.ParcelTooHeavyException` (assumed) + +#### Exceptions / Errors +- `ParcelTooHeavyException` thrown for overweight parcels. +- No explicit null checks; relies on Groovy null safety. + +#### Concurrency +- No threading or synchronization. All operations are stateless per instance. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/groovy/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/groovy/package.ai.md new file mode 100644 index 00000000..822b03d5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/groovy/package.ai.md @@ -0,0 +1,36 @@ +### other/groovy +- H: 1.0 +- C: 1C9C7B86 +- D: 2026-11-04T06:47:09Z +- T: 2026-11-04T12:42:35Z +- G: +- A: 0.0.0 +- X: package +- F: [ShippingRulesSpec.groovy](ShippingRulesSpec.groovy.ai.md) +--- +> A Groovy module that defines a shipping cost engine and its Spock tests, applying free‑shipping thresholds and tiered pricing while rejecting overweight parcels. + +#### Purpose +- Compute shipping cost for an order based on weight and total. +- Provide unit tests for the shipping rules. + +#### Responsibilities +- **ShippingRules**: encapsulates carrier settings, maximum parcel weight, and tiered cost calculation. +- **ShippingRulesSpec**: Spock specification exercising the rule engine, including free‑shipping and overweight scenarios. + +#### Key units +- `class ShippingRules` – `@CompileStatic`; fields `carrier:String`, `maxParcelKg:BigDecimal`; method `costFor(Order):BigDecimal` that throws `ParcelTooHeavyException` if `order.weightKg > maxParcelKg`, returns `0` for free shipping, otherwise selects the first tier where `order.weightKg <= tier.upTo` and returns its `price`. +- `class ShippingRulesSpec` – extends `Specification`; defines `FREE_SHIPPING_THRESHOLD`; tests `costFor` for normal, free‑shipping, and overweight orders using `@Unroll`. + +#### Data flow +`ShippingRules` receives an `Order` (with `total` and `weightKg`), checks weight against `maxParcelKg`, applies free‑shipping threshold, then selects a tiered price based on weight, returning the cost or throwing an exception. + +#### Dependencies +- Groovy `@CompileStatic` for type safety. +- Spock `Specification` and `Unroll` for testing. +- Domain types `shop.shipping.Order` and `shop.shipping.ParcelTooHeavyException` (assumed to exist elsewhere). + +#### Cross-cutting +- Static type checking via `@CompileStatic`. +- No concurrency; all operations are stateless per instance. +- Exception handling limited to `ParcelTooHeavyException` for overweight parcels. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md new file mode 100644 index 00000000..c495aacb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/integration/order-routes.xml.ai.md @@ -0,0 +1,65 @@ +### order-routes.xml +- H: 1.0 +- C: C08413DB +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:41:20Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 06F61DFE +--- +**Facts (exact, whole file):** elements: 30; namespace declarations: 3; id and name attributes: 7; XSD type definitions: 0; XSLT templates: 0; Spring beans: 4; Camel routes and route templates: 3; Camel REST services: 0; Camel consumer endpoints (from): 3; Camel producer endpoints: 6; Mule flows and sub-flows: 0; Mule flow references: 0; Spring Integration channels: 0; channel adapters and gateways: 0; Synapse proxies, APIs, sequences and endpoints (named): 0; error handlers: 1; property placeholders: 6 + +> Configures Camel integration routes for order processing, validation, and ERP communication. + +#### Purpose +- Defines order validation, translation, and routing logic. +- Handles exceptions and dead‑letter routing. +- Splits orders for manual review and audits. + +#### Type +- Spring XML configuration. +- Root element: `beans`. +- Namespaces: + - `xmlns="http://www.springframework.org/schema/beans"` + - `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + - `xmlns="http://camel.apache.org/schema/spring"` (within `camelContext`). + +#### Definitions +- **Beans** + - `orderValidator` → `shop.integration.OrderValidator` + - `invoiceTranslator` → `shop.integration.InvoiceTranslator` +- **Camel Context** `orderIntegration` + - **Property placeholder** `properties` → `classpath:integration.properties` + - **Exception handling** for `shop.integration.ErpUnavailableException` + - Redelivery: max 5, delay 2000 ms, exponential back‑off. + - Handled, send to `jms:queue:orders.deadletter`. + - **Routes** + - `incomingOrders` + - From `jms:queue:{{orders.incoming.queue}}` + - Bean `orderValidator.validate` + - Choice: if `${body.total} > {{orders.review.threshold}}` → `direct:manualReview`; else → `direct:toErp`. + - WireTap to `seda:orderAudit`. + - `toErp` + - From `direct:toErp` + - Bean `invoiceTranslator` + - Dynamic to `https://{{erp.host}}/api/orders/${header.orderId}`. + - `manualReview` + - From `direct:manualReview` + - Split on `${body.lines}` → `jms:queue:review.lines`. + - Commented `legacyFtpImport` route (inactive). + +#### Configuration +- `orders.incoming.queue` (property placeholder). +- `orders.review.threshold` (property placeholder). +- `erp.host` (property placeholder). +- `orders.deadletter` queue URI. +- Redelivery policy: `maximumRedeliveries="5"`, `redeliveryDelay="2000"`, `useExponentialBackOff="true"`. + +#### Dependencies +- `shop.integration.OrderValidator` +- `shop.integration.InvoiceTranslator` +- `shop.integration.ErpUnavailableException` +- External JMS queues: `orders.deadletter`, `review.lines`. +- External HTTP endpoint: `https://{{erp.host}}/api/orders/${header.orderId}`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/integration/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/integration/package.ai.md new file mode 100644 index 00000000..5d676ffa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/integration/package.ai.md @@ -0,0 +1,55 @@ +### other/integration +- H: 1.0 +- C: 369070B0 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:42:37Z +- G: +- A: 0.0.0 +- X: package +- F: [order-routes.xml](order-routes.xml.ai.md) +--- +> Orchestrates order ingestion, validation, audit, and ERP transmission via Camel routes. + +#### Purpose +- Centralizes order processing integration logic. +- Validates orders, routes them to ERP or manual review, and logs audits. +- Provides fault tolerance with dead‑letter handling. + +#### Responsibilities +- **Order Validation** – uses `OrderValidator` bean to enforce business rules. +- **Audit Trail** – wire‑taps orders to `seda:orderAudit` for downstream logging. +- **Routing Decisions** – splits orders based on total amount threshold. +- **ERP Communication** – translates orders with `InvoiceTranslator` and posts to ERP API. +- **Manual Review** – splits large orders into line‑level messages for human inspection. +- **Error Management** – retries on `ErpUnavailableException`, then dead‑letters. + +#### Key units +- **Beans** + - `orderValidator` (`shop.integration.OrderValidator`) – validates order payloads. + - `invoiceTranslator` (`shop.integration.InvoiceTranslator`) – converts orders to ERP format. +- **Camel Context** `orderIntegration` + - **Routes** + - `incomingOrders` – entry point from JMS, validation, choice, audit tap. + - `toErp` – translates and posts to ERP endpoint. + - `manualReview` – splits large orders for review. + - **Exception Handling** – retries `ErpUnavailableException` (5×, 2 s delay, exponential), then sends to `jms:queue:orders.deadletter`. +- **Properties** + - `orders.incoming.queue`, `orders.review.threshold`, `erp.host`, `orders.deadletter`. + +#### Data flow +1. **Receive** order from `jms:queue:{{orders.incoming.queue}}`. +2. **Validate** via `orderValidator.validate`. +3. **Audit** via wire‑tap to `seda:orderAudit`. +4. **Route**: + - If `total > {{orders.review.threshold}}` → split lines to `jms:queue:review.lines`. + - Else → translate with `invoiceTranslator` and POST to `https://{{erp.host}}/api/orders/${header.orderId}`. +5. **Error**: on `ErpUnavailableException`, retry; on failure, dead‑letter to `orders.deadletter`. + +#### Dependencies +- **Internal**: `shop.integration.OrderValidator`, `shop.integration.InvoiceTranslator`, `shop.integration.ErpUnavailableException`. +- **External**: JMS queues (`orders.deadletter`, `review.lines`), HTTP ERP API (`https://{{erp.host}}/api/orders/...`). + +#### Cross-cutting +- Property placeholders (`{{…}}`) for queue names, thresholds, and ERP host. +- Unified exception handling with redelivery policy. +- Wire‑tap pattern for audit logging without affecting main flow. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md new file mode 100644 index 00000000..7434192d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jee/ejb-jar.xml.ai.md @@ -0,0 +1,40 @@ +### ejb-jar.xml +- H: 1.0 +- C: 7FD305D6 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:41:24Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 36; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 0; servlet mappings: 0; URL patterns: 0; filters: 0; filter mappings: 0; listeners: 0; context parameters: 0; session beans: 2; stateless session beans: 1; message-driven beans: 1; entity beans (EJB 2.x): 0; interceptors: 1; timers: 0; EJB references: 1; resource references: 0; persistence references: 0; environment entries: 1; security roles: 0; security constraints: 0; container transactions: 1; method permissions: 0; EAR modules: 0 + +> Defines the Jakarta EE EJB deployment descriptor for the application, specifying session beans, a message‑driven bean, environment entries, local references, transaction attributes, and an interceptor. + +#### Purpose +- Configures EJB components and their deployment settings. +- Declares transaction behavior and interceptor bindings. + +#### Type +- Jakarta EE descriptor (`ejb-jar.xml`), root element `ejb-jar` with namespace `https://jakarta.ee/xml/ns/jakartaee` version `4.0`. + +#### Definitions +- **Session Beans** + - `StockReservationBean` (`shop.stock.StockReservationBean`, Stateless) with env‑entry `reservationMinutes` (`java.lang.Integer`, value `45`). + - `CheckoutSessionBean` (`shop.checkout.CheckoutSessionBean`, Stateful) with local reference `ejb/StockReservation` to `shop.stock.StockReservation`. +- **Message‑Driven Bean** + - `OrderPlacedListener` (`shop.events.OrderPlacedListener`) activated on queue `java:/jms/queue/OrderPlaced`. +- **Interceptor** + - `shop.audit.TimingInterceptor` applied globally to all EJBs. +- **Container Transaction** + - Method `reserve` of `StockReservationBean` uses `RequiresNew`. + +#### Configuration +- `reservationMinutes` = `45`. +- `destinationLookup` = `java:/jms/queue/OrderPlaced`. +- `trans-attribute` = `RequiresNew` for `StockReservationBean.reserve`. + +#### Dependencies +- Java classes: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`, `shop.stock.StockReservation`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jee/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jee/package.ai.md new file mode 100644 index 00000000..87fdd423 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jee/package.ai.md @@ -0,0 +1,48 @@ +### other/jee +- H: 1.0 +- C: 90176FB5 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:42:43Z +- G: +- A: 0.0.0 +- X: package +- F: [ejb-jar.xml](ejb-jar.xml.ai.md) +- F: [web.xml](web.xml.ai.md) +--- +> Provides the Jakarta EE deployment descriptors for a shop back‑office application, configuring EJBs, a message‑driven bean, a servlet, filter, listener, security, and JDBC resources. + +#### Purpose +- Deploy and configure EJB components and web resources for the shop back‑office. +- Define transaction behavior, security constraints, and resource references. + +#### Responsibilities +- **EJB Deployment** – session beans, message‑driven bean, interceptor, and transaction settings. +- **Web Configuration** – servlet, filter, listener, session timeout, security, and JDBC resource. + +#### Key units +- `StockReservationBean` (`shop.stock.StockReservationBean`) – stateless EJB, `reserve` uses `RequiresNew`. +- `CheckoutSessionBean` (`shop.checkout.CheckoutSessionBean`) – stateful EJB, references `StockReservation`. +- `OrderPlacedListener` (`shop.events.OrderPlacedListener`) – message‑driven bean listening on `java:/jms/queue/OrderPlaced`. +- `TimingInterceptor` (`shop.audit.TimingInterceptor`) – global EJB interceptor. +- `ReportDownloadServlet` (`shop.web.ReportDownloadServlet`) – handles `/reports/*`. +- `RequestIdFilter` (`shop.web.RequestIdFilter`) – applied to all requests. +- `StartupAuditListener` (`shop.web.StartupAuditListener`) – application‑start listener. +- `jdbc/ShopDS` – JDBC `DataSource` referenced by the web app. + +#### Data flow +1. **Order Placement** → JMS queue `OrderPlaced` → `OrderPlacedListener` processes event. +2. **Stock Reservation** → `CheckoutSessionBean` calls `StockReservationBean.reserve` (new transaction). +3. **Report Download** → HTTP request to `/reports/*` → `ReportDownloadServlet` serves files from `/var/shop/reports`. +4. **Request ID** → `RequestIdFilter` injects a unique ID into each request before reaching servlets or EJBs. +5. **Audit** → `StartupAuditListener` logs startup events; `TimingInterceptor` measures EJB method execution times. + +#### Dependencies +- **Internal**: `shop.stock.StockReservationBean`, `shop.checkout.CheckoutSessionBean`, `shop.events.OrderPlacedListener`, `shop.audit.TimingInterceptor`, `shop.web.ReportDownloadServlet`, `shop.web.RequestIdFilter`, `shop.web.StartupAuditListener`. +- **External**: Jakarta EE container, JMS queue `java:/jms/queue/OrderPlaced`, JDBC `DataSource` `jdbc/ShopDS`, security role `admin`. + +#### Cross-cutting +- Global EJB interceptor (`TimingInterceptor`) for performance logging. +- Request‑scoped filter (`RequestIdFilter`) for correlation IDs. +- Common environment entry `reservationMinutes` (45) used by `StockReservationBean`. +- Security constraint restricting `/admin/*` to role `admin`. +- Session timeout set to 20 minutes for web sessions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jee/web.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jee/web.xml.ai.md new file mode 100644 index 00000000..696f57e7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jee/web.xml.ai.md @@ -0,0 +1,61 @@ +### web.xml +- H: 1.0 +- C: 8EA108C7 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:41:27Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: ED1F2692 +--- +**Facts (exact, whole file):** elements: 33; namespace declarations: 1; id and name attributes: 0; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; servlets: 1; servlet mappings: 1; URL patterns: 3; filters: 1; filter mappings: 1; listeners: 1; context parameters: 1; session beans: 0; stateless session beans: 0; message-driven beans: 0; entity beans (EJB 2.x): 0; interceptors: 0; timers: 0; EJB references: 0; resource references: 1; persistence references: 0; environment entries: 0; security roles: 1; security constraints: 1; container transactions: 0; method permissions: 0; EAR modules: 0 + +> Configures the Jakarta EE web application “shop-backoffice”, defining servlets, filters, listeners, session timeout, security constraints, and a JDBC resource reference. + +#### Purpose +- Sets up servlet, filter, listener, session, security, and resource configuration for the web app. + +#### Type +- Jakarta EE descriptor (`web.xml`) +- Root element: `web-app` +- Namespace: `https://jakarta.ee/xml/ns/jakartaee` (prefix default) + +#### Definitions +- **Context parameter** + - `shop.reportDirectory` → `/var/shop/reports` +- **Servlet** + - `ReportDownloadServlet` (`shop.web.ReportDownloadServlet`) – load‑on‑startup `1` +- **Servlet mapping** + - `ReportDownloadServlet` → `/reports/*` +- **Filter** + - `RequestIdFilter` (`shop.web.RequestIdFilter`) +- **Filter mapping** + - `RequestIdFilter` → `/*` +- **Listener** + - `shop.web.StartupAuditListener` +- **Session config** + - Timeout: `20` minutes +- **Security constraint** + - Resource collection `backoffice` → `/admin/*` + - Auth constraint: role `admin` +- **Security role** + - `admin` +- **Resource reference** + - Name: `jdbc/ShopDS` + - Type: `javax.sql.DataSource` + +#### Configuration +- `shop.reportDirectory` = `/var/shop/reports` +- `load-on-startup` for `ReportDownloadServlet` = `1` +- `session-timeout` = `20` +- URL pattern for `RequestIdFilter` = `/*` +- URL pattern for `ReportDownloadServlet` = `/reports/*` +- Security URL pattern = `/admin/*` + +#### Dependencies +- Servlet class `shop.web.ReportDownloadServlet` +- Filter class `shop.web.RequestIdFilter` +- Listener class `shop.web.StartupAuditListener` +- JDBC resource `jdbc/ShopDS` (DataSource) +- Security role `admin` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md new file mode 100644 index 00000000..e94c036e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jsp/order-list.jsp.ai.md @@ -0,0 +1,49 @@ +### order-list.jsp +- H: 1.0 +- C: 939CAC41 +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:41:30Z +- G: +- A: 0.0.0 +- X: file +- P: C9F70393 +- N: F786E780 +--- +**Facts (exact, whole file):** page directives: 1; taglib directives: 2; includes and forwards: 2; tag file attributes: 0; scriptlets: 1; expressions: 1; declarations: 0; EL expressions: 7; prefixed tags: 5; forms: 1; input fields: 3; request parameters read: 1 + +> Displays a list of open orders with search and cancel options, showing order number, total, overdue status, and page size. + +#### Purpose +- List open orders. +- Provide search by customer email and status. +- Allow cancellation of individual orders. + +#### Type +- JSP page +- Content type: `text/html;charset=UTF-8` +- Tag libraries: `c` = `jakarta.tags.core`, `fmt` = `jakarta.tags.fmt` + +#### Data +- `request` attribute `orderFilter` → `OrderFilter filter` +- `filter.getPageSize()` used for page size display +- `request` attribute `orders` → iterated as `${orders}` with var `order` +- `order.number`, `order.total`, `order.overdue`, `order.id` +- Request parameters: `param.customerEmail`, `param.status` + +#### Actions +- Form: `action="${pageContext.request.contextPath}/orders/search"`, method `get` + - Inputs: `customerEmail`, `status` +- Link: `href="orders/${order.id}/cancel"` for each order + +#### Structure +- Includes header: `/WEB-INF/jspf/header.jspf` +- Includes footer: `/WEB-INF/jspf/footer.jspf` + +#### Server code +- Scriptlet imports: `java.util.List`, `shop.Order`, `shop.OrderFilter` +- Scriptlet retrieves `OrderFilter` from request and computes `pageSize` + +#### Dependencies +- Tag libraries: `jakarta.tags.core`, `jakarta.tags.fmt` +- Included files: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf` +- Beans/Classes: `shop.Order`, `shop.OrderFilter` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jsp/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jsp/package.ai.md new file mode 100644 index 00000000..cc0fdc25 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/jsp/package.ai.md @@ -0,0 +1,42 @@ +### other/jsp +- H: 1.0 +- C: 8415F0DC +- D: 2026-11-04T06:55:10Z +- T: 2026-11-04T12:42:47Z +- G: +- A: 0.0.0 +- X: package +- F: [order-list.jsp](order-list.jsp.ai.md) +--- +> A JSP page that lists open orders, lets users search by customer email or status, and cancel individual orders. + +#### Purpose +- Render a searchable table of open orders. +- Provide pagination controls and cancellation links. + +#### Responsibilities +- **Order listing** – iterate over `orders` and display number, total, overdue flag, and ID. +- **Search form** – capture `customerEmail` and `status` and submit to `/orders/search`. +- **Cancellation** – link each order to `orders/{id}/cancel`. + +#### Key units +- **`order-list.jsp`** – main view rendering orders, search form, and cancel links. +- **`OrderFilter`** – request attribute holding search criteria and page size. +- **`Order`** – bean representing an individual order (fields: `number`, `total`, `overdue`, `id`). + +#### Data flow +1. Controller populates `request` attributes `orderFilter` and `orders`. +2. `order-list.jsp` reads `orderFilter` to set page size and pre‑populate search fields. +3. The page iterates over `orders`, rendering each order row. +4. User submits search form → controller refines `orders` list. +5. User clicks cancel link → controller processes cancellation. + +#### Dependencies +- **Tag libraries**: `jakarta.tags.core` (`c`), `jakarta.tags.fmt` (`fmt`). +- **Included JSP fragments**: `/WEB-INF/jspf/header.jspf`, `/WEB-INF/jspf/footer.jspf`. +- **Java classes**: `shop.Order`, `shop.OrderFilter`. + +#### Cross-cutting +- Uses EL expressions for data binding (`${orders}`, `${order}`). +- Relies on standard JSP scriptlet imports for bean access. +- Pagination size derived from `OrderFilter.getPageSize()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md new file mode 100644 index 00000000..90b0b1d2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/k8s/orders-deployment.yaml.ai.md @@ -0,0 +1,52 @@ +### orders-deployment.yaml +- H: 1.0 +- C: 16BC7D8B +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:41:37Z +- G: +- A: 0.0.0 +- X: file +- P: 34F16BF8 +- N: C433AA07 +--- +**Facts (exact, whole file):** resources: 3; workloads: 1; Services, Ingresses and Routes: 2; ConfigMaps and Secrets: 0; container images: 1; container ports: 1; probes: 1; secret references: 1; Helm control actions (approx): 0; .Values references: 0 + +> Deploys the `orders-backoffice` application as a Kubernetes Deployment, Service, and Ingress. + +#### Purpose +- Runs the orders back‑office microservice. +- Exposes it internally via a Service and externally via an Ingress. + +#### Type +- Kubernetes manifests (`apiVersion: apps/v1`, `v1`, `networking.k8s.io/v1`). + +#### Definitions +- **Deployment** `orders-backoffice` + - 3 replicas. + - Container `backoffice`: + - Image `registry.shop.example/orders-backoffice:2.1.0`. + - Port `8080`. + - Env: + - `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop`. + - `SHOP_DB_PASSWORD` from secret `orders-db-credentials` key `password`. + - Readiness probe: HTTP GET `/health/ready` on port `8080`. + - Resources: `limits` `memory: 768Mi`, `cpu: "1"`. +- **Service** `orders-backoffice` + - Selector `app: orders-backoffice`. + - Port `80` → target `8080`. +- **Ingress** `orders-backoffice` + - Host `backoffice.shop.example`. + - Path `/` (Prefix) routes to Service `orders-backoffice` port `80`. + +#### Configuration +- `SHOP_DB_URL=jdbc:postgresql://orders-db:5432/shop` +- `SHOP_DB_PASSWORD` from `orders-db-credentials.password` +- `replicas=3` +- `containerPort=8080` +- `servicePort=80` +- `ingressHost=backoffice.shop.example` + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0`. +- Secret `orders-db-credentials` (key `password`). +- Service `orders-backoffice` (used by Ingress). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/k8s/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/k8s/package.ai.md new file mode 100644 index 00000000..1d5a7c0e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/k8s/package.ai.md @@ -0,0 +1,44 @@ +### other/k8s +- H: 1.0 +- C: FF5D03E7 +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:42:50Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-deployment.yaml](orders-deployment.yaml.ai.md) +--- +> Deploys and exposes the orders‑backoffice microservice on Kubernetes, handling database connectivity and health checks. + +#### Purpose +- Run the orders‑backoffice application in a scalable, containerized environment. +- Provide internal and external access via Service and Ingress. + +#### Responsibilities +- **Deployment**: manage pod lifecycle, replica count, container image, environment, probes, and resource limits. +- **Service**: expose the application internally on a stable port. +- **Ingress**: route external traffic to the Service with host and path rules. +- **Configuration**: inject database URL and credentials from a Secret. + +#### Key units +- **Deployment `orders-backoffice`** – orchestrates 3 replicas of the `backoffice` container (`registry.shop.example/orders-backoffice:2.1.0`), sets env vars, readiness probe, and resource limits. +- **Service `orders-backoffice`** – selects pods by label `app: orders-backoffice`, forwards port 80 to container port 8080. +- **Ingress `orders-backoffice`** – routes host `backoffice.shop.example` and path `/` to the Service on port 80. +- **Secret `orders-db-credentials`** – supplies `SHOP_DB_PASSWORD` to the container. + +#### Data flow +1. **Deployment** pulls the Docker image and starts pods with env vars `SHOP_DB_URL` and `SHOP_DB_PASSWORD`. +2. Pods expose port 8080; readiness probe checks `/health/ready`. +3. **Service** maps internal traffic from port 80 to pod port 8080. +4. **Ingress** receives external requests on `backoffice.shop.example` and forwards them to the Service. + +#### Dependencies +- Docker image `registry.shop.example/orders-backoffice:2.1.0`. +- Kubernetes Secret `orders-db-credentials` (key `password`). +- PostgreSQL database reachable at `orders-db:5432`. + +#### Cross-cutting +- Consistent use of labels (`app: orders-backoffice`) for selector matching. +- Environment variables for configuration, with secrets referenced via `valueFrom`. +- Standard readiness probe pattern (`/health/ready` on container port). +- Resource limits (`memory: 768Mi`, `cpu: "1"`) to enforce pod sizing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md new file mode 100644 index 00000000..d091989f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/kotlin/InvoiceService.kt.ai.md @@ -0,0 +1,91 @@ +### InvoiceService.kt +- H: 1.0 +- C: 4ED52ECD +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:41:41Z +- G: +- A: 0.0.0 +- X: file +- P: 0B812A3C +- N: 579A2910 +--- +**Facts (exact, whole file):** type declarations: 6; companion objects: 1; data classes: 3; sealed types: 1; functions (approx): 4; extension functions: 1; suspend functions: 1; secondary constructors: 0; constructor properties (approx): 9; const vals: 2; lateinit properties: 1; imports: 4 + +> Issues invoices for completed orders, assigns numbers, applies tax rates, and persists them. + +#### Purpose +- Generates and stores invoices for completed orders. +- Calculates due dates and applies reduced tax rates for specific categories. + +#### Type +- `final class InvoiceService` (class) + - Extends `Any`. + - Implements no interfaces. + - Modifiers: none. + - Annotations: none. +- `value class InvoiceNumber` (value) + - Modifiers: `@JvmInline`. +- `data class InvoiceLine` (data) + - Modifiers: none. +- `sealed interface InvoiceResult` (interface) + - Modifiers: none. + - Subtypes: `data class Issued`, `data class Rejected`. + +#### Input +- `InvoiceService` constructor: `repository: InvoiceRepository`, `clock: () -> LocalDate = LocalDate::now`. +- `issue(order: CompletedOrder)` parameter: `order: CompletedOrder`. +- `taxRate(category: String)` parameter: `category: String`. +- `nextNumber()` uses internal `sequence` and `PREFIX`. +- `List.total()` operates on a list of `InvoiceLine`. + +#### Output +- `issue` returns `InvoiceResult` (`Issued` or `Rejected`). +- `taxRate` returns `BigDecimal`. +- `nextNumber` returns `InvoiceNumber`. +- `List.total` returns `BigDecimal`. +- `repository.save(invoice)` persists an `Invoice`. + +#### Core logic +- `issue` + 1. Checks `order.lines.isEmpty()` → returns `Rejected`. + 2. Calls `nextNumber()` → `InvoiceNumber`. + 3. Creates `Invoice(number, order.customerId, order.lines, clock().plusDays(PAYMENT_TERM_DAYS))`. + 4. Calls `repository.save(invoice)`. + 5. Returns `Issued(number, invoice.dueDate)`. +- `taxRate` + - If `category` in `REDUCED_TAX_CATEGORIES` → `0.07`; else `0.19`. +- `nextNumber` + - Increments `sequence` and returns `InvoiceNumber("$PREFIX-${sequence}")`. +- `List.total` + - Folds list summing `line.amount`. + +#### Public API +- `InvoiceService.issue(order: CompletedOrder) -> InvoiceResult` – issue invoice for order. +- `InvoiceService.taxRate(category: String) -> BigDecimal` – get tax rate. +- `InvoiceNumber.value: String` – invoice identifier. +- `InvoiceLine.sku: String` – product SKU. +- `InvoiceLine.quantity: Int` – quantity. +- `InvoiceLine.unitPrice: BigDecimal` – unit price. +- `InvoiceLine.amount: BigDecimal` – line total. +- `InvoiceResult.Issued.number: InvoiceNumber` – issued number. +- `InvoiceResult.Issued.dueDate: LocalDate` – due date. +- `InvoiceResult.Rejected.reason: String` – rejection reason. +- `List.total() -> BigDecimal` – total amount. + +#### Dependencies +- `java.math.BigDecimal` +- `java.time.LocalDate` +- `kotlinx.coroutines.Dispatchers` +- `kotlinx.coroutines.withContext` +- `shop.billing.InvoiceRepository` (assumed) +- `shop.billing.CompletedOrder` (assumed) +- `shop.billing.Invoice` (assumed) + +#### Exceptions / Errors +- `issue` returns `Rejected` if `order.lines.isEmpty()`. +- No explicit exceptions thrown; relies on repository and date operations. + +#### Concurrency +- `issue` runs in `Dispatchers.IO` context. +- `nextNumber` is not thread‑safe; `sequence` is a mutable `var`. +- No other synchronization mechanisms. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/kotlin/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/kotlin/package.ai.md new file mode 100644 index 00000000..05328789 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/kotlin/package.ai.md @@ -0,0 +1,45 @@ +### other/kotlin +- H: 1.0 +- C: 284EE5DF +- D: 2026-11-04T06:47:08Z +- T: 2026-11-04T12:42:53Z +- G: +- A: 0.0.0 +- X: package +- F: [InvoiceService.kt](InvoiceService.kt.ai.md) +--- +> Generates and stores invoices for completed orders, applying tax rates and due dates. + +#### Purpose +- Create and persist invoices for finished orders. +- Compute due dates and apply appropriate tax rates. + +#### Responsibilities +- **Invoice creation**: validate order, generate number, build invoice, persist. +- **Tax calculation**: determine rate based on product category. +- **Number sequencing**: maintain incremental invoice identifiers. +- **Line total aggregation**: sum amounts of invoice lines. + +#### Key units +- `InvoiceService` – orchestrates issuance, number generation, and persistence. +- `InvoiceNumber` – inline value type for invoice identifiers. +- `InvoiceLine` – data holder for SKU, quantity, unit price, and line total. +- `InvoiceResult` (sealed) – outcome of issuance: `Issued` (with number and due date) or `Rejected` (with reason). + +#### Data flow +1. `issue(order)` receives a `CompletedOrder`. +2. Validates `order.lines`; rejects if empty. +3. Calls `nextNumber()` → `InvoiceNumber`. +4. Builds `Invoice(number, customerId, lines, dueDate)`. +5. Persists via `InvoiceRepository.save(invoice)`. +6. Returns `Issued(number, dueDate)` or `Rejected(reason)`. + +#### Dependencies +- **Internal**: `InvoiceRepository`, `CompletedOrder`, `Invoice`. +- **External**: `java.math.BigDecimal`, `java.time.LocalDate`, `kotlinx.coroutines.Dispatchers`, `kotlinx.coroutines.withContext`. + +#### Cross-cutting +- Uses coroutine `Dispatchers.IO` for repository interaction. +- Simple mutable `sequence` counter; not thread‑safe. +- Tax rates defined as constants; reduced rate for specific categories. +- Extension `List.total()` aggregates line amounts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md new file mode 100644 index 00000000..d73ce399 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/mybatis/CustomerMapper.xml.ai.md @@ -0,0 +1,43 @@ +### CustomerMapper.xml +- H: 1.0 +- C: F9CCC6BC +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:41:49Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 12173379 +--- +**Facts (exact, whole file):** mapper namespaces: 1; select statements: 2; insert, update and delete statements: 3; result maps: 1; SQL fragments: 1; fragment includes: 2; dynamic SQL tags: 5; parameters #{}: 8; substitutions ${}: 1 + +> Maps customer data to SQL operations for the `shop.customer.CustomerMapper` namespace. + +#### Purpose +- Provides CRUD and search operations for `shop.customer.Customer` entities. + +#### Type +- MyBatis mapper XML + Root element: `mapper` + Namespace: `shop.customer.CustomerMapper` + Declared DTD: `mybatis-3-mapper.dtd` + +#### Definitions +- **ResultMap** `customerResult`: maps `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER` to `shop.customer.Customer` fields `id`, `email`, `loyaltyTier`. +- **SQL fragment** `customerColumns`: `CUSTOMER_ID, EMAIL, LOYALTY_TIER, CREATED_AT`. +- **Select** `findByEmail`: retrieves a single customer by `EMAIL`; uses `customerResult`. +- **Select** `search`: retrieves customers filtered by optional `tier` and `createdAfter`; orders by `${sortColumn}`; uses `customerResult`. +- **Insert** `insert`: inserts a new customer; generates key for `id`. +- **Update** `promote`: updates `LOYALTY_TIER` for a list of `ids`. +- **Delete** `deleteInactive`: deletes customers with `LAST_ORDER_AT` before `${cutoff}`. + +#### Configuration +- `useGeneratedKeys="true"` on `insert`. +- `keyProperty="id"` on `insert`. +- `order by ${sortColumn}` in `search`. +- `where` clause in `search` uses conditional `` elements. +- `foreach` in `promote` iterates over `ids` collection. + +#### Dependencies +- DTD: `https://mybatis.org/dtd/mybatis-3-mapper.dtd` +- Java class: `shop.customer.Customer` (entity mapped by `customerResult`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/mybatis/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/mybatis/package.ai.md new file mode 100644 index 00000000..616d9264 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/mybatis/package.ai.md @@ -0,0 +1,46 @@ +### other/mybatis +- H: 1.0 +- C: A14A29CA +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:42:58Z +- G: +- A: 0.0.0 +- X: package +- F: [CustomerMapper.xml](CustomerMapper.xml.ai.md) +--- +> Provides SQL mapping for customer entities, enabling CRUD and search operations via MyBatis. + +#### Purpose +- Exposes database operations for `shop.customer.Customer` objects. +- Supports creation, retrieval, update, deletion, and filtered search. + +#### Responsibilities +- **Data persistence**: Insert, update, delete customer records. +- **Querying**: Retrieve by email, search with optional filters and dynamic ordering. +- **Batch operations**: Promote multiple customers to a higher loyalty tier. + +#### Key units +- **Mapper namespace** `shop.customer.CustomerMapper` – central MyBatis configuration. +- **ResultMap** `customerResult` – maps `CUSTOMER_ID`, `EMAIL`, `LOYALTY_TIER` to `shop.customer.Customer` fields. +- **SQL fragment** `customerColumns` – reusable column list for SELECT/INSERT. +- **Select** `findByEmail` – single‑row lookup by email. +- **Select** `search` – multi‑row lookup with optional `tier` and `createdAfter` filters, dynamic `order by`. +- **Insert** `insert` – creates a customer, returns generated `id`. +- **Update** `promote` – batch updates `LOYALTY_TIER` for a list of IDs. +- **Delete** `deleteInactive` – removes customers whose last order predates a cutoff. + +#### Data flow +1. **Input**: Method parameters (`email`, filter criteria, list of IDs, cutoff date, sort column). +2. **Processing**: MyBatis builds SQL using the defined fragments, dynamic `` and `` tags. +3. **Execution**: SQL runs against the database; results mapped via `customerResult`. +4. **Output**: Java objects (`Customer`) or affected row counts. + +#### Dependencies +- **External**: MyBatis runtime, database driver. +- **Internal**: Java entity `shop.customer.Customer`. +- **DTD**: `https://mybatis.org/dtd/mybatis-3-mapper.dtd`. + +#### Cross-cutting +- Dynamic SQL: `` for optional predicates, `${}` for column ordering, `` for batch IDs. +- Generated keys: `useGeneratedKeys="true"`, `keyProperty="id"` on insert. +- Reusable column list via `customerColumns` fragment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md new file mode 100644 index 00000000..94adadf0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/openapi/orders-api.yaml.ai.md @@ -0,0 +1,54 @@ +### orders-api.yaml +- H: 1.0 +- C: 518FD0AB +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:41:52Z +- G: +- A: 0.0.0 +- X: file +- P: 30325B28 +- N: 25FD89A2 +--- +**Facts (exact, whole file):** paths: 3; operations (approx): 3; operationIds: 3; parameters: 4; $ref references: 4; object schemas: 1; security schemes: 1; deprecated operations and fields: 1 + +> The API manages shop orders: listing, retrieving, and canceling them. + +#### Purpose +- Provides endpoints to list, get, and cancel shop orders. + +#### Type +- `OpenAPI 3.0.3` +- Title: `Shop Orders API` +- Version: `2.1.0` + +#### Operations +- `GET /orders` – `listOrders` + - Query: `status` (`OrderStatus`), `limit` (integer, max 200) + - Response `200`: array of `Order` +- `GET /orders/{orderId}` – `getOrder` + - Path: `orderId` (string) + - Responses: `200` (`Order`), `404` (no such order) +- `POST /orders/{orderId}/cancel` – `cancelOrder` + - Path: `orderId` (string) + - Security: `backofficeToken` with scope `orders:write` + - Responses: `204` (cancelled), `409` (already shipped) + +#### Schemas +- `OrderStatus` + - type: `string` + - enum: `OPEN`, `PAID`, `SHIPPED`, `CANCELLED` +- `Order` + - type: `object` + - required: `orderId`, `status`, `total` + - properties: + - `orderId`: `string` + - `status`: `$ref: '#/components/schemas/OrderStatus'` + - `total`: `number` (format `double`) + - `couponCode`: `string` (deprecated) + +#### Security and servers +- Security scheme `backofficeToken`: OAuth2 client credentials, token URL `https://auth.shop.example/token`, scope `orders:write` +- Server: `https://api.shop.example/backoffice` + +#### Dependencies +- None diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/openapi/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/openapi/package.ai.md new file mode 100644 index 00000000..92ea34a0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/openapi/package.ai.md @@ -0,0 +1,39 @@ +### other/openapi +- H: 1.0 +- C: 1372091D +- D: 2026-11-04T06:55:34Z +- T: 2026-11-04T12:43:01Z +- G: +- A: 0.0.0 +- X: package +- F: [orders-api.yaml](orders-api.yaml.ai.md) +--- +> A RESTful API for managing shop orders, including listing, retrieving, and canceling orders. + +#### Purpose +- Exposes endpoints for order lifecycle operations in a shop back‑office system. + +#### Responsibilities +- **Order retrieval**: list orders with optional status filter and pagination; fetch a single order by ID. +- **Order cancellation**: cancel an existing order, enforcing business rules (e.g., cannot cancel shipped orders). +- **Security**: protect write operations with OAuth2 client‑credentials (`orders:write` scope). + +#### Key units +- **OpenAPI document** (`orders-api.yaml`): defines the API contract, including paths, operations, schemas, and security. +- **Schemas** + - `OrderStatus`: enum of order states (`OPEN`, `PAID`, `SHIPPED`, `CANCELLED`). + - `Order`: object with `orderId`, `status`, `total`, and deprecated `couponCode`. +- **Security scheme** `backofficeToken`: OAuth2 client‑credentials flow, token endpoint `https://auth.shop.example/token`. + +#### Data flow +1. **Client request** → API gateway → `GET /orders` or `GET /orders/{orderId}` or `POST /orders/{orderId}/cancel`. +2. **Server** validates request parameters, checks security (for cancel), performs business logic, and returns the appropriate response (`200`, `204`, `404`, or `409`). + +#### Dependencies +- OAuth2 provider at `https://auth.shop.example/token` for token issuance. +- No external data stores or services referenced in the OpenAPI spec. + +#### Cross-cutting +- **Versioning**: API version `2.1.0`. +- **Deprecation**: `couponCode` field in `Order` schema is marked deprecated. +- **Error handling**: standard HTTP status codes (`404` for not found, `409` for conflict). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..6ec550c9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,72 @@ +### other +- H: 1.0 +- C: 5D62DE46 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:43:12Z +- G: +- A: 0.0.0 +- X: package +- F: [actions/](actions/package.ai.md) +- F: [bpmn/](bpmn/package.ai.md) +- F: [docker/](docker/package.ai.md) +- F: [facelets/](facelets/package.ai.md) +- F: [groovy/](groovy/package.ai.md) +- F: [integration/](integration/package.ai.md) +- F: [jee/](jee/package.ai.md) +- F: [jsp/](jsp/package.ai.md) +- F: [k8s/](k8s/package.ai.md) +- F: [kotlin/](kotlin/package.ai.md) +- F: [mybatis/](mybatis/package.ai.md) +- F: [openapi/](openapi/package.ai.md) +- F: [persistence/](persistence/package.ai.md) +- F: [wsdl/](wsdl/package.ai.md) +--- +> A comprehensive back‑office system that orchestrates order fulfilment, inventory, shipping, invoicing, and reporting across CI/CD, containerization, Kubernetes, and multiple integration patterns. + +#### Purpose +- Deliver a fully automated order lifecycle from placement to invoicing. +- Provide CI/CD, container, and cloud deployment pipelines for the back‑office service. +- Expose REST and SOAP APIs for external systems and internal services. + +#### Responsibilities +- **CI/CD & Deployment** – GitHub Actions, Docker, Kubernetes manifests, and Helm‑style reusable workflows. +- **Order Fulfilment** – BPMN process, stock reservation, payment handling, approval routing, shipping, invoicing, and cancellation. +- **Integration & Messaging** – Camel routes for order ingestion, validation, audit, ERP posting, and dead‑letter handling. +- **Persistence & ORM** – Hibernate mappings for shipments, MyBatis mappers for customers, and JPA persistence units. +- **Web & UI** – JSF Facelets for checkout, JSP for order listing, servlet/filter listeners for request correlation and reporting. +- **Service Exposure** – OpenAPI REST contract and SOAP WSDL for stock queries. +- **Business Logic** – Groovy shipping cost engine, Kotlin invoice generation, and Java EJB components for stock and checkout. + +#### Key units +- **CI/CD**: `release-backoffice` workflow, `build`, `image`, `deploy` jobs. +- **Docker**: two‑stage `Dockerfile` with `APP_VERSION`, `JAVA_OPTS`, `SHOP_PROFILE`. +- **Kubernetes**: `orders-backoffice` Deployment, Service, Ingress, `orders-db-credentials` Secret. +- **BPMN**: `orderFulfilment` process, `ReserveStockDelegate`, `shipping` external task, `invoicing` call activity, `msgPaymentReceived` message, `errOutOfStock` error. +- **Camel**: `orderIntegration` context with `incomingOrders`, `toErp`, `manualReview` routes; beans `orderValidator`, `invoiceTranslator`. +- **Persistence**: `Shipment`, `ExpressShipment` entities; `shop` and `reporting` persistence units; HQL `Shipment.undelivered`, SQL `Shipment.countByCarrier`. +- **MyBatis**: `shop.customer.CustomerMapper` with `findByEmail`, `search`, `insert`, `promote`, `deleteInactive`. +- **Web**: `checkout.xhtml` with `checkoutBean`; `order-list.jsp` with `OrderFilter`; `ReportDownloadServlet`; `RequestIdFilter`; `StartupAuditListener`. +- **Business Logic**: `ShippingRules` (Groovy), `InvoiceService` (Kotlin), `StockReservationBean`, `CheckoutSessionBean`, `OrderPlacedListener`. +- **APIs**: `orders-api.yaml` (OpenAPI), `StockService.wsdl` (SOAP). + +#### Data flow +1. **Order Placement** → REST/WS → `orderFulfilment` BPMN → `ReserveStockDelegate` → stock DB. +2. **Payment** → `msgPaymentReceived` → BPMN waits → approval or direct shipping. +3. **Shipping** → external task `shipping` → external shipping service. +4. **Invoicing** → call activity `invoicing` → invoice DB via `InvoiceService`. +5. **Integration** – Camel routes validate, audit, route to ERP or manual review, handle retries and dead‑letters. +6. **Persistence** – Hibernate/JPA for shipments; MyBatis for customers; JDBC for reporting. +7. **Deployment** – GitHub Actions builds JAR → Docker image → pushes to registry → Kubernetes deploys pods with secrets and probes. + +#### Dependencies +- **External**: GitHub Actions, Docker registry `registry.shop.example`, Kubernetes cluster, PostgreSQL DB, JMS queues, ERP HTTP API, OAuth2 provider, SOAP endpoint `erp.shop.example`. +- **Internal**: Java EE container, Camunda BPM engine, Camel runtime, MyBatis, Hibernate, Spring (profile `production`), Groovy/Spock, Kotlin coroutines. +- **Configuration**: Property placeholders (`{{…}}`), environment variables (`SHOP_DB_URL`, `SHOP_DB_PASSWORD`, `JAVA_OPTS`), secrets (`REGISTRY_USER`, `REGISTRY_TOKEN`). + +#### Cross-cutting +- **Security**: OAuth2 client‑credentials for write ops, role‑based access (`admin`) in web descriptors, request‑scoped correlation IDs. +- **Error Handling**: Camel redelivery policy, BPMN error events (`errOutOfStock`), SOAP fault `UnknownSkuFault`. +- **Testing**: Spock specs for shipping rules, unit tests in CI pipeline. +- **Performance**: Hibernate batch size, coroutine `Dispatchers.IO` for DB ops, Kubernetes resource limits. +- **Observability**: Health checks (`/health/live`, `/health/ready`), timing interceptor, audit listeners, request ID filter. +- **Configuration Management**: Shared labels, environment variables, secrets, property placeholders across CI, Docker, Kubernetes, and application layers. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md new file mode 100644 index 00000000..0599ad40 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/persistence/Shipment.hbm.xml.ai.md @@ -0,0 +1,47 @@ +### Shipment.hbm.xml +- H: 1.0 +- C: 608896F9 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:41:58Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 0; id and name attributes: 12; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 0; JTA data sources: 0; non-JTA data sources: 0; listed classes: 0; entity mappings: 2; embeddables and mapped superclasses: 0; named queries: 2; associations: 2; mapping files: 0; properties: 4 + +> Maps the `shop.shipping.Shipment` entity and its subclasses to database tables, defines relationships, queries, and persistence behavior. + +#### Purpose +- Configures Hibernate mapping for `Shipment` and related entities. +- Provides HQL and native SQL queries for shipment retrieval and statistics. + +#### Type +- Hibernate mapping (`` root). +- Namespace: none. +- Declares package `shop.shipping`. + +#### Definitions +- **Class** `Shipment` mapped to table `SHIPMENT` + - `id` (`SHIPMENT_ID`) generated by sequence `SHIPMENT_SEQ`. + - `trackingCode` (`TRACKING_CODE`, length 40, not‑null). + - `carrier` (`CARRIER`, length 12). + - `shippedAt` (`SHIPPED_AT`, type `timestamp`). + - `order` (`ORDER_ID`, many‑to‑one to `shop.Order`, not‑null). + - `parcels` (``, inverse, cascade `all-delete-orphan`, key `SHIPMENT_ID`, one‑to‑many `Parcel`). +- **Joined subclass** `ExpressShipment` mapped to `EXPRESS_SHIPMENT` + - Key `SHIPMENT_ID`. + - `deliveryWindow` (`DELIVERY_WINDOW`). +- **Query** `Shipment.undelivered` (HQL): `from Shipment s where s.deliveredAt is null and s.shippedAt < :cutoff`. +- **SQL query** `Shipment.countByCarrier`: `select CARRIER, count(*) from SHIPMENT group by CARRIER`. + +#### Configuration +- Sequence generator: `sequence_name = SHIPMENT_SEQ`. +- Cascade: `all-delete-orphan` on `parcels`. +- Query parameters: `:cutoff` in `Shipment.undelivered`. + +#### Dependencies +- External DTD: `http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd`. +- Referenced classes: `shop.Order`, `Parcel`, `ExpressShipment`. +- Database tables: `SHIPMENT`, `EXPRESS_SHIPMENT`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/persistence/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/persistence/package.ai.md new file mode 100644 index 00000000..3a08f5a1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/persistence/package.ai.md @@ -0,0 +1,48 @@ +### other/persistence +- H: 1.0 +- C: 2F8025B8 +- D: 2026-11-04T06:47:45Z +- T: 2026-11-04T12:43:04Z +- G: +- A: 0.0.0 +- X: package +- F: [Shipment.hbm.xml](Shipment.hbm.xml.ai.md) +- F: [persistence.xml](persistence.xml.ai.md) +--- +> Provides Hibernate persistence configuration for the shop’s shipping domain, defining entity mappings, queries, and persistence units for both transactional contexts. + +#### Purpose +- Configure Hibernate mappings for `Shipment` and its subclasses. +- Define JPA persistence units for shop and reporting data sources. + +#### Responsibilities +- **Entity mapping** – `Shipment`, `ExpressShipment`, and related associations. +- **Query definition** – HQL and native SQL for shipment status and carrier statistics. +- **Persistence unit setup** – JTA and RESOURCE_LOCAL units with data source, provider, and Hibernate properties. + +#### Key units +- **`Shipment` entity** – maps to `SHIPMENT` table, includes `trackingCode`, `carrier`, `shippedAt`, `order` FK, and `parcels` set. +- **`ExpressShipment` subclass** – joined to `EXPRESS_SHIPMENT`, adds `deliveryWindow`. +- **`Shipment.undelivered` HQL** – selects undelivered shipments before a cutoff. +- **`Shipment.countByCarrier` SQL** – aggregates shipment counts per carrier. +- **Persistence unit `shop`** – JTA, uses `java:/jdbc/ShopDS`, includes `shop.Order`, `shop.OrderLine`, `shop.Customer`. +- **Persistence unit `reporting`** – RESOURCE_LOCAL, uses `java:/jdbc/ReportingDS`, includes `shop.reporting.DailyRevenue`. + +#### Data flow +1. **Entity persistence** – `Shipment` instances are persisted via the `shop` unit; `ExpressShipment` inherits and adds its own table. +2. **Query execution** – `Shipment.undelivered` and `Shipment.countByCarrier` are invoked through the entity manager to retrieve shipment data. +3. **Reporting** – `shop.reporting.DailyRevenue` is managed by the `reporting` unit for analytics queries. + +#### Dependencies +- **Hibernate** – `org.hibernate.jpa.HibernatePersistenceProvider`, DTD `hibernate-mapping-3.0.dtd`. +- **JPA** – Jakarta Persistence API. +- **Database** – PostgreSQL (dialect `PostgreSQLDialect`). +- **Data sources** – `java:/jdbc/ShopDS` (JTA), `java:/jdbc/ReportingDS` (RESOURCE_LOCAL). +- **Entities** – `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue`. + +#### Cross-cutting +- **Batching** – `hibernate.jdbc.batch_size=50` for efficient inserts. +- **Sequence generation** – `SHIPMENT_SEQ` for `Shipment.id`. +- **Cascade strategy** – `all-delete-orphan` on `Shipment.parcels`. +- **Security** – connection credentials hidden (`***`). +- **Mapping file inclusion** – `META-INF/order-queries.xml` referenced in `shop` unit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md new file mode 100644 index 00000000..568c9d86 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/persistence/persistence.xml.ai.md @@ -0,0 +1,53 @@ +### persistence.xml +- H: 1.0 +- C: 24ACE2B2 +- D: 2026-11-04T06:47:44Z +- T: 2026-11-04T12:41:55Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: 13E13638 +--- +**Facts (exact, whole file):** elements: 17; namespace declarations: 1; id and name attributes: 6; XSD type definitions: 0; XSLT templates: 0; Spring beans: 0; persistence units: 2; JTA data sources: 1; non-JTA data sources: 1; listed classes: 4; entity mappings: 0; embeddables and mapped superclasses: 0; named queries: 0; associations: 0; mapping files: 1; properties: 4 + +> Configures two Jakarta Persistence units for the shop application, specifying data sources, entity classes, provider, and Hibernate properties. + +#### Purpose +- Define persistence units for JTA and RESOURCE_LOCAL transactions. +- Map entity classes and query files. + +#### Type +- Jakarta Persistence XML (`persistence.xml`). +- Root element: `persistence`. +- Namespace: `https://jakarta.ee/xml/ns/persistence`. + +#### Definitions +- **Persistence unit `shop`** + - `transaction-type="JTA"` + - `provider`: `org.hibernate.jpa.HibernatePersistenceProvider` + - `jta-data-source`: `java:/jdbc/ShopDS` + - `mapping-file`: `META-INF/order-queries.xml` + - Entity classes: `shop.Order`, `shop.OrderLine`, `shop.Customer` + - Properties: + - `hibernate.dialect`: `org.hibernate.dialect.PostgreSQLDialect` + - `hibernate.jdbc.batch_size`: `50` + - `hibernate.connection.username`: `shop_app` + - `hibernate.connection.password`: `***` +- **Persistence unit `reporting`** + - `transaction-type="RESOURCE_LOCAL"` + - `non-jta-data-source`: `java:/jdbc/ReportingDS` + - Entity class: `shop.reporting.DailyRevenue` + - `exclude-unlisted-classes`: `true` + +#### Configuration +- `hibernate.dialect`: `org.hibernate.dialect.PostgreSQLDialect` +- `hibernate.jdbc.batch_size`: `50` +- `hibernate.connection.username`: `shop_app` +- `hibernate.connection.password`: `***` + +#### Dependencies +- `org.hibernate.jpa.HibernatePersistenceProvider` +- `META-INF/order-queries.xml` +- Entity classes: `shop.Order`, `shop.OrderLine`, `shop.Customer`, `shop.reporting.DailyRevenue` +- Data sources: `java:/jdbc/ShopDS`, `java:/jdbc/ReportingDS` diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md new file mode 100644 index 00000000..4c12bfdd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/wsdl/StockService.wsdl.ai.md @@ -0,0 +1,61 @@ +### StockService.wsdl +- H: 1.0 +- C: A034A9B4 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:42:01Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +- N: EC197B72 +--- +**Facts (exact, whole file):** elements: 38; namespace declarations: 4; id and name attributes: 22; XSD type definitions: 1; XSLT templates: 0; Spring beans: 0; services: 1; ports and endpoints: 1; port types and interfaces: 1; bindings: 1; operations: 2; messages: 3; SOAP bindings: 1 + +> Defines a SOAP web service for querying stock levels by SKU, including request/response types and a fault for unknown SKUs. + +#### Purpose +- Exposes a `GetStockLevel` operation over SOAP. +- Provides fault handling for unknown SKUs. + +#### Type +- WSDL 1.1 +- Root element: `definitions` +- Namespaces: + - `xmlns` → `http://schemas.xmlsoap.org/wsdl/` + - `xmlns:soap` → `http://schemas.xmlsoap.org/wsdl/soap/` + - `xmlns:tns` → `http://shop.example/stock` + - `xmlns:xs` → `http://www.w3.org/2001/XMLSchema` + +#### Definitions +- **Schema** (`xs:schema` targetNamespace=`http://shop.example/stock`): + - Element `StockLevelRequest` (complexType: sequence of `sku` string) + - Element `StockLevelResponse` (complexType: sequence of `available` int) + - ComplexType `UnknownSkuFault` (sequence of `sku` string) +- **Messages**: + - `GetStockLevelInput` – part `parameters` element `tns:StockLevelRequest` + - `GetStockLevelOutput` – part `parameters` element `tns:StockLevelResponse` + - `UnknownSku` – part `fault` type `tns:UnknownSkuFault` +- **PortType** `StockPortType`: + - Operation `GetStockLevel`: + - Input `tns:GetStockLevelInput` + - Output `tns:GetStockLevelOutput` + - Fault `UnknownSku` message `tns:UnknownSku` +- **Binding** `StockSoapBinding` (type `tns:StockPortType`): + - SOAP binding style `document`, transport `http://schemas.xmlsoap.org/soap/http` + - Operation `GetStockLevel`: + - SOAP action `http://shop.example/stock/GetStockLevel` + - Input body `use="literal"` + - Output body `use="literal"` + - Fault `UnknownSku` SOAP fault `use="literal"` +- **Service** `StockService`: + - Port `StockPort` binding `tns:StockSoapBinding` + - SOAP address location `https://erp.shop.example/soap/stock` + +#### Configuration +- SOAP action: `http://shop.example/stock/GetStockLevel` +- Service endpoint: `https://erp.shop.example/soap/stock` + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema` +- SOAP namespace `http://schemas.xmlsoap.org/wsdl/soap/` +- Target namespace `http://shop.example/stock` used for types, messages, portType, binding, and service. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/wsdl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/wsdl/package.ai.md new file mode 100644 index 00000000..23393b50 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/other/wsdl/package.ai.md @@ -0,0 +1,44 @@ +### other/wsdl +- H: 1.0 +- C: DD12C338 +- D: 2026-11-04T06:55:09Z +- T: 2026-11-04T12:43:08Z +- G: +- A: 0.0.0 +- X: package +- F: [StockService.wsdl](StockService.wsdl.ai.md) +--- +> Provides a SOAP web service for querying stock levels by SKU, with fault handling for unknown SKUs. + +#### Purpose +- Exposes a `GetStockLevel` operation over SOAP. +- Supplies a fault for unknown SKUs. + +#### Responsibilities +- **Service definition**: WSDL 1.1 file declaring request/response types, fault, and service endpoint. +- **Data contract**: XML Schema types for request, response, and fault payloads. +- **Transport configuration**: SOAP binding, action, and endpoint URL. + +#### Key units +- **StockService.wsdl** – root `definitions` element, contains schema, messages, portType, binding, and service. +- **Schema** (`http://shop.example/stock`): + - `StockLevelRequest` (sku string) + - `StockLevelResponse` (available int) + - `UnknownSkuFault` (sku string) +- **Messages**: `GetStockLevelInput`, `GetStockLevelOutput`, `UnknownSku`. +- **PortType** `StockPortType` with operation `GetStockLevel`. +- **Binding** `StockSoapBinding` (document style, HTTP transport). +- **Service** `StockService` exposing `StockPort` at `https://erp.shop.example/soap/stock`. + +#### Data flow +1. Client sends `StockLevelRequest` (SKU) to `https://erp.shop.example/soap/stock`. +2. Service processes request and returns `StockLevelResponse` (available quantity) or raises `UnknownSkuFault` if SKU not found. + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema`. +- SOAP namespace `http://schemas.xmlsoap.org/wsdl/soap/`. +- Target namespace `http://shop.example/stock` for all types, messages, portType, binding, and service. + +#### Cross-cutting +- All messages use `use="literal"` SOAP body. +- Fault handling follows SOAP 1.1 fault conventions with a custom `UnknownSkuFault` type. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..8cf949f5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,70 @@ +### ai +- H: 1.0 +- C: 9F3D4F5A +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:43:19Z +- G: +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +- F: [other/](other/package.ai.md) +--- +> A back‑office order‑management system that exposes secure REST endpoints, orchestrates fulfillment via BPMN, integrates with external ERP and shipping services, and automates CI/CD, containerization, and Kubernetes deployment. + +#### Purpose +- Provide a stateless REST API for order listing, detail, cancellation, and nightly cleanup. +- Orchestrate the full order lifecycle (stock reservation, payment, shipping, invoicing) and expose SOAP/REST contracts for external systems. +- Deliver automated build, container, and cloud deployment pipelines. + +#### Responsibilities +- **Order API** – secure CRUD and cancellation endpoints with audit and refund handling. +- **Fulfillment Orchestration** – BPMN process for stock reservation, payment approval, shipping, invoicing, and cancellation. +- **Integration & Messaging** – Camel routes for order ingestion, validation, ERP posting, and dead‑letter handling. +- **Persistence & ORM** – Hibernate/JPA for shipments, MyBatis for customers, and SQL/HQL queries for reporting. +- **CI/CD & Deployment** – GitHub Actions workflows, Docker builds, Helm‑style Kubernetes manifests, and secrets management. +- **Web & UI** – JSF checkout, JSP order listing, servlet filters for correlation IDs, and health‑check endpoints. +- **Business Logic** – Groovy shipping cost engine, Kotlin invoice generation, and Java EJB components for stock and checkout. + +#### Key units +- `OrderResource` – JAX‑RS stateless resource for order operations. +- `PaymentGateway` – service for processing refunds. +- `AuditLog` – EJB for recording audit events. +- `Order` entity – JPA mapping with named queries `"Order.open"` and `"Order.purgeCancelled"`. +- `orderFulfilment` BPMN process – orchestrates reservation, payment, shipping, invoicing. +- `ReserveStockDelegate` – Java delegate for stock reservation. +- `shipping` external task – delegates to external shipping service. +- `InvoiceService` (Kotlin) – generates invoices. +- `orderIntegration` Camel context – routes for order ingestion, validation, ERP posting. +- `shop.customer.CustomerMapper` (MyBatis) – customer CRUD and search. +- `checkout.xhtml` (JSF) – checkout UI. +- `orders-backoffice` Deployment, Service, Ingress – Kubernetes resources. +- `release-backoffice` GitHub Actions workflow – CI/CD pipeline. + +#### Data flow +1. **Order Placement** – REST/WS → `orderFulfilment` BPMN → `ReserveStockDelegate` → stock DB. +2. **Payment** – `msgPaymentReceived` triggers BPMN wait → approval or direct shipping. +3. **Shipping** – external task `shipping` → external shipping service. +4. **Invoicing** – call activity `invoicing` → `InvoiceService` → invoice DB. +5. **Cancellation** – `OrderResource.cancel()` → `PaymentGateway.refund()` → status update → `AuditLog`. +6. **Nightly Purge** – `@Schedule purgeCancelled()` → bulk delete of cancelled orders older than 30 days → `AuditLog`. +7. **Integration** – Camel routes validate, audit, route to ERP or manual review, handle retries and dead‑letters. +8. **Deployment** – GitHub Actions → Docker image → Kubernetes pods with secrets and probes. + +#### Dependencies +- **Jakarta EE** – `@Stateless`, `@EJB`, `@Inject`, `@PersistenceContext`, `@Schedule`, `@RolesAllowed`. +- **JPA/Hibernate** – `EntityManager`, named queries on `Order`, `Shipment` entities. +- **MyBatis** – `CustomerMapper` for customer data. +- **Camunda BPM** – BPMN engine for `orderFulfilment`. +- **Apache Camel** – routing and integration. +- **External services** – ERP HTTP API, SOAP endpoint `erp.shop.example`, shipping provider, OAuth2 provider. +- **Infrastructure** – GitHub Actions, Docker registry, Kubernetes cluster, PostgreSQL DB, JMS queues. + +#### Cross-cutting +- **Security** – OAuth2 client‑credentials for write ops, role‑based access (`backoffice`, `admin`) on REST resources, request‑scoped correlation IDs via servlet filter. +- **Transactions** – container‑managed, default `REQUIRED`, rollback on runtime exceptions. +- **Scheduling** – nightly purge via `@Schedule`, asynchronous execution. +- **Audit** – every state change (cancel, purge) recorded through `AuditLog`. +- **Error Handling** – Camel redelivery policy, BPMN error events (`errOutOfStock`), SOAP fault `UnknownSkuFault`, 404 for missing orders. +- **Observability** – health‑check endpoints (`/health/live`, `/health/ready`), timing interceptor, audit listeners, request ID filter. +- **Performance** – Hibernate batch size, coroutine `Dispatchers.IO` for DB ops, Kubernetes resource limits. +- **Configuration Management** – property placeholders (`{{…}}`), environment variables (`SHOP_DB_URL`, `SHOP_DB_PASSWORD`, `JAVA_OPTS`), secrets (`REGISTRY_USER`, `REGISTRY_TOKEN`), shared labels across CI, Docker, Kubernetes, and application layers. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..3d93bbb9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/enterprise/run3/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,55 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 93656303 +- D: 2026-11-04T06:55:35Z +- T: 2026-11-04T12:43:24Z +- G: +- A: 0.0.0 +- X: project +- F: [java](java/package.ai.md) +- F: [java/shop](java/shop/package.ai.md) +- F: [other/actions/.github](other/actions/.github/package.ai.md) +- F: [other/actions/.github/workflows](other/actions/.github/workflows/package.ai.md) +- F: [other/actions](other/actions/package.ai.md) +- F: [other/bpmn](other/bpmn/package.ai.md) +- F: [other/docker](other/docker/package.ai.md) +- F: [other/facelets](other/facelets/package.ai.md) +- F: [other/groovy](other/groovy/package.ai.md) +- F: [other/integration](other/integration/package.ai.md) +- F: [other/jee](other/jee/package.ai.md) +- F: [other/jsp](other/jsp/package.ai.md) +- F: [other/k8s](other/k8s/package.ai.md) +- F: [other/kotlin](other/kotlin/package.ai.md) +- F: [other/mybatis](other/mybatis/package.ai.md) +- F: [other/openapi](other/openapi/package.ai.md) +- F: [other](other/package.ai.md) +- F: [other/persistence](other/persistence/package.ai.md) +- F: [other/wsdl](other/wsdl/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The back‑office system exposes secure REST endpoints for listing, retrieving, and canceling shop orders, and orchestrates end‑to‑end fulfillment through a BPMN engine that handles stock reservation, payment capture, shipping, invoicing, and error handling. Order data is persisted with Hibernate and MyBatis, while a Groovy‑based shipping cost engine applies tiered pricing and free‑shipping thresholds. Integration with external ERP and shipping services is achieved via Camel routes and a SOAP web service for stock queries, and the entire application is containerized in an Alpine JRE image, deployed to Kubernetes with health checks and CI/CD pipelines automated by GitHub Actions. The system also provides a JSF Facelets page for order submission and a JSP page for order management, all coordinated by Jakarta EE deployment descriptors. + +#### Packages +- java — A stateless REST service that manages back‑office orders, providing listing, detail retrieval, cancellation with payment refund, and nightly cleanup of old cancelled orders. +- java/shop — Provides a stateless REST service for back‑office order management, handling listing, retrieval, cancellation with payment refund, and nightly purge of cancelled orders. +- other/actions/.github — Automates the continuous integration, containerization, and Kubernetes deployment of the Backoffice Java service. +- other/actions/.github/workflows — Automates the continuous integration, containerization, and Kubernetes deployment of the Backoffice service. +- other/actions — Automates the continuous integration, containerization, and Kubernetes deployment of the Backoffice Java service. +- other/bpmn — Orchestrates end‑to‑end order fulfilment, from stock reservation and payment capture to approval, shipping, invoicing, and error handling. +- other/docker — Builds and runs the `orders-backoffice` Java application in a lightweight Alpine JRE container. +- other/facelets — A JSF Facelets page that gathers a customer’s shipping details, lets them pick a shipping method, shows the order total, and submits the order. +- other/groovy — A Groovy module that defines a shipping cost engine and its Spock tests, applying free‑shipping thresholds and tiered pricing while rejecting overweight parcels. +- other/integration — Orchestrates order ingestion, validation, audit, and ERP transmission via Camel routes. +- other/jee — Provides the Jakarta EE deployment descriptors for a shop back‑office application, configuring EJBs, a message‑driven bean, a servlet, filter, listener, security, and JDBC resources. +- other/jsp — A JSP page that lists open orders, lets users search by customer email or status, and cancel individual orders. +- other/k8s — Deploys and exposes the orders‑backoffice microservice on Kubernetes, handling database connectivity and health checks. +- other/kotlin — Generates and stores invoices for completed orders, applying tax rates and due dates. +- other/mybatis — Provides SQL mapping for customer entities, enabling CRUD and search operations via MyBatis. +- other/openapi — A RESTful API for managing shop orders, including listing, retrieving, and canceling orders. +- other — A comprehensive back‑office system that orchestrates order fulfilment, inventory, shipping, invoicing, and reporting across CI/CD, containerization, Kubernetes, and multiple integration patterns. +- other/persistence — Provides Hibernate persistence configuration for the shop’s shipping domain, defining entity mappings, queries, and persistence units for both transactional contexts. +- other/wsdl — Provides a SOAP web service for querying stock levels by SKU, with fault handling for unknown SKUs. +- . — A back‑office order‑management system that exposes secure REST endpoints, orchestrates fulfillment via BPMN, integrates with external ERP and shipping services, and automates CI/CD, containerization, and Kubernetes deployment. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/meta/gpt-6-luna.json new file mode 100644 index 00000000..85cfc986 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/meta/gpt-6-luna.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:12:32Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 72.1, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 42.8, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.8, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:14:29Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 15507, + "cachedPromptTokens": 3972, + "completionTokens": 6679, + "seconds": 71.5230606 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.004533, + "costUsd": 0.005379, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/meta/gpt-oss-20b.json new file mode 100644 index 00000000..9c711b8c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:14:30Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 56.7, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 30.4, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.3, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:15:59Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16078, + "cachedPromptTokens": 448, + "completionTokens": 5200, + "seconds": 56.1455605 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.001158, + "costUsd": 0.004149, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..eed285c5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,53 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:14:10Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> Provides operational tooling and configuration for log analysis, service deployment and health, payment export, billing reminders, shipment validation, and account-statement rendering. + +#### Purpose +- Groups utilities and configuration that support production operations and billing workflows. +- Covers access-log aggregation, release and worker management, settled-payment exports, scheduled reminders, and XML-based validation and presentation. + +#### Responsibilities +- **Log analysis (`perl/`):** Parse access logs, aggregate host and status statistics, filter hosts, rank busiest hosts, and report slow requests. +- **Operational scripts (`shell/`):** Deploy tagged `orderd` builds, manage `queue-worker` lifecycle and health checks, and export settled Oracle payments with a row-count control file. +- **Billing and document configuration (`xml/`):** Configure the invoice-service build and migrations, schedule weekday overdue reminders, define shipment-notice constraints, and transform account statements into HTML. + +#### Key units +- `LogDigest` — parses and aggregates access-log entries; `log_digest.pl` supplies command-line filtering and text or JSON output. +- `deploy_host`, `wait_healthy`, `load_hosts` — deploy a release to selected hosts and verify service health. +- `is_running`, `heartbeat_age`, `start_worker`, `stop_worker` — check and manage `queue-worker`. +- `run_export`, `write_control` — export settled payments and record the business day and row count. +- `invoice-service` Maven project — configures the Java 17 service build, dependencies, tests, migrations, and optional PDFBox profile. +- `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler` — connect reminder data and email delivery to a weekday schedule. +- `shipmentNotice` / `ShipmentNoticeType` — define the required shipment notice structure and validation constraints. +- `statement-to-html.xsl` — renders statement headers, bookings, and totals as HTML. + +#### Data flow +- Access-log files are filtered using configured aliases and exclusions, aggregated by `LogDigest`, then emitted as text or canonical JSON. +- Release settings and a build tag select hosts and an archive; deployment uploads and installs it, restarts `orderd`, then polls the host health endpoint. +- Worker actions check PID and heartbeat files, then report status or start, stop, or restart the worker. +- A selected business day drives an Oracle `settled_payment` query; results become a CSV, a row-count control file, and a gzipped export. +- Reminder properties configure the database and SMTP gateway; the scheduler invokes `OverdueReminderJob` on weekday mornings. +- Shipment XML is validated against `shipment.xsd`; statement XML in `urn:example:statement` is transformed to HTML. + +#### Dependencies +- Perl tooling uses `Getopt::Long`, `JSON::PP`, `POSIX`, `List::Util`, `Carp`, and `Exporter`. +- Deployment uses `lib/common.sh`, host-list files, `rsync`, `ssh`, and `curl`; worker management uses `nohup`, `kill`, and `stat`. +- Payment export uses SQL*Plus, Oracle `settled_payment`, and `gzip`. +- Invoice build inherits from `org.example.billing:billing-parent:2.7.0`; dependencies include Jackson, Flyway, PostgreSQL, JUnit Jupiter, Testcontainers, and optional PDFBox. +- Reminder configuration uses HikariCP and `org.example.reminder` classes; Flyway migrations reside at `src/main/resources/db/migration`. + +#### Cross-cutting +- Runtime and build configuration comes from CLI options, environment variables, properties, Maven profiles, and XML bean configuration. +- Log aggregation normalizes hosts, limits input to 50,000 lines, counts requests over 1,500 ms as slow, and ranks deterministically. +- Scripts expose operational failures through messages and exit codes; deployment health checks and export retries are bounded. +- Shipment schema defaults recipient country to `DE` and caps parcel weight at 31,500 grams; statement rendering defaults to `EUR` and highlights amounts above 1,000. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..e2754719 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,67 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:12:32Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Aggregates web-server access-log entries into per-host, per-status, busiest-host, and slow-request statistics. + +#### Purpose +- Parses access-log lines and accumulates digest statistics. +- Provides host normalization and count ranking. + +#### Type +- Module; package `LogDigest`. +- Exportable names: `@EXPORT_OK` contains `parse_line`, `top_n`. +- Procedural functions and blessed-object methods; constructor `new`. + +#### Input +- `new` accepts a `level` named argument. +- `add` accepts an access-log line; `parse_line` accepts one line; `top_n` accepts a count hash reference and rank limit. +- No command-line options, environment variables, or file reads. + +#### Output +- `parse_line` returns a hash reference with `host`, `time`, `method`, `path`, `status`, and `millis`, or returns false for an unmatched line. +- `add` returns `1` for a parsed line and `0` for an unmatched line. +- `summarize` returns a hash reference containing UTC `generated` timestamp, `total`, distinct `hosts`, maximum per-host count as `busiest`, `slow` count, and a copied `statuses` hash. +- `top_n` returns host/count keys sorted by descending count, then ascending key. +- No printed output or files written. + +#### Core logic +- `new` validates the requested log level and initializes host/status counts, slow-request count, and processed-line count. +- `add` increments the line counter, rejects input beyond `MAX_LINES`, parses the line, then increments normalized-host and status counts. +- A parsed request increments `slow` when `millis` exceeds `SLOW_REQUEST_MS`. +- `parse_line` matches a log-line pattern, extracts request fields, and lowercases the host while removing one trailing dot. +- `summarize` derives total requests and busiest-host count, counts distinct hosts, timestamps the result, and copies status counts. +- `top_n` sorts keys by count descending, with lexical tie-breaking, and returns up to the requested number. + +#### Subs +- `new($class, %args) -> blessed object` — validate level and initialize counters. +- `parse_line($line) -> hash reference or false` — extract fields from a log line. +- `add($self, $line) -> 1 or 0` — parse and accumulate one entry. +- `summarize($self) -> hash reference` — build aggregate statistics. +- `top_n($counts, $n) -> list` — rank count keys. +- `_normalize_host($host) -> normalized host` — lowercase and trim trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50_000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `$VERSION = '1.4'` +- `@EXPORT_OK = qw(parse_line top_n)` +- `%LEVEL_RANK = (DEBUG => 0, INFO => 1, WARN => 2, ERROR => 3)` + +#### Dependencies +- `strict`, `warnings` — enable compile-time and runtime checks. +- `POSIX` — imports `strftime`. +- `List::Util` — imports `max`, `sum`. +- `Carp` — imports `croak`. +- `parent` — loads `Exporter` as parent. + +#### Exceptions / Errors +- `new` croaks with `unknown level ''` when `level` is not in `%LEVEL_RANK`. +- `add` croaks with `more than 50000 lines` when the line limit is exceeded. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..55083966 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/perl/log_digest.pl.ai.md @@ -0,0 +1,70 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:12:41Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Summarizes access-log requests by host and status, reporting busiest hosts and slow-request counts as text or JSON. + +#### Purpose +- Reads one or more access-log files, applies host aliases and exclusions, and prints an aggregate summary. + +#### Type +- Script; package `main`; procedural. +- Imports `top_n` from `LogDigest`; no object construction in this script. + +#### Input +- `--top` / `--n`: sets `$top` (integer; default `10`). +- `--level`: sets `$level` (string; default `WARN`). +- `--json` / `--nojson`: sets `$as_json` (default `0`). +- `--exclude-host`: appends host names to `@exclude_hosts`. +- `--help` / `-h`: prints usage and exits successfully. +- `@ARGV`: access-log file paths; each file is read line by line. +- `%ENV`: `LOG_DIGEST_CONFIG`; sets `$config_file`, default `/etc/log-digest.conf`. +- `$config_file`: read as host-alias configuration; missing/unreadable file yields no aliases. +- Access-log lines: first space-delimited field is treated as the host. +- Alias configuration lines: `from=to`; blank lines and lines beginning with optional whitespace followed by `#` are ignored. + +#### Output +- Text mode: request, host, and slow counts, followed by `top_n` host entries. +- JSON mode: canonical JSON encoding of the summary, followed by a newline. +- Returns `0` from `main`; script exits with that status. +- Help prints usage and exits with status `0`. + +#### Core logic +- Parses options and rejects `$top < 1`. +- Reads aliases from `$config_file`; builds an exclusion lookup from `@exclude_hosts`. +- Creates a `LogDigest` object with the selected `level`. +- For each `@ARGV` file, reads each line and skips it when its aliased host (or original host if no alias) is excluded. +- Adds remaining lines to the digest, then calls `summarize`. +- Prints canonical JSON or text counts plus `top_n($digest->{hosts}, $top)`. + +#### Subs +- `usage() -> string` — builds command usage text. +- `read_aliases($path) -> hash` — reads host aliases; returns empty hash on open failure. +- `main() -> 0` — processes files and prints the digest summary. + +#### Constants and configuration +- `$config_file`: `$ENV{LOG_DIGEST_CONFIG}` or `/etc/log-digest.conf`. +- `$top`: `10`. +- `$level`: `WARN`. +- `$as_json`: `0`. +- `@exclude_hosts`: initially empty. + +#### Dependencies +- `strict`, `warnings` — enable strictness and warnings. +- `FindBin` — imports `$Bin`. +- `lib` — adds `$Bin` to module search path. +- `Getopt::Long` — imports `GetOptions`. +- `JSON::PP` — canonical JSON encoding. +- `LogDigest` — imports `top_n`; calls `new`, `add`, and `summarize`. + +#### Exceptions / Errors +- Dies with `--top must be positive` when `$top < 1`. +- Dies with usage text if `GetOptions` fails. +- Dies with `cannot read $file: $!` when an access-log file cannot be opened. +- `read_aliases` handles config-file open failure by returning an empty hash. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/perl/package.ai.md new file mode 100644 index 00000000..55e77525 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/perl/package.ai.md @@ -0,0 +1,47 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:13:44Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Aggregates web-server access logs into host and status statistics, with configurable host filtering, busiest-host rankings, and slow-request reporting. + +#### Purpose +- Parse and summarize access-log requests by normalized host and status. +- Provide a command-line tool to process files and emit text or canonical JSON summaries. + +#### Responsibilities +- **Parsing and aggregation:** `LogDigest` parses individual log lines, tracks request, host, status, and slow-request counts, and builds summary statistics. +- **Host ranking:** `top_n` ranks host counts by descending count with lexical tie-breaking. +- **Command-line processing:** `log_digest.pl` reads access-log files, applies configured aliases and excluded hosts, and prints the summary. +- **Configuration and output:** The script accepts options for ranking, level, exclusions, and JSON output; it reads aliases from `LOG_DIGEST_CONFIG` or `/etc/log-digest.conf`. + +#### Key units +- `LogDigest::new` — validates the level and initializes aggregation state. +- `LogDigest::parse_line` — extracts host, time, method, path, status, and milliseconds from a log entry. +- `LogDigest::add` — parses and accumulates an entry, enforcing the line limit and slow-request threshold. +- `LogDigest::summarize` — returns generated time, totals, distinct-host count, busiest-host count, slow count, and status counts. +- `LogDigest::top_n` — returns the highest-ranked count keys. +- `log_digest.pl::read_aliases` — loads `from=to` host mappings, returning no aliases if the config cannot be opened. +- `log_digest.pl::main` — processes options and input files, then prints text or JSON results. + +#### Data flow +- The script reads alias configuration and builds an exclusion lookup. +- For each input line, it applies the alias for the first space-delimited field when checking host exclusions; excluded lines are skipped. +- Remaining lines are passed to `LogDigest::add`, which parses each request and updates host, status, total, and slow-request counts. +- `summarize` produces the aggregate result; text output includes counts and ranked hosts, while JSON output uses canonical encoding. + +#### Dependencies +- `log_digest.pl` uses `Getopt::Long`, `JSON::PP`, and `LogDigest`. +- `LogDigest` uses `POSIX` for UTC timestamp formatting, `List::Util` for `max` and `sum`, `Carp` for errors, and `Exporter` for exports. + +#### Cross-cutting +- `LogDigest` normalizes hosts to lowercase and removes one trailing dot. +- Aggregation rejects more than `50,000` lines; requests over `1,500` milliseconds count as slow. +- The default level is `WARN`; unknown levels and line-limit violations raise errors. +- Host ranking is deterministic: count descending, then key ascending. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..2c2536bc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,79 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:12:50Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a tagged release of the `orderd` service across staging or production hosts, one host at a time, stopping when a host fails its health check. + +#### Purpose +- Roll out `build/.tar.gz` to every host in the selected environment and restart `orderd`. +- Run directly; sources `lib/common.sh`. + +#### Type +- Bash (`#!/usr/bin/env bash`); strict mode: `set -euo pipefail`. + +#### Input +- `-e ` sets `ENVIRONMENT`; parsed with `getopts`. +- `-t ` sets `TAG`; parsed with `getopts`. +- `-n` sets `DRY_RUN=1`; parsed with `getopts`. +- `-p ` is accepted and logged as unsupported; parsed with `getopts`. +- `-h` prints usage and exits; parsed with `getopts`. +- Environment variables: `DEPLOY_USER` defaults to `deploy`; `SSH_KEY` defaults to `$HOME/.ssh/deploy_ed25519`; `HOME` supplies that default. +- Reads the SSH key at `SSH_KEY`, the selected host list under `SCRIPT_DIR` (`hosts.staging` or `hosts.production`), and `build/$TAG.tar.gz`. +- Requires nonempty `ENVIRONMENT` and `TAG`; does not use remaining positional arguments. + +#### Output +- Logs timestamped messages to stderr. +- On each remote host, uploads the tarball to `/tmp/`, extracts it under `/opt/releases/$TAG`, updates `/opt/releases/current`, and restarts `orderd` with `sudo systemctl`. +- Probes `http://:8080/health`; removes `/tmp/deploy_release.$$.lock` on exit. The script does not create this lock file. +- Exits `0` on successful completion or `-h`; exits `1` through `die` for validation, prerequisite, host-list, or health-check failures; exits `2` when required environment or tag is missing. `set -e` may also terminate on an unhandled command failure. + +#### Core logic +- Sources `lib/common.sh` relative to the script directory and sets deployment configuration. +- Parses options; prints usage for `-h`, rejects unknown options or missing option values, then shifts parsed arguments. +- Requires environment and tag; checks for `rsync`, `ssh`, and `curl`, and verifies the SSH key is readable. +- Selects the environment’s host file, removes lines beginning with `#`, and fails if no hosts remain. +- For each host, either logs the intended deployment in dry-run mode or uploads the tarball and runs remote extraction, symlink update, and service restart commands. +- After each real deployment, polls the host health endpoint every two seconds, failing at the health timeout; logs each completed host. +- Runs cleanup on exit. + +#### Functions +- `log` — Timestamp and print to stderr. +- `die` — Log an error and exit `1`. +- `usage` — Print the usage comment. +- `check_prereqs` — Check tools and SSH key readability. +- `load_hosts` — Read hostnames for the selected environment. +- `deploy_host` — Upload and install a release on one host. +- `wait_healthy` — Poll a host’s health endpoint. +- `cleanup` — Remove the per-process lock path. + +#### Constants and configuration +- `SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"` (readonly) +- `DEPLOY_USER="${DEPLOY_USER:-deploy}"` +- `SSH_KEY="${SSH_KEY:-$HOME/.ssh/deploy_ed25519}"` +- `RELEASE_ROOT="/opt/releases"` (exported) +- `SERVICE_NAME="orderd"` +- `HEALTH_TIMEOUT=30` +- `ENVIRONMENT=""` +- `TAG=""` +- `DRY_RUN=0` +- `HOSTS=()` (indexed array) +- `HOST_FILES=([staging]="hosts.staging" [production]="hosts.production")` (associative array) + +#### Dependencies +- Sourced file: `"$SCRIPT_DIR/lib/common.sh"`. +- Commands: `rsync`, `ssh`, `curl`, `date`, `sed`, `command`, `grep`, `tar`, `mkdir`, `ln`, `sudo`, `systemctl`, `sleep`, `rm`. +- Host-list files: `hosts.staging`, `hosts.production`, selected under `SCRIPT_DIR`. +- Build artifact: `build/$TAG.tar.gz`; remote deployment uses `/tmp/$TAG.tar.gz`. +- Remote health endpoint: `http://$host:8080/health`. + +#### Errors and exit codes +- `1`: `die` exits for missing tools, unreadable SSH key, unknown environment, empty host list, or a host not healthy before `HEALTH_TIMEOUT`. +- `2`: required `ENVIRONMENT` or `TAG` is empty. +- `0`: successful deployment or help request. +- `EXIT` trap invokes `cleanup`, removing `/tmp/deploy_release.$$.lock`; no retry beyond health polling, which checks every two seconds for up to 30 seconds. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..9b7154b1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,62 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:13:02Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Manages the queue worker lifecycle and checks whether its process and heartbeat indicate healthy operation. + +#### Purpose +- Starts, stops, restarts, reports status for, and health-checks the queue worker. +- Run directly as an init-style command wrapper. + +#### Type +- POSIX `sh`; no strict-mode settings (`set -e`, `set -u`, or `pipefail`). + +#### Input +- `$1`: action name: `start`, `stop`, `restart`, `status`, or `health`. +- Environment: `PID_FILE` defaults to `/run/queue-worker.pid`; `HEARTBEAT_FILE` defaults to `/var/lib/queue-worker/heartbeat`. +- Reads the PID file and, for health checks, the heartbeat file’s modification time. + +#### Output +- Starts `queue-worker` with output discarded; writes its PID to `PID_FILE`. +- Removes `PID_FILE` after a successful stop signal; does not remove it on other paths. +- Prints `already running`, `running`, `stopped`, `CRITICAL: not running`, `WARNING: heartbeat ...s old`, `OK`, or usage text as applicable. +- `status` exits 3 when stopped; `health` exits 2 when not running and 1 when the heartbeat exceeds the age limit. Invalid actions exit 64. +- Other actions return the status of their final command. + +#### Core logic +- `start`: if the PID file identifies a live process, print `already running`; otherwise launch the worker with `nohup` and write its background PID to `PID_FILE`. +- `stop`: if the worker is not running, do nothing; otherwise send it `TERM` and remove `PID_FILE` if the signal succeeds. +- `restart`: run stop, then start. +- `status`: print `running` if the PID identifies a live process; otherwise print `stopped` and exit 3. +- `health`: require a live process, calculate current time minus heartbeat modification time (using 0 if `stat` fails), warn and exit 1 if age exceeds 120 seconds; otherwise print `OK`. +- Unrecognized action: print usage to standard error and exit 64. + +#### Functions +- `is_running`: check PID file and process liveness. +- `heartbeat_age`: calculate heartbeat age in seconds. +- `start_worker`: launch worker and record PID. +- `stop_worker`: signal worker and remove PID file. + +#### Constants and configuration +- `PID_FILE="${PID_FILE:-/run/queue-worker.pid}"` +- `HEARTBEAT_FILE="${HEARTBEAT_FILE:-/var/lib/queue-worker/heartbeat}"` +- `MAX_HEARTBEAT_AGE=120` +- `WORKER_BIN=/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `cat`, `date`, `kill`, `nohup`, `rm`, `stat`. +- Worker executable: `/usr/local/bin/queue-worker`; launched with `--heartbeat` and the configured heartbeat path. + +#### Errors and exit codes +- Exit 0 for successful status, healthy probe, and already-running start; other command paths use their final command’s status. +- Exit 1 when heartbeat age is greater than `MAX_HEARTBEAT_AGE`. +- Exit 2 when health check finds no running worker. +- Exit 3 when status check finds no running worker. +- Exit 64 for an unsupported action. +- No traps, retries, or timeouts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..e03e85a5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,67 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:13:11Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Exports one business day of settled Oracle payments as a gzipped CSV with a companion row-count control file. + +#### Purpose +- Produce a daily settled-payments export for downstream processing. +- Run directly as a nightly job; not a sourced library. + +#### Type +- ksh93 (`#!/bin/ksh93`); no strict-mode settings. + +#### Input +- `-d YYYYMMDD` parsed by `getopts`: sets `business_day`; defaults to the current date in `YYYYMMDD` format. +- `-o dir` parsed by `getopts`: sets `export_dir`; defaults to `/data/export/payments`. +- Environment variable `ORACLE_SID`: used if set; otherwise defaults to `PAYPRD`. +- Reads Oracle table `settled_payment`; no local input files. + +#### Output +- Writes `payments_.csv` in `export_dir`, then compresses it to `.csv.gz`. +- Writes a sibling `.ctl` file containing the CSV row count and business day. +- Logs timestamped status and failure messages to standard error. +- Exits `0` on success; `2` for invalid usage, `3` for missing required tools, `4` after exhausting export retries, or the default `1` for other `fail` calls. + +#### Core logic +- Sets defaults, derives the current business day, and exports `ORACLE_SID` and `NLS_LANG`. +- Parses `-d` and `-o`; shifts parsed arguments. +- Checks that `sqlplus` and `gzip` are available; creates `export_dir` if needed. +- Attempts the Oracle export up to three times, sleeping 60 seconds after each failed attempt. +- Runs a SQL*Plus query for the selected `business_day`, writing semicolon-separated payment ID, account number, amount, and currency fields to the CSV. +- On success, counts CSV lines, writes the `.ctl` file, gzips the CSV, logs success, and exits. +- After all attempts fail, logs a final failure and exits `4`. + +#### Functions +- `log`: Write timestamped messages to standard error. +- `fail`: Log failure and exit with a status. +- `require_tools`: Check required commands are available. +- `run_export`: Query settled payments into a CSV. +- `write_control`: Write row count and business day to a control file. + +#### Constants and configuration +- `ORACLE_SID_DEFAULT=PAYPRD` +- `EXPORT_DIR_DEFAULT=/data/export/payments` +- `MAX_RETRIES=3` +- `attempt=0` +- `business_day=$(date +%Y%m%d)` +- `export_dir=$EXPORT_DIR_DEFAULT` +- `ORACLE_SID=${ORACLE_SID:-$ORACLE_SID_DEFAULT}` (exported) +- `NLS_LANG=AMERICAN_AMERICA.AL32UTF8` (exported) + +#### Dependencies +- Commands: `date`, `whence`, `sqlplus`, `wc`, `gzip`, `mkdir`, `sleep`. +- Oracle connection: `/ AS SYSDBA`; query reads `settled_payment` and filters `business_day` using `TO_DATE(..., 'YYYYMMDD')`. + +#### Errors and exit codes +- Exit `2`: unsupported option or usage error. +- Exit `3`: `sqlplus` or `gzip` is unavailable. +- Exit `4`: all three export attempts fail; waits 60 seconds between failed attempts. +- Exit `1` by default for `fail` calls without an explicit status; also used if output directory creation fails. +- No traps or cleanup handlers. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/package.ai.md new file mode 100644 index 00000000..ea296c77 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/shell/package.ai.md @@ -0,0 +1,47 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:13:52Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Supports release operations by deploying `orderd`, managing queue-worker health, and exporting settled Oracle payments for downstream processing. + +#### Purpose +- Provides standalone shell utilities for service rollout and worker lifecycle/health checks. +- Produces a nightly, business-day-filtered settled-payments export with a row-count control file. + +#### Responsibilities +- **Release deployment:** `deploy_release.sh` selects staging or production hosts, installs a tagged build, restarts `orderd`, and gates progress on host health checks; supports dry-run mode. +- **Worker operations:** `healthcheck.sh` starts, stops, restarts, and reports status or heartbeat health for `queue-worker`. +- **Payment export:** `nightly_extract.ksh` queries Oracle `settled_payment`, writes a CSV and `.ctl` row-count file, then gzips the export; retries failed exports. + +#### Key units +- `deploy_host` — uploads and installs a release on one host, updates the `current` symlink, and restarts `orderd`. +- `wait_healthy` — polls a host’s `/health` endpoint after deployment. +- `load_hosts` — loads the selected staging or production host list. +- `is_running` — checks whether the PID in the queue worker’s PID file identifies a live process. +- `heartbeat_age` — calculates the age of the worker heartbeat file. +- `start_worker` / `stop_worker` — launch `queue-worker` and record its PID, or signal it and remove the PID file. +- `run_export` — runs the SQL*Plus query for the selected business day. +- `write_control` — records the export’s row count and business day in the companion control file. + +#### Data flow +- **Deployment:** CLI environment and tag → host list and `build/.tar.gz` → per-host upload, extraction, symlink update, and service restart → HTTP health polling. +- **Worker health:** action argument → PID/process check; for `health`, heartbeat age check → status message and action-specific exit code. +- **Payment export:** business-day and output-directory options → Oracle query → semicolon-separated CSV → row count and business-day `.ctl` file → gzipped CSV. + +#### Dependencies +- `deploy_release.sh` sources `lib/common.sh`, reads `hosts.staging` or `hosts.production`, and uses `rsync`, `ssh`, and `curl`; deployment targets `/opt/releases` and `orderd`. +- `healthcheck.sh` manages `/usr/local/bin/queue-worker` using PID and heartbeat files; relies on `nohup`, `kill`, and `stat`. +- `nightly_extract.ksh` uses `sqlplus` to connect as `/ AS SYSDBA` and query Oracle table `settled_payment`; requires `gzip`. + +#### Cross-cutting +- Scripts are directly executable shell jobs: Bash for deployment, POSIX `sh` for worker management, and ksh93 for payment export. +- Configuration is supplied through command-line options and environment variables, with defaults for deployment credentials, worker files, export directory, and Oracle SID. +- Operational failures are surfaced through stderr logging or status messages and distinct exit codes; deployment health polling and export retries are bounded, while worker checks have no retry or timeout. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..39fd7c05 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,45 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:13:20Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Builds the `invoice-service` JAR for creating, numbering, and archiving customer invoices, with database migrations and an optional PDFBox dependency. + +#### Purpose +- Defines Maven build dependencies, plugins, properties, and the `native-pdf` profile for the invoice service. + +#### Type +- Maven POM; root element `project`. +- Namespaces: default `http://maven.apache.org/POM/4.0.0`; `xsi` = `http://www.w3.org/2001/XMLSchema-instance`. + +#### Definitions +- Coordinates: `org.example.billing:invoice-service:2.7.0` (group and version inherited); packaging `jar`; name `Invoice service`. +- Parent: `org.example.billing:billing-parent:2.7.0`. +- Dependencies: + - `com.fasterxml.jackson.core:jackson-databind` — compile; version `${jackson.version}`. + - `org.flywaydb:flyway-core` — compile; version `${flyway.version}`. + - `org.postgresql:postgresql` — runtime. + - `org.junit.jupiter:junit-jupiter` — test. + - `org.testcontainers:postgresql` — test. +- Plugins: + - `flyway-maven-plugin` — version `${flyway.version}`; migration location `filesystem:src/main/resources/db/migration`. + - `maven-surefire-plugin` — sets system property `invoice.archive.dir` to `${invoice.archive.dir}`. +- Properties: `maven.compiler.release=17`; `jackson.version=2.19.2`; `flyway.version=11.4.0`; `invoice.archive.dir=${project.build.directory}/archive`. +- Profile `native-pdf`: adds `org.apache.pdfbox:pdfbox` version `3.0.5`. + +#### Configuration +- `maven.compiler.release`: `17`. +- `jackson.version`: `2.19.2`. +- `flyway.version`: `11.4.0`. +- `invoice.archive.dir`: `${project.build.directory}/archive`; passed to Surefire as a system property. +- Flyway migration location: `filesystem:src/main/resources/db/migration`. + +#### Dependencies +- Parent POM: `org.example.billing:billing-parent:2.7.0`. +- Migration files under `src/main/resources/db/migration`. +- External systems and libraries: PostgreSQL, Jackson, Flyway, JUnit Jupiter, Testcontainers, and PDFBox (profile-dependent). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/package.ai.md new file mode 100644 index 00000000..d62262aa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/package.ai.md @@ -0,0 +1,52 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:14:01Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides XML-based build, scheduling, validation, and presentation configuration for billing, reminders, shipments, and account statements. + +#### Purpose +- Defines service build and runtime scheduling configuration alongside XML formats and transformations for shipment notices and account statements. +- Supports invoice-service dependencies and migrations, overdue-reminder delivery, shipment validation, and statement-to-HTML rendering. + +#### Responsibilities +- **Build and migrations:** `invoice-service-pom.xml` configures the `invoice-service` JAR, PostgreSQL/Flyway dependencies, migration location, tests, and optional PDFBox support. +- **Reminder scheduling:** `scheduler-context.xml` wires a JDBC repository, SMTP gateway, and overdue-reminder job, scheduled for weekday mornings. +- **Shipment validation:** `shipment.xsd` defines shipment notice structure, supported carrier codes, recipient address fields, and parcel weight constraints. +- **Statement presentation:** `statement-to-html.xsl` renders account statements as HTML with booking rows, totals, currency formatting, and threshold-based highlighting. + +#### Key units +- `invoice-service` Maven project — builds version `2.7.0` with Java release 17 and a `native-pdf` profile. +- `reminderDataSource` — HikariCP data source configured from reminder database properties. +- `reminderRepository` — `JdbcReminderRepository` backed by `reminderDataSource`. +- `mailGateway` — `SmtpMailGateway` configured for the reminder SMTP host on port 587. +- `overdueReminderJob` — `OverdueReminderJob` combining repository and mail gateway with a 14-day grace period. +- `reminderScheduler` — Spring task scheduler with pool size 2; invokes `sendDueReminders` at 07:00 Monday–Friday. +- `shipmentNotice` / `ShipmentNoticeType` — shipment document schema requiring order reference, timestamp, carrier, recipient, and one or more parcels. +- `CarrierCode`, `WeightGrams`, `ParcelType`, `AddressType` — schema types constraining carriers, parcel weights, parcel metadata, and recipient details. +- `statement-to-html.xsl` — XSLT 1.0 stylesheet rendering statement headers, bookings, and totals. + +#### Data flow +- Reminder properties configure the data source and SMTP gateway; the repository and gateway feed `OverdueReminderJob`, which the scheduler invokes on weekdays. +- Shipment notice XML is checked against `shipment.xsd`, including carrier enumeration, required identifiers, and parcel weight limits. +- Statement XML in `urn:example:statement` is transformed by `statement-to-html.xsl` into HTML with formatted booking amounts and a summed total. +- Maven build configuration resolves service dependencies and Flyway migrations; Surefire receives the invoice archive directory as a system property. + +#### Dependencies +- `invoice-service` inherits from `org.example.billing:billing-parent:2.7.0`; uses Jackson, Flyway, PostgreSQL, JUnit Jupiter, Testcontainers, and optionally PDFBox. +- Flyway migrations are located at `src/main/resources/db/migration`. +- Reminder context references HikariCP and `org.example.reminder` classes; loads `reminder.properties` and scans `org.example.reminder.web`. +- Shipment schema uses XML Schema built-in types; statement transformation consumes elements in `urn:example:statement`. + +#### Cross-cutting +- Configuration is expressed in XML: Maven properties and profiles, Spring beans and property placeholders, XSD constraints, and XSLT parameters. +- Reminder runtime settings include `reminder.db.url`, `reminder.db.user`, and `reminder.smtp.host`; statement rendering defaults to `EUR` and highlights amounts above `1000`. +- Shipment defaults recipient country to `DE` and caps parcel weight at 31,500 grams. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..80e0d87e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,41 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:13:27Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures weekday morning delivery of overdue reminders using a JDBC-backed repository and SMTP gateway. + +#### Purpose +- Wires the reminder data source, repository, mail gateway, job, and scheduler. +- Loads reminder settings from `reminder.properties` and scans the reminder web package. + +#### Type +- Spring application context; root element `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` `http://www.w3.org/2001/XMLSchema-instance`; `context` `http://www.springframework.org/schema/context`; `task` `http://www.springframework.org/schema/task`. + +#### Definitions +- Beans: + - `reminderDataSource`: `com.zaxxer.hikari.HikariDataSource`; closes via `destroy-method="close"`. + - `reminderRepository`: `org.example.reminder.JdbcReminderRepository`; constructor references `reminderDataSource`. + - `mailGateway`: `org.example.reminder.SmtpMailGateway`. + - `overdueReminderJob`: `org.example.reminder.OverdueReminderJob`; constructor references `reminderRepository` and `mailGateway`. +- Scheduled task: `overdueReminderJob.sendDueReminders`, scheduled with cron `0 0 7 * * MON-FRI` using `reminderScheduler`. +- Scheduler: `reminderScheduler`, pool size `2`. +- Component scan: `org.example.reminder.web`. + +#### Configuration +- Property placeholder file: `classpath:reminder.properties`. +- `reminderDataSource`: `jdbcUrl=${reminder.db.url}`; `username=${reminder.db.user}`; `maximumPoolSize=8`. +- `mailGateway`: `host=${reminder.smtp.host}`; `port=587`. +- `overdueReminderJob`: `graceDays=14`. + +#### Dependencies +- Referenced property keys: `reminder.db.url`, `reminder.db.user`, `reminder.smtp.host`. +- Referenced file: `reminder.properties`. +- Referenced classes: `com.zaxxer.hikari.HikariDataSource`, `org.example.reminder.JdbcReminderRepository`, `org.example.reminder.SmtpMailGateway`, `org.example.reminder.OverdueReminderJob`. +- Scanned package: `org.example.reminder.web`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..8b9cda49 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/shipment.xsd.ai.md @@ -0,0 +1,38 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:13:33Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the warehouse shipment notice format, including recipient details, carrier codes, parcel tracking and weight limits. + +#### Purpose +- Validates shipment notices sent when parcels leave a warehouse. +- Constrains carrier, parcel weight, address, and shipment metadata. + +#### Type +- XML Schema; root element `schema`. +- Namespaces: `xs` = `http://www.w3.org/2001/XMLSchema`; `shp` = `urn:example:shipment:1`. +- Target namespace: `urn:example:shipment:1`; `elementFormDefault="qualified"`. + +#### Definitions +- Top-level element: `shipmentNotice` of type `shp:ShipmentNoticeType`. +- Simple types: + - `CarrierCode`: `xs:string` enumeration `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: `xs:positiveInteger`, maximum inclusive `31500`. +- Complex types: + - `ParcelType`: ordered `trackingNumber` (`xs:string`), `weight` (`shp:WeightGrams`); required `sequence` attribute (`xs:positiveInteger`). + - `AddressType`: ordered `name`, `street`, `postalCode`, `city` (`xs:string`) and optional `country` (`xs:string`, default `DE`). + - `ShipmentNoticeType`: ordered `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one or more `parcel` elements (`shp:ParcelType`); required `noticeId` attribute (`xs:ID`). + +#### Configuration +- `country` default: `DE`. +- `weight` maximum: `31500` grams. +- `parcel` has no specified upper occurrence limit. + +#### Dependencies +- References XML Schema built-in types: `xs:string`, `xs:positiveInteger`, `xs:dateTime`, and `xs:ID`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..45e5498c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,37 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:13:38Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a monthly account statement into an HTML page with account details, booking rows, and a total. + +#### Purpose +- Renders statement period and account number, one row per booking, and the summed booking amount. +- Marks booking rows as `large` when the amount exceeds a configurable threshold. + +#### Type +- XSLT 1.0 stylesheet; root element `xsl:stylesheet`. +- Namespaces: `xsl` — `http://www.w3.org/1999/XSL/Transform`; `st` — `urn:example:statement`. + +#### Definitions +- Output method: `html`, encoding `UTF-8`, `indent="yes"`. +- Parameters: `currencySymbol` defaults to `EUR`; `highlightAbove` defaults to `1000`. +- Key `bookingsByDay`: matches `st:booking`, indexed by `st:valueDate`. +- Templates: + - Match `/st:statement`: emits the HTML page, calls `statementHeader` and `statementTotal`, and applies templates to `st:booking`. + - Named `statementHeader`: emits the account number and period. + - Match `st:booking`: emits date, purpose, and formatted amount with currency; assigns class `large` if `number(st:amount) > $highlightAbove`. + - Named `statementTotal`: emits the formatted sum of `st:booking/st:amount`. + +#### Configuration +- `currencySymbol` — `EUR`. +- `highlightAbove` — `1000`. +- Amount format — `#,##0.00`. + +#### Dependencies +- Input statement data in namespace `urn:example:statement`, using `st:statement`, `st:accountNumber`, `st:booking`, `st:valueDate`, `st:purpose`, and `st:amount`; period is read from `@period`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..f8750608 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/package.ai.md @@ -0,0 +1,52 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:14:19Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> Supports production operations and billing workflows by analyzing logs, managing services, exporting payments, scheduling reminders, and validating and rendering business documents. + +#### Purpose +- Provides operational tooling and configuration for service deployment, worker health, and access-log analysis. +- Supports billing and document workflows, including payment export, overdue reminders, shipment validation, and account-statement rendering. + +#### Responsibilities +- **Log analysis:** Filter access logs, aggregate host and status statistics, identify busiest hosts, and report slow requests. +- **Service operations:** Deploy tagged `orderd` builds, check service health, and manage the `queue-worker` lifecycle. +- **Payment export:** Query settled Oracle payments for a business day and produce CSV, row-count control, and compressed outputs. +- **Billing and documents:** Configure the invoice-service build and migrations; schedule overdue reminders; constrain shipment notices; render account statements as HTML. + +#### Key units +- `LogDigest`, `log_digest.pl` — aggregate access-log entries and emit text or JSON reports. +- `deploy_host`, `wait_healthy`, `load_hosts` — select hosts, deploy a release, and verify health. +- `is_running`, `heartbeat_age`, `start_worker`, `stop_worker` — inspect and manage `queue-worker`. +- `run_export`, `write_control` — export settled payments and record the business day and row count. +- `invoice-service` Maven project — configure the Java 17 service build, dependencies, tests, migrations, and optional PDFBox profile. +- `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler` — connect reminder data and email delivery to weekday scheduling. +- `shipmentNotice`, `ShipmentNoticeType`, `shipment.xsd` — define and validate shipment-notice structure. +- `statement-to-html.xsl` — render statement headers, bookings, and totals as HTML. + +#### Data flow +- Access logs are filtered using aliases and exclusions, aggregated by `LogDigest`, then emitted as text or canonical JSON. +- Release settings and a build tag select hosts and an archive; deployment installs the archive, restarts `orderd`, and polls the health endpoint. +- Worker management checks PID and heartbeat files before reporting status or starting, stopping, or restarting the worker. +- A selected business day drives an Oracle `settled_payment` query; results are written to CSV, a row-count control file, and a gzip export. +- Reminder properties configure database and SMTP access; the scheduler invokes `OverdueReminderJob` on weekday mornings. +- Shipment XML is validated against `shipment.xsd`; statement XML in `urn:example:statement` is transformed to HTML. + +#### Dependencies +- Perl tooling: `Getopt::Long`, `JSON::PP`, `POSIX`, `List::Util`, `Carp`, and `Exporter`. +- Deployment and worker scripts: `lib/common.sh`, host-list files, `rsync`, `ssh`, `curl`, `nohup`, `kill`, and `stat`. +- Payment export: SQL*Plus, Oracle `settled_payment`, and `gzip`. +- Invoice build: `org.example.billing:billing-parent:2.7.0`, Jackson, Flyway, PostgreSQL, JUnit Jupiter, Testcontainers, and optional PDFBox. +- Reminder configuration: HikariCP, `org.example.reminder` classes, and Flyway migrations under `src/main/resources/db/migration`. + +#### Cross-cutting +- Configuration comes from CLI options, environment variables, properties, Maven profiles, and XML bean configuration. +- Log aggregation normalizes hosts, limits input to 50,000 lines, flags requests over 1,500 ms as slow, and ranks results deterministically. +- Operational scripts report failures through messages and exit codes; deployment health checks and export retries are bounded. +- Shipment validation defaults recipient country to `DE` and caps parcel weight at 31,500 grams; statement rendering defaults to `EUR` and highlights amounts above 1,000. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..d501195c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-6-luna/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 4CCE51E3 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:14:27Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +Production operations and billing workflows are supported by operational tooling and configuration for log analysis, service deployment and health, payment export, billing reminders, shipment validation, and account-statement rendering. Perl utilities aggregate web-server access logs into host and status statistics, while shell tools handle `orderd` deployment, queue-worker health, and settled Oracle payment exports. XML configuration covers build, scheduling, validation, and presentation for billing, reminders, shipments, and account statements. + +#### Packages +- other — Provides operational tooling and configuration for log analysis, service deployment and health, payment export, billing reminders, shipment validation, and account-statement rendering. +- other/perl — Aggregates web-server access logs into host and status statistics, with configurable host filtering, busiest-host rankings, and slow-request reporting. +- other/shell — Supports release operations by deploying `orderd`, managing queue-worker health, and exporting settled Oracle payments for downstream processing. +- other/xml — Provides XML-based build, scheduling, validation, and presentation configuration for billing, reminders, shipments, and account statements. +- . — Supports production operations and billing workflows by analyzing logs, managing services, exporting payments, scheduling reminders, and validating and rendering business documents. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..57ee295a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,57 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:15:42Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A collection of tooling and configuration artifacts that parse web logs, automate deployment and health checks for a payment service, and supply build, scheduling, validation, and presentation assets for an invoicing system. + +#### Purpose +- Provide utilities for log analysis, deployment automation, and invoicing configuration. +- Enable quick reporting, reliable service management, and consistent data validation/rendering. + +#### Responsibilities +- **Log Processing** – parse access logs, aggregate host and status statistics, flag slow requests, and output summaries. +- **Deployment & Ops** – deploy releases, manage queue worker lifecycle, monitor health, and extract nightly payment data from Oracle. +- **Build & Configuration** – define Maven build, Spring scheduling, XML schema validation, and XSLT rendering for invoices. + +#### Key units +- **Perl** + - `LogDigest` (module): parses lines, aggregates counts, tracks slow requests. + - `log_digest.pl` (script): CLI driver, handles exclusions, outputs text/JSON. + - `top_n`, `parse_line`: helper functions for ranking and field extraction. +- **Shell** + - `deploy_release.sh`: packages, rsyncs, SSH‑deploys, restarts services, polls health. + - `healthcheck.sh`: POSIX wrapper for start/stop/restart/status/health of queue worker. + - `nightly_extract.ksh`: runs Oracle SQL, writes CSV, creates control file, gzips output. +- **XML** + - `invoice-service-pom.xml`: Maven project, Flyway migrations, PDF profile. + - `scheduler-context.xml`: Spring beans for reminder jobs, cron triggers. + - `shipment.xsd`: XML Schema for shipment notices. + - `statement-to-html.xsl`: XSLT stylesheet converting statements to HTML with highlighting. + +#### Data flow +1. **Log Analysis** – `log_digest.pl` reads files → `LogDigest->add` parses → aggregates → `summarize` → output. +2. **Deployment** – `deploy_release.sh` reads host list → rsync archive → SSH → extract → symlink → restart `orderd` → curl `/health`. +3. **Health Check** – `healthcheck.sh` reads PID/heartbeat → reports status/health. +4. **Extraction** – `nightly_extract.ksh` builds SQL → `sqlplus` → CSV → control file → gzip. +5. **Build & Scheduling** – Maven compiles → Flyway runs → Spring loads context → reminder job triggers via cron. +6. **Validation & Rendering** – External XML → validated by `shipment.xsd`; statements → transformed by `statement-to-html.xsl` to HTML. + +#### Dependencies +- **Perl**: `Getopt::Long`, `JSON::PP`, `List::Util`, `Carp`, `Exporter`. +- **Shell**: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `nohup`, `kill`, `sqlplus`, `gzip`. +- **XML**: Maven (`org.example.billing:billing-parent`, Flyway, Jackson, PostgreSQL, PDFBox), Spring (`task`, `context`, `beans`, HikariCP), XSD/XSLT 1.0. + +#### Cross-cutting +- Robust error handling (`set -euo pipefail`, `croak`, explicit exit codes). +- Configuration via environment variables and property placeholders. +- Consistent logging with timestamps. +- Retry logic in nightly extraction; heartbeat age and health poll timeouts in health checks. +- Parameterized XSLT and default values for XML namespaces and presentation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..a3fcdb1d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,68 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:14:31Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Provides a log‑digesting object for summarizing access logs. +- Offers helper `top_n` for ranking counts. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: `new`, `add`, `summarize`. + +#### Input +- `new(level => $level)` – `$level` must be one of `DEBUG`, `INFO`, `WARN`, `ERROR`; defaults to `WARN`. +- `add($line)` – expects a log line matching the regex in `parse_line`. +- `parse_line($line)` – parses a single log line; returns `undef` if format mismatches. + +#### Output +- `add` returns `1` on successful parse, `0` otherwise; dies if line count exceeds `MAX_LINES`. +- `summarize` returns a hashref: + - `generated` – UTC timestamp. + - `total` – total parsed lines. + - `hosts` – number of distinct hosts. + - `busiest` – max requests per host. + - `slow` – count of requests > `SLOW_REQUEST_MS`. + - `statuses` – hashref of status code counts. +- `top_n($counts, $n)` returns an array of the top `$n` keys sorted by count descending, then lexicographically. + +#### Core logic +- `new` validates log level, initializes counters. +- `parse_line` extracts host, time, method, path, status, millis via regex. +- `_normalize_host` lower‑cases host, strips trailing dot. +- `add` parses line, updates host and status counters, increments slow counter if millis > 1500 ms. +- `summarize` aggregates totals, computes busiest host, returns summary hashref. +- `top_n` sorts counts and slices top N. + +#### Subs +- `new(%args) -> object` – create digest with level. +- `parse_line($line) -> hashref|undef` – parse log line. +- `add($line) -> 1|0` – add parsed line to digest. +- `summarize() -> hashref` – produce summary. +- `top_n($counts, $n) -> array` – rank counts. +- `_normalize_host($host) -> host` – lower‑case, strip trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `%LEVEL_RANK = (DEBUG => 0, INFO => 1, WARN => 2, ERROR => 3)` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `croak` if unknown level in `new`. +- `croak` if more than `MAX_LINES` added in `add`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..9aa2819e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,80 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:14:37Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Reads web server logs, aggregates request counts per host, reports the busiest hosts and status‑code statistics, optionally outputting JSON. + +#### Purpose +- Command‑line tool to analyze access logs. +- Produces host‑level request summaries and status‑code tallies. + +#### Type +- Script. +- No package; procedural. +- Exports none. + +#### Input +- Options: + - `--top|n=i` → `$top` (default `10`). + - `--level=s` → `$level` (default `'WARN'`). + - `--json!` → `$as_json` (default `0`). + - `--exclude-host=s` → `@exclude_hosts` (multiple allowed). + - `--help|h` → prints usage. +- Positional arguments: `FILE...` (log files). +- Environment: + - `LOG_DIGEST_CONFIG` → `$config_file` (default `'/etc/log-digest.conf'`). +- Files read: + - `$config_file` (alias mapping). + - Each `FILE` from `@ARGV`. + +#### Output +- If `$as_json`: JSON string of `$summary` (canonical order) followed by newline. +- Else: plain text: + - One line: `" requests from hosts, slow"`. + - Followed by `` lines of host summaries from `top_n`. +- Exit status: `0` on success, non‑zero on error. + +#### Core logic +- Load host aliases from config file into `%aliases`. +- Build `%excluded` hash from `@exclude_hosts`. +- Create `LogDigest` object with `level => $level`. +- For each input file: + - Read line by line. + - Extract `$host` (first field). + - Skip if `$host` (or its alias) is in `%excluded`. + - Pass raw log line to `$digest->add`. +- After all files: + - `$summary = $digest->summarize`. + - Output JSON or formatted text as described. + +#### Subs +- `usage() -> string` + Returns usage message. +- `read_aliases($path) -> %aliases` + Parses `key = value` lines, ignores comments/blank. +- `main() -> 0` + Orchestrates parsing, digesting, and output. + +#### Constants and configuration +- `$config_file = $ENV{LOG_DIGEST_CONFIG} // '/etc/log-digest.conf'`. +- `$top = 10`. +- `$level = 'WARN'`. +- `$as_json = 0`. +- `@exclude_hosts = ()`. + +#### Dependencies +- `FindBin` – `$Bin`. +- `Getopt::Long` – `GetOptions`. +- `JSON::PP` – `->new->canonical->encode`. +- `LogDigest` – `new`, `add`, `summarize`, `hosts` (hash), `top_n`. + +#### Exceptions / Errors +- `die usage()` if `GetOptions` fails. +- `die "--top must be positive\n"` if `$top < 1`. +- `die "cannot read $file: $!\n"` when opening a log file fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..994fc801 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,42 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:15:27Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> A Perl toolkit that parses web‑server access logs, aggregates per‑host and per‑status statistics, and reports the busiest hosts and slow requests. + +#### Purpose +- Summarize access logs into host‑level counts and status‑code tallies. +- Provide a CLI for quick reporting, optionally in JSON. + +#### Responsibilities +- **Log parsing & aggregation** – `LogDigest` parses individual log lines, normalizes hosts, tracks counts, and flags slow requests. +- **Reporting** – `log_digest.pl` orchestrates file reading, applies host exclusions, and formats output (plain text or JSON). +- **Utility helpers** – `top_n` ranks counts; `parse_line` extracts fields via regex. + +#### Key units +- **LogDigest** (module) – OO interface: `new`, `add`, `summarize`, `top_n`; exports `parse_line`. +- **log_digest.pl** (script) – command‑line driver: `main`, `usage`, `read_aliases`. + +#### Data flow +1. `log_digest.pl` loads host aliases and exclusions. +2. For each log file, each line is passed to `LogDigest->add`. +3. `LogDigest` parses the line, updates host/status counters, and tracks slow requests. +4. After all files, `summarize` produces a hashref of totals, busiest host, slow count, and status counts. +5. `log_digest.pl` outputs the summary as text or JSON. + +#### Dependencies +- **Internal**: `LogDigest` module, `top_n`, `parse_line`. +- **External**: `Getopt::Long`, `JSON::PP`, `FindBin`, `POSIX`, `List::Util`, `Carp`, `Exporter`. + +#### Cross-cutting +- Host normalization (`_normalize_host`) ensures consistent counting. +- Error handling via `croak` for invalid levels or exceeding `MAX_LINES`. +- Configurable log level (`DEBUG`, `INFO`, `WARN`, `ERROR`) influences verbosity (not shown in summaries but present in module). +- JSON output uses canonical ordering for reproducibility. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..5bcd4c91 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,81 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:14:42Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploys a specified release to all hosts in an environment. +- Runs sequentially; stops on first health failure. +- Can perform a dry‑run. + +#### Type +- Bash (`#!/usr/bin/env bash`) +- Strict mode: `set -euo pipefail` + +#### Input +- Options parsed with `getopts`: + - `-e ` → `ENVIRONMENT` + - `-t ` → `TAG` + - `-n` → `DRY_RUN=1` + - `-p ` → ignored (logged) + - `-h` → prints usage +- Environment variables: + - `DEPLOY_USER` (default `deploy`) + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`) +- Files read: + - `$SCRIPT_DIR/${HOST_FILES[$ENVIRONMENT]}` (hosts list) + - `build/$TAG.tar.gz` (release archive) + +#### Output +- Copies `build/$TAG.tar.gz` to `/tmp/` on each host via `rsync`. +- Extracts archive to `$RELEASE_ROOT/$TAG`, updates `$RELEASE_ROOT/current` symlink. +- Restarts `orderd` service with `systemctl`. +- Checks health at `http://$host:8080/health`; exits on failure. +- Logs actions to stderr. +- Creates and removes `/tmp/deploy_release.$$.lock` on exit. + +#### Core logic +- Parse options → set `ENVIRONMENT`, `TAG`, `DRY_RUN`. +- Verify prerequisites (`rsync`, `ssh`, `curl`, SSH key). +- Load host list from environment‑specific file. +- For each host: + - If dry‑run: log intended action. + - Else: `rsync` archive, SSH into host to extract, symlink, restart service. + - Wait for health endpoint; fail if timeout. + - Log successful deployment. + +#### Functions +- `log` – prints timestamped message to stderr. +- `die` – logs error and exits. +- `usage` – prints usage comment from script header. +- `check_prereqs` – ensures required tools and SSH key exist. +- `load_hosts` – reads host file into `HOSTS` array. +- `deploy_host` – performs rsync, extraction, restart, health check. +- `wait_healthy` – polls health endpoint until success or timeout. +- `cleanup` – removes temporary lock file on exit. + +#### Constants and configuration +- `SCRIPT_DIR` – script directory. +- `DEPLOY_USER` – `deploy` +- `SSH_KEY` – `$HOME/.ssh/deploy_ed25519` +- `RELEASE_ROOT` – `/opt/releases` +- `SERVICE_NAME` – `orderd` +- `HEALTH_TIMEOUT` – `30` +- `HOST_FILES` – associative array mapping `staging` → `hosts.staging`, `production` → `hosts.production` + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `mkdir`, `ln`, `rm`. +- Host files: `hosts.staging`, `hosts.production`. +- Release archive: `build/.tar.gz`. + +#### Errors and exit codes +- `die` exits with status `1` for missing tools, unreadable SSH key, empty host list, or health timeout. +- `getopts` errors exit with status `1` or `2` for missing arguments or unknown options. +- `wait_healthy` exits with `1` if health check fails after `HEALTH_TIMEOUT` seconds. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..74f0ba8f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,65 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:14:55Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> A POSIX‑style wrapper to control a queue worker and report its health via PID and heartbeat files. + +#### Purpose +- Manages a queue worker process: `start`, `stop`, `restart`, `status`, `health`. +- Intended to be run directly as a command. + +#### Type +- `sh` (POSIX sh) with no strict mode flags. + +#### Input +- `$1` command (`start`, `stop`, `restart`, `status`, `health`). +- Environment variables: + - `PID_FILE` (default `/run/queue-worker.pid`). + - `HEARTBEAT_FILE` (default `/var/lib/queue-worker/heartbeat`). +- No options parsed; uses a `case` on `$1`. + +#### Output +- Writes PID to `PID_FILE` when starting. +- Removes `PID_FILE` when stopping. +- Prints status messages to stdout or stderr. +- Exits with codes: `0` (OK), `1` (WARNING), `2` (CRITICAL), `3` (stopped), `64` (usage error). + +#### Core logic +- `is_running`: checks existence of `PID_FILE` and liveness of PID. +- `heartbeat_age`: computes seconds since last modification of `HEARTBEAT_FILE`. +- `start_worker`: starts `WORKER_BIN` with `--heartbeat`, records PID. +- `stop_worker`: kills PID and removes `PID_FILE`. +- `case` dispatch: + - `start`: invoke `start_worker`. + - `stop`: invoke `stop_worker`. + - `restart`: stop then start. + - `status`: report `running` or `stopped`. + - `health`: verify running and heartbeat age against `MAX_HEARTBEAT_AGE` (120 s). + +#### Functions +- `is_running`: check if worker process is alive. +- `heartbeat_age`: calculate heartbeat staleness. +- `start_worker`: launch worker and record PID. +- `stop_worker`: terminate worker and clean PID file. + +#### Constants and configuration +- `PID_FILE`=`/run/queue-worker.pid` +- `HEARTBEAT_FILE`=`/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE`=`120` +- `WORKER_BIN`=`/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `nohup`, `kill`, `cat`, `date`, `stat`, `echo`. +- `WORKER_BIN` executable (`/usr/local/bin/queue-worker`) which accepts `--heartbeat`. + +#### Errors and exit codes +- `exit 64`: usage error for unknown command. +- `exit 2`: worker not running during `health`. +- `exit 1`: heartbeat older than `MAX_HEARTBEAT_AGE`. +- `exit 3`: `status` reports stopped. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..87918c84 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,71 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:15:01Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, creates a row‑count control file, and gzips the result. + +#### Purpose +- Runs nightly to export settled payments. +- Executed directly (not sourced). + +#### Type +- `ksh93` (shebang `#!/bin/ksh93`). +- Uses `set -e`? none; relies on `whence -q` and explicit exits. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → variable `business_day`. + - `-o

` → variable `export_dir`. +- Environment variables read: + - `ORACLE_SID` (default `PAYPRD`). + - `NLS_LANG` set to `AMERICAN_AMERICA.AL32UTF8`. +- No other files read. + +#### Output +- Creates `payments_.csv` in `export_dir`. +- Creates control file `payments_.ctl` with row count. +- Gzips the CSV to `payments_.csv.gz`. +- Prints log messages to stderr. +- Exits with status 0 on success, 1–4 on various failures. + +#### Core logic +- Parse options; set defaults. +- Ensure `export_dir` exists. +- Build CSV path. +- Retry loop (max 3 attempts): + - Run `run_export` to spool SQL query output to CSV. + - If successful, write control file, gzip CSV, log success, exit. + - On failure, log, sleep 60, retry. +- On exhausting retries, call `fail` with exit code 4. + +#### Functions +- `log` – prints timestamped message to stderr. +- `fail` – logs failure and exits with given code. +- `require_tools` – checks for `sqlplus` and `gzip`. +- `run_export` – runs SQL query via `sqlplus`, writes to given file. +- `write_control` – counts rows in CSV, writes control file. + +#### Constants and configuration +- ``ORACLE_SID_DEFAULT=PAYPRD`` +- ``EXPORT_DIR_DEFAULT=/data/export/payments`` +- ``MAX_RETRIES=3`` +- ``attempt=0`` +- ``business_day=$(date +%Y%m%d)`` +- ``export_dir=$EXPORT_DIR_DEFAULT`` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle connection: `CONNECT / AS SYSDBA` (no credentials in script). +- SQL query reads table `settled_payment`. + +#### Errors and exit codes +- `fail` with code 1: generic failure. +- `fail` with code 2: usage error. +- `fail` with code 3: missing required tool. +- `fail` with code 4: exceeded retry limit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..09c5031b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,47 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:15:32Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates deployment, health monitoring, and nightly data extraction for a payment processing service. + +#### Purpose +- Deploy release tarballs to multiple hosts, restart services, and verify health. +- Control a queue worker process and expose its health status. +- Export settled payments from Oracle to CSV, create control files, and compress output. + +#### Responsibilities +- **Deployment**: `deploy_release.sh` handles packaging, distribution, service restart, and health checks across environments. +- **Process Management**: `healthcheck.sh` starts, stops, restarts, and reports status/health of a queue worker. +- **Data Extraction**: `nightly_extract.ksh` queries Oracle for settled payments, writes CSV, creates control files, and gzips the result. + +#### Key units +- `deploy_release.sh` – orchestrates host‑by‑host deployment, uses `rsync`, `ssh`, `systemctl`, and `curl` for health polling. +- `healthcheck.sh` – POSIX shell wrapper exposing `start|stop|restart|status|health`; manages PID and heartbeat files. +- `nightly_extract.ksh` – KSH script that runs a SQL query via `sqlplus`, writes CSV, counts rows, and gzips the file. + +#### Data flow +1. **Deployment**: script reads environment‑specific host list → rsync archive → SSH to host → extract → symlink → restart `orderd` → poll `/health` endpoint. +2. **Health check**: worker binary (`/usr/local/bin/queue-worker`) writes heartbeat; script reads PID and heartbeat age to determine health. +3. **Extraction**: script builds SQL query → runs via `sqlplus` → writes CSV → counts rows → writes control file → gzips CSV. + +#### Dependencies +- External utilities: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `nohup`, `kill`, `sqlplus`, `gzip`. +- Host files: `hosts.staging`, `hosts.production`. +- Release archives: `build/.tar.gz`. +- Oracle connection: `CONNECT / AS SYSDBA` to `settled_payment` table. +- Config files: `PID_FILE`, `HEARTBEAT_FILE`, `WORKER_BIN`. + +#### Cross-cutting +- Strict error handling (`set -euo pipefail` in deployment, explicit exit codes in healthcheck). +- Logging via timestamped `log` functions. +- Use of environment variables for configuration (e.g., `DEPLOY_USER`, `SSH_KEY`, `ORACLE_SID`). +- Retry logic in nightly extraction (max 3 attempts with sleep). +- Health thresholds: 120 s heartbeat age, 30 s health poll timeout. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..c9448a07 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,58 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:15:07Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures the Maven build for the Invoice Service module, including dependencies, compiler settings, Flyway migrations, and a PDF generation profile. + +#### Purpose +- Defines build configuration for the Invoice Service. +- Specifies dependencies, compiler release, and Flyway migration settings. +- Provides a native‑PDF profile for PDF generation. + +#### Type +- Maven POM + Root element: `project` + Namespaces: + - `xmlns="http://maven.apache.org/POM/4.0.0"` + - `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release=17` + - `jackson.version=2.19.2` + - `flyway.version=11.4.0` + - `invoice.archive.dir=${project.build.directory}/archive` +- **Dependencies**: + - `com.fasterxml.jackson.core:jackson-databind:${jackson.version}` + - `org.flywaydb:flyway-core:${flyway.version}` + - `org.postgresql:postgresql` (runtime) + - `org.junit.jupiter:junit-jupiter` (test) + - `org.testcontainers:postgresql` (test) +- **Build Plugins**: + - `org.flywaydb:flyway-maven-plugin:${flyway.version}` with location `filesystem:src/main/resources/db/migration` + - `org.apache.maven.plugins:maven-surefire-plugin` with system property `invoice.archive.dir=${invoice.archive.dir}` +- **Profiles**: + - `native-pdf` adds dependency `org.apache.pdfbox:pdfbox:3.0.5` + +#### Configuration +- `maven.compiler.release` → `17` +- `invoice.archive.dir` → `${project.build.directory}/archive` +- Flyway plugin location → `filesystem:src/main/resources/db/migration` +- Surefire system property `invoice.archive.dir` → `${invoice.archive.dir}` + +#### Dependencies +- `org.example.billing:billing-parent:2.7.0` (parent) +- `com.fasterxml.jackson.core:jackson-databind:${jackson.version}` +- `org.flywaydb:flyway-core:${flyway.version}` +- `org.postgresql:postgresql` (runtime) +- `org.junit.jupiter:junit-jupiter` (test) +- `org.testcontainers:postgresql` (test) +- `org.apache.pdfbox:pdfbox:3.0.5` (native‑PDF profile) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..73151ebe --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,49 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:15:38Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides configuration and schema artifacts for an invoicing and reminder system, including build setup, scheduling, shipment validation, and statement rendering. + +#### Purpose +- Define Maven build and dependencies for the Invoice Service. +- Configure Spring components for reminder scheduling. +- Validate shipment notices via XML Schema. +- Transform account statements from XML to HTML. + +#### Responsibilities +- **Build & Deployment** – Maven POM with compiler, Flyway, PDF profile. +- **Scheduling** – Spring context wiring for reminder jobs and cron triggers. +- **Data Validation** – XSD for shipment notices. +- **Presentation** – XSLT for converting statements to HTML. + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, Flyway migration path, PDF profile. +- `scheduler-context.xml` – Spring beans: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, scheduler and cron trigger. +- `shipment.xsd` – `ShipmentNoticeType` schema with carrier codes, parcel weights, addresses, and notice metadata. +- `statement-to-html.xsl` – XSLT stylesheet with parameters `$currencySymbol`, `$highlightAbove`, templates for header, bookings, and total. + +#### Data flow +1. **Build**: Maven compiles code, runs Flyway migrations, optionally packages PDF generation. +2. **Scheduling**: Spring context loads data source → repository → job → scheduler → cron trigger → job executes, sending reminders via mail gateway. +3. **Shipment**: External system emits XML; `shipment.xsd` validates structure before processing. +4. **Statement**: XML statement is fed to `statement-to-html.xsl`, producing an HTML page with highlighted bookings. + +#### Dependencies +- Maven: `org.example.billing:billing-parent`, Jackson, Flyway, PostgreSQL, JUnit, Testcontainers, PDFBox (profile). +- Spring: `task`, `context`, `beans`; HikariCP; custom reminder classes (`JdbcReminderRepository`, `SmtpMailGateway`, `OverdueReminderJob`). +- XML: standard XSD namespace; XSLT 1.0. + +#### Cross-cutting +- Configuration via property placeholders (`reminder.properties`). +- Use of namespaces for XML (`urn:example:shipment:1`, `urn:example:statement`). +- Consistent use of default values (e.g., `country="DE"`, `$currencySymbol='EUR'`). +- Parameterized XSLT for threshold highlighting. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..b2a818d2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,46 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:15:12Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures a Spring context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled trigger. + +#### Purpose +- Wire components for reminder scheduling. +- Define data source, repository, mail gateway, job, and cron trigger. + +#### Type +- Spring context XML (`` root). +- Namespaces: `http://www.springframework.org/schema/beans` (default), `http://www.springframework.org/schema/context`, `http://www.springframework.org/schema/task`. + +#### Definitions +- **Property placeholder**: `reminder.properties`. +- **Component scan**: `org.example.reminder.web`. +- **Beans**: + - `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`): `jdbcUrl` `${reminder.db.url}`, `username` `${reminder.db.user}`, `maximumPoolSize` `8`. + - `reminderRepository` (`org.example.reminder.JdbcReminderRepository`): constructor `reminderDataSource`. + - `mailGateway` (`org.example.reminder.SmtpMailGateway`): `host` `${reminder.smtp.host}`, `port` `587`. + - `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`): constructor `reminderRepository`, `mailGateway`; property `graceDays` `14`. +- **Scheduler**: `reminderScheduler` (`task:scheduler`) with `pool-size` `2`. +- **Scheduled task**: `overdueReminderJob.sendDueReminders` cron `0 0 7 * * MON-FRI`. + +#### Configuration +- `reminder.db.url` – JDBC URL. +- `reminder.db.user` – DB username. +- `reminder.smtp.host` – SMTP host. +- `reminder.smtp.port` – `587`. +- `overdueReminderJob.graceDays` – `14`. +- Scheduler pool size – `2`. +- Cron expression – `0 0 7 * * MON-FRI`. + +#### Dependencies +- `com.zaxxer.hikari.HikariDataSource`. +- `org.example.reminder.JdbcReminderRepository`. +- `org.example.reminder.SmtpMailGateway`. +- `org.example.reminder.OverdueReminderJob`. +- Spring `task` and `context` modules. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..a3528bc2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,37 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:15:17Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Validates shipment notice documents. +- Enforces structure and value constraints for carrier codes, parcel weights, addresses, and shipment metadata. + +#### Type +- XML Schema (`xs:schema`). +- Root namespace: `urn:example:shipment:1`. +- Declared namespaces: `xs` (http://www.w3.org/2001/XMLSchema), `shp` (urn:example:shipment:1). + +#### Definitions +- **Element**: `shipmentNotice` of type `shp:ShipmentNoticeType`. +- **SimpleTypes**: + - `CarrierCode`: enumeration of `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: positive integer ≤ 31500. +- **ComplexTypes**: + - `ParcelType`: sequence of `trackingNumber` (`xs:string`) and `weight` (`shp:WeightGrams`); required attribute `sequence` (`xs:positiveInteger`). + - `AddressType`: sequence of `name`, `street`, `postalCode`, `city` (`xs:string`); optional `country` (`xs:string`, default `DE`). + - `ShipmentNoticeType`: sequence of `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one or more `parcel` (`shp:ParcelType`); required attribute `noticeId` (`xs:ID`). + +#### Configuration +- `elementFormDefault="qualified"`: all elements must be namespace-qualified. +- `country` attribute default: `"DE"`. + +#### Dependencies +- Relies on standard XML Schema namespace `http://www.w3.org/2001/XMLSchema`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..b087ace8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,39 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:15:20Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a monthly account statement XML into an HTML page with header, booking rows, and total. + +#### Purpose +- Render statement as HTML. +- Highlight bookings above a threshold. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespace: `xmlns:xsl="http://www.w3.org/1999/XSL/Transform"`, `xmlns:st="urn:example:statement"`. + +#### Definitions +- **Parameters** + - `$currencySymbol` (`'EUR'`) + - `$highlightAbove` (`1000`) +- **Key** + - `bookingsByDay`: matches `st:booking`, uses `st:valueDate`. +- **Templates** + - `match="/st:statement"`: builds `` with header, table, total. + - `name="statementHeader"`: outputs `

` with `st:accountNumber` and period. + - `match="st:booking"`: outputs ``; adds `class="large"` if `st:amount > $highlightAbove`; columns: `st:valueDate`, `st:purpose`, formatted `st:amount` + `$currencySymbol`. + - `name="statementTotal"`: outputs total of all `st:booking/st:amount`. + +#### Configuration +- Output method: `html`, encoding `UTF-8`, indent `yes`. +- `$currencySymbol` default `'EUR'`. +- `$highlightAbove` default `1000`. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: `statement`, `accountNumber`, `period`, `booking`, `valueDate`, `purpose`, `amount`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..cd7c5687 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,55 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:15:48Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A toolkit that parses web logs, automates deployment and health monitoring for a payment service, and supplies build, scheduling, validation, and rendering assets for an invoicing system. + +#### Purpose +- Provide utilities for log analysis, deployment automation, and invoicing configuration. +- Enable quick reporting, reliable service management, and consistent data validation/rendering. + +#### Responsibilities +- **Log Processing** – parse access logs, aggregate host and status statistics, flag slow requests, and output summaries. +- **Deployment & Ops** – deploy releases, manage queue worker lifecycle, monitor health, and extract nightly payment data from Oracle. +- **Build & Configuration** – define Maven build, Spring scheduling, XML schema validation, and XSLT rendering for invoices. + +#### Key units +- **Perl** + - `LogDigest` (module): parses lines, aggregates counts, tracks slow requests. + - `log_digest.pl` (script): CLI driver, handles exclusions, outputs text/JSON. + - Helper functions: `top_n`, `parse_line`. +- **Shell** + - `deploy_release.sh`: packages, rsyncs, SSH‑deploys, restarts services, polls health. + - `healthcheck.sh`: POSIX wrapper for start/stop/restart/status/health of queue worker. + - `nightly_extract.ksh`: runs Oracle SQL, writes CSV, creates control file, gzips output. +- **XML** + - `invoice-service-pom.xml`: Maven project, Flyway migrations, PDF profile. + - `scheduler-context.xml`: Spring beans for reminder jobs, cron triggers. + - `shipment.xsd`: XML Schema for shipment notices. + - `statement-to-html.xsl`: XSLT stylesheet converting statements to HTML with highlighting. + +#### Data flow +1. **Log Analysis** – `log_digest.pl` → `LogDigest->add` → aggregates → `summarize` → output. +2. **Deployment** – `deploy_release.sh` → rsync → SSH → extract → symlink → restart `orderd` → curl `/health`. +3. **Health Check** – `healthcheck.sh` reads PID/heartbeat → reports status/health. +4. **Extraction** – `nightly_extract.ksh` builds SQL → `sqlplus` → CSV → control file → gzip. +5. **Build & Scheduling** – Maven compiles → Flyway runs → Spring loads context → reminder job triggers via cron. +6. **Validation & Rendering** – External XML → validated by `shipment.xsd`; statements → transformed by `statement-to-html.xsl` to HTML. + +#### Dependencies +- **Perl**: `Getopt::Long`, `JSON::PP`, `List::Util`, `Carp`, `Exporter`. +- **Shell**: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `nohup`, `kill`, `sqlplus`, `gzip`. +- **XML**: Maven (`org.example.billing:billing-parent`, Flyway, Jackson, PostgreSQL, PDFBox), Spring (`task`, `context`, `beans`, HikariCP), XSD/XSLT 1.0. + +#### Cross-cutting +- Robust error handling (`set -euo pipefail`, `croak`, explicit exit codes). +- Configuration via environment variables and property placeholders. +- Consistent logging with timestamps. +- Retry logic in nightly extraction; heartbeat age and health poll timeouts in health checks. +- Parameterized XSLT and default values for XML namespaces and presentation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..83c49704 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run1/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: FB38AAFC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:15:58Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project centers on a payment and invoicing platform, with a core toolkit that parses web logs, automates deployment, and monitors health for the payment service while also providing build, scheduling, validation, and rendering assets for invoicing. Supporting this core, Perl utilities aggregate access‑log statistics to identify heavy hosts and slow requests, and shell scripts automate nightly data extraction and deployment tasks. XML configuration artifacts supply schemas and build setup for invoicing, reminders, shipment validation, and statement rendering, tying the various subsystems together into a cohesive workflow. + +#### Packages +- other — A collection of tooling and configuration artifacts that parse web logs, automate deployment and health checks for a payment service, and supply build, scheduling, validation, and presentation assets for an invoicing system. +- other/perl — A Perl toolkit that parses web‑server access logs, aggregates per‑host and per‑status statistics, and reports the busiest hosts and slow requests. +- other/shell — Automates deployment, health monitoring, and nightly data extraction for a payment processing service. +- other/xml — Provides configuration and schema artifacts for an invoicing and reminder system, including build setup, scheduling, shipment validation, and statement rendering. +- . — A toolkit that parses web logs, automates deployment and health monitoring for a payment service, and supplies build, scheduling, validation, and rendering assets for an invoicing system. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/meta/gpt-6-luna.json new file mode 100644 index 00000000..fbb4d97e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/meta/gpt-6-luna.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:16:00Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 72.2, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 39.0, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.8, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:17:54Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 15507, + "cachedPromptTokens": 15480, + "completionTokens": 6865, + "seconds": 71.5897646 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.00359, + "costUsd": 0.003538, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/meta/gpt-oss-20b.json new file mode 100644 index 00000000..370e1c56 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:17:55Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 29.5, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 21.3, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 39.5, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:19:25Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16083, + "cachedPromptTokens": 10224, + "completionTokens": 5154, + "seconds": 28.9312546 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.001153, + "costUsd": 0.004846, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..96bf2223 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,49 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:17:35Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> Supports billing and commerce operations through access-log analytics, release and worker operations, payment exports, and XML-defined build, scheduling, validation, and statement rendering. + +#### Purpose +- Provides operational tools for monitoring web access, deploying and managing services, and exporting settled payments. +- Defines build and application configuration plus XML contracts and presentation rules for billing, reminders, shipments, and statements. + +#### Responsibilities +- **Access-log analytics (`perl/`):** Parses and aggregates host, request, HTTP-status, and slow-request statistics; supports configurable aliases, exclusions, and text or JSON reporting. +- **Service operations (`shell/`):** Deploys tagged `orderd` releases across staging or production hosts, manages queue-worker lifecycle and heartbeat checks, and exports settled payments to compressed CSV with a control file. +- **Billing and document configuration (`xml/`):** Configures the invoice-service Maven build and weekday overdue-reminder job; defines shipment-notice validation and transforms account statements into HTML. + +#### Key units +- `LogDigest`, `parse_line`, `top_n`, `summarize` — access-log parsing, aggregation, and summary generation. +- `log_digest.pl::main`, `read_aliases` — CLI orchestration and host-alias configuration. +- `deploy_host`, `wait_healthy`, `load_hosts` — staged release installation and per-host health verification. +- `is_running`, `start_worker`, `stop_worker`, `heartbeat_age` — queue-worker lifecycle and health reporting. +- `run_export`, `write_control` — settled-payment extraction and export metadata. +- `invoice-service` — Maven project `org.example.billing:invoice-service:2.7.0`, including Flyway setup and optional PDFBox profile. +- `scheduler-context.xml` — Spring wiring and weekday scheduling of `OverdueReminderJob.sendDueReminders`. +- `shipmentNotice`, `ShipmentNoticeType`, `CarrierCode`, `WeightGrams` — shipment XML structure and validation constraints. +- `/st:statement`, `statementHeader`, `statementTotal` — XSLT rendering of statement details, bookings, and totals. + +#### Data flow +- Access logs pass through alias resolution and exclusions into `LogDigest`; aggregated results are rendered as text or canonical JSON. +- Deployment options select a host inventory and release archive; hosts receive the release, switch the `current` symlink, restart `orderd`, and undergo HTTP health checks. +- Worker commands manage the process using PID and heartbeat files; payment exports query `settled_payment`, write a CSV and control file, then gzip the CSV. +- Spring loads reminder settings and wires database and SMTP components to the scheduled job; shipment documents are validated against an XSD, while statement XML is transformed to HTML. + +#### Dependencies +- Perl reporting uses `Getopt::Long`, `JSON::PP`, `FindBin`, and `LogDigest`; alias configuration comes from `LOG_DIGEST_CONFIG`. +- Shell operations use `lib/common.sh`, `rsync`, `ssh`, `sudo systemctl`, `curl`, `/usr/local/bin/queue-worker`, and Oracle `sqlplus`; deployment uses staging and production host inventories. +- XML build configuration depends on the billing parent POM, Jackson, Flyway, PostgreSQL, JUnit, Testcontainers, and optional PDFBox; reminder wiring uses `reminder.properties`, HikariCP, `JdbcReminderRepository`, and `SmtpMailGateway`. + +#### Cross-cutting +- Access-log aggregation caps input at 50,000 lines and counts requests slower than 1,500 ms; hostnames are lowercased and stripped of one trailing dot. +- Deployment stops on the first host failure; payment export retries failures up to three times; worker health checks use a 120-second heartbeat limit. +- XML configuration uses Maven properties, Spring placeholders, XSD restrictions, and XSLT parameters; reminder pools are capped at 8 database connections and 2 scheduler threads. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..623e5def --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,67 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:16:01Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Aggregates web-server access-log entries into per-host, per-status, busiest-host, and slow-request counts. + +#### Purpose +- Provides access-log parsing and aggregation for host and HTTP status statistics. +- Tracks requests exceeding a fixed duration threshold and produces a timestamped summary. + +#### Type +- Module; package `LogDigest`. +- Exports `parse_line` and `top_n` via `@EXPORT_OK`. +- Procedural functions plus object-oriented aggregation through `new`. + +#### Input +- `new` accepts named arguments; `level` sets the log level, defaulting to `DEFAULT_LEVEL`. +- `add` accepts a log line as a string; no file or handle is read by the module. +- No command-line options or `%ENV` keys. + +#### Output +- `parse_line` returns a hash reference with `host`, `time`, `method`, `path`, `status`, and `millis`, or false for a non-matching line. +- `add` returns `1` for a parsed line, `0` for a non-matching line. +- `summarize` returns a hash reference containing `generated`, `total`, `hosts`, `busiest`, `slow`, and a copied `statuses` hash. +- `top_n` returns keys sorted by descending count, then alphabetically. +- No printed output, files written, or explicit exit statuses. + +#### Core logic +- `new` validates the configured level and initializes host/status counts, slow-request count, and line count. +- `parse_line` matches a combined-style access-log line with a three-digit status and numeric duration; normalizes the host before returning parsed fields. +- `add` increments the line count, rejects input beyond `MAX_LINES`, ignores unparsable lines, and updates host, status, and slow-request counts. +- `summarize` computes total requests, distinct hosts, busiest-host count, slow requests, and status counts; stamps the result with current UTC time. +- `top_n` orders count keys by descending count and alphabetical tie-break, then selects up to `n` keys. +- `_normalize_host` lowercases the host and removes one trailing dot. + +#### Subs +- `new($class, %args) -> object` — validate level; initialize counters. +- `parse_line($line) -> hashref or false` — parse and normalize one log line. +- `add($self, $line) -> 1 or 0` — count a valid log entry. +- `summarize($self) -> hashref` — build aggregate statistics. +- `top_n($counts, $n) -> list` — return highest-count keys. +- `_normalize_host($host) -> string` — lowercase and trim trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50_000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `$VERSION = '1.4'` +- `@EXPORT_OK = qw(parse_line top_n)` +- `%LEVEL_RANK`: `DEBUG => 0`, `INFO => 1`, `WARN => 2`, `ERROR => 3` + +#### Dependencies +- `strict`, `warnings` — enable strict checks and warnings. +- `POSIX`: imports `strftime`. +- `List::Util`: imports `max`, `sum`. +- `Carp`: imports `croak`. +- `parent`: inherits from `Exporter`. + +#### Exceptions / Errors +- `new` croaks with `unknown level ''` when `level` is not in `%LEVEL_RANK`. +- `add` croaks with `more than 50000 lines` when the line count exceeds `MAX_LINES`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..d66ae14d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/perl/log_digest.pl.ai.md @@ -0,0 +1,63 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:16:09Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Summarizes access-log requests by host and status, reporting busiest hosts and aggregate counts as text or JSON. + +#### Purpose +- Command-line tool for digesting access logs with configurable host aliases and exclusions. +- Reports total requests, distinct hosts, slow requests, and top hosts. + +#### Type +- Script; no package declaration; procedural. +- Imports `top_n` from `LogDigest`; no object construction in this script, though it uses a `LogDigest` object. + +#### Input +- Options: `--top` / `-n` sets `$top`; `--level` sets `$level`; `--json` / `--nojson` sets `$as_json`; repeatable `--exclude-host` sets `@exclude_hosts`; `--help` / `-h` prints usage and exits. +- Remaining `@ARGV` entries are access-log file paths; each file is read line by line. +- `%ENV`: `LOG_DIGEST_CONFIG`, default `/etc/log-digest.conf`; config lines supply host aliases as `from=to`. +- Config and log files are opened for reading; no standard input read. + +#### Output +- Text mode: request, host, and slow counts; then one top-host entry per line from `top_n`. +- JSON mode: canonical JSON encoding of the summary, followed by a newline. +- Exit status: `main` returns `0`; help exits `0`. Invalid option parsing or nonpositive `$top` dies. + +#### Core logic +- Load aliases from the configured file; missing/unreadable config yields an empty alias map. +- Build an exclusion lookup from `@exclude_hosts`. +- Create `LogDigest` with the selected `level`. +- For each input file, read lines, extract the first space-delimited field as host, resolve its alias, and skip excluded hosts. +- Add remaining lines to the digest, then summarize it. +- Emit canonical JSON or print aggregate counts and `top_n` results. + +#### Subs +- `usage() -> string` — Return command usage text. +- `read_aliases($path) -> hash` — Read host aliases from config. +- `main() -> 0` — Process logs and print digest. + +#### Constants and configuration +- `$config_file` — `LOG_DIGEST_CONFIG` or `/etc/log-digest.conf`. +- `$top` — Default `10`. +- `$level` — Default `'WARN'`. +- `$as_json` — Default `0`. +- `@exclude_hosts` — Initially empty. + +#### Dependencies +- `strict`, `warnings` — Enable compile-time and runtime checks. +- `FindBin` — Imports `$Bin`. +- `Getopt::Long` — Imports `GetOptions`. +- `JSON::PP` — Uses `new`, `canonical`, and `encode`. +- `LogDigest` — Imports `top_n`; calls `new`, `add`, and `summarize`. + +#### Exceptions / Errors +- `GetOptions` failure dies with usage text. +- `$top < 1` dies with `--top must be positive`. +- Failure to open a log file dies with `cannot read $file: $!`. +- Failure to open the alias config is handled by returning an empty alias map. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/perl/package.ai.md new file mode 100644 index 00000000..2ec90166 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/perl/package.ai.md @@ -0,0 +1,44 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:17:13Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Converts web-server access logs into host, HTTP-status, and slow-request statistics, with command-line reporting in text or JSON. + +#### Purpose +- Parse and aggregate combined-style access-log entries into request, host, status, busiest-host, and slow-request counts. +- Provide a CLI for processing log files with configurable host aliases, exclusions, top-host limits, and output format. + +#### Responsibilities +- **Parsing and aggregation:** Parse log lines, normalize hosts, enforce an input-line limit, and build summary statistics. +- **Log-file orchestration:** Read configured log files, apply aliases and host exclusions, and add eligible entries to the digest. +- **Reporting:** Emit aggregate counts and top hosts as text, or serialize the complete summary as canonical JSON. + +#### Key units +- `LogDigest`: Object-oriented accumulator for host, status, request, and slow-request counts. +- `parse_line`: Parses a combined-style log line into host, time, method, path, status, and duration fields. +- `top_n`: Sorts count keys by descending count with alphabetical tie-breaking. +- `summarize`: Produces a timestamped aggregate with totals, distinct hosts, busiest host, slow requests, and status counts. +- `log_digest.pl::read_aliases`: Reads `from=to` host mappings from the configured alias file. +- `log_digest.pl::main`: Parses CLI options, processes log files, and prints the digest. + +#### Data flow +- `log_digest.pl` reads aliases and log files, extracts each line’s first field for alias resolution and exclusion checks, then sends eligible lines to `LogDigest::add`. +- `LogDigest` parses and normalizes each line, updates counters for valid entries, and returns a summary; the script renders it as text or canonical JSON. +- `top_n` selects busiest hosts for text output; `--json` serializes the full summary. + +#### Dependencies +- `log_digest.pl` uses `LogDigest`, `Getopt::Long`, `JSON::PP`, and `FindBin`. +- `LogDigest` uses `Exporter`, `POSIX::strftime`, `List::Util`, and `Carp`. +- Alias configuration comes from `LOG_DIGEST_CONFIG`, defaulting to `/etc/log-digest.conf`; unreadable or missing configuration yields no aliases. + +#### Cross-cutting +- `LogDigest` defaults to level `WARN`, accepts configured levels from `DEBUG`, `INFO`, `WARN`, and `ERROR`, and rejects unknown levels. +- Aggregation stops with an error after more than `50,000` lines; requests slower than `1,500` ms count as slow. +- Host normalization lowercases names and removes one trailing dot; CLI aliases and exclusions are applied before aggregation. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..00fe619e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,79 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:16:17Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a tagged release tarball to each staging or production host in sequence, restarting `orderd` and stopping on the first failed health check. + +#### Purpose +- Rolls out one release to every host in the selected environment, one host at a time. +- Runs directly; sources `lib/common.sh`. + +#### Type +- Bash; strict mode: `set -euo pipefail`. + +#### Input +- Options parsed with `getopts ":e:t:np:h"`: + - `-e` sets `ENVIRONMENT` (`staging` or `production`). + - `-t` sets `TAG`. + - `-n` sets `DRY_RUN=1`. + - `-p` accepts a value but only logs that parallel deployment is unsupported. + - `-h` prints usage and exits. +- Environment variables: `DEPLOY_USER` defaults to `deploy`; `SSH_KEY` defaults to `$HOME/.ssh/deploy_ed25519`; reads `HOME`. +- Reads the selected `hosts.staging` or `hosts.production` file under `SCRIPT_DIR`, and `build/$TAG.tar.gz`. + +#### Output +- Logs timestamps and deployment messages to standard error. +- On real deployments, uploads the tarball to each host’s `/tmp/`, extracts it under `/opt/releases/$TAG`, updates `/opt/releases/current`, and restarts `orderd`. +- Removes `/tmp/deploy_release.$$.lock` on exit; this script does not create that lock file. +- Exit statuses: `0` for success or help; `1` for `die` failures; `2` when `-e` or `-t` is missing. With strict mode, failing commands may also terminate with their command status. + +#### Core logic +- Checks for `rsync`, `ssh`, and `curl`, and verifies that `SSH_KEY` is readable. +- Selects the host list for `ENVIRONMENT`, excludes lines beginning with `#`, and fails if no hosts remain. +- For each host, either logs the dry-run action or uploads `build/$TAG.tar.gz` using `rsync`. +- Runs remote commands over SSH to create the release directory, extract the tarball, update the `current` symlink, and restart the service with `sudo systemctl`. +- Polls `http://$host:8080/health` every two seconds until healthy; fails at the `HEALTH_TIMEOUT` limit. +- Logs successful deployment per host; stops on the first failure. + +#### Functions +- `log`: Timestamp and print a message. +- `die`: Log an error and exit with status 1. +- `usage`: Print the usage comment. +- `check_prereqs`: Check required commands and SSH key. +- `load_hosts`: Load hosts for the selected environment. +- `deploy_host`: Upload, install, restart, and check one host. +- `wait_healthy`: Poll a host’s health endpoint. +- `cleanup`: Remove the named temporary lock path. + +#### Constants and configuration +- `SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"`. +- `DEPLOY_USER="${DEPLOY_USER:-deploy}"`. +- `SSH_KEY="${SSH_KEY:-$HOME/.ssh/deploy_ed25519}"`. +- `RELEASE_ROOT="/opt/releases"` (exported). +- `SERVICE_NAME="orderd"`. +- `HEALTH_TIMEOUT=30`. +- `ENVIRONMENT=""`. +- `TAG=""`. +- `DRY_RUN=0`. +- `HOSTS=()`. +- `HOST_FILES=([staging]="hosts.staging" [production]="hosts.production")`. + +#### Dependencies +- Sourced file: `$SCRIPT_DIR/lib/common.sh`. +- External commands: `bash`, `cd`, `command`, `curl`, `date`, `grep`, `ln`, `mapfile`, `mkdir`, `rm`, `rsync`, `sed`, `sleep`, `ssh`, `sudo`, `systemctl`, `tar`. +- Hosts: entries in `hosts.staging` and `hosts.production`. +- Endpoint: `http://$host:8080/health`. +- Remote service: `orderd`, restarted through `sudo systemctl`. + +#### Errors and exit codes +- `die` exits `1` for missing tools, unreadable SSH key, unknown environment, empty host list, or a host unhealthy after the timeout. +- Missing `-e` or `-t` prints usage and exits `2`; `-h` prints usage and exits `0`. +- Unknown options and options missing values call `die`. +- Health checks retry every two seconds up to `HEALTH_TIMEOUT=30`. +- `EXIT` trap calls `cleanup`, which removes `/tmp/deploy_release.$$.lock`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..3a6fcff4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,61 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:16:29Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Manages the queue worker lifecycle and checks whether its heartbeat is recent enough to indicate worker health. + +#### Purpose +- Provides `start`, `stop`, `restart`, `status`, and `health` operations for the queue worker. +- Run directly as an init-style command wrapper. + +#### Type +- POSIX `sh`; no strict-mode settings (`set -e`, `set -u`, or `pipefail`). + +#### Input +- `$1`: operation name: `start`, `stop`, `restart`, `status`, or `health`; parsed by a `case` statement. +- Environment variables: `PID_FILE` defaults to `/run/queue-worker.pid`; `HEARTBEAT_FILE` defaults to `/var/lib/queue-worker/heartbeat`. +- Reads the PID file at `PID_FILE` and checks the heartbeat file at `HEARTBEAT_FILE`. + +#### Output +- Starts `/usr/local/bin/queue-worker` with `--heartbeat` and redirects its output to `/dev/null`; records its PID in `PID_FILE`. +- Removes `PID_FILE` after a successful `kill` in `stop`. +- Prints lifecycle and health messages, including `already running`, `running`, `stopped`, `CRITICAL: not running`, `WARNING: heartbeat Ns old`, `OK`, or usage text. +- Exit statuses: `0` for successful operations and healthy status; `1` for stale heartbeat; `2` when health check finds the worker stopped; `3` when `status` finds it stopped; `64` for an unrecognized operation. + +#### Core logic +- `start`: if `is_running` succeeds, prints `already running`; otherwise launches the worker with `nohup` in the background and writes `$!` to `PID_FILE`. +- `stop`: returns successfully if the worker is not running; otherwise sends `kill` to the PID from `PID_FILE` and removes the PID file on successful termination request. +- `restart`: runs `stop_worker`, then `start_worker`. +- `status`: prints `running` if the PID file identifies a live process; otherwise prints `stopped` and exits `3`. +- `health`: exits `2` with a critical message if the worker is not running; otherwise calculates heartbeat age, warns and exits `1` if it exceeds `MAX_HEARTBEAT_AGE`, or prints `OK`. + +#### Functions +- `is_running`: Checks PID file and process liveness. +- `heartbeat_age`: Computes heartbeat file age in seconds. +- `start_worker`: Launches worker and records its PID. +- `stop_worker`: Stops worker and removes PID file. + +#### Constants and configuration +- `PID_FILE="${PID_FILE:-/run/queue-worker.pid}"` +- `HEARTBEAT_FILE="${HEARTBEAT_FILE:-/var/lib/queue-worker/heartbeat}"` +- `MAX_HEARTBEAT_AGE=120` +- `WORKER_BIN=/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `cat`, `date`, `echo`, `kill`, `nohup`, `rm`, `stat`. +- Worker executable: `/usr/local/bin/queue-worker`, invoked with `--heartbeat`. +- Uses `/run/queue-worker.pid` by default for the PID file and `/var/lib/queue-worker/heartbeat` by default for the heartbeat file. + +#### Errors and exit codes +- `0`: Successful operation; `status` reports a running worker; `health` reports a fresh heartbeat. +- `1`: `health` finds heartbeat age greater than `MAX_HEARTBEAT_AGE`. +- `2`: `health` finds the worker is not running. +- `3`: `status` finds the worker is stopped. +- `64`: Unrecognized operation; prints usage to standard error. +- No traps, retries, or timeouts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..f9a4ac49 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,72 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:16:38Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Exports one business day of settled Oracle payments as a gzipped CSV with a neighboring row-count control file. + +#### Purpose +- Produces a daily settled-payments export for a selected business day. +- Runs directly as a nightly command-line script. + +#### Type +- `ksh93` (`#!/bin/ksh93`); no strict-mode settings. + +#### Input +- `-d YYYYMMDD` via `getopts`: sets `business_day`. +- `-o dir` via `getopts`: sets `export_dir`. +- `ORACLE_SID`: read from the environment; defaults to `PAYPRD`. +- Reads the `settled_payment` table in Oracle. +- Reads the current date via `date +%Y%m%d` when initializing `business_day`. + +#### Output +- Creates `export_dir` if absent. +- Writes `payments_.csv`, then compresses it to `.csv.gz`. +- Writes a sibling `.ctl` file containing `rows= business_day=`. +- Logs timestamped messages to standard error. +- Exits `0` on success; `1` by default for `fail`; `2` for usage errors; `3` for missing tools; `4` after export retries are exhausted. + +#### Core logic +- Parses `-d` and `-o`; shifts parsed arguments. Remaining arguments are not validated. +- Checks that `sqlplus` and `gzip` are available. +- Creates the export directory if needed; fails if creation fails. +- Builds the CSV path as `payments_.csv` under `export_dir`. +- Tries up to `MAX_RETRIES` times to run a silent `sqlplus` session, connecting as SYSDBA and selecting payment ID, account number, amount, and currency from `settled_payment` for the requested `business_day`. +- On success, counts CSV lines with `wc -l`, writes the control file, compresses the CSV with `gzip -f`, logs success, and exits. +- On each failed export, logs a retry message and sleeps 60 seconds; after the retry limit, fails with status `4`. + +#### Functions +- `log`: Timestamped stderr logging. +- `fail`: Logs failure and exits with a supplied or default status. +- `require_tools`: Checks required commands. +- `run_export`: Runs the Oracle query into the CSV. +- `write_control`: Writes the row-count control file. + +#### Constants and configuration +- `ORACLE_SID_DEFAULT=PAYPRD` +- `EXPORT_DIR_DEFAULT=/data/export/payments` +- `MAX_RETRIES=3` +- `attempt=0` +- `business_day=$(date +%Y%m%d)` +- `export_dir=$EXPORT_DIR_DEFAULT` +- `ORACLE_SID=${ORACLE_SID:-$ORACLE_SID_DEFAULT}` +- `NLS_LANG=AMERICAN_AMERICA.AL32UTF8` +- `opt` is set by `getopts` for each parsed option. +- `csv=$export_dir/payments_$business_day.csv` + +#### Dependencies +- External commands: `date`, `sqlplus`, `gzip`, `wc`, `mkdir`, `sleep`. +- Oracle SYSDBA connection; query reads `settled_payment`. + +#### Errors and exit codes +- `2`: unsupported option; logs the usage string. +- `3`: `sqlplus` or `gzip` is unavailable. +- `1`: directory creation failure, or any other `fail` call without an explicit status. +- `4`: all export attempts fail. +- Retries failed exports up to three times, sleeping 60 seconds after each failed attempt, including the last. +- No traps are defined. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/package.ai.md new file mode 100644 index 00000000..4c8dcb12 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/shell/package.ai.md @@ -0,0 +1,46 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:17:20Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates release deployment, queue-worker health management, and daily settled-payment exports for operational services. + +#### Purpose +- Provides command-line operations for deploying `orderd`, controlling and checking the queue worker, and exporting settled Oracle payments. +- Supports staged host rollout, heartbeat-based worker monitoring, and business-day payment delivery as compressed CSV with a control file. + +#### Responsibilities +- **Release deployment — `deploy_release.sh`:** Selects staging or production hosts, installs a tagged release, restarts `orderd`, and verifies each host’s health before proceeding. +- **Worker lifecycle and health — `healthcheck.sh`:** Starts, stops, restarts, and reports on the queue worker; checks heartbeat freshness. +- **Payment extraction — `nightly_extract.ksh`:** Queries `settled_payment` for a business day, writes and compresses a CSV, and emits a row-count control file. + +#### Key units +- `deploy_host`: Uploads and installs a release on one host, restarts the service, and checks health. +- `wait_healthy`: Polls `http://$host:8080/health` until healthy or the timeout is reached. +- `load_hosts`: Loads the selected `hosts.staging` or `hosts.production` list. +- `is_running`: Determines queue-worker liveness from its PID file and process state. +- `start_worker` / `stop_worker`: Launch the queue worker and record its PID, or signal it and remove the PID file. +- `heartbeat_age`: Computes the age of the worker heartbeat for health reporting. +- `run_export`: Runs the Oracle payment query for the selected business day. +- `write_control`: Writes the export row count and business day to the `.ctl` file. + +#### Data flow +- **Deployment:** Environment and tag options select a host list and release tarball; each host receives the archive, extracts it under `/opt/releases`, switches the `current` symlink, restarts `orderd`, and undergoes an HTTP health check. +- **Worker health:** Lifecycle commands use the PID file to identify and manage the worker; `health` additionally checks heartbeat age against the 120-second limit. +- **Payment export:** Business-day and output-directory options determine the Oracle query and destination; successful output is counted, recorded in a neighboring control file, then gzipped. + +#### Dependencies +- Deployment uses `lib/common.sh`, `rsync`, `ssh`, `sudo systemctl`, and `curl`; host inventories are `hosts.staging` and `hosts.production`. +- Worker management invokes `/usr/local/bin/queue-worker` and uses PID and heartbeat files, configurable through `PID_FILE` and `HEARTBEAT_FILE`. +- Payment extraction uses `sqlplus` with Oracle `ORACLE_SID` (default `PAYPRD`) and reads the `settled_payment` table; output uses `gzip` and `wc`. + +#### Cross-cutting +- These are directly invoked shell scripts: Bash with strict mode for deployment, POSIX `sh` for worker management, and `ksh93` for payment extraction. +- Each script has its own logging, configuration, and error conventions; deployment stops at the first host failure, while payment extraction retries failed exports up to three times. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..e9dff463 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,45 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:16:49Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Builds the `invoice-service` JAR for creating, numbering, and archiving customer invoices, with database migrations and optional PDF support. + +#### Purpose +- Defines the Maven build and dependencies for the invoice service. +- Configures Flyway migrations, test execution, and an optional PDFBox dependency. + +#### Type +- Maven POM; root element `project`. +- Namespaces: default `http://maven.apache.org/POM/4.0.0`; `xsi` = `http://www.w3.org/2001/XMLSchema-instance`. + +#### Definitions +- Coordinates: `org.example.billing:invoice-service:2.7.0`, packaging `jar`; parent `org.example.billing:billing-parent:2.7.0`. +- Properties: `maven.compiler.release` = `17`; `jackson.version` = `2.19.2`; `flyway.version` = `11.4.0`; `invoice.archive.dir` = `${project.build.directory}/archive`. +- Dependencies: + - `com.fasterxml.jackson.core:jackson-databind` — default scope (`compile`), version `${jackson.version}`. + - `org.flywaydb:flyway-core` — default scope (`compile`), version `${flyway.version}`. + - `org.postgresql:postgresql` — `runtime`. + - `org.junit.jupiter:junit-jupiter` — `test`. + - `org.testcontainers:postgresql` — `test`. +- Plugins: + - `flyway-maven-plugin` — version `${flyway.version}`; migration location `filesystem:src/main/resources/db/migration`. + - `maven-surefire-plugin` — sets system property `invoice.archive.dir` to `${invoice.archive.dir}`. +- Profile `native-pdf` — adds `org.apache.pdfbox:pdfbox` version `3.0.5`. + +#### Configuration +- Java compiler release: `17`. +- Flyway migration location: `filesystem:src/main/resources/db/migration`. +- Surefire system property `invoice.archive.dir`: `${invoice.archive.dir}`. +- Archive directory: `${project.build.directory}/archive`. +- `jackson.version`: `2.19.2`; `flyway.version`: `11.4.0`. + +#### Dependencies +- Parent POM: `org.example.billing:billing-parent:2.7.0`. +- Migration files: `src/main/resources/db/migration`. +- External libraries and test dependencies: Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL; profile-specific PDFBox. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/package.ai.md new file mode 100644 index 00000000..f881b085 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/package.ai.md @@ -0,0 +1,47 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:17:29Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Defines XML-based build, scheduling, validation, and presentation configuration for billing, reminders, shipments, and account statements. + +#### Purpose +- Packages the invoice service’s Maven build and configures weekday overdue-reminder delivery. +- Defines the XML contract for shipment notices and transforms account statements into HTML. + +#### Responsibilities +- **Invoice service build:** Java 17 Maven JAR configuration, dependencies, Flyway migration setup, archive directory, test configuration, and optional PDFBox profile. +- **Reminder scheduling:** Spring wiring for the reminder datasource, repository, SMTP gateway, overdue-reminder job, and weekday schedule. +- **Shipment validation:** XSD constraints for shipment identifiers, recipient addresses, carriers, and parcels. +- **Statement rendering:** XSLT templates for statement headers, booking rows, totals, currency display, and large-amount highlighting. + +#### Key units +- `invoice-service` — Maven project `org.example.billing:invoice-service:2.7.0`, with Flyway migrations and optional native PDF support. +- `scheduler-context.xml` — Spring context configuring `OverdueReminderJob.sendDueReminders` at 07:00 Monday–Friday. +- `shipmentNotice` / `ShipmentNoticeType` — shipment notice schema with order, dispatch, carrier, recipient, and one-or-more parcel details. +- `CarrierCode` / `WeightGrams` — schema restrictions for supported carriers and parcel weights up to 31,500 grams. +- `/st:statement` — XSLT template rendering statement details, booking rows, and total. +- `statementHeader`, `statementTotal` — named templates rendering account information and formatted booking sum. + +#### Data flow +- Spring loads reminder settings from `reminder.properties`, wires database and SMTP components into `OverdueReminderJob`, and schedules its due-reminder operation on weekdays. +- Shipment notice XML is validated against `urn:example:shipment:1`, including required identifiers and parcel constraints. +- Statement XML in `urn:example:statement` is transformed into HTML; booking amounts are formatted and values above `highlightAbove` receive the `large` class. + +#### Dependencies +- Invoice build: parent POM `org.example.billing:billing-parent:2.7.0`; Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, and profile-specific PDFBox. +- Reminder context: `reminder.properties`, HikariCP, `JdbcReminderRepository`, `SmtpMailGateway`, `OverdueReminderJob`, and scanned package `org.example.reminder.web`. +- Shipment schema uses XML Schema built-in types; statement stylesheet consumes statement elements in `urn:example:statement`. + +#### Cross-cutting +- Configuration is expressed through Maven properties, Spring property placeholders, XSD defaults and restrictions, and XSLT parameters. +- Reminder database connections use a Hikari pool capped at 8; the scheduler pool size is 2. +- Statement rendering defaults to `EUR`, highlights amounts above `1000`, and formats amounts as `#,##0.00`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..09a4030c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,45 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:16:55Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures the reminder service’s database access, SMTP delivery, and weekday morning overdue-reminder schedule. + +#### Purpose +- Wires the reminder repository and mail gateway into the overdue-reminder job. +- Schedules reminder delivery on weekdays. + +#### Type +- Spring application context; root element `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` `http://www.w3.org/2001/XMLSchema-instance`; `context` `http://www.springframework.org/schema/context`; `task` `http://www.springframework.org/schema/task`. + +#### Definitions +- Property placeholder loads `classpath:reminder.properties`; keys used: `reminder.db.url`, `reminder.db.user`, `reminder.smtp.host`. +- Component scan: `org.example.reminder.web`. +- Beans: + - `reminderDataSource`: `com.zaxxer.hikari.HikariDataSource`; destroy method `close`. + - `reminderRepository`: `org.example.reminder.JdbcReminderRepository`; constructor reference `reminderDataSource`. + - `mailGateway`: `org.example.reminder.SmtpMailGateway`. + - `overdueReminderJob`: `org.example.reminder.OverdueReminderJob`; constructor references `reminderRepository`, `mailGateway`. + - `reminderScheduler`: task scheduler. +- Scheduled task: `overdueReminderJob.sendDueReminders`, using `reminderScheduler`, cron `0 0 7 * * MON-FRI`. + +#### Configuration +- `reminderDataSource.jdbcUrl`: `${reminder.db.url}`. +- `reminderDataSource.username`: `${reminder.db.user}`. +- `reminderDataSource.maximumPoolSize`: `8`. +- `mailGateway.host`: `${reminder.smtp.host}`. +- `mailGateway.port`: `587`. +- `overdueReminderJob.graceDays`: `14`. +- `reminderScheduler.pool-size`: `2`. +- Schedule: `0 0 7 * * MON-FRI` (07:00, Monday–Friday). + +#### Dependencies +- `classpath:reminder.properties`. +- Classes: `com.zaxxer.hikari.HikariDataSource`, `org.example.reminder.JdbcReminderRepository`, `org.example.reminder.SmtpMailGateway`, `org.example.reminder.OverdueReminderJob`. +- Scanned package: `org.example.reminder.web`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..ecd84f06 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/shipment.xsd.ai.md @@ -0,0 +1,39 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:17:01Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the warehouse shipment notice exchanged when parcels leave the building, including carrier, recipient, and parcel data constraints. + +#### Purpose +- Validates shipment notices containing order and dispatch details, recipient address, and one or more parcels. +- Constrains carrier codes, parcel weights, and required identifiers. + +#### Type +- XML Schema; root `schema`. +- Namespaces: `xs` = `http://www.w3.org/2001/XMLSchema`; `shp` = `urn:example:shipment:1`. +- Target namespace: `urn:example:shipment:1`; `elementFormDefault="qualified"`. + +#### Definitions +- Top-level element: `shipmentNotice` of type `shp:ShipmentNoticeType`. +- Simple types: + - `CarrierCode`: restriction of `xs:string`; enumeration values `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: restriction of `xs:positiveInteger`; maximum inclusive `31500`. +- Complex types: + - `ParcelType`: sequence of `trackingNumber` (`xs:string`), `weight` (`shp:WeightGrams`); required `sequence` attribute of type `xs:positiveInteger`. + - `AddressType`: sequence of `name`, `street`, `postalCode`, `city`, and optional `country` (all `xs:string`; `country` defaults to `DE`). + - `ShipmentNoticeType`: sequence of `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one or more `parcel` (`shp:ParcelType`); required `noticeId` attribute of type `xs:ID`. + +#### Configuration +- `WeightGrams` maximum: `31500` grams, inclusive. +- `AddressType.country`: optional; default `DE`. +- `ShipmentNoticeType.noticeId` and `ParcelType.sequence`: required attributes. +- `ShipmentNoticeType.parcel`: minimum occurrence defaults to `1`; maximum is `unbounded`. + +#### Dependencies +- Uses XML Schema built-in types `xs:string`, `xs:positiveInteger`, `xs:dateTime`, and `xs:ID`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..8f13ec5f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,37 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:17:07Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a monthly account statement into an HTML page with account details, booking rows, and a formatted total. + +#### Purpose +- Renders statement period and account number, one row per booking, and the sum of booking amounts. +- Marks booking rows as `large` when their amount exceeds a configurable threshold. + +#### Type +- XSLT 1.0 stylesheet; root element `xsl:stylesheet`. +- Namespace: `xsl` = `http://www.w3.org/1999/XSL/Transform`; `st` = `urn:example:statement`. + +#### Definitions +- Templates: + - Match `/st:statement`: renders the HTML page, invokes `statementHeader` and `statementTotal`, and applies templates to `st:booking`. + - Named `statementHeader`: renders `st:accountNumber` and the statement `@period`. + - Match `st:booking`: renders value date, purpose, and formatted amount; assigns class `large` when the amount exceeds `$highlightAbove`. + - Named `statementTotal`: renders the formatted sum of `st:booking/st:amount`. +- Parameters: `currencySymbol` (default `EUR`); `highlightAbove` (default `1000`). +- Key: `bookingsByDay`, matching `st:booking`, indexed by `st:valueDate`. +- Output method: `html`, encoding `UTF-8`, `indent="yes"`. + +#### Configuration +- `currencySymbol` = `EUR`; appended to each displayed booking amount. +- `highlightAbove` = `1000`; booking amounts greater than this value receive class `large`. +- Amount format: `#,##0.00`. + +#### Dependencies +- Input statement elements in namespace `urn:example:statement`: `st:statement`, `st:accountNumber`, `st:booking`, `st:valueDate`, `st:purpose`, and `st:amount`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..e02b82e5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/package.ai.md @@ -0,0 +1,48 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:17:44Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> Provides operational tooling and document configuration for billing, payment processing, service operations, and commerce monitoring. + +#### Purpose +- Supports access-log analysis, service deployment and worker management, and settled-payment exports. +- Defines billing build and scheduling configuration, shipment validation, and statement rendering. + +#### Responsibilities +- **Log analytics:** Parses and aggregates access logs, with host aliases, exclusions, and text or JSON output. +- **Service operations:** Deploys `orderd` releases, manages queue-worker processes and health checks, and exports settled payments to compressed CSV. +- **Billing and documents:** Configures the invoice-service build and overdue-reminder schedule; validates shipment notices and transforms statement XML to HTML. + +#### Key units +- `LogDigest`, `parse_line`, `top_n`, `summarize` — parse and aggregate access-log data. +- `log_digest.pl::main`, `read_aliases` — coordinate reporting and load host aliases. +- `deploy_host`, `wait_healthy`, `load_hosts` — install releases and verify host health. +- `is_running`, `start_worker`, `stop_worker`, `heartbeat_age` — manage queue-worker lifecycle and report heartbeat status. +- `run_export`, `write_control` — export settled payments and write export metadata. +- `invoice-service` — Maven project `org.example.billing:invoice-service:2.7.0`, with Flyway configuration and an optional PDFBox profile. +- `scheduler-context.xml` — wires and schedules `OverdueReminderJob.sendDueReminders` on weekdays. +- `shipmentNotice`, `ShipmentNoticeType`, `CarrierCode`, `WeightGrams` — define shipment XML structure and validation constraints. +- `/st:statement`, `statementHeader`, `statementTotal` — render statement details, bookings, and totals. + +#### Data flow +- Access logs pass through alias resolution and exclusions into `LogDigest`, then produce text or canonical JSON summaries. +- Deployment selects a host inventory and release archive, installs the release, switches the `current` symlink, restarts `orderd`, and checks HTTP health. +- Worker commands use PID and heartbeat files; payment exports query `settled_payment`, write CSV and control metadata, then gzip the CSV. +- Spring loads reminder settings and connects database and SMTP components to the scheduled job; shipment XML is XSD-validated and statement XML is transformed to HTML. + +#### Dependencies +- Perl tooling uses `Getopt::Long`, `JSON::PP`, `FindBin`, and `LogDigest`; aliases are configured via `LOG_DIGEST_CONFIG`. +- Shell operations use `lib/common.sh`, `rsync`, `ssh`, `sudo systemctl`, `curl`, `/usr/local/bin/queue-worker`, and Oracle `sqlplus`. +- The Maven build depends on the billing parent POM, Jackson, Flyway, PostgreSQL, JUnit, Testcontainers, and optional PDFBox. +- Reminder wiring uses `reminder.properties`, HikariCP, `JdbcReminderRepository`, and `SmtpMailGateway`. + +#### Cross-cutting +- Access-log processing caps input at 50,000 lines, counts requests slower than 1,500 ms, and normalizes hostnames by lowercasing and removing one trailing dot. +- Deployment stops on the first host failure; payment export retries failures up to three times; worker health checks use a 120-second heartbeat limit. +- XML configuration uses Maven properties, Spring placeholders, XSD restrictions, and XSLT parameters; reminder resources are capped at 8 database connections and 2 scheduler threads. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..942469bf --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-6-luna/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 620A6BFB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:17:52Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project centers on operational tooling and document configuration for billing, payment processing, service operations, and commerce monitoring. Perl access-log analytics produce host, HTTP-status, and slow-request reports, while shell scripts handle deployments, queue-worker health, and settled-payment exports. XML configuration supports build and scheduling workflows, validation, and presentation of billing, reminders, shipments, and account statements. + +#### Packages +- other — Supports billing and commerce operations through access-log analytics, release and worker operations, payment exports, and XML-defined build, scheduling, validation, and statement rendering. +- other/perl — Converts web-server access logs into host, HTTP-status, and slow-request statistics, with command-line reporting in text or JSON. +- other/shell — Automates release deployment, queue-worker health management, and daily settled-payment exports for operational services. +- other/xml — Defines XML-based build, scheduling, validation, and presentation configuration for billing, reminders, shipments, and account statements. +- . — Provides operational tooling and document configuration for billing, payment processing, service operations, and commerce monitoring. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..3ba4819c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,58 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:36Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A multi‑language toolkit that aggregates web‑server logs, automates deployment and queue‑worker management, and supports invoicing workflows through build, scheduling, and XML transformations. + +#### Purpose +- Consolidate and report access‑log metrics. +- Automate release deployment, worker health checks, and nightly payment extraction. +- Build, schedule, and transform invoicing and shipment data. + +#### Responsibilities +- **Log Analysis (Perl)** – parse, aggregate, and report host/activity statistics. +- **Deployment & Process Control (Shell)** – orchestrate tarball deployment, worker lifecycle, and Oracle data export. +- **Build & Scheduling (XML/Maven)** – compile the Invoice Service, run migrations, schedule overdue reminders, and validate/transform XML contracts. + +#### Key units +- **Perl** + - `LogDigest` module – OO log aggregator (`new`, `add`, `summarize`, `top_n`). + - `parse_line` – regex parser for host, status, latency. + - `log_digest.pl` – CLI driver for file ingestion, alias handling, and output. +- **Shell** + - `deploy_release.sh` – host‑by‑host deployment via `rsync/ssh`, symlink, `systemctl`, health check. + - `healthcheck.sh` – PID/heartbeat watchdog for `/usr/local/bin/queue-worker`. + - `nightly_extract.ksh` – Oracle `sqlplus` export to CSV/CTL, gzip. +- **XML/Maven** + - `invoice-service-pom.xml` – Maven build, Flyway migrations, PDFBox profile. + - `scheduler-context.xml` – Spring beans for overdue‑invoice reminders. + - `shipment.xsd` – XML schema for `shipmentNotice`. + - `statement-to-html.xsl` – XSLT for rendering account statements. + +#### Data flow +1. **Log Processing** – CLI reads log files → `LogDigest` aggregates → summary or JSON output. +2. **Deployment** – Script copies tarball → remote extraction → symlink update → service restart → health check. +3. **Health Check** – PID/heartbeat files → status report. +4. **Extraction** – `sqlplus` query → CSV/CTL → gzip. +5. **Build** – Maven compiles, migrates, packages JAR. +6. **Scheduling** – Cron triggers `OverdueReminderJob` → email dispatch. +7. **XML** – Shipment notices validated against `shipment.xsd`; statements transformed by `statement-to-html.xsl`. + +#### Dependencies +- **Perl**: core modules (`POSIX`, `List::Util`, `Carp`, `Exporter`, `FindBin`, `Getopt::Long`), `JSON::PP`. +- **Shell**: `rsync`, `ssh`, `curl`, `systemctl`, `sqlplus`, `gzip`, `nohup`, `kill`. +- **XML/Maven**: Jackson, Flyway, PostgreSQL, JUnit, Testcontainers, PDFBox, HikariCP, Spring task/context. + +#### Cross‑cutting +- Centralized error handling (`croak`, `die`, strict `set -euo pipefail`). +- Configurable logging levels and host normalization. +- Environment‑driven configuration (env vars, config files). +- Consistent use of XML namespaces and XSLT parameters. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..2328385c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,68 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:17:55Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Provides a log‑digesting utility for web‑server access logs. +- Counts requests per host, per status, and flags slow requests. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: constructor `new`, instance methods `add`, `summarize`. + +#### Input +- `new(level => $level)` – `$level` must be one of `DEBUG`, `INFO`, `WARN`, `ERROR`; defaults to `WARN`. +- `add($line)` – a single log line string. +- `parse_line($line)` – parses a log line. +- `top_n($counts, $n)` – selects top `$n` keys from a hash of counts. + +#### Output +- `add` returns `1` on successful parse, `0` if line ignored, dies if line count exceeds `MAX_LINES`. +- `summarize` returns a hashref: + - `generated` – UTC timestamp. + - `total` – total request count. + - `hosts` – number of distinct hosts. + - `busiest` – max requests from a single host. + - `slow` – count of requests > `SLOW_REQUEST_MS`. + - `statuses` – hashref of status code counts. +- `top_n` returns an array of keys sorted by count descending, then lexicographically. + +#### Core logic +- `new` validates log level, initializes counters. +- `parse_line` extracts host, time, method, path, status, millis via regex; normalizes host. +- `add` increments line counter, updates host/status counts, tracks slow requests. +- `summarize` aggregates totals, computes busiest host, formats timestamp. +- `top_n` sorts hash keys by value descending, ties by key ascending, slices top `$n`. + +#### Subs +- `new(%args) -> LogDigest` – create digest object. +- `parse_line($line) -> hashref` – parse log line. +- `add($line) -> 1|0` – add entry to digest. +- `summarize() -> hashref` – produce summary. +- `top_n($counts, $n) -> @keys` – top N keys by count. +- `_normalize_host($host) -> $host` – lowercase, strip trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `new` dies with `croak` if unknown level. +- `add` dies if more than `MAX_LINES` lines added. +- `parse_line` silently returns `undef` on regex mismatch. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..ada1bb62 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,65 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:17:59Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Reads web server logs, filters hosts, and reports request counts and slow requests, optionally as JSON. + +#### Purpose +- Script to analyze access logs and report busiest hosts and status‑code counts. + +#### Type +- Script; no package; procedural. + +#### Input +- `--top|n=i` → `$top` (default 10) +- `--level=s` → `$level` (default 'WARN') +- `--json!` → `$as_json` (default 0) +- `--exclude-host=s` → `@exclude_hosts` (multiple) +- `--help|h` → prints usage +- `@ARGV` → list of log files +- `%ENV{LOG_DIGEST_CONFIG}` → `$config_file` (default '/etc/log-digest.conf') +- Config file lines `from = to` → `%aliases` + +#### Output +- If `$as_json`: JSON string of `$summary` followed by newline. +- Else: text line `"%d requests from %d hosts, %d slow"` then top hosts list. +- Exit status 0 on success, non‑zero on error. + +#### Core logic +- Load host aliases from `$config_file`. +- Build `%excluded` from `@exclude_hosts`. +- Create `LogDigest` with `level => $level`. +- For each file in `@ARGV`: + - Read each line, split host, skip if host (or alias) in `%excluded`. + - Pass line to `$digest->add`. +- After all files, call `$digest->summarize`. +- Output summary in requested format. + +#### Subs +- `usage() -> string` – prints usage text. +- `read_aliases($path) -> %aliases` – parses alias file. +- `main() -> 0` – orchestrates processing. + +#### Constants and configuration +- `$config_file = $ENV{LOG_DIGEST_CONFIG} // '/etc/log-digest.conf'` +- `$top = 10` +- `$level = 'WARN'` +- `$as_json = 0` +- `@exclude_hosts = ()` + +#### Dependencies +- `FindBin` – `$Bin` +- `Getopt::Long` – `GetOptions` +- `JSON::PP` – `->new->canonical->encode` +- `LogDigest` – `new`, `add`, `summarize`, `top_n` + +#### Exceptions / Errors +- `die usage()` on bad options. +- `die "--top must be positive\n"` if `$top < 1`. +- `die "cannot read $file: $!\n"` on file open failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..04e84e4b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,48 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:25Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Condenses and reports web‑server access log statistics, highlighting host activity, status codes, and slow requests. + +#### Purpose +- Aggregate access‑log metrics per host and status code. +- Flag requests exceeding a configurable latency threshold. +- Provide a CLI tool for quick reporting, optionally in JSON. + +#### Responsibilities +- **Parsing & Normalization** – extract host, status, and latency from raw log lines. +- **Counting & Aggregation** – maintain per‑host and per‑status tallies, track slow requests. +- **Reporting** – generate a concise summary and top‑N host list, output as text or JSON. +- **Configuration** – load host aliases and exclusion lists from a config file. + +#### Key units +- **`LogDigest` (module)** – OO interface for digesting logs; methods: `new`, `add`, `summarize`, `top_n`; exports `parse_line`. +- **`parse_line`** – regex‑based parser returning a hashref of host, status, and latency. +- **`top_n`** – helper that returns the highest‑count keys from a hash. +- **`log_digest.pl` (script)** – orchestrates file reading, alias handling, exclusion filtering, and output formatting. + +#### Data flow +1. **Input**: list of log files, optional `--exclude-host`, `--top`, `--level`, `--json`. +2. **Alias loading**: `read_aliases` parses `/etc/log-digest.conf` into `%aliases`. +3. **Digest creation**: `LogDigest->new(level => $level)`. +4. **Line processing**: for each file, read lines → skip excluded hosts → `$digest->add($line)`. +5. **Summarization**: `$digest->summarize` → hashref with totals, host stats, slow count, status counts. +6. **Output**: either plain text or JSON via `JSON::PP`, including top hosts via `top_n`. + +#### Dependencies +- **Perl core**: `POSIX`, `List::Util`, `Carp`, `Exporter`, `FindBin`, `Getopt::Long`. +- **CPAN**: `JSON::PP`. +- **Internal**: `LogDigest` module, config file `/etc/log-digest.conf`. + +#### Cross-cutting +- **Error handling**: `croak` for invalid log level; `die` for exceeding `MAX_LINES` or file I/O errors. +- **Constants**: `MAX_LINES = 50000`, `SLOW_REQUEST_MS = 1500`, `DEFAULT_LEVEL = 'WARN'`. +- **Host normalization**: lowercasing and stripping trailing dots via `_normalize_host`. +- **Logging level**: configurable via constructor argument, defaulting to `WARN`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..0fccbce1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,82 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:03Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploys a specified release to all hosts in an environment. +- Runs as a standalone script. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`) +- `set -euo pipefail` + +#### Input +- Options parsed by `getopts`: + - `-e ` → `ENVIRONMENT` + - `-t ` → `TAG` + - `-n` → `DRY_RUN=1` + - `-p ` → ignored, logged + - `-h` → prints usage +- Environment variables: + - `DEPLOY_USER` (default `deploy`) + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`) +- Files read: + - `$SCRIPT_DIR/lib/common.sh` + - `$SCRIPT_DIR/${HOST_FILES[$ENVIRONMENT]}` (hosts list) + +#### Output +- Logs to stderr. +- Copies `build/$TAG.tar.gz` to each host via `rsync`. +- Extracts tarball on host, updates symlink `$RELEASE_ROOT/current`. +- Restarts `orderd` service via `systemctl`. +- Verifies health at `http://$host:8080/health`. +- Exits with status 1 on errors, 0 on success. + +#### Core logic +- Parse options; validate `ENVIRONMENT` and `TAG`. +- `check_prereqs`: ensure `rsync`, `ssh`, `curl` exist and SSH key readable. +- `load_hosts`: read host list file into `HOSTS`. +- For each host: + - `deploy_host`: rsync tarball, SSH into host to extract, symlink, restart service. + - `wait_healthy`: poll health endpoint until success or timeout. + - Log deployment success. + +#### Functions +- `log`: prints timestamped message to stderr. +- `die`: logs error and exits. +- `usage`: prints usage comment from script header. +- `check_prereqs`: verifies required tools and SSH key. +- `load_hosts`: loads host list from environment-specific file. +- `deploy_host`: deploys release to a single host. +- `wait_healthy`: waits for service health check. +- `cleanup`: removes temporary lock file (unused in current code). + +#### Constants and configuration +- `SCRIPT_DIR`=`$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)` +- `DEPLOY_USER`=`${DEPLOY_USER:-deploy}` +- `SSH_KEY`=`${SSH_KEY:-$HOME/.ssh/deploy_ed25519}` +- `RELEASE_ROOT`=`/opt/releases` +- `SERVICE_NAME`=`orderd` +- `HEALTH_TIMEOUT`=`30` +- `ENVIRONMENT`=`""` +- `TAG`=`""` +- `DRY_RUN`=`0` +- `HOSTS`=() +- `HOST_FILES`=([staging]="hosts.staging" [production]="hosts.production") + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `mkdir`, `ln`, `sudo`. +- External file: `$SCRIPT_DIR/lib/common.sh`. +- Host files: `hosts.staging`, `hosts.production`. + +#### Errors and exit codes +- `die` exits with status 1 for missing tools, unreadable SSH key, no hosts, health timeout, unknown option, or missing option value. +- `usage` prints help and exits with status 0 or 2 when required arguments missing. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..4d3db479 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,67 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:08Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> A POSIX‑style init wrapper that starts, stops, checks status, and probes the health of a queue worker by inspecting its PID and heartbeat files. + +#### Purpose +- Manage a queue worker process. +- Provide health checks for monitoring systems. + +#### Type +- `sh` (POSIX sh). +- No strict mode flags used. + +#### Input +- `$1` command: `start`, `stop`, `restart`, `status`, `health`. +- Environment variables: + - `PID_FILE` (default `/run/queue-worker.pid`). + - `HEARTBEAT_FILE` (default `/var/lib/queue-worker/heartbeat`). +- No other options or arguments. + +#### Output +- Writes PID to `PID_FILE` when starting. +- Removes `PID_FILE` when stopping. +- Prints status messages (`running`, `stopped`, `OK`, `WARNING`, `CRITICAL`). +- Exit codes: + - `0` success. + - `1` heartbeat too old. + - `2` not running. + - `3` stopped status. + - `64` usage error. + +#### Core logic +- `is_running`: checks if PID file exists and process is alive. +- `heartbeat_age`: computes seconds since last heartbeat file modification. +- `start_worker`: starts worker with `nohup`, records PID. +- `stop_worker`: kills process and removes PID file. +- Command dispatch: `start`, `stop`, `restart`, `status`, `health`. + +#### Functions +- `is_running`: test if worker is active. +- `heartbeat_age`: calculate heartbeat age. +- `start_worker`: launch worker, write PID. +- `stop_worker`: terminate worker, clean PID. + +#### Constants and configuration +- `PID_FILE`=`/run/queue-worker.pid` +- `HEARTBEAT_FILE`=`/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE`=`120` +- `WORKER_BIN`=`/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `kill`, `nohup`, `date`, `stat`. +- Worker binary: `/usr/local/bin/queue-worker` with `--heartbeat` option. + +#### Errors and exit codes +- `exit 2` if not running during `health`. +- `exit 1` if heartbeat age exceeds `MAX_HEARTBEAT_AGE`. +- `exit 3` if status reports stopped. +- `exit 64` for invalid command usage. +- No traps or cleanup beyond PID file removal. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..cec7a27c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,70 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:11Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, creates a row‑count control file, and gzips the result. + +#### Purpose +- Run nightly to export settled payments. +- Executed directly; not sourced. + +#### Type +- `ksh93` (shebang `#!/bin/ksh93`). +- Uses `set -e`? none; relies on `whence -q` and explicit exits. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → variable `business_day`. + - `-o ` → variable `export_dir`. +- Environment: + - `ORACLE_SID` (defaults to `PAYPRD`). + - `NLS_LANG` set to `AMERICAN_AMERICA.AL32UTF8`. +- No other arguments. + +#### Output +- CSV file: `${export_dir}/payments_${business_day}.csv`. +- Control file: `${export_dir}/payments_${business_day}.ctl` containing `rows=` and `business_day=`. +- Gzipped CSV: `${export_dir}/payments_${business_day}.csv.gz`. +- Logs to stderr via `log`. +- Exit status: `0` on success, `1` on failure, `3` if tools missing, `4` if retries exhausted. + +#### Core logic +- Parse options; set defaults. +- Ensure export directory exists. +- Attempt up to `MAX_RETRIES` times: + - Run `run_export` to spool SQL query output to CSV. + - If successful, write control file, gzip CSV, log success, exit. + - On failure, log, sleep 60, retry. +- On exhausting retries, call `fail`. + +#### Functions +- `log` – prepend timestamp to messages, write to stderr. +- `fail` – log failure, exit with code. +- `require_tools` – ensure `sqlplus` and `gzip` are available. +- `run_export` – execute SQL query via `sqlplus`, spool to file. +- `write_control` – count rows in CSV, write control file. + +#### Constants and configuration +- ``ORACLE_SID_DEFAULT='PAYPRD'`` +- ``EXPORT_DIR_DEFAULT='/data/export/payments'`` +- ``MAX_RETRIES=3`` +- ``attempt=0`` +- ``business_day=$(date +%Y%m%d)`` +- ``export_dir=$EXPORT_DIR_DEFAULT`` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle connection: `CONNECT / AS SYSDBA` (no credentials in script). +- SQL query reads table `settled_payment`. + +#### Errors and exit codes +- `fail` with code `3` if `sqlplus` or `gzip` missing. +- `fail` with code `4` after exceeding `MAX_RETRIES`. +- `fail` with code `2` for usage error. +- Traps: none defined; cleanup handled by `gzip -f` and exit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..d33c8051 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,44 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:29Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> A collection of shell utilities for deploying releases, managing a queue worker, and nightly payment extraction from Oracle. + +#### Purpose +- Deploy application releases to multiple hosts. +- Control and monitor a queue worker process. +- Export settled payments nightly to CSV for downstream processing. + +#### Responsibilities +- **Deployment**: `deploy_release.sh` handles tarball transfer, extraction, symlink updates, service restart, and health verification across environments. +- **Process Management**: `healthcheck.sh` starts, stops, restarts, reports status, and performs heartbeat‑based health checks for a queue worker. +- **Data Extraction**: `nightly_extract.ksh` pulls settled payments from Oracle, writes CSV and control files, and gzips the output. + +#### Key units +- `deploy_release.sh` – orchestrates host‑by‑host deployment, uses `rsync`, `ssh`, `curl`, and `systemctl`. +- `healthcheck.sh` – PID/heartbeat watchdog for `/usr/local/bin/queue-worker`. +- `nightly_extract.ksh` – Oracle export driver, writes `payments_.csv`, `payments_.ctl`, and gzips the CSV. + +#### Data flow +1. **Deployment**: script reads environment‑specific host list → rsync tarball → SSH remote extraction → symlink `current` → `systemctl restart` → `curl` health check. +2. **Healthcheck**: command dispatch → PID file checks → heartbeat file age → status output. +3. **Extraction**: parse date/dir → `sqlplus` query → spool to CSV → count rows → write control file → `gzip` CSV. + +#### Dependencies +- External binaries: `rsync`, `ssh`, `curl`, `systemctl`, `sqlplus`, `gzip`, `nohup`, `kill`. +- External files: host lists (`hosts.staging`, `hosts.production`), worker binary (`/usr/local/bin/queue-worker`). +- Environment variables: `DEPLOY_USER`, `SSH_KEY`, `PID_FILE`, `HEARTBEAT_FILE`, `ORACLE_SID`. + +#### Cross-cutting +- Logging via `log` functions with timestamps. +- Strict error handling: `set -euo pipefail` in deployment, explicit exit codes in healthcheck, retry logic in extraction. +- Configuration via environment variables and defaults. +- Use of `getopts` for option parsing across scripts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..0823b417 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,57 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:16Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures the Maven build for the Invoice Service module, defining dependencies, plugins, and a PDF generation profile. + +#### Purpose +- Builds the `invoice-service` JAR. +- Manages database migrations with Flyway. +- Provides a profile for native PDF generation. + +#### Type +- Maven POM +- Root element: `project` +- Namespaces: `xmlns="http://maven.apache.org/POM/4.0.0"`, `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release=17` + - `jackson.version=2.19.2` + - `flyway.version=11.4.0` + - `invoice.archive.dir=${project.build.directory}/archive` +- **Dependencies** (5): + - `com.fasterxml.jackson.core:jackson-databind` (`${jackson.version}`) + - `org.flywaydb:flyway-core` (`${flyway.version}`) + - `org.postgresql:postgresql` (runtime) + - `org.junit.jupiter:junit-jupiter` (test) + - `org.testcontainers:postgresql` (test) +- **Plugins** (2): + - `org.flywaydb:flyway-maven-plugin` (`${flyway.version}`) – configures `locations` to `filesystem:src/main/resources/db/migration`. + - `org.apache.maven.plugins:maven-surefire-plugin` – sets system property `invoice.archive.dir` to `${invoice.archive.dir}`. +- **Profile** `native-pdf`: adds dependency `org.apache.pdfbox:pdfbox:3.0.5`. + +#### Configuration +- `maven.compiler.release=17` +- `jackson.version=2.19.2` +- `flyway.version=11.4.0` +- `invoice.archive.dir=${project.build.directory}/archive` +- Flyway `locations`: `filesystem:src/main/resources/db/migration` +- Surefire `systemPropertyVariables`: `invoice.archive.dir=${invoice.archive.dir}` + +#### Dependencies +- `org.example.billing:billing-parent:2.7.0` (parent) +- `com.fasterxml.jackson.core:jackson-databind` +- `org.flywaydb:flyway-core` +- `org.postgresql:postgresql` +- `org.junit.jupiter:junit-jupiter` +- `org.testcontainers:postgresql` +- `org.apache.pdfbox:pdfbox` (profile `native-pdf`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..35310ad2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,49 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:32Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides build configuration, scheduling, XML schema, and XSLT transformation for an invoicing and shipment system. + +#### Purpose +- Build and package the Invoice Service JAR with database migration and optional PDF support. +- Configure a Spring reminder scheduler for overdue invoices. +- Define XML contracts for shipment notices and account statements. +- Transform statement XML into HTML for reporting. + +#### Responsibilities +- **Build & Deployment** – Maven POM with dependencies, plugins, and PDF profile. +- **Scheduling** – Spring context wiring for data source, repository, mail gateway, job, and cron trigger. +- **Data Validation** – XML Schema for shipment notices (`shipment.xsd`). +- **Presentation** – XSLT stylesheet to render account statements as HTML (`statement-to-html.xsl`). + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, Flyway migration, PDFBox profile. +- `scheduler-context.xml` – Spring beans: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`; scheduler `reminderScheduler`. +- `shipment.xsd` – `shipmentNotice` root, `CarrierCode`, `WeightGrams`, `ParcelType`, `AddressType`, `ShipmentNoticeType`. +- `statement-to-html.xsl` – Parameters `currencySymbol`, `highlightAbove`; templates for header, booking rows, and total. + +#### Data flow +1. **Build**: Maven compiles `invoice-service`, runs Flyway migrations, optionally bundles PDFBox for native PDF generation. +2. **Scheduling**: At 07:00 Mon‑Fri, `OverdueReminderJob` queries `JdbcReminderRepository` via `reminderDataSource`, sends emails through `SmtpMailGateway`. +3. **Shipment**: Warehouse emits `shipmentNotice` XML validated against `shipment.xsd`; consumer processes the notice. +4. **Statement**: Monthly statement XML (namespace `urn:example:statement`) is transformed by `statement-to-html.xsl` into an HTML report, highlighting amounts above `highlightAbove`. + +#### Dependencies +- **Internal**: `org.example.reminder` classes, `org.example.billing` parent POM. +- **External**: Jackson, Flyway, PostgreSQL, JUnit, Testcontainers, PDFBox, HikariCP, Spring task/context modules. +- **Schema**: Standard XML Schema namespace; XSLT uses `urn:example:statement`. + +#### Cross-cutting +- Configuration via property placeholders (`reminder.properties`). +- Consistent use of XML namespaces for data contracts. +- Parameterized XSLT for currency and threshold customization. +- Maven profiles enable optional features (PDF generation). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..0a7b2ead --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,46 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:18Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures a Spring context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled trigger. + +#### Purpose +- Wire components for reminder scheduling. +- Define data source, repository, mail gateway, job, and cron trigger. + +#### Type +- Spring context XML (`` root). +- Namespaces: `http://www.springframework.org/schema/beans` (default), `http://www.springframework.org/schema/context`, `http://www.springframework.org/schema/task`. + +#### Definitions +- **Property placeholder**: `reminder.properties`. +- **Component scan**: `org.example.reminder.web`. +- **Beans**: + - `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`): `jdbcUrl` `${reminder.db.url}`, `username` `${reminder.db.user}`, `maximumPoolSize` `8`. + - `reminderRepository` (`org.example.reminder.JdbcReminderRepository`): constructor `reminderDataSource`. + - `mailGateway` (`org.example.reminder.SmtpMailGateway`): `host` `${reminder.smtp.host}`, `port` `587`. + - `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`): constructor `reminderRepository`, `mailGateway`; property `graceDays` `14`. +- **Scheduler**: `reminderScheduler` (`task:scheduler`) with `pool-size` `2`. +- **Scheduled task**: `overdueReminderJob.sendDueReminders` triggered by cron `0 0 7 * * MON-FRI`. + +#### Configuration +- `reminder.db.url` – JDBC URL. +- `reminder.db.user` – DB username. +- `reminder.smtp.host` – SMTP host. +- `reminder.smtp.port` – SMTP port `587`. +- `overdueReminderJob.graceDays` – `14`. +- Scheduler pool size – `2`. +- Cron expression – `0 0 7 * * MON-FRI`. + +#### Dependencies +- `com.zaxxer.hikari.HikariDataSource`. +- `org.example.reminder.JdbcReminderRepository`. +- `org.example.reminder.SmtpMailGateway`. +- `org.example.reminder.OverdueReminderJob`. +- Spring `task` and `context` modules. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..d799bd5e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,40 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:20Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Validates shipment notice documents. +- Enforces structure and value constraints for parcels, addresses, and carrier codes. + +#### Type +- XML Schema (``). +- Root element: `shipmentNotice`. +- Namespaces: `xs` → `http://www.w3.org/2001/XMLSchema`; `shp` → `urn:example:shipment:1`. + +#### Definitions +- **Simple types** + - `CarrierCode`: enumeration of `"DHL"`, `"UPS"`, `"GLS"`, `"POST"`. + - `WeightGrams`: positive integer ≤ 31500. +- **Complex types** + - `ParcelType` + - Elements: `trackingNumber` (`xs:string`), `weight` (`shp:WeightGrams`). + - Attribute: `sequence` (`xs:positiveInteger`, required). + - `AddressType` + - Elements: `name`, `street`, `postalCode`, `city` (`xs:string`); `country` (`xs:string`, optional, default `"DE"`). + - `ShipmentNoticeType` + - Elements: `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), `parcel` (`shp:ParcelType`, unbounded). + - Attribute: `noticeId` (`xs:ID`, required). + +#### Configuration +- `country` element defaults to `"DE"` when omitted. + +#### Dependencies +- Relies on standard XML Schema namespace `http://www.w3.org/2001/XMLSchema`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..9a18df29 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,39 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:22Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a monthly account statement XML into an HTML page with header, rows per booking, and a total. + +#### Purpose +- Render a monthly account statement as an HTML page. +- Highlight bookings exceeding a threshold. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespaces: `xsl` (`http://www.w3.org/1999/XSL/Transform`), `st` (`urn:example:statement`). + +#### Definitions +- **Parameters** + - `currencySymbol` (default `'EUR'`) + - `highlightAbove` (default `1000`) +- **Key** + - `bookingsByDay` matches `st:booking` using `st:valueDate` +- **Templates** + - `match="/st:statement"`: outputs `` with header, table of bookings, and total. + - `name="statementHeader"`: outputs `

` with account number and `

` with period. + - `match="st:booking"`: outputs a ``; adds `class="large"` if `st:amount` > `$highlightAbove`; contains `` cells for date, purpose, and formatted amount with currency symbol. + - `name="statementTotal"`: outputs `

` with formatted sum of all `st:booking/st:amount`. + +#### Configuration +- `xsl:output` method `html`, encoding `UTF-8`, indent `yes`. +- `currencySymbol` parameter value `'EUR'`. +- `highlightAbove` parameter value `1000`. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: `statement`, `accountNumber`, `period`, `booking`, `valueDate`, `purpose`, `amount`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..81e3565f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,56 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:41Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A multi‑language toolkit that aggregates web‑server logs, automates deployment and queue‑worker management, and supports invoicing workflows through build, scheduling, and XML transformations. + +#### Purpose +- Consolidate and report access‑log metrics. +- Automate release deployment, worker health checks, and nightly payment extraction. +- Build, schedule, and transform invoicing and shipment data. + +#### Responsibilities +- **Log Analysis (Perl)** – parse, aggregate, and report host/activity statistics. +- **Deployment & Process Control (Shell)** – orchestrate tarball deployment, worker lifecycle, and Oracle data export. +- **Build & Scheduling (XML/Maven)** – compile the Invoice Service, run migrations, schedule overdue reminders, and validate/transform XML contracts. + +#### Key units +- **Perl** + - `LogDigest` module – OO log aggregator (`new`, `add`, `summarize`, `top_n`). + - `parse_line` – regex parser for host, status, latency. + - `log_digest.pl` – CLI driver for file ingestion, alias handling, and output. +- **Shell** + - `deploy_release.sh` – host‑by‑host deployment via `rsync/ssh`, symlink, `systemctl`, health check. + - `healthcheck.sh` – PID/heartbeat watchdog for `/usr/local/bin/queue-worker`. + - `nightly_extract.ksh` – Oracle `sqlplus` export to CSV/CTL, gzip. +- **XML/Maven** + - `invoice-service-pom.xml` – Maven build, Flyway migrations, PDFBox profile. + - `scheduler-context.xml` – Spring beans for overdue‑invoice reminders. + - `shipment.xsd` – XML schema for `shipmentNotice`. + - `statement-to-html.xsl` – XSLT for rendering account statements. + +#### Data flow +1. **Log Processing** – CLI reads log files → `LogDigest` aggregates → summary or JSON output. +2. **Deployment** – Script copies tarball → remote extraction → symlink update → service restart → health check. +3. **Health Check** – PID/heartbeat files → status report. +4. **Extraction** – `sqlplus` query → CSV/CTL → gzip. +5. **Build** – Maven compiles, migrates, packages JAR. +6. **Scheduling** – Cron triggers `OverdueReminderJob` → email dispatch. +7. **XML** – Shipment notices validated against `shipment.xsd`; statements transformed by `statement-to-html.xsl`. + +#### Dependencies +- **Perl**: core modules (`POSIX`, `List::Util`, `Carp`, `Exporter`, `FindBin`, `Getopt::Long`), `JSON::PP`. +- **Shell**: `rsync`, `ssh`, `curl`, `systemctl`, `sqlplus`, `gzip`, `nohup`, `kill`. +- **XML/Maven**: Jackson, Flyway, PostgreSQL, JUnit, Testcontainers, PDFBox, HikariCP, Spring task/context. + +#### Cross‑cutting +- Centralized error handling (`croak`, `die`, strict `set -euo pipefail`). +- Configurable logging levels and host normalization. +- Environment‑driven configuration (env vars, config files). +- Consistent use of XML namespaces and XSLT parameters. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..782743a5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run2/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 2EBF0F46 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:18:46Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard project is a multi‑language toolkit that aggregates web‑server logs, automates deployment and queue‑worker management, and supports invoicing workflows through build, scheduling, and XML transformations. The Perl package condenses access log statistics, highlighting host activity, status codes, and slow requests, while the shell utilities orchestrate release deployments, queue‑worker control, and nightly payment extraction from Oracle. The XML package supplies build configuration, scheduling, XML schema, and XSLT transformations for invoicing and shipment, tying together the log aggregation, deployment, and invoicing subsystems. + +#### Packages +- other — A multi‑language toolkit that aggregates web‑server logs, automates deployment and queue‑worker management, and supports invoicing workflows through build, scheduling, and XML transformations. +- other/perl — Condenses and reports web‑server access log statistics, highlighting host activity, status codes, and slow requests. +- other/shell — A collection of shell utilities for deploying releases, managing a queue worker, and nightly payment extraction from Oracle. +- other/xml — Provides build configuration, scheduling, XML schema, and XSLT transformation for an invoicing and shipment system. +- . — A multi‑language toolkit that aggregates web‑server logs, automates deployment and queue‑worker management, and supports invoicing workflows through build, scheduling, and XML transformations. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/meta/gpt-6-luna.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/meta/gpt-6-luna.json new file mode 100644 index 00000000..6d7d3ea4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/meta/gpt-6-luna.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-6-luna", + "name": "GPT-6 Luna", + "backend": "openrouter", + "definition": { + "key": "gpt-6-luna", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-6-luna" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:19:26Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 66.3, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 39.1, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.5, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:21:14Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 15507, + "cachedPromptTokens": 15480, + "completionTokens": 6692, + "seconds": 65.7288248 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.003504, + "costUsd": 0.005626, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/meta/gpt-oss-20b.json new file mode 100644 index 00000000..01241a34 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:21:14Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 27.3, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 19.3, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 3.1, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:22:04Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16083, + "cachedPromptTokens": 13936, + "completionTokens": 4964, + "seconds": 26.7069537 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.001128, + "costUsd": 0.001862, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/package.ai.md new file mode 100644 index 00000000..866339b8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/package.ai.md @@ -0,0 +1,55 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:20:54Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> Provides operational tooling and billing resources for analyzing access traffic, deploying and monitoring services, exporting settled payments, and supporting invoice, reminder, shipment, and statement workflows. + +#### Purpose +- Combines log summarization, release and worker operations, payment export, and XML/Maven resources for billing workflows. +- Supplies command-line tools and configuration for producing traffic reports, operational health checks, payment files, and billing-related build or document outputs. + +#### Responsibilities +- **Access-log analysis (`perl/`):** Parse requests, aggregate host and HTTP-status counts, track slow requests, and emit text or JSON summaries with filtering and aliases. +- **Service operations (`shell/`):** Deploy tagged `orderd` releases to staging or production hosts; manage and check `queue-worker` lifecycle and health. +- **Payment export (`shell/`):** Query Oracle settled payments for a business day and produce a compressed CSV with a row-count control file. +- **Billing resources (`xml/`):** Configure the invoice-service Maven build and reminder scheduler; define shipment validation and statement-to-HTML transformation. + +#### Key units +- `LogDigest`, `parse_line`, `top_n` — parse access-log entries, aggregate traffic metrics, and rank hosts. +- `log_digest.pl` `main`, `read_aliases` — handle CLI input and host mappings, then emit filtered summaries. +- `deploy_host`, `wait_healthy`, `load_hosts` — deploy to selected hosts and verify service health. +- `is_running`, `heartbeat_age`, `start_worker`, `stop_worker` — manage queue-worker process state and heartbeat checks. +- `run_export`, `write_control` — query `settled_payment` and record export counts and business day. +- `invoice-service-pom.xml` — configure invoice-service dependencies, Flyway migrations, tests, and optional PDFBox support. +- `scheduler-context.xml` — wire reminder data access, mail delivery, job execution, and weekday scheduling. +- `shipment.xsd` — define shipment notice, address, carrier, and parcel structure and constraints. +- `statement-to-html.xsl` — render statement headers, booking rows, totals, and threshold-based highlighting. + +#### Data flow +- Access logs are read and filtered using aliases and exclusions; valid entries update `LogDigest` host, status, and slow-request metrics, which are emitted as text or canonical JSON. +- Deployment selects an environment’s host list and release archive, then transfers, activates, restarts, and health-checks hosts sequentially. +- Worker lifecycle commands use PID and heartbeat files to determine process status and health. +- The payment export queries Oracle for a selected business day and writes semicolon-separated results, a control count, and a gzipped CSV. +- Reminder properties configure database and SMTP connections that feed `OverdueReminderJob`; shipment XML is validated against `shipment.xsd`, while statement XML is transformed to HTML. +- Maven builds the invoice JAR, runs Flyway migrations, and supplies the configured archive directory to tests. + +#### Dependencies +- Perl tooling uses `JSON::PP`, `Getopt::Long`, `FindBin`, `POSIX`, `List::Util`, `Carp`, and `Exporter`. +- Deployment uses `lib/common.sh`, environment-specific host lists, SSH/rsync, `systemctl`, and the service `/health` endpoint; worker scripts invoke `/usr/local/bin/queue-worker`. +- Payment export uses `sqlplus` and Oracle’s `settled_payment` table. +- Invoice build depends on the billing parent POM, Jackson Databind, Flyway, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, and optionally PDFBox. +- Reminder configuration uses HikariCP and `org.example.reminder` repository, gateway, and job classes; XML resources use XML Schema types and XSLT functions. + +#### Cross-cutting +- Configuration comes from CLI options, environment variables, or properties; defaults cover deployment credentials, worker paths, Oracle SID, and export directory. +- Failures use tool-specific errors and exit statuses; deployment stops at the first failed host, while payment export retries up to three times. +- Log processing skips malformed entries, limits input to 50,000 lines, and counts requests over 1,500 ms as slow. +- XML resources use explicit namespaces; the reminder scheduler uses a two-thread pool, weekday 7:00 schedule, and 14-day grace period. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..580ad3c2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,61 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:19:27Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Condenses web-server access-log entries into normalized per-host traffic counts, HTTP status totals, and slow-request metrics. + +#### Purpose +- Aggregates parsed access-log lines into a summary of hosts, statuses, busiest host, and slow requests. +- Provides line parsing and count-ranking helpers. + +#### Type +- Module; package `LogDigest`. +- Exports `parse_line` and `top_n` via `@EXPORT_OK`. +- Object-oriented: `new` blesses an instance; `add` and `summarize` operate on it. + +#### Output +- `parse_line` returns a hash reference with `host`, `time`, `method`, `path`, `status`, and `millis`, or an undefined value for malformed input. +- `add` returns `1` for a parsed line and `0` for a malformed line. +- `summarize` returns a hash reference containing UTC `generated` timestamp, `total`, distinct `hosts`, `busiest` host count, `slow` request count, and a copied `statuses` hash. +- `top_n` returns host/count keys sorted by descending count, then ascending key. +- No printed output or files written. + +#### Core logic +- `new` validates the requested log level and initializes host/status counts, slow-request count, and line count. +- `parse_line` extracts host, timestamp, method, path, three-digit status, and duration from a combined-log-style line; lowercases the host and removes one trailing dot. +- `add` increments the line limit counter, ignores unparsable lines, then updates per-host and per-status counts; durations above `SLOW_REQUEST_MS` increment the slow count. +- `summarize` calculates total requests and busiest-host count, counts distinct hosts, and adds a UTC generation timestamp. +- `top_n` sorts keys by count descending with lexical tie-breaking, then returns up to `n` keys. + +#### Subs +- `new($class, %args) -> blessed object` — validate level and initialize counters. +- `parse_line($line) -> hashref or undef` — parse and normalize a log entry. +- `add($self, $line) -> 1 or 0` — count a valid entry or skip malformed input. +- `summarize($self) -> hashref` — build aggregate metrics and timestamp. +- `top_n($counts, $n) -> list` — rank keys by count and name. +- `_normalize_host($host) -> string` — lowercase host and strip trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50_000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `$VERSION = '1.4'` +- `@EXPORT_OK = qw(parse_line top_n)` +- `%LEVEL_RANK`: `DEBUG => 0`, `INFO => 1`, `WARN => 2`, `ERROR => 3` + +#### Dependencies +- `strict`, `warnings` — enable compile-time checks and warnings. +- `POSIX`: `strftime` +- `List::Util`: `max`, `sum` +- `Carp`: `croak` +- `parent`: `Exporter` + +#### Exceptions / Errors +- `new` croaks with `unknown level '$level'` when `level` is not in `%LEVEL_RANK`. +- `add` croaks with `more than 50000 lines` when the line count exceeds `MAX_LINES`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..fb0738b4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/perl/log_digest.pl.ai.md @@ -0,0 +1,67 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:19:35Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Summarizes access-log requests by host and status, reporting busiest hosts and slow-request counts as text or JSON. + +#### Purpose +- Command-line tool for digesting access-log files, applying host aliases and exclusions. +- Prints aggregate request statistics and the top hosts, or a JSON summary. + +#### Type +- Script; no package declaration or exports; procedural. +- Uses `LogDigest` object methods. + +#### Input +- `--top` / `--n`: set `$top`; integer, default `10`. +- `--level`: set `$level`; string, default `WARN`. +- `--json` / `--nojson`: set `$as_json`. +- `--exclude-host`: append host names to `@exclude_hosts`. +- `--help` / `--h`: print usage and exit `0`. +- `@ARGV`: access-log file paths; each line is passed to `LogDigest->add` unless its first space-delimited field, after alias mapping, is excluded. +- `%ENV` key `LOG_DIGEST_CONFIG`: alias-config path; defaults to `/etc/log-digest.conf`. +- Reads the alias-config file as `from = to` lines; skips blank and comment lines. Reads each access-log file line by line. + +#### Output +- Text mode: `N requests from H hosts, S slow`, followed by one line per result from `top_n($digest->{hosts}, $top)`. +- JSON mode: canonical JSON encoding of the summary, followed by a newline. +- Returns `0` from `main`; the script exits with that status. +- Help prints usage text and exits `0`. + +#### Core logic +- Loads aliases from the configured file; missing or unreadable alias files produce an empty alias map. +- Builds the excluded-host lookup and initializes `LogDigest` with `$level`. +- Reads each `@ARGV` log file, skips lines whose aliased host is excluded, and adds remaining lines to the digest. +- Summarizes the digest, then prints canonical JSON or text statistics and top hosts. +- Rejects `$top < 1` before running `main`. + +#### Subs +- `usage() -> string` — returns command usage text. +- `read_aliases($path) -> hash` — reads host aliases from a config file. +- `main() -> 0` — reads logs, summarizes, and prints results. + +#### Constants and configuration +- `$config_file` — `$ENV{LOG_DIGEST_CONFIG}` or `/etc/log-digest.conf`. +- `$top` — `10`. +- `$level` — `WARN`. +- `$as_json` — `0`. +- `@exclude_hosts` — initially empty. + +#### Dependencies +- `strict`, `warnings` — enforce strictness and emit warnings. +- `FindBin` — imports `$Bin`. +- `Getopt::Long` — imports `GetOptions`. +- `JSON::PP` — canonical JSON encoding. +- `LogDigest` — imports `top_n`; uses `new`, `add`, and `summarize`. + +#### Exceptions / Errors +- `GetOptions` failure: dies with usage text. +- `$top < 1`: dies with `--top must be positive`. +- Failure to open an access-log file: dies with `cannot read $file: $!`. +- Failure to open the alias config is handled by returning an empty alias map. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/perl/package.ai.md new file mode 100644 index 00000000..d5cffedd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/perl/package.ai.md @@ -0,0 +1,42 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:20:33Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Converts web-server access logs into normalized host and HTTP-status traffic summaries, including busiest-host rankings and slow-request counts. + +#### Purpose +- Parse and aggregate access-log requests into host, status, and slow-request metrics. +- Provide a CLI for filtering hosts, applying aliases, and displaying the summary as text or JSON. + +#### Responsibilities +- **Parsing and aggregation:** Normalize hostnames, validate log entries, count requests by host and status, and track slow requests. +- **Ranking and reporting:** Rank hosts by request count with lexical tie-breaking; produce summary metrics and a UTC generation timestamp. +- **CLI input and filtering:** Read log files, map host aliases from configuration, exclude selected hosts, and control output format and top-host count. + +#### Key units +- `LogDigest`: Object-oriented aggregator with `new`, `add`, and `summarize`; exports `parse_line` and `top_n`. +- `parse_line`: Extracts and normalizes host, timestamp, method, path, status, and duration from a log line. +- `top_n`: Returns up to *n* keys ranked by descending count, then ascending name. +- `log_digest.pl` `main`: Reads filtered log entries, builds a digest, and prints text or canonical JSON. +- `read_aliases`: Loads `from = to` host mappings from the configured alias file. + +#### Data flow +- The CLI reads alias configuration and access-log files, maps each line’s host for exclusion checks, then passes non-excluded lines to `LogDigest->add`. +- `add` parses each line and updates host/status totals and the slow-request count; malformed lines are ignored. +- `summarize` produces aggregate metrics; the CLI emits canonical JSON or text with top hosts from `top_n`. + +#### Dependencies +- `log_digest.pl` uses `LogDigest` and `JSON::PP`; it uses `Getopt::Long` for options and `FindBin` for script location. +- `LogDigest` uses `POSIX` for UTC timestamps, `List::Util` for aggregate calculations, `Carp` for errors, and `Exporter` for optional exports. + +#### Cross-cutting +- Hostnames are lowercased and have one trailing dot removed; CLI aliases and exclusions provide additional host filtering. +- `LogDigest` enforces a 50,000-line limit, counts requests exceeding 1,500 ms as slow, and validates levels against `DEBUG`, `INFO`, `WARN`, and `ERROR`. +- Invalid log lines are skipped; invalid levels, excessive lines, invalid `--top`, option parsing failures, and unreadable log files raise errors. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..23ad63e1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,77 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:19:43Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a tagged release to each host in a staging or production environment, restarting `orderd` and stopping if a host fails its health check. + +#### Purpose +- Roll out `build/$TAG.tar.gz` to environment hosts one at a time. +- Run directly; sources a shared helper file. + +#### Type +- Bash (`#!/usr/bin/env bash`); strict mode: `set -euo pipefail`. + +#### Input +- `-e ` sets `ENVIRONMENT`; parsed by `getopts`. +- `-t ` sets `TAG`; parsed by `getopts`. +- `-n` sets `DRY_RUN=1`; parsed by `getopts`. +- `-p ` logs that parallel deploys are unsupported and ignores the value; parsed by `getopts`. +- `-h` prints usage and exits; parsed by `getopts`. +- Environment variables: `DEPLOY_USER` defaults to `deploy`; `SSH_KEY` defaults to `$HOME/.ssh/deploy_ed25519`; reads `HOME`. +- Reads the selected host list under `$SCRIPT_DIR` (`hosts.staging` or `hosts.production`), the SSH key, and `build/$TAG.tar.gz`. + +#### Output +- Prints timestamped logs to stderr. +- Transfers the release archive to each host’s `/tmp/`, extracts it under `/opt/releases/$TAG`, updates `/opt/releases/current`, and restarts `orderd`. +- Sends health-check requests to `http://$host:8080/health`. +- Removes `/tmp/deploy_release.$$.lock` on exit; this script does not create that lock file. +- Exits `0` on success or help, `1` on `die` errors, and `2` when `ENVIRONMENT` or `TAG` is missing. + +#### Core logic +- Checks that `rsync`, `ssh`, and `curl` are available and that the SSH key is readable. +- Loads non-comment lines from the selected host file into `HOSTS`; fails if no hosts are loaded. +- For each host, either logs the dry-run action or transfers the archive and runs remote commands to create the release directory, extract the archive, update the `current` symlink, and restart `orderd`. +- Polls the host health endpoint every two seconds until it succeeds or reaches `HEALTH_TIMEOUT`; then logs the host deployment as complete. +- Stops at the first failed host or health check. + +#### Functions +- `log`: Timestamp and print a message. +- `die`: Log an error and exit `1`. +- `usage`: Print the usage line from the script. +- `check_prereqs`: Check tools and SSH key access. +- `load_hosts`: Read hosts for the selected environment. +- `deploy_host`: Deploy a release to one host. +- `wait_healthy`: Poll a host health endpoint. +- `cleanup`: Remove the lock-file path. + +#### Constants and configuration +- `SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"` (readonly) +- `DEPLOY_USER="${DEPLOY_USER:-deploy}"` +- `SSH_KEY="${SSH_KEY:-$HOME/.ssh/deploy_ed25519}"` +- `RELEASE_ROOT="/opt/releases"` (exported) +- `SERVICE_NAME="orderd"` +- `HEALTH_TIMEOUT=30` +- `ENVIRONMENT=""` +- `TAG=""` +- `DRY_RUN=0` +- `HOSTS=()` (declared indexed array) +- `HOST_FILES=([staging]="hosts.staging" [production]="hosts.production")` (declared associative array) + +#### Dependencies +- Sources `$SCRIPT_DIR/lib/common.sh`. +- External commands: `date`, `sed`, `command`, `grep`, `mapfile`, `rsync`, `ssh`, `bash` (remote), `mkdir`, `tar`, `ln`, `sudo`, `systemctl`, `curl`, `sleep`, `rm`. +- Uses host-list files `hosts.staging` and `hosts.production`, archive `build/$TAG.tar.gz`, and health endpoint `http://$host:8080/health`. + +#### Errors and exit codes +- `1`: Missing tool, unreadable SSH key, unknown environment, empty host list, or host not healthy before timeout. +- `1`: Unknown option or option missing a value. +- `2`: Required `ENVIRONMENT` or `TAG` absent. +- `0`: Help requested or all hosts deployed successfully. +- `EXIT` trap runs `cleanup`, removing `/tmp/deploy_release.$$.lock`. +- Health checks retry every two seconds, with a 30-second timeout. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..209bf780 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,60 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:19:54Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Manages the queue worker lifecycle and checks whether its process and heartbeat are healthy. + +#### Purpose +- Starts, stops, restarts, and reports the status or heartbeat health of the queue worker. +- Run directly as an init-style command wrapper. + +#### Type +- POSIX `sh`; no strict-mode settings (`set -e`, `set -u`, or `pipefail`). + +#### Input +- `$1`: command selected by a `case` loop: `start`, `stop`, `restart`, `status`, or `health`. +- Environment variable `PID_FILE`, default `/run/queue-worker.pid`. +- Environment variable `HEARTBEAT_FILE`, default `/var/lib/queue-worker/heartbeat`. +- Reads the PID file with `cat`; checks the heartbeat file timestamp with `stat`. + +#### Output +- Starts `queue-worker` in the background, redirects its output to `/dev/null`, and writes its PID to `PID_FILE`. +- Stops the worker and removes `PID_FILE` if `kill` succeeds. +- Prints `already running`, `running`, `stopped`, `CRITICAL: not running`, `WARNING: heartbeat …s old`, `OK`, or usage text as applicable. +- Exit statuses: `0` for successful start, stop, restart, running status, or healthy probe; `1` for stale heartbeat; `2` when the health probe finds the worker stopped; `3` when status finds it stopped; `64` for an unrecognized command. Other command failures may propagate. + +#### Core logic +- `start`: if the PID file identifies a live process, print `already running`; otherwise launch the worker with the heartbeat path and save its PID. +- `stop`: if no live process is detected, return successfully; otherwise kill the PID and remove the PID file on success. +- `restart`: stop, then start the worker. +- `status`: print `running` when the PID is live; otherwise print `stopped` and exit `3`. +- `health`: exit `2` with a critical message if the PID is not live; otherwise compare heartbeat age against 120 seconds, exit `1` with a warning if stale, or print `OK`. + +#### Functions +- `is_running` — checks PID file and process liveness. +- `heartbeat_age` — calculates heartbeat age in seconds. +- `start_worker` — launches the worker and records its PID. +- `stop_worker` — kills the worker and removes its PID file. + +#### Constants and configuration +- `PID_FILE="${PID_FILE:-/run/queue-worker.pid}"` +- `HEARTBEAT_FILE="${HEARTBEAT_FILE:-/var/lib/queue-worker/heartbeat}"` +- `MAX_HEARTBEAT_AGE=120` +- `WORKER_BIN=/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `nohup`, `kill`, `cat`, `date`, `stat`, `rm`. +- Worker executable: `/usr/local/bin/queue-worker`, invoked with `--heartbeat` and the configured heartbeat path. +- Files: PID file at `PID_FILE`; heartbeat file at `HEARTBEAT_FILE`. + +#### Errors and exit codes +- Health check exits `2` if the worker is not running, or `1` if heartbeat age exceeds `MAX_HEARTBEAT_AGE`. +- Status exits `3` if the worker is not running. +- Invalid command exits `64` and prints usage to standard error. +- No traps, retries, or timeouts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..3d3b9d40 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,71 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:20:02Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Exports a business day’s settled Oracle payments as a gzipped CSV with a row-count control file. + +#### Purpose +- Produces a nightly export of settled payments for one business day. +- Runs directly as a command-line script. + +#### Type +- `ksh93` (`#!/bin/ksh93`); no strict-mode settings (`set -e`, `set -u`, or `pipefail`). + +#### Input +- `-d` sets `business_day` to the requested `YYYYMMDD`; parsed with `getopts`. +- `-o` sets `export_dir`; parsed with `getopts`. +- `ORACLE_SID` environment variable; defaults to `PAYPRD`. +- Reads the `settled_payment` table in Oracle, filtering `business_day`. + +#### Output +- Creates `export_dir` if it does not exist. +- Writes `payments_$business_day.csv`, then compresses it with `gzip -f` to `.csv.gz`. +- Writes a sibling `.ctl` file containing the CSV row count and business day. +- Logs timestamped messages to standard error. +- Exits `0` after a successful export; failure statuses are listed below. + +#### Core logic +- Defaults `business_day` to the current date in `YYYYMMDD` format and `export_dir` to the configured export directory. +- Sets Oracle client environment variables and parses `-d` and `-o`. +- Checks that `sqlplus` and `gzip` are available; creates the export directory if needed. +- Retries the SQL export up to three times, sleeping 60 seconds after each failed attempt. +- Runs `sqlplus -s /nolog`, connects as SYSDBA, and selects payment ID, account number, amount, and currency as semicolon-separated fields from `settled_payment`. +- Counts CSV lines, writes the control file, gzips the CSV, logs success, and exits; after all retries fail, reports failure. + +#### Functions +- `log` — Timestamp and print messages to standard error. +- `fail` — Log failure and exit with a status. +- `require_tools` — Check required commands are available. +- `run_export` — Query Oracle and write the CSV. +- `write_control` — Write row count and business day to the control file. + +#### Constants and configuration +- `ORACLE_SID_DEFAULT=PAYPRD` +- `EXPORT_DIR_DEFAULT=/data/export/payments` +- `MAX_RETRIES=3` +- `attempt=0` +- `business_day=$(date +%Y%m%d)` +- `export_dir=$EXPORT_DIR_DEFAULT` +- `ORACLE_SID=${ORACLE_SID:-$ORACLE_SID_DEFAULT}` +- `NLS_LANG=AMERICAN_AMERICA.AL32UTF8` +- `csv=$export_dir/payments_$business_day.csv` + +#### Dependencies +- External commands: `date`, `sqlplus`, `gzip`, `wc`, `mkdir`, `sleep`. +- Uses `whence` to check command availability. +- Oracle connection: `CONNECT / AS SYSDBA`. +- Oracle table: `settled_payment`. + +#### Errors and exit codes +- `2` — Unsupported or invalid option; logs usage. +- `3` — `sqlplus` or `gzip` is unavailable. +- `4` — All three export attempts fail. +- `1` by default — `fail` calls without an explicit status, including failure to create the export directory. +- `0` — Export and control-file generation complete; `gzip` status is not checked before success is reported. +- Retries failed exports up to three times with a 60-second sleep between attempts; no traps. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/package.ai.md new file mode 100644 index 00000000..e5c0b472 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/shell/package.ai.md @@ -0,0 +1,48 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:20:40Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates release deployment, queue-worker health and lifecycle checks, and nightly export of settled payments for operational systems. + +#### Purpose +- Provides command-line operations for deploying `orderd`, managing and monitoring the queue worker, and exporting Oracle payment data. +- Produces environment-specific rollouts, worker health signals, and compressed daily payment files with control counts. + +#### Responsibilities +- **Release deployment:** `deploy_release.sh` selects staging or production hosts, transfers and activates a tagged release, restarts `orderd`, and verifies each host before proceeding. +- **Worker operations:** `healthcheck.sh` starts, stops, restarts, and reports status or heartbeat health for `queue-worker`. +- **Payment export:** `nightly_extract.ksh` queries settled payments for a business day, retries failed exports, and creates a gzipped CSV plus a control file. + +#### Key units +- `deploy_host` — deploys a release archive to one host and restarts the service. +- `wait_healthy` — polls a host’s `/health` endpoint until success or timeout. +- `load_hosts` — loads the selected staging or production host list. +- `is_running` — checks the queue worker PID file and process liveness. +- `heartbeat_age` — calculates the age of the worker heartbeat. +- `start_worker` / `stop_worker` — launch or stop `queue-worker` and manage its PID file. +- `run_export` — queries Oracle’s `settled_payment` table for the selected business day. +- `write_control` — records the export row count and business day in the `.ctl` file. + +#### Data flow +- Deployment: environment and tag select a host list and `build/$TAG.tar.gz`; hosts are processed sequentially through transfer, extraction, symlink update, service restart, and health verification. Dry-run mode logs actions instead. +- Worker: lifecycle commands use `PID_FILE` to track the process; health checks combine process liveness with heartbeat age. +- Export: business day and export directory configure the Oracle query; results become a semicolon-separated CSV, a row-count control file, and a compressed `.csv.gz` output. + +#### Dependencies +- Deployment sources `lib/common.sh`; uses `hosts.staging` or `hosts.production`, SSH/rsync, `systemctl`, and `http://$host:8080/health`. +- Worker management invokes `/usr/local/bin/queue-worker` and uses configurable PID and heartbeat files. +- Payment export uses `sqlplus` with `CONNECT / AS SYSDBA` and reads Oracle table `settled_payment`. +- All scripts rely on external shell utilities; deployment and export also check required tools. + +#### Cross-cutting +- Each script is directly executable; the package spans Bash, POSIX `sh`, and `ksh93`. +- Configuration is provided through command-line options and environment variables, with defaults for deployment credentials, worker file paths, Oracle SID, and export directory. +- Operational failures use script-specific exit statuses; deployment stops on the first failed host, while payment export retries up to three times. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..22ebda36 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,48 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:20:12Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Builds the invoice service JAR, configuring database migrations, test execution, and an optional PDF-generation dependency. + +#### Purpose +- Defines the `invoice-service` Maven module for creating, numbering, and archiving customer invoices. +- Configures Flyway migrations and passes the invoice archive directory to tests. + +#### Type +- Maven POM; root element `project`. +- Declares the default namespace `http://maven.apache.org/POM/4.0.0` and the `xsi` namespace `http://www.w3.org/2001/XMLSchema-instance`. + +#### Definitions +- Coordinates: `artifactId` `invoice-service`, `packaging` `jar`; `groupId` is not declared in this file. +- Parent: `org.example.billing:billing-parent:2.7.0`. +- Dependencies: + - `com.fasterxml.jackson.core:jackson-databind` — default compile scope. + - `org.flywaydb:flyway-core` — default compile scope. + - `org.postgresql:postgresql` — `runtime`. + - `org.junit.jupiter:junit-jupiter` — `test`. + - `org.testcontainers:postgresql` — `test`. +- Plugins: + - `flyway-maven-plugin` — version `${flyway.version}`; migration location `filesystem:src/main/resources/db/migration`. + - `maven-surefire-plugin` — sets system property `invoice.archive.dir` to `${invoice.archive.dir}`. +- Properties: `maven.compiler.release` = `17`; `jackson.version` = `2.19.2`; `flyway.version` = `11.4.0`; `invoice.archive.dir` = `${project.build.directory}/archive`. +- Profile `native-pdf` — adds `org.apache.pdfbox:pdfbox` version `3.0.5`. +- Project metadata: `name` `Invoice service`; description `Creates, numbers and archives customer invoices.` + +#### Configuration +- `maven.compiler.release`: `17`. +- `jackson.version`: `2.19.2`. +- `flyway.version`: `11.4.0`. +- `invoice.archive.dir`: `${project.build.directory}/archive`. +- Flyway migration location: `filesystem:src/main/resources/db/migration`. +- Surefire system property `invoice.archive.dir`: `${invoice.archive.dir}`. + +#### Dependencies +- Parent POM: `org.example.billing:billing-parent:2.7.0`. +- Migration files under `src/main/resources/db/migration`. +- External dependencies: Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL; optional profile dependency PDFBox. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/package.ai.md new file mode 100644 index 00000000..8a3917e6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/package.ai.md @@ -0,0 +1,47 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:20:47Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Supports billing operations through invoice build configuration, scheduled overdue-reminder delivery, shipment-notice validation, and account-statement rendering. + +#### Purpose +- Defines Maven build and test settings for the `invoice-service`, including database migrations and invoice archive configuration. +- Provides XML resources for reminder scheduling, shipment-message validation, and statement-to-HTML presentation. + +#### Responsibilities +- **Invoice service build:** Packages the `invoice-service` JAR; configures Flyway migrations, test archive directory, and optional PDFBox support. +- **Reminder scheduling:** Wires JDBC persistence and SMTP delivery into a weekday job, with database and mail settings supplied by properties. +- **Shipment validation:** Specifies required shipment notice, recipient, carrier, and parcel fields and their constraints. +- **Statement presentation:** Transforms statement XML into HTML with booking details, totals, and threshold-based highlighting. + +#### Key units +- `invoice-service-pom.xml` — Maven configuration for the Java 17 invoice module, dependencies, migrations, and tests. +- `scheduler-context.xml` — Spring context defining `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, and `reminderScheduler`. +- `shipment.xsd` — Schema for `shipmentNotice`, including `ShipmentNoticeType`, `ParcelType`, `AddressType`, `CarrierCode`, and `WeightGrams`. +- `statement-to-html.xsl` — XSLT templates for statement headers, booking rows, and totals; exposes `currencySymbol` and `highlightAbove`. + +#### Data flow +- Reminder configuration resolves database and SMTP placeholders from `reminder.properties`, wires the repository and gateway into `OverdueReminderJob`, and schedules `sendDueReminders` for weekday mornings. +- Shipment XML is checked against `shipment.xsd`, including carrier enumeration, parcel weight limits, required identifiers, and recipient structure. +- Statement XML in `urn:example:statement` is transformed into HTML; bookings are formatted and summed, with rows marked `large` when amounts exceed `highlightAbove`. +- Maven builds the invoice JAR, runs Flyway from `src/main/resources/db/migration`, and passes the configured archive directory to tests. + +#### Dependencies +- Build: parent `org.example.billing:billing-parent:2.7.0`; Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL; optional PDFBox. +- Reminder context: HikariCP, `org.example.reminder` repository, gateway, and job classes; scans `org.example.reminder.web`. +- XML resources: XML Schema built-in types and XSLT functions; statement input uses namespace `urn:example:statement`. + +#### Cross-cutting +- XML resources use explicit namespaces; shipment elements are qualified in `urn:example:shipment:1`. +- Reminder settings use property placeholders; the Hikari data source is closed through its configured destroy method. +- Reminder scheduling uses a pool size of 2 and a cron schedule of `0 0 7 * * MON-FRI`; the job has a 14-day grace period. +- Invoice archive location defaults to `${project.build.directory}/archive`; PDF generation is enabled through the `native-pdf` profile. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..6a610db4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,45 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:20:19Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures weekday morning delivery of overdue reminders using a JDBC repository, SMTP gateway, and Spring-managed scheduler. + +#### Purpose +- Wires the reminder database, repository, mail gateway, and overdue-reminder job. +- Schedules `sendDueReminders` to run on weekdays. + +#### Type +- Spring application context; root element `beans`. +- Namespaces: default `http://www.springframework.org/schema/beans`; `xsi` `http://www.w3.org/2001/XMLSchema-instance`; `context` `http://www.springframework.org/schema/context`; `task` `http://www.springframework.org/schema/task`. + +#### Definitions +- Beans: + - `reminderDataSource` — `com.zaxxer.hikari.HikariDataSource`; `destroy-method="close"`. + - `reminderRepository` — `org.example.reminder.JdbcReminderRepository`; constructor references `reminderDataSource`. + - `mailGateway` — `org.example.reminder.SmtpMailGateway`. + - `overdueReminderJob` — `org.example.reminder.OverdueReminderJob`; constructor references `reminderRepository` and `mailGateway`. +- Component scan: `org.example.reminder.web`. +- Property placeholder source: `classpath:reminder.properties`. +- Scheduler: `reminderScheduler`; scheduled method `overdueReminderJob.sendDueReminders`. + +#### Configuration +- `reminderDataSource.jdbcUrl`: `${reminder.db.url}`. +- `reminderDataSource.username`: `${reminder.db.user}`. +- `reminderDataSource.maximumPoolSize`: `8`. +- `mailGateway.host`: `${reminder.smtp.host}`. +- `mailGateway.port`: `587`. +- `overdueReminderJob.graceDays`: `14`. +- `reminderScheduler.pool-size`: `2`. +- `overdueReminderJob.sendDueReminders` cron: `0 0 7 * * MON-FRI`. + +#### Dependencies +- Property file: `classpath:reminder.properties`. +- Classes: `com.zaxxer.hikari.HikariDataSource`, `org.example.reminder.JdbcReminderRepository`, `org.example.reminder.SmtpMailGateway`, `org.example.reminder.OverdueReminderJob`. +- Scanned package: `org.example.reminder.web`. +- Placeholder keys: `reminder.db.url`, `reminder.db.user`, `reminder.smtp.host`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..c6d45031 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/shipment.xsd.ai.md @@ -0,0 +1,37 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:20:24Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the structure and validation rules for warehouse shipment notices, including carrier, recipient, and parcel details. + +#### Purpose +- Validates shipment notices sent when parcels leave a warehouse. + +#### Type +- XML Schema; root element `schema`. +- Namespaces: `xs` = `http://www.w3.org/2001/XMLSchema`; `shp` = `urn:example:shipment:1`. +- Target namespace: `urn:example:shipment:1`; `elementFormDefault="qualified"`. + +#### Definitions +- Top-level element: `shipmentNotice` of type `shp:ShipmentNoticeType`. +- Simple types: + - `CarrierCode`: `xs:string` enumeration `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: `xs:positiveInteger`, maximum inclusive `31500`. +- Complex types: + - `ParcelType`: ordered `trackingNumber` (`xs:string`), `weight` (`shp:WeightGrams`); required `sequence` attribute (`xs:positiveInteger`). + - `AddressType`: ordered `name`, `street`, `postalCode`, `city`, `country` (all `xs:string`); `country` is optional. + - `ShipmentNoticeType`: ordered `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), one or more `parcel` (`shp:ParcelType`); required `noticeId` attribute (`xs:ID`). + +#### Configuration +- `WeightGrams`: values must be positive integers no greater than `31500`. +- `AddressType.country`: default `DE`; optional. +- `ShipmentNoticeType.parcel`: `maxOccurs="unbounded"`. + +#### Dependencies +- References XML Schema built-in types: `xs:string`, `xs:positiveInteger`, `xs:dateTime`, `xs:ID`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..69986ba0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,37 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:20:28Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a monthly account statement into an HTML page showing account and period details, booking rows, and a total. + +#### Purpose +- Render statement data as an HTML account statement. +- Mark booking rows as `large` when their amount exceeds a configurable threshold. + +#### Type +- XSLT 1.0 stylesheet; root element `xsl:stylesheet`. +- Namespace: `xsl` — `http://www.w3.org/1999/XSL/Transform`; `st` — `urn:example:statement`. + +#### Definitions +- Templates: + - Match `/st:statement`: emits the HTML page, calls `statementHeader` and `statementTotal`, and applies templates to `st:booking`. + - Named `statementHeader`: outputs account number and period. + - Match `st:booking`: outputs value date, purpose, and formatted amount with currency; adds class `large` when the amount exceeds `$highlightAbove`. + - Named `statementTotal`: outputs the formatted sum of booking amounts. +- Parameters: `currencySymbol` (default `EUR`); `highlightAbove` (default `1000`). +- Key: `bookingsByDay`, matching `st:booking`, indexed by `st:valueDate`. +- Output method: `html`; encoding `UTF-8`; indentation enabled. + +#### Configuration +- `currencySymbol` — default `EUR`. +- `highlightAbove` — default `1000`. + +#### Dependencies +- Input statement data in namespace `urn:example:statement`, using `st:statement`, `st:accountNumber`, `st:booking`, `st:valueDate`, `st:purpose`, and `st:amount`. +- Uses XSLT functions `format-number()` and `sum()`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/package.ai.md new file mode 100644 index 00000000..cdeecf5e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/package.ai.md @@ -0,0 +1,53 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:03Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> Supports billing and service operations by analyzing access traffic, managing deployments and workers, exporting settled payments, and supplying invoice and document-processing resources. + +#### Purpose +- Provides operational tools and billing resources for traffic reporting, service health, payment exports, and invoice-related workflows. +- Combines command-line utilities with Maven, scheduler, schema, and transformation configuration. + +#### Responsibilities +- **Traffic analysis:** Parse and aggregate access logs by host and HTTP status, track slow requests, apply aliases and exclusions, and emit text or JSON reports. +- **Service operations:** Deploy tagged `orderd` releases to staging or production and manage `queue-worker` lifecycle and health. +- **Payment export:** Query Oracle settled payments for a business day and generate a compressed CSV with a row-count control file. +- **Billing resources:** Configure the invoice-service build and reminder scheduler; define shipment validation and statement-to-HTML transformation. + +#### Key units +- `LogDigest`, `parse_line`, `top_n` — parse log entries, aggregate traffic metrics, and rank hosts. +- `log_digest.pl` `main`, `read_aliases` — process CLI options and host mappings, then emit filtered summaries. +- `deploy_host`, `wait_healthy`, `load_hosts` — select hosts, deploy releases, and verify service health. +- `is_running`, `heartbeat_age`, `start_worker`, `stop_worker` — manage worker process state and heartbeat checks. +- `run_export`, `write_control` — query `settled_payment` and write export records and control metadata. +- `invoice-service-pom.xml` — configure invoice-service dependencies, migrations, tests, and optional PDFBox support. +- `scheduler-context.xml` — wire reminder data access, mail delivery, job execution, and weekday scheduling. +- `shipment.xsd` — define shipment notice, address, carrier, and parcel structure and constraints. +- `statement-to-html.xsl` — render statement headers, bookings, totals, and threshold-based highlighting. + +#### Data flow +- Access-log lines are filtered and parsed into host, status, and slow-request metrics, then emitted as text or canonical JSON. +- Deployment selects an environment host list and release archive, transfers and activates the release, restarts the service, and checks health sequentially. +- Worker commands use PID and heartbeat files to determine process status and health. +- Payment export queries Oracle for a selected business day and writes semicolon-separated results, a control count, and a gzipped CSV. +- Reminder properties configure database and SMTP connections for `OverdueReminderJob`; shipment XML is validated against `shipment.xsd`, and statement XML is transformed to HTML. +- Maven builds the invoice JAR, runs Flyway migrations, and configures the archive directory used by tests. + +#### Dependencies +- Perl utilities use `JSON::PP`, `Getopt::Long`, `FindBin`, `POSIX`, `List::Util`, `Carp`, and `Exporter`. +- Deployment uses `lib/common.sh`, environment host lists, SSH/rsync, `systemctl`, and the service `/health` endpoint; worker scripts invoke `/usr/local/bin/queue-worker`. +- Payment export uses `sqlplus` and Oracle’s `settled_payment` table. +- Invoice build depends on the billing parent POM, Jackson Databind, Flyway, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, and optionally PDFBox. +- Reminder configuration uses HikariCP and `org.example.reminder` repository, gateway, and job classes; XML resources use XML Schema types and XSLT functions. + +#### Cross-cutting +- Configuration comes from CLI options, environment variables, or properties, with defaults for deployment credentials, worker paths, Oracle SID, and export directory. +- Tool-specific errors and exit statuses report failures; deployment stops at the first failed host, while payment export retries up to three times. +- Log processing skips malformed entries, limits input to 50,000 lines, and counts requests over 1,500 ms as slow. +- The reminder scheduler uses a two-thread pool, weekday 7:00 schedule, and 14-day grace period. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/project.ai.md new file mode 100644 index 00000000..2fb07676 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-6-luna/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: CA841C91 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:12Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project combines operational tooling for billing and service management, including release deployment, queue-worker health and lifecycle checks, and settled-payment exports. Traffic analysis converts web-server logs into normalized host and HTTP-status summaries, while billing resources support invoice builds, overdue reminders, shipment validation, and account-statement rendering. + +#### Packages +- other — Provides operational tooling and billing resources for analyzing access traffic, deploying and monitoring services, exporting settled payments, and supporting invoice, reminder, shipment, and statement workflows. +- other/perl — Converts web-server access logs into normalized host and HTTP-status traffic summaries, including busiest-host rankings and slow-request counts. +- other/shell — Automates release deployment, queue-worker health and lifecycle checks, and nightly export of settled payments for operational systems. +- other/xml — Supports billing operations through invoice build configuration, scheduled overdue-reminder delivery, shipment-notice validation, and account-statement rendering. +- . — Supports billing and service operations by analyzing access traffic, managing deployments and workers, exporting settled payments, and supplying invoice and document-processing resources. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..0e84c25b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,55 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:52Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A multi‑language toolkit that ingests web‑server logs, aggregates statistics, and supports deployment, service control, and invoicing workflows across Perl, shell, and XML components. + +#### Purpose +- Parse and summarize access logs into host‑ and status‑level metrics. +- Automate application release deployment and queue‑worker lifecycle. +- Build and schedule invoicing reminders, validate shipment XML, and render statements to HTML. + +#### Responsibilities +- **Log Processing (Perl)** – parsing, aggregation, slow‑request detection, reporting. +- **Deployment & Service Control (Shell)** – host‑by‑host release rollout, queue‑worker PID/heartbeat management, nightly Oracle payment extraction. +- **Build & Scheduling (XML/Maven/Spring)** – Maven build, Flyway migrations, Spring job scheduling for overdue reminders, XML schema validation, XSLT rendering. + +#### Key units +- `LogDigest` (Perl module) – OO interface for adding log lines, summarizing, and retrieving top hosts. +- `log_digest.pl` (Perl script) – CLI front‑end, option parsing, config loading, output formatting. +- `deploy_release.sh` (Shell) – orchestrates tarball transfer, extraction, symlink, service restart, health polling. +- `healthcheck.sh` (Shell) – wrapper for queue‑worker daemon, PID/heartbeat handling. +- `nightly_extract.ksh` (Shell) – Oracle `sqlplus` extraction, CSV/CTL generation, gzip, retry loop. +- `invoice-service-pom.xml` (Maven) – project definition, Flyway, optional PDF profile. +- `scheduler-context.xml` (Spring) – data source, repository, mail gateway, overdue reminder job, cron trigger. +- `shipment.xsd` (XML Schema) – validation for shipment notices. +- `statement-to-html.xsl` (XSLT) – transforms statement XML to HTML with currency and threshold parameters. + +#### Data flow +1. **Log ingestion** – CLI → `LogDigest` → internal counters → summary hash → formatted output. +2. **Deployment** – script reads env → host list → rsync → SSH extraction → symlink → systemctl restart → curl health check. +3. **Service lifecycle** – `healthcheck.sh` writes/reads PID and heartbeat files; status/health commands query these. +4. **Payment extraction** – `nightly_extract.ksh` runs `sqlplus`, writes CSV/CTL, gzips, retries on failure. +5. **Build & scheduling** – Maven compiles, runs Flyway, packages JAR; Spring context loads beans, triggers overdue reminder job via cron; mail gateway sends emails. +6. **XML processing** – external system produces shipment XML → validated against `shipment.xsd`; statement XML → transformed by `statement-to-html.xsl` into HTML. + +#### Dependencies +- **Perl**: core modules (`POSIX`, `List::Util`, `Carp`, `Exporter`), external (`Getopt::Long`, `JSON::PP`, `FindBin`), config file `/etc/log-digest.conf`. +- **Shell**: external commands (`rsync`, `ssh`, `curl`, `systemctl`, `sqlplus`, `gzip`), host lists (`hosts.staging`, `hosts.production`), common library `lib/common.sh`. +- **Maven/Spring**: `org.flywaydb:flyway-core`, `com.fasterxml.jackson.core:jackson-databind`, `org.postgresql:postgresql`, optional `org.apache.pdfbox:pdfbox`, Spring context and scheduler, HikariDataSource. +- **XML**: standard XSD namespace, XSLT 1.0 processor. + +#### Cross‑cutting +- Logging via timestamped `log` functions (Shell) and verbosity levels (Perl). +- Error handling: `die`/`fail` with exit codes (Shell), `croak` on invalid levels (Perl). +- Configuration through environment variables, defaults, and property placeholders. +- Retry logic in `nightly_extract.ksh` (max 3 attempts, 60‑second backoff). +- Consistent namespace prefixes (`shp`, `st`) and parameterized XSLT for currency and thresholds. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..74677d09 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,68 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:15Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Provides a log‑digesting utility for web‑server access logs. +- Counts requests per host, per status code, and flags slow requests. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: constructor `new`, methods `add`, `summarize`. + +#### Input +- `new(level => $level)` – `$level` must be one of `DEBUG`, `INFO`, `WARN`, `ERROR`; defaults to `WARN`. +- `add($line)` – expects a log line matching the regex in `parse_line`. +- `parse_line($line)` – parses a single log line. +- `top_n($counts, $n)` – returns top `$n` keys from a hash of counts. + +#### Output +- `add` returns `1` on successful parse, `0` if line ignored, dies on too many lines. +- `summarize` returns hashref: + - `generated` – UTC timestamp. + - `total` – total request count. + - `hosts` – number of distinct hosts. + - `busiest` – max requests from a single host. + - `slow` – count of requests > 1500 ms. + - `statuses` – hashref of status code counts. +- `top_n` returns list of keys sorted by count descending, then lexicographically. + +#### Core logic +- `new`: validate log level, initialize counters. +- `parse_line`: regex extracts host, time, method, path, status, millis; normalizes host. +- `add`: enforce `MAX_LINES`; parse line; increment host and status counters; increment slow counter if millis > `SLOW_REQUEST_MS`. +- `summarize`: compute totals, busiest host, and assemble summary hash. +- `top_n`: sort hash keys by count descending, tie‑break by key; slice top `$n`. + +#### Subs +- `new(%args) -> object` – create digest with level. +- `parse_line($line) -> hashref` – parse log line. +- `add($line) -> 1|0` – add entry, update counters. +- `summarize() -> hashref` – produce summary. +- `top_n($counts, $n) -> list` – top N keys. +- `_normalize_host($host) -> host` – lowercase, strip trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `%LEVEL_RANK = (DEBUG => 0, INFO => 1, WARN => 2, ERROR => 3)` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `croak` if unknown level in `new`. +- `croak` if more than `MAX_LINES` added in `add`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..2cc50caf --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,75 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:20Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Reads web server access logs, filters hosts, and reports request counts and slow responses, optionally as JSON. + +#### Purpose +- Script to analyze access logs. +- Outputs busiest hosts and status‑code tallies. + +#### Type +- Script. +- Uses `LogDigest` module; no exported symbols. + +#### Input +- Options: + - `--top|n=i` → `$top` (default 10). + - `--level=s` → `$level` (default 'WARN'). + - `--json!` → `$as_json` (default 0). + - `--exclude-host=s` → `@exclude_hosts` (multiple allowed). + - `--help|h` → prints usage. +- Positional arguments: `FILE...` (log files). +- Environment: + - `LOG_DIGEST_CONFIG` → `$config_file` (default `/etc/log-digest.conf`). +- Reads config file lines `from = to` for host aliases. + +#### Output +- If `$as_json`: JSON string of `$summary` hash, newline terminated. +- Else: plain text: + - `printf "%d requests from %d hosts, %d slow\n", $summary->{total}, $summary->{hosts}, $summary->{slow};` + - List of top hosts via `top_n($digest->{hosts}, $top)`. + +#### Core logic +- Load host aliases from config. +- Build `%excluded` hash from `@exclude_hosts`. +- Create `LogDigest` with `level`. +- For each input file: + - Read line by line. + - Extract `$host` (first token). + - Skip if host (or its alias) in `%excluded`. + - Pass line to `$digest->add`. +- After all files, call `$digest->summarize`. +- Output summary in chosen format. + +#### Subs +- `usage() -> string` + Returns usage message. +- `read_aliases(path) -> hash` + Parses alias file into `%aliases`. +- `main() -> 0` + Orchestrates parsing, digesting, output. + +#### Constants and configuration +- `$config_file = $ENV{LOG_DIGEST_CONFIG} // '/etc/log-digest.conf'`. +- `$top = 10`. +- `$level = 'WARN'`. +- `$as_json = 0`. +- `@exclude_hosts = ()`. + +#### Dependencies +- `FindBin` – `$Bin`. +- `Getopt::Long` – `GetOptions`. +- `JSON::PP` – `new`, `canonical`, `encode`. +- `LogDigest` – `new`, `add`, `summarize`, `hosts`, `top_n`. + +#### Exceptions / Errors +- `die usage()` on bad options. +- `die "--top must be positive\n"` if `$top < 1`. +- `die "cannot read $file: $!\n"` on file open failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..38db8a9c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,44 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:42Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> A Perl toolkit that parses web‑server access logs, aggregates per‑host and per‑status statistics, flags slow requests, and outputs concise summaries or JSON reports. + +#### Purpose +- Digest access logs into host‑ and status‑level counts. +- Identify slow requests and provide quick summaries. + +#### Responsibilities +- **Log parsing & normalization** – extract host, status, and latency from each line. +- **Aggregation** – maintain counters for hosts, status codes, and slow requests. +- **Reporting** – produce human‑readable or JSON summaries, including top N hosts. +- **CLI orchestration** – read files, apply host exclusions, load alias mappings, and drive the digest. + +#### Key units +- `LogDigest` (module) – OO interface (`new`, `add`, `summarize`, `top_n`), internal counters, host normalization. +- `log_digest.pl` (script) – command‑line front‑end, option parsing, config loading, output formatting. + +#### Data flow +1. **CLI** parses options → creates `LogDigest` instance. +2. For each log file: read line → filter by excluded hosts → `LogDigest->add`. +3. After all lines: `LogDigest->summarize` → hash of totals, hosts, slow count, status counts. +4. Script formats output (plain or JSON) and prints. + +#### Dependencies +- **Perl core**: `POSIX`, `List::Util`, `Carp`, `Exporter`. +- **External**: `Getopt::Long`, `JSON::PP`, `FindBin`. +- **Configuration**: `/etc/log-digest.conf` for host alias mappings. + +#### Cross-cutting +- Host names are normalized to lowercase and stripped of trailing dots. +- Logging levels (`DEBUG`, `INFO`, `WARN`, `ERROR`) control verbosity; invalid levels `croak`. +- A hard limit of 50 000 lines (`MAX_LINES`) protects against runaway input. +- Slow requests are flagged when latency exceeds 1500 ms (`SLOW_REQUEST_MS`). +- Top‑N selection uses a deterministic tie‑break: count descending, then lexicographic order. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..f8108894 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,84 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:24Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploys a specified release to all hosts in an environment. +- Runs as a standalone script. + +#### Type +- `bash` +- `set -euo pipefail` + +#### Input +- Options parsed with `getopts`: + - `-e ` → `ENVIRONMENT` + - `-t ` → `TAG` + - `-n` → `DRY_RUN=1` + - `-p ` → ignored, logged + - `-h` → prints usage +- Environment variables: + - `DEPLOY_USER` (default `deploy`) + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`) +- Files read: + - `$SCRIPT_DIR/lib/common.sh` + - `$SCRIPT_DIR/hosts.staging` or `$SCRIPT_DIR/hosts.production` based on `ENVIRONMENT` + - `build/$TAG.tar.gz` + +#### Output +- Copies `build/$TAG.tar.gz` to `/tmp/` on each host. +- Extracts to `$RELEASE_ROOT/$TAG` on each host. +- Creates symlink `$RELEASE_ROOT/current` → `$RELEASE_ROOT/$TAG`. +- Restarts `orderd` via `systemctl`. +- Checks health at `http://$host:8080/health`; exits on failure. +- Logs actions to stderr. +- Exit status 0 on success, 1 on error, 2 on missing arguments. + +#### Core logic +- Parse options; validate `ENVIRONMENT` and `TAG`. +- Verify required tools (`rsync`, `ssh`, `curl`) and SSH key. +- Load host list from environment-specific file. +- For each host: + - If dry‑run, log intended action. + - Else: + - `rsync` tarball to host. + - SSH into host, create target dir, extract tarball, update symlink, restart service. + - Poll health endpoint until success or timeout. + - Log deployment completion. + +#### Functions +- `log` – prints timestamped message to stderr. +- `die` – logs error and exits. +- `usage` – prints usage from script comment. +- `check_prereqs` – ensures required tools and SSH key exist. +- `load_hosts` – reads host list file into `HOSTS`. +- `deploy_host` – performs deployment steps for a single host. +- `wait_healthy` – polls health endpoint with timeout. +- `cleanup` – removes temporary lock file on exit. + +#### Constants and configuration +- `SCRIPT_DIR`=`/path/to/other/shell` +- `DEPLOY_USER`=`deploy` +- `SSH_KEY`=`$HOME/.ssh/deploy_ed25519` +- `RELEASE_ROOT`=`/opt/releases` +- `SERVICE_NAME`=`orderd` +- `HEALTH_TIMEOUT`=`30` +- `HOST_FILES`=`[staging]="hosts.staging" [production]="hosts.production"` + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl` +- External file: `$SCRIPT_DIR/lib/common.sh` +- Host list files: `hosts.staging`, `hosts.production` + +#### Errors and exit codes +- `die` exits with status 1 for missing tools, unreadable SSH key, empty host list, or health check failure. +- Missing required options triggers usage and exits with status 2. +- Health check timeout (`HEALTH_TIMEOUT`) causes exit 1 after exceeding limit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..9dc6d592 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,67 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:28Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> A POSIX init-style wrapper that manages a queue worker process, providing start, stop, status, restart, and health check based on PID and heartbeat files. + +#### Purpose +- Controls a queue worker binary. +- Exposed as a command-line tool (`start|stop|restart|status|health`). + +#### Type +- `sh` (POSIX sh). +- No strict mode flags used. + +#### Input +- `$1` command (`start`, `stop`, `restart`, `status`, `health`). +- Environment variables: + - `PID_FILE` (default `/run/queue-worker.pid`). + - `HEARTBEAT_FILE` (default `/var/lib/queue-worker/heartbeat`). +- No other options or arguments. + +#### Output +- Writes PID to `$PID_FILE` when starting. +- Removes `$PID_FILE` when stopping. +- Prints status messages (`running`, `stopped`, `OK`, `WARNING`, `CRITICAL`). +- Exit codes: + - `0` success. + - `1` heartbeat too old. + - `2` not running. + - `3` stopped status. + - `64` invalid usage. + +#### Core logic +- `is_running`: checks PID file and process liveness. +- `heartbeat_age`: calculates seconds since heartbeat file modification. +- `start_worker`: starts worker with `nohup`, records PID. +- `stop_worker`: kills process, removes PID file. +- Command dispatch via `case` on `$1`. + +#### Functions +- `is_running`: test if worker process exists. +- `heartbeat_age`: compute heartbeat staleness. +- `start_worker`: launch worker, write PID. +- `stop_worker`: terminate worker, clean PID. + +#### Constants and configuration +- `PID_FILE`=`/run/queue-worker.pid` +- `HEARTBEAT_FILE`=`/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE`=`120` +- `WORKER_BIN`=`/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `kill`, `nohup`, `date`, `stat`, `cat`. +- Worker binary: `/usr/local/bin/queue-worker` with `--heartbeat` option. + +#### Errors and exit codes +- `exit 64`: usage error. +- `exit 2`: health check fails because worker not running. +- `exit 1`: heartbeat older than `MAX_HEARTBEAT_AGE`. +- `exit 3`: status reports stopped. +- `nohup` and `kill` errors suppressed to `/dev/null`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..bced2d59 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,76 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:30Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, creates a control file, and gzips the result with retry logic. + +#### Purpose +- Run nightly to export settled payments. +- Executed directly; not sourced. + +#### Type +- `ksh93` (shebang `#!/bin/ksh93`). +- Uses `set -e`? none; relies on `whence -q` and explicit exits. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → variable `business_day`. + - `-o

` → variable `export_dir`. +- Environment variables read: + - `ORACLE_SID` (default `PAYPRD`). + - `NLS_LANG` set to `AMERICAN_AMERICA.AL32UTF8`. +- No positional arguments. + +#### Output +- Creates `payments_.csv` in `export_dir`. +- Generates `.ctl` with row count and business day. +- Gzips the CSV to `.gz`. +- Prints log messages to stderr. +- Exits with status 0 on success, 1–4 on various failures. + +#### Core logic +- Parse options; set defaults. +- Ensure `export_dir` exists. +- Build `csv` path. +- Retry loop (max 3 attempts): + - Run `run_export` to dump data via `sqlplus`. + - On success: + - Write control file. + - Gzip CSV. + - Log success and exit. + - On failure: + - Log attempt, sleep 60, retry. +- On exhausting retries, call `fail` with exit code 4. + +#### Functions +- `log` – prefix timestamped message to stderr. +- `fail` – log failure and exit with code. +- `require_tools` – ensure `sqlplus` and `gzip` are available. +- `run_export` – execute SQL to produce CSV. +- `write_control` – write row count and business day to `.ctl`. + +#### Constants and configuration +- `ORACLE_SID_DEFAULT=PAYPRD` +- `EXPORT_DIR_DEFAULT=/data/export/payments` +- `MAX_RETRIES=3` +- `attempt=0` +- `business_day=$(date +%Y%m%d)` +- `export_dir=$EXPORT_DIR_DEFAULT` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle database connection via `/ AS SYSDBA`. +- SQL query reads `settled_payment` table for `business_day`. + +#### Errors and exit codes +- `fail` exit codes: + - 1: generic failure (e.g., missing tool). + - 2: usage error. + - 3: missing required tool. + - 4: exceeded retry limit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..c86af4a2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,44 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:45Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> A collection of shell utilities for deploying releases, managing a queue‑worker service, and nightly payment extraction from Oracle. + +#### Purpose +- Automate deployment of application releases to multiple hosts. +- Provide a POSIX‑style control interface for a queue‑worker daemon. +- Export settled payments nightly into CSV/CTL files with retry logic. + +#### Responsibilities +- **Deployment**: `deploy_release.sh` handles tarball transfer, extraction, symlink updates, service restart, and health polling across environments. +- **Service Management**: `healthcheck.sh` offers start/stop/status/health commands for a queue worker, tracking PID and heartbeat. +- **Data Extraction**: `nightly_extract.ksh` queries Oracle for settled payments, writes CSV/CTL, gzips output, and retries on failure. + +#### Key units +- `deploy_release.sh` – orchestrates host‑by‑host deployment, uses `rsync`, `ssh`, `curl`. +- `healthcheck.sh` – wrapper around `/usr/local/bin/queue-worker`, manages `/run/queue-worker.pid` and `/var/lib/queue-worker/heartbeat`. +- `nightly_extract.ksh` – runs `sqlplus` against `PAYPRD`, produces `payments_.csv`, `.ctl`, and gzipped archive. + +#### Data flow +1. **Deployment**: script reads environment flag → loads host list → for each host: rsync tarball → SSH to extract → symlink → systemctl restart → curl health check. +2. **Service**: `start` writes PID, `stop` kills process, `status` checks PID and heartbeat age, `health` reports OK/CRITICAL. +3. **Extraction**: parse date & dir → ensure dir → retry loop: `sqlplus` dumps to CSV → write control file → gzip CSV. + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl`, `systemctl`, `kill`, `nohup`, `date`, `stat`, `sqlplus`, `gzip`. +- External files: `hosts.staging`, `hosts.production`, `$SCRIPT_DIR/lib/common.sh`. +- Oracle connection via `/ AS SYSDBA` and `PAYPRD` SID. + +#### Cross‑cutting +- Logging via timestamped `log` functions. +- Error handling with `die`/`fail` and exit codes (0 success, 1–4 failures). +- Configuration via environment variables and defaults (`DEPLOY_USER`, `SSH_KEY`, `PID_FILE`, `HEARTBEAT_FILE`, `MAX_HEARTBEAT_AGE`, `ORACLE_SID_DEFAULT`). +- Retry logic in `nightly_extract.ksh` (max 3 attempts, 60‑second backoff). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..6fe0df92 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,58 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:33Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures the Maven build for the Invoice Service module, defining dependencies, compiler settings, and build plugins. + +#### Purpose +- Builds the `invoice-service` JAR. +- Manages database migrations with Flyway. +- Supplies test dependencies and optional PDF support. + +#### Type +- Maven POM + Root element: `project` + Namespaces: `xmlns="http://maven.apache.org/POM/4.0.0"`, `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release` = `17` + - `jackson.version` = `2.19.2` + - `flyway.version` = `11.4.0` + - `invoice.archive.dir` = `${project.build.directory}/archive` +- **Dependencies**: + - `com.fasterxml.jackson.core:jackson-databind:${jackson.version}` + - `org.flywaydb:flyway-core:${flyway.version}` + - `org.postgresql:postgresql` (runtime) + - `org.junit.jupiter:junit-jupiter` (test) + - `org.testcontainers:postgresql` (test) +- **Build Plugins**: + - `org.flywaydb:flyway-maven-plugin:${flyway.version}` + - `locations`: `filesystem:src/main/resources/db/migration` + - `org.apache.maven.plugins:maven-surefire-plugin` + - `systemPropertyVariables`: `invoice.archive.dir=${invoice.archive.dir}` +- **Profile** `native-pdf` + - Adds dependency `org.apache.pdfbox:pdfbox:3.0.5` + +#### Configuration +- `maven.compiler.release` = `17` +- `invoice.archive.dir` = `${project.build.directory}/archive` +- Flyway `locations` = `filesystem:src/main/resources/db/migration` +- Surefire `systemPropertyVariables.invoice.archive.dir` = `${invoice.archive.dir}` + +#### Dependencies +- `org.example.billing:billing-parent:2.7.0` +- `com.fasterxml.jackson.core:jackson-databind:${jackson.version}` +- `org.flywaydb:flyway-core:${flyway.version}` +- `org.postgresql:postgresql` +- `org.junit.jupiter:junit-jupiter` +- `org.testcontainers:postgresql` +- `org.apache.pdfbox:pdfbox:3.0.5` (profile `native-pdf`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..a0fa95fc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,48 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:49Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides build, configuration, and data‑formatting support for an invoicing and reminder system, including XML schemas, XSLT rendering, and Spring scheduling. + +#### Purpose +- Build the `invoice-service` JAR with Maven, manage DB migrations, and optionally support PDF generation. +- Configure a Spring context for scheduling overdue reminder emails. +- Define XML schemas for shipment notices and XSLT for statement‑to‑HTML conversion. + +#### Responsibilities +- **Build & Dependency Management** – Maven POM with compiler, Flyway, test, and optional PDF dependencies. +- **Scheduling Infrastructure** – Spring XML defining data source, repository, mail gateway, job, and cron trigger. +- **Data Validation** – XML Schema (`shipment.xsd`) for shipment notices. +- **Presentation** – XSLT (`statement-to-html.xsl`) to transform statement XML into HTML. + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, Flyway plugin, optional `native-pdf` profile. +- `scheduler-context.xml` – Spring beans: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler`. +- `shipment.xsd` – Schema for `shipmentNotice` with `ParcelType`, `AddressType`, and `ShipmentNoticeType`. +- `statement-to-html.xsl` – XSLT stylesheet with parameters `currencySymbol`, `highlightAbove`; templates for header, booking rows, and total. + +#### Data flow +1. **Build**: Maven compiles source, runs Flyway migrations, packages JAR, optionally bundles PDF support. +2. **Scheduling**: Spring context loads data source → repository → job → scheduler; cron triggers `overdueReminderJob.sendDueReminders` → mail gateway sends emails. +3. **Shipment Notice**: External system generates XML validated against `shipment.xsd`. +4. **Statement Rendering**: Input `` XML is transformed by `statement-to-html.xsl` into an HTML page, highlighting large amounts. + +#### Dependencies +- Maven: `org.flywaydb:flyway-core`, `com.fasterxml.jackson.core:jackson-databind`, `org.postgresql:postgresql`, testcontainers, JUnit, optional `org.apache.pdfbox:pdfbox`. +- Spring: `com.zaxxer.hikari.HikariDataSource`, task scheduler, context. +- XML: standard XSD namespace; XSLT 1.0 processor. + +#### Cross-cutting +- Configuration via property placeholders (`reminder.properties`). +- Consistent use of namespace prefixes (`shp`, `st`) for XML documents. +- Parameterized XSLT for currency and threshold customization. +- Flyway migration location set to `src/main/resources/db/migration`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..86791e1a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,42 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:36Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures a Spring context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled trigger. + +#### Purpose +- Wire components for reminder scheduling. +- Define data source, repository, mail gateway, job, and cron trigger. + +#### Type +- Spring context XML (`` root). +- Namespaces: `http://www.springframework.org/schema/beans` (default), `http://www.springframework.org/schema/context`, `http://www.springframework.org/schema/task`. + +#### Definitions +- **Property placeholder**: `reminder.properties`. +- **Component scan**: `org.example.reminder.web`. +- **Beans**: + - `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`): `jdbcUrl` `${reminder.db.url}`, `username` `${reminder.db.user}`, `maximumPoolSize` `8`. + - `reminderRepository` (`org.example.reminder.JdbcReminderRepository`): constructor `reminderDataSource`. + - `mailGateway` (`org.example.reminder.SmtpMailGateway`): `host` `${reminder.smtp.host}`, `port` `587`. + - `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`): constructor `reminderRepository`, `mailGateway`; property `graceDays` `14`. +- **Scheduler**: `reminderScheduler` (`task:scheduler`) with `pool-size` `2`. +- **Scheduled task**: `overdueReminderJob.sendDueReminders` with cron `0 0 7 * * MON-FRI`. + +#### Configuration +- `reminder.db.url`: value from `reminder.properties`. +- `reminder.db.user`: value from `reminder.properties`. +- `reminder.smtp.host`: value from `reminder.properties`. + +#### Dependencies +- `com.zaxxer.hikari.HikariDataSource`. +- `org.example.reminder.JdbcReminderRepository`. +- `org.example.reminder.SmtpMailGateway`. +- `org.example.reminder.OverdueReminderJob`. +- Spring task scheduler and context libraries. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..2ce02615 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,36 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:38Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Validates shipment notice documents. +- Specifies structure of parcels, addresses, and carrier information. + +#### Type +- XML Schema (``) +- Root element: `shipmentNotice` +- Namespace: `urn:example:shipment:1` (prefix `shp`) + +#### Definitions +- **Simple types** + - `CarrierCode`: enumeration of `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: positive integer ≤ 31500. +- **Complex types** + - `ParcelType`: sequence of `trackingNumber` (`xs:string`) and `weight` (`shp:WeightGrams`); required attribute `sequence` (`xs:positiveInteger`). + - `AddressType`: sequence of `name`, `street`, `postalCode`, `city` (`xs:string`); optional `country` (`xs:string`, default `DE`). + - `ShipmentNoticeType`: sequence of `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one or more `parcel` (`shp:ParcelType`); required attribute `noticeId` (`xs:ID`). + +#### Configuration +- `elementFormDefault="qualified"`: elements must be namespace-qualified. + +#### Dependencies +- No external schema imports or includes. +- Relies on standard XML Schema namespace `http://www.w3.org/2001/XMLSchema`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..5004c480 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,36 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:40Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a custom `` XML into an HTML page with header, table rows per booking, and a total. + +#### Purpose +- Render monthly account statements as HTML. +- Highlight bookings exceeding a threshold. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespace: `xmlns:st="urn:example:statement"`. + +#### Definitions +- **Parameters**: `currencySymbol` (default `'EUR'`), `highlightAbove` (default `1000`). +- **Key**: `bookingsByDay` – matches `st:booking` elements, indexed by `st:valueDate`. +- **Templates**: + - `match="/st:statement"` – main entry, outputs ``, calls header, table, total. + - `name="statementHeader"` – outputs `

` with account number and `

` with period. + - `match="st:booking"` – outputs ``; adds `class="large"` if `st:amount` > `$highlightAbove`; columns: date, purpose, amount with currency symbol. + - `name="statementTotal"` – outputs `

` with sum of all `st:booking/st:amount`. + +#### Configuration +- `xsl:output` method: `html`, encoding: `UTF-8`, indent: `yes`. +- `currencySymbol` parameter: `'EUR'`. +- `highlightAbove` parameter: `1000`. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: `statement`, `accountNumber`, `period`, `booking`, `valueDate`, `purpose`, `amount`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..c7847be0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,53 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:21:57Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A toolkit that ingests web‑server logs, aggregates metrics, automates deployment and service control, and orchestrates invoicing workflows across Perl, shell, and XML components. + +#### Purpose +- Parse and summarize access logs into host‑ and status‑level metrics. +- Automate application release deployment and queue‑worker lifecycle. +- Build and schedule invoicing reminders, validate shipment XML, and render statements to HTML. + +#### Responsibilities +- **Log Processing (Perl)** – parsing, aggregation, slow‑request detection, reporting. +- **Deployment & Service Control (Shell)** – host‑by‑host release rollout, queue‑worker PID/heartbeat management, nightly Oracle payment extraction. +- **Build & Scheduling (XML/Maven/Spring)** – Maven build, Flyway migrations, Spring job scheduling for overdue reminders, XML schema validation, XSLT rendering. + +#### Key units +- `LogDigest` (Perl module) – OO interface for adding log lines, summarizing, and retrieving top hosts. +- `log_digest.pl` (Perl script) – CLI front‑end, option parsing, config loading, output formatting. +- `deploy_release.sh` (Shell) – orchestrates tarball transfer, extraction, symlink, service restart, health polling. +- `healthcheck.sh` (Shell) – wrapper for queue‑worker daemon, PID/heartbeat handling. +- `nightly_extract.ksh` (Shell) – Oracle `sqlplus` extraction, CSV/CTL generation, gzip, retry loop. +- `invoice-service-pom.xml` (Maven) – project definition, Flyway, optional PDF profile. +- `scheduler-context.xml` (Spring) – data source, repository, mail gateway, overdue reminder job, cron trigger. +- `shipment.xsd` (XML Schema) – validation for shipment notices. +- `statement-to-html.xsl` (XSLT) – transforms statement XML to HTML with currency and threshold parameters. + +#### Data flow +1. **Log ingestion** – CLI → `LogDigest` → counters → summary hash → formatted output. +2. **Deployment** – script reads env → host list → rsync → SSH extraction → symlink → systemctl restart → curl health check. +3. **Service lifecycle** – `healthcheck.sh` writes/reads PID and heartbeat files; status/health commands query these. +4. **Payment extraction** – `nightly_extract.ksh` runs `sqlplus`, writes CSV/CTL, gzips, retries on failure. +5. **Build & scheduling** – Maven compiles, runs Flyway, packages JAR; Spring context loads beans, triggers overdue reminder job via cron; mail gateway sends emails. +6. **XML processing** – external system produces shipment XML → validated against `shipment.xsd`; statement XML → transformed by `statement-to-html.xsl` into HTML. + +#### Dependencies +- **Perl**: core modules (`POSIX`, `List::Util`, `Carp`, `Exporter`), external (`Getopt::Long`, `JSON::PP`, `FindBin`), config file `/etc/log-digest.conf`. +- **Shell**: external commands (`rsync`, `ssh`, `curl`, `systemctl`, `sqlplus`, `gzip`), host lists (`hosts.staging`, `hosts.production`), common library `lib/common.sh`. +- **Maven/Spring**: `org.flywaydb:flyway-core`, `com.fasterxml.jackson.core:jackson-databind`, `org.postgresql:postgresql`, optional `org.apache.pdfbox:pdfbox`, Spring context and scheduler, HikariDataSource. +- **XML**: standard XSD namespace, XSLT 1.0 processor. + +#### Cross‑cutting +- Logging via timestamped `log` functions (Shell) and verbosity levels (Perl). +- Error handling: `die`/`fail` with exit codes (Shell), `croak` on invalid levels (Perl). +- Configuration through environment variables, defaults, and property placeholders. +- Retry logic in `nightly_extract.ksh` (max 3 attempts, 60‑second backoff). +- Consistent namespace prefixes (`shp`, `st`) and parameterized XSLT for currency and thresholds. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..146ee57c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run3/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: F91917C1 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:22:02Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard project is a multi‑language toolkit that ingests web‑server logs, aggregates metrics, and automates deployment and service control. It orchestrates invoicing workflows by combining Perl modules that parse access logs and produce JSON summaries, shell utilities that deploy releases, manage a queue‑worker service, and extract nightly payments from Oracle, and XML components that provide build, configuration, and data‑formatting support for invoicing and reminders. Together, these subsystems enable end‑to‑end processing from log ingestion to invoicing and reminder generation. + +#### Packages +- other — A multi‑language toolkit that ingests web‑server logs, aggregates statistics, and supports deployment, service control, and invoicing workflows across Perl, shell, and XML components. +- other/perl — A Perl toolkit that parses web‑server access logs, aggregates per‑host and per‑status statistics, flags slow requests, and outputs concise summaries or JSON reports. +- other/shell — A collection of shell utilities for deploying releases, managing a queue‑worker service, and nightly payment extraction from Oracle. +- other/xml — Provides build, configuration, and data‑formatting support for an invoicing and reminder system, including XML schemas, XSLT rendering, and Spring scheduling. +- . — A toolkit that ingests web‑server logs, aggregates metrics, automates deployment and service control, and orchestrates invoicing workflows across Perl, shell, and XML components. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/meta/gpt-oss-20b.json new file mode 100644 index 00000000..4ad8a547 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:43:28Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 29.2, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 21.5, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 1.9, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:44:21Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16083, + "cachedPromptTokens": 5984, + "completionTokens": 5005, + "seconds": 28.6241016 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.001133, + "costUsd": 0.0, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..2f46bcb9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,66 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:08Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A collection of tooling and infrastructure for processing web‑server logs, deploying and monitoring a payment service, and managing invoicing, reminders, and statement rendering in a billing system. + +#### Purpose +- Log analytics and reporting for web‑server access logs. +- Automated deployment, health monitoring, and nightly data extraction for a payment processing service. +- Build, schedule, validate, and present billing documents (invoices, reminders, shipments, statements). + +#### Responsibilities +- **Log processing** – parse, aggregate, and report access‑log statistics. +- **Deployment & monitoring** – distribute releases, manage worker processes, and export settled payments. +- **Billing infrastructure** – build the invoice service, schedule overdue reminders, validate shipment notices, and transform statements to HTML. + +#### Key units +- `LogDigest` (Perl module) – parses log lines, aggregates host/status counts, tracks slow requests. +- `log_digest.pl` (Perl script) – CLI driver for log aggregation, host filtering, and JSON/text output. +- `deploy_release.sh` (Shell script) – orchestrates tarball distribution, extraction, service restart, and health checks. +- `healthcheck.sh` (Shell script) – POSIX init‑style interface for a queue‑worker, managing PID, heartbeat, and status. +- `nightly_extract.ksh` (Korn shell script) – extracts settled payments from Oracle, writes CSV/CTL, gzips output, retries on failure. +- `invoice-service-pom.xml` (Maven POM) – defines the Invoice Service build, dependencies, Flyway migrations, and optional PDF support. +- `scheduler-context.xml` (Spring XML) – configures the overdue‑reminder scheduler, JDBC repository, and mail gateway. +- `shipment.xsd` (XSD) – schema for `` documents. +- `statement-to-html.xsl` (XSLT) – transforms statement XML into styled HTML. + +#### Data flow +1. **Log analytics** + `log_digest.pl` → reads log files → feeds lines to `LogDigest` → `summarize` → textual/JSON report. +2. **Deployment** + `deploy_release.sh` → `rsync` tarball → SSH → extract → symlink → `systemctl restart` → `curl` health check. +3. **Health monitoring** + `healthcheck.sh` `start` → writes PID → worker writes heartbeat → `health` reads heartbeat age → status report. +4. **Data export** + `nightly_extract.ksh` → `sqlplus` query → CSV + control file → `gzip` → retry loop. +5. **Billing** + Maven build → Flyway migrations → JAR package. + Spring scheduler (`reminderScheduler`) triggers `overdueReminderJob` → `JdbcReminderRepository` queries overdue invoices → `SmtpMailGateway` sends emails. + Shipment XMLs validated against `shipment.xsd`. + Statement XML → `statement-to-html.xsl` → HTML output. + +#### Dependencies +- **Perl**: `POSIX`, `List::Util`, `Carp`, `Exporter`, `Getopt::Long`, `JSON::PP`, `FindBin`. +- **Shell utilities**: `rsync`, `ssh`, `curl`, `nohup`, `kill`, `stat`, `sqlplus`, `gzip`. +- **Oracle**: `sqlplus` (SYSDBA, `/`), `settled_payment` table. +- **Maven**: Flyway Core, Surefire, PDFBox (profile), Jackson Databind, HikariCP, Spring Task & Context. +- **Java**: PostgreSQL JDBC, JUnit Jupiter, Testcontainers. +- **XML**: XSD schema (`shipment.xsd`), XSLT stylesheet (`statement-to-html.xsl`). +- **Configuration files**: `/etc/log-digest.conf`, `hosts.staging`, `hosts.production`, `reminder.properties`. + +#### Cross‑cutting +- **Logging**: timestamped stderr messages (`log` function in shell scripts), Perl `croak`/`die` with clear messages. +- **Error handling**: strict `set -euo pipefail` in deployment, retry logic in nightly extract, Perl `croak` for malformed lines. +- **Configuration**: environment variables (`DEPLOY_USER`, `PID_FILE`, `HEARTBEAT_FILE`, `ORACLE_SID`), property placeholders in Spring (`reminder.properties`), Maven properties. +- **Performance limits**: Perl `MAX_LINES = 50000`, slow request threshold `SLOW_REQUEST_MS = 1500`. +- **Threading/Concurrency**: Scheduler pool size 2, HikariCP pool size 8, worker heartbeat mechanism. +- **Naming conventions**: XML namespaces (`urn:example:shipment:1`, `urn:example:statement`), bean names follow Spring conventions, Perl module exports. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..259a9ac3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,69 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:43:29Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Provides a log‑digesting object for summarizing access logs. +- Offers utility to retrieve top N hosts or statuses. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: `new`, `add`, `summarize`. + +#### Input +- `new(level => $level)` – `$level` must be one of `DEBUG`, `INFO`, `WARN`, `ERROR` (default `WARN`). +- `add($line)` – a single log line string. +- `parse_line($line)` – parses a log line. +- `top_n($counts, $n)` – receives a hashref of counts and integer `n`. + +#### Output +- `add` returns `1` on successful parse, `0` if line ignored, dies on too many lines. +- `summarize` returns hashref: + - `generated` – UTC timestamp. + - `total` – total entries counted. + - `hosts` – number of distinct hosts. + - `busiest` – max count for any host. + - `slow` – number of requests > 1500 ms. + - `statuses` – hashref of status counts. +- `top_n` returns list of keys sorted by count descending, ties broken alphabetically. + +#### Core logic +- `new`: validate level, initialize counters. +- `parse_line`: regex extracts host, time, method, path, status, millis; normalizes host. +- `add`: enforce `MAX_LINES`; parse line; increment host and status counters; count slow requests. +- `summarize`: compute totals, busiest host, generate UTC timestamp. +- `top_n`: sort counts descending, return top `n` keys. +- `_normalize_host`: lowercase, strip trailing dot. + +#### Subs +- `new(%args) -> object` – create digest with level. +- `parse_line($line) -> hashref` – parse log line. +- `add($line) -> 1|0` – add entry, update stats. +- `summarize() -> hashref` – return summary. +- `top_n($counts, $n) -> list` – top N keys. +- `_normalize_host($host) -> host` – lowercase, strip dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `%LEVEL_RANK = (DEBUG => 0, INFO => 1, WARN => 2, ERROR => 3)` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `croak` if unknown level in `new`. +- `croak` if more than `MAX_LINES` added in `add`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..d054742c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,67 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:43:34Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Reads web server logs, filters hosts, and reports request counts and slow requests, optionally as JSON. + +#### Purpose +- Command‑line tool for summarizing access logs. +- Filters by host aliases and exclusion list. +- Outputs text or JSON summary. + +#### Type +- Script. +- No package; procedural. +- Exports none. + +#### Input +- `--top|n=i` → `$top` (default 10). +- `--level=s` → `$level` (default 'WARN'). +- `--json!` → `$as_json` (default 0). +- `--exclude-host=s` → `@exclude_hosts`. +- `--help|h` → prints usage. +- `@ARGV` → list of log files. +- `%ENV{LOG_DIGEST_CONFIG}` → `$config_file` (default '/etc/log-digest.conf'). + +#### Output +- Text: `printf "%d requests from %d hosts, %d slow\n"`. +- JSON: `JSON::PP->new->canonical->encode($summary)`. +- Prints top hosts via `top_n`. +- Exit status 0 on success; non‑zero on errors. + +#### Core logic +- Load host aliases from `$config_file`. +- Build exclusion hash from `@exclude_hosts`. +- Create `LogDigest` with `$level`. +- For each file: + - Open file; read lines. + - Extract host from each line. + - Skip if host (or alias) in exclusion hash. + - Add line to digest. +- Summarize digest. +- Output summary in chosen format. + +#### Subs +- `usage() -> string` – prints help text. +- `read_aliases($path) -> %aliases` – parses alias file. +- `main() -> 0` – orchestrates processing. + +#### Constants and configuration +- None. + +#### Dependencies +- `FindBin` – `$Bin`. +- `Getopt::Long` – `GetOptions`. +- `JSON::PP` – `new`, `canonical`, `encode`. +- `LogDigest` – `new`, `add`, `summarize`, `hosts` (accessed as `$digest->{hosts}`). + +#### Exceptions / Errors +- `die "--top must be positive\n"` if `$top < 1`. +- `die usage()` on `GetOptions` failure. +- `die "cannot read $file: $!\n"` on file open error. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..700bffdd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,42 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:43:58Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> A Perl toolkit that parses web‑server access logs, aggregates per‑host and per‑status statistics, and exposes a command‑line utility for quick reporting or JSON output. + +#### Purpose +- Summarize access logs into host‑ and status‑level counts. +- Identify slow requests and provide top‑N host or status lists. + +#### Responsibilities +- **Log parsing & aggregation** – `LogDigest` module handles line parsing, counting, and summarization. +- **Command‑line reporting** – `log_digest.pl` script reads log files, applies host filters, and outputs human‑readable or JSON summaries. + +#### Key units +- `LogDigest` (module) – object with `new`, `add`, `summarize`, `top_n`; exports `parse_line`. +- `log_digest.pl` (script) – orchestrates file reading, host filtering, and output formatting. + +#### Data flow +1. `log_digest.pl` loads host aliases and exclusion list. +2. For each log file, it reads lines, extracts the host, skips excluded hosts, and feeds the line to a `LogDigest` instance via `add`. +3. After all files, `summarize` produces a hashref with totals, host stats, slow request count, and status counts. +4. The script prints the summary textually or as JSON, optionally listing the top N hosts. + +#### Dependencies +- **Perl core**: `POSIX`, `List::Util`, `Carp`, `Exporter`. +- **External modules**: `Getopt::Long`, `JSON::PP`, `FindBin`. +- **Configuration**: `/etc/log-digest.conf` for host aliases. + +#### Cross-cutting +- Host normalization (lowercase, strip trailing dot). +- Logging level validation (`DEBUG`, `INFO`, `WARN`, `ERROR`). +- Enforced line limit (`MAX_LINES = 50000`). +- Slow request threshold (`SLOW_REQUEST_MS = 1500`). +- Error handling via `croak` and `die` with clear messages. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..8d3af57e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,87 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:43:37Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploys a specified release to all hosts of an environment. +- Runs as a standalone script. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`) +- `set -euo pipefail` + +#### Input +- Options parsed by `getopts`: + - `-e ` → `ENVIRONMENT` + - `-t ` → `TAG` + - `-n` → `DRY_RUN=1` + - `-p ` → ignored, logged + - `-h` → prints usage +- Environment variables: + - `DEPLOY_USER` (default `deploy`) + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`) +- Files read: + - `$SCRIPT_DIR/lib/common.sh` + - `$SCRIPT_DIR/${HOST_FILES[$ENVIRONMENT]}` (hosts list) + +#### Output +- Copies `build/$TAG.tar.gz` to each host via `rsync`. +- Extracts tarball to `$RELEASE_ROOT/$TAG`, updates symlink `$RELEASE_ROOT/current`. +- Restarts `$SERVICE_NAME` (`orderd`) via `systemctl`. +- Checks health endpoint `http://$host:8080/health` until success or timeout. +- Logs actions to stderr. +- Exit status 0 on success; non‑zero on errors or health failure. + +#### Core logic +- Parse options → set `ENVIRONMENT`, `TAG`, `DRY_RUN`. +- Verify prerequisites (`rsync`, `ssh`, `curl`, SSH key). +- Load host list from environment‑specific file. +- For each host: + - If `DRY_RUN`, log intended action. + - Else: + - `rsync` tarball to `/tmp/`. + - SSH into host, create target dir, extract tarball, update symlink, restart service. + - Wait for health endpoint, failing after `HEALTH_TIMEOUT` seconds. + - Log successful deployment. + +#### Functions +- `log` – prints timestamped message to stderr. +- `die` – logs error and exits. +- `usage` – prints usage from script comment. +- `check_prereqs` – ensures required tools and SSH key exist. +- `load_hosts` – reads host list file into `HOSTS`. +- `deploy_host` – performs deployment steps for a single host. +- `wait_healthy` – polls health endpoint until success or timeout. +- `cleanup` – removes temporary lock file on exit. + +#### Constants and configuration +- `SCRIPT_DIR` – directory of script. +- `DEPLOY_USER` – `deploy` +- `SSH_KEY` – `$HOME/.ssh/deploy_ed25519` +- `RELEASE_ROOT` – `/opt/releases` +- `SERVICE_NAME` – `orderd` +- `HEALTH_TIMEOUT` – `30` +- `ENVIRONMENT` – unset +- `TAG` – unset +- `DRY_RUN` – `0` +- `HOSTS` – array +- `HOST_FILES` – `([staging]="hosts.staging" [production]="hosts.production")` + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl` +- Sourced file: `$SCRIPT_DIR/lib/common.sh` +- Host list files: `hosts.staging`, `hosts.production` + +#### Errors and exit codes +- `die` exits with status `1` for missing tools, unreadable SSH key, unknown environment, empty host list, or health timeout. +- `usage` exits with status `0` when `-h` is used. +- Missing required options (`-e`, `-t`) cause exit status `2`. +- Health check failure after `HEALTH_TIMEOUT` seconds triggers `die` with status `1`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..db58b3d4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,67 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:43:41Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> A POSIX init-style wrapper that manages a queue worker, providing start, stop, status, restart, and health check based on PID and heartbeat files. + +#### Purpose +- Controls a queue worker process. +- Exposes `start`, `stop`, `restart`, `status`, and `health` commands. + +#### Type +- `sh` (POSIX). +- No strict mode flags used. + +#### Input +- `$1` command (`start`, `stop`, `restart`, `status`, `health`). +- Environment variables: + - `PID_FILE` (default `/run/queue-worker.pid`). + - `HEARTBEAT_FILE` (default `/var/lib/queue-worker/heartbeat`). +- No command‑line options. + +#### Output +- Writes PID to `$PID_FILE`. +- Updates `$HEARTBEAT_FILE` via worker. +- Prints status messages (`running`, `stopped`, `OK`, `WARNING`, `CRITICAL`). +- Exit codes: + - `0` success. + - `1` heartbeat too old. + - `2` worker not running. + - `3` status stopped. + - `64` invalid usage. + +#### Core logic +- `is_running`: checks PID file and process liveness. +- `heartbeat_age`: computes seconds since last heartbeat file modification. +- `start_worker`: starts worker with `nohup`, records PID. +- `stop_worker`: kills process, removes PID file. +- Command dispatch via `case` on `$1`. + +#### Functions +- `is_running`: test if worker process exists. +- `heartbeat_age`: calculate heartbeat age in seconds. +- `start_worker`: launch worker, write PID. +- `stop_worker`: terminate worker, delete PID. + +#### Constants and configuration +- `PID_FILE`=`/run/queue-worker.pid` +- `HEARTBEAT_FILE`=`/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE`=`120` +- `WORKER_BIN`=`/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `nohup`, `kill`, `cat`, `date`, `stat`. +- Worker binary: `/usr/local/bin/queue-worker` (expects `--heartbeat` option). + +#### Errors and exit codes +- `exit 2` if worker not running during `health`. +- `exit 1` if heartbeat age exceeds `MAX_HEARTBEAT_AGE`. +- `exit 3` if `status` finds no running process. +- `exit 64` for unknown command. +- No traps or cleanup beyond PID file removal. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..f75e6957 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,74 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:43:44Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, creates a control file, and gzips the output with retry logic. + +#### Purpose +- Performs nightly export of settled payments. +- Runs as a standalone script. + +#### Type +- `ksh93` with `typeset` and `function` syntax. +- No strict mode flags set. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → sets `business_day`. + - `-o

` → sets `export_dir`. +- Environment variables read: + - `ORACLE_SID` (default `PAYPRD`). + - `NLS_LANG` set to `AMERICAN_AMERICA.AL32UTF8`. +- No positional arguments. + +#### Output +- Creates `payments_.csv` in `export_dir`. +- Generates `.ctl` with row count and business day. +- Gzips the CSV to `.gz`. +- Prints log messages to stderr. +- Exits with status 0 on success, 1–4 on various failures. + +#### Core logic +- Parse options; set defaults. +- Ensure `export_dir` exists. +- Set `csv` path. +- Retry loop (max 3 attempts): + - Run `run_export` to dump data via `sqlplus`. + - If successful: + - Write control file. + - Gzip CSV. + - Log success and exit. + - On failure: log, sleep 60, retry. +- On exhausting retries: log failure and exit with code 4. + +#### Functions +- `log` – prints timestamped messages to stderr. +- `fail` – logs failure and exits with given code. +- `require_tools` – checks for `sqlplus` and `gzip`. +- `run_export` – runs SQL*Plus to dump settled payments to a file. +- `write_control` – writes row count and business day to a `.ctl` file. + +#### Constants and configuration +- ``ORACLE_SID_DEFAULT=PAYPRD`` +- ``EXPORT_DIR_DEFAULT=/data/export/payments`` +- ``MAX_RETRIES=3`` +- ``attempt=0`` +- ``business_day=$(date +%Y%m%d)`` +- ``export_dir=$EXPORT_DIR_DEFAULT`` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle database connection via `sqlplus` (SYSDBA, `/`). +- SQL query reads `settled_payment` table for `business_day`. + +#### Errors and exit codes +- `fail` exits with code 1 by default, or specified code. +- Missing tools → exit 3. +- Cannot create export directory → exit 1. +- Exhausted retries → exit 4. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..6298256d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,47 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:01Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates deployment, health monitoring, and nightly data extraction for a payment processing service. + +#### Purpose +- Deploy release tarballs to multiple hosts, restart services, and verify health. +- Control a queue‑worker process with start/stop/status/health commands. +- Export settled payments from Oracle to CSV, create control files, and compress them. + +#### Responsibilities +- **Deployment**: `deploy_release.sh` handles distribution, extraction, service restart, and health checks across environments. +- **Process Management**: `healthcheck.sh` provides a POSIX init‑style interface for a queue worker, managing PID, heartbeat, and status. +- **Data Export**: `nightly_extract.ksh` extracts settled payments, writes CSV/CTL files, gzips output, and retries on failure. + +#### Key units +- `deploy_release.sh` – orchestrates host‑by‑host deployment, uses `rsync`, `ssh`, `curl`. +- `healthcheck.sh` – exposes `start|stop|restart|status|health`; uses `nohup`, `kill`, `stat`. +- `nightly_extract.ksh` – runs `sqlplus` to dump `settled_payment`, writes control file, gzips CSV, retries up to 3 times. + +#### Data flow +1. **Deployment**: script parses `-e`/`-t`, loads host list, `rsync` tarball → SSH → extract → symlink → `systemctl restart` → `curl` health check. +2. **Healthcheck**: `start` writes PID, worker writes heartbeat; `health` reads heartbeat age, reports status. +3. **Export**: parse `-d`/`-o`, ensure dir, run `sqlplus` query → CSV → control file → `gzip`. + +#### Dependencies +- External utilities: `rsync`, `ssh`, `curl`, `nohup`, `kill`, `stat`, `sqlplus`, `gzip`. +- Host list files: `hosts.staging`, `hosts.production`. +- Worker binary: `/usr/local/bin/queue-worker` (expects `--heartbeat`). +- Oracle connection via `sqlplus` (SYSDBA, `/`). + +#### Cross‑cutting +- Common logging pattern: timestamped messages to stderr (`log` function). +- Error handling via `die`/`fail` functions with exit codes. +- Configuration via environment variables and defaults (`DEPLOY_USER`, `PID_FILE`, `HEARTBEAT_FILE`, `ORACLE_SID`). +- Retry logic in `nightly_extract.ksh` (max 3 attempts with sleep). +- Health check timeout constants (`HEALTH_TIMEOUT`, `MAX_HEARTBEAT_AGE`). +- Use of `set -euo pipefail` in deployment script for strict error handling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..bbde703c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,51 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:43:48Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures the Maven build for the Invoice Service module, defining dependencies, compiler settings, and build plugins. + +#### Purpose +- Builds the `invoice-service` JAR. +- Manages database migrations with Flyway. +- Supplies test and runtime dependencies. + +#### Type +- Maven POM + Root element: `project` + Namespaces: `xmlns="http://maven.apache.org/POM/4.0.0"`, `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release` = `17` + - `jackson.version` = `2.19.2` + - `flyway.version` = `11.4.0` + - `invoice.archive.dir` = `${project.build.directory}/archive` +- **Dependencies**: + - `com.fasterxml.jackson.core:jackson-databind` (`${jackson.version}`) + - `org.flywaydb:flyway-core` (`${flyway.version}`) + - `org.postgresql:postgresql` (runtime) + - `org.junit.jupiter:junit-jupiter` (test) + - `org.testcontainers:postgresql` (test) +- **Plugins**: + - `org.flywaydb:flyway-maven-plugin` (`${flyway.version}`) + Configuration: `locations` → `filesystem:src/main/resources/db/migration` + - `org.apache.maven.plugins:maven-surefire-plugin` + Configuration: `systemPropertyVariables` → `invoice.archive.dir` = `${invoice.archive.dir}` +- **Profile** `native-pdf` adds dependency `org.apache.pdfbox:pdfbox:3.0.5`. + +#### Configuration +- `maven.compiler.release` = `17` +- `invoice.archive.dir` = `${project.build.directory}/archive` +- Flyway location: `filesystem:src/main/resources/db/migration` +- Surefire system property: `invoice.archive.dir` = `${invoice.archive.dir}` + +#### Dependencies +- External libraries: `jackson-databind`, `flyway-core`, `postgresql`, `junit-jupiter`, `testcontainers`, `pdfbox` (profile). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..469ce0ce --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,50 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:04Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides infrastructure for invoicing, reminders, shipment validation, and statement rendering in a billing system. + +#### Purpose +- Build and package the Invoice Service. +- Configure a scheduled reminder job for overdue invoices. +- Validate shipment notices from warehouses. +- Transform monthly account statements into HTML. + +#### Responsibilities +- **Build & Deployment** – Maven POM with dependencies, compiler settings, Flyway migrations, and optional PDF support. +- **Scheduling & Email** – Spring context wiring for a reminder scheduler that queries a JDBC repository and sends emails via SMTP. +- **XML Validation** – XSD schema defining the structure of shipment notices. +- **Presentation** – XSLT stylesheet converting statement XML into styled HTML. + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, Flyway plugin, Surefire configuration. +- `scheduler-context.xml` – Spring beans: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler`. +- `shipment.xsd` – Schema for `` with `CarrierCode`, `ParcelType`, `AddressType`. +- `statement-to-html.xsl` – XSLT stylesheet with templates `statementHeader`, `statementTotal`, and booking row rendering. + +#### Data flow +1. **Build**: Maven compiles Java, runs Flyway migrations, packages JAR, optionally includes PDFBox. +2. **Scheduling**: Spring context loads; `reminderScheduler` triggers `overdueReminderJob.sendDueReminders` every weekday at 7 AM. +3. **Reminder Job**: `JdbcReminderRepository` queries overdue invoices → `SmtpMailGateway` sends reminder emails. +4. **Shipment Validation**: XML documents are validated against `shipment.xsd` before processing. +5. **Statement Rendering**: Statement XML (namespace `urn:example:statement`) is transformed by `statement-to-html.xsl` into an HTML page with totals and highlighted rows. + +#### Dependencies +- **Internal**: `JdbcReminderRepository`, `SmtpMailGateway`, `OverdueReminderJob`. +- **External Libraries**: Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers, PDFBox (profile), HikariCP, Spring Task & Context. +- **External Resources**: `reminder.properties` for DB and SMTP settings; `src/main/resources/db/migration` for Flyway scripts. + +#### Cross-cutting +- **Configuration**: Property placeholders (`reminder.properties`), Maven properties (`maven.compiler.release`, `invoice.archive.dir`). +- **Error Handling**: Not explicitly detailed; relies on Spring and JDBC exception propagation. +- **Threading**: Scheduler pool size set to 2; HikariCP pool size 8. +- **Naming Conventions**: XML namespaces (`urn:example:shipment:1`, `urn:example:statement`), bean names follow Spring conventions. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..b14b7742 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,43 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:43:50Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures a Spring context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled trigger. + +#### Purpose +- Wire reminder scheduler components. +- Schedule overdue reminder job. + +#### Type +- Spring context XML (`` root). +- Namespaces: `xmlns` (beans), `xmlns:context`, `xmlns:task`. + +#### Definitions +- **Property placeholder**: `reminder.properties`. +- **Component scan**: `org.example.reminder.web`. +- **Beans**: + - `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`): `jdbcUrl` `${reminder.db.url}`, `username` `${reminder.db.user}`, `maximumPoolSize` `8`. + - `reminderRepository` (`org.example.reminder.JdbcReminderRepository`): constructor `reminderDataSource`. + - `mailGateway` (`org.example.reminder.SmtpMailGateway`): `host` `${reminder.smtp.host}`, `port` `587`. + - `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`): constructor `reminderRepository`, `mailGateway`; property `graceDays` `14`. +- **Scheduler**: `reminderScheduler` (`task:scheduler`) with `pool-size` `2`. +- **Scheduled task**: `overdueReminderJob.sendDueReminders` triggered by cron `0 0 7 * * MON-FRI`. + +#### Configuration +- `reminder.db.url`, `reminder.db.user`, `reminder.smtp.host` (from `reminder.properties`). +- `reminder.db.url` → JDBC URL. +- `reminder.db.user` → DB username. +- `reminder.smtp.host` → SMTP host. + +#### Dependencies +- `com.zaxxer.hikari.HikariDataSource` (HikariCP). +- `org.example.reminder.JdbcReminderRepository`. +- `org.example.reminder.SmtpMailGateway`. +- `org.example.reminder.OverdueReminderJob`. +- Spring `task` and `context` modules. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..2c6ed2f6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,36 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:43:53Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Validates shipment notice documents. +- Enforces structure and value constraints for carriers, parcels, and addresses. + +#### Type +- XML Schema (`xs:schema`). +- Root namespace: `urn:example:shipment:1`. +- Declared namespaces: `xs` → `http://www.w3.org/2001/XMLSchema`, `shp` → `urn:example:shipment:1`. + +#### Definitions +- **Element**: `shipmentNotice` (type `shp:ShipmentNoticeType`). +- **SimpleTypes**: + - `CarrierCode`: enumeration of `"DHL"`, `"UPS"`, `"GLS"`, `"POST"`. + - `WeightGrams`: positive integer ≤ 31500. +- **ComplexTypes**: + - `ParcelType`: sequence of `trackingNumber` (`xs:string`) and `weight` (`shp:WeightGrams`); required attribute `sequence` (`xs:positiveInteger`). + - `AddressType`: sequence of `name`, `street`, `postalCode`, `city` (`xs:string`), optional `country` (`xs:string`, default `"DE"`). + - `ShipmentNoticeType`: sequence of `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one or more `parcel` (`shp:ParcelType`); required attribute `noticeId` (`xs:ID`). + +#### Configuration +- `country` attribute in `AddressType` defaults to `"DE"`. + +#### Dependencies +- Uses standard XML Schema namespace `http://www.w3.org/2001/XMLSchema`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..c53529ae --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,38 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:43:55Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a monthly account statement XML into an HTML page with header, table rows for each booking, and a total. + +#### Purpose +- Render monthly account statements as HTML pages. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespace: `xmlns:st="urn:example:statement"`. + +#### Definitions +- **Parameters**: + - `currencySymbol` (`'EUR'`) + - `highlightAbove` (`1000`) +- **Key**: `bookingsByDay` (matches `st:booking`, indexed by `st:valueDate`). +- **Templates**: + - `match="/st:statement"` – main entry, outputs `` with header, table, and total. + - `name="statementHeader"` – outputs account number and period. + - `match="st:booking"` – outputs a `` for each booking; adds `class="large"` if `st:amount` > `$highlightAbove`. + - `name="statementTotal"` – outputs total amount of all bookings. + +#### Configuration +- `xsl:output` method: `html`, encoding: `UTF-8`, indent: `yes`. +- `currencySymbol` default: `'EUR'`. +- `highlightAbove` default: `1000`. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: `statement`, `booking`, `valueDate`, `purpose`, `amount`, `accountNumber`. +- No external files or schemas referenced. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..b6f4ef42 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,56 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:13Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A toolkit for processing web‑server logs, automating deployment and monitoring of a payment service, and generating, scheduling, and rendering billing documents. + +#### Purpose +- Log analytics and reporting for web‑server access logs. +- Automated deployment, health monitoring, and nightly data extraction for a payment processing service. +- Build, schedule, validate, and present billing documents (invoices, reminders, shipments, statements). + +#### Responsibilities +- **Log processing** – parse, aggregate, and report access‑log statistics. +- **Deployment & monitoring** – distribute releases, manage worker processes, and export settled payments. +- **Billing infrastructure** – build the invoice service, schedule overdue reminders, validate shipment notices, and transform statements to HTML. + +#### Key units +- `LogDigest` (Perl module) – parses log lines, aggregates host/status counts, tracks slow requests. +- `log_digest.pl` – CLI driver for log aggregation, host filtering, and JSON/text output. +- `deploy_release.sh` – orchestrates tarball distribution, extraction, service restart, and health checks. +- `healthcheck.sh` – POSIX init‑style interface for a queue‑worker, managing PID, heartbeat, and status. +- `nightly_extract.ksh` – extracts settled payments from Oracle, writes CSV/CTL, gzips output, retries on failure. +- `invoice-service-pom.xml` – Maven POM for the Invoice Service build, dependencies, Flyway migrations, and optional PDF support. +- `scheduler-context.xml` – Spring XML configuring the overdue‑reminder scheduler, JDBC repository, and mail gateway. +- `shipment.xsd` – schema for `` documents. +- `statement-to-html.xsl` – XSLT transforming statement XML into styled HTML. + +#### Data flow +1. **Log analytics** – `log_digest.pl` reads log files → feeds lines to `LogDigest` → `summarize` → textual/JSON report. +2. **Deployment** – `deploy_release.sh` → `rsync` tarball → SSH → extract → symlink → `systemctl restart` → `curl` health check. +3. **Health monitoring** – `healthcheck.sh start` writes PID → worker writes heartbeat → `health` reads heartbeat age → status report. +4. **Data export** – `nightly_extract.ksh` → `sqlplus` query → CSV + control file → `gzip` → retry loop. +5. **Billing** – Maven build → Flyway migrations → JAR package. Spring scheduler (`reminderScheduler`) triggers `overdueReminderJob` → `JdbcReminderRepository` queries overdue invoices → `SmtpMailGateway` sends emails. Shipment XMLs validated against `shipment.xsd`. Statement XML → `statement-to-html.xsl` → HTML output. + +#### Dependencies +- **Perl**: `POSIX`, `List::Util`, `Carp`, `Exporter`, `Getopt::Long`, `JSON::PP`, `FindBin`. +- **Shell utilities**: `rsync`, `ssh`, `curl`, `nohup`, `kill`, `stat`, `sqlplus`, `gzip`. +- **Oracle**: `sqlplus` (SYSDBA, `/`), `settled_payment` table. +- **Maven**: Flyway Core, Surefire, PDFBox (profile), Jackson Databind, HikariCP, Spring Task & Context. +- **Java**: PostgreSQL JDBC, JUnit Jupiter, Testcontainers. +- **XML**: `shipment.xsd`, `statement-to-html.xsl`. +- **Configuration**: `/etc/log-digest.conf`, `hosts.staging`, `hosts.production`, `reminder.properties`. + +#### Cross‑cutting +- **Logging**: timestamped stderr messages (`log` function in shell scripts), Perl `croak`/`die` with clear messages. +- **Error handling**: strict `set -euo pipefail` in deployment, retry logic in nightly extract, Perl `croak` for malformed lines. +- **Configuration**: environment variables (`DEPLOY_USER`, `PID_FILE`, `HEARTBEAT_FILE`, `ORACLE_SID`), property placeholders in Spring (`reminder.properties`), Maven properties. +- **Performance limits**: Perl `MAX_LINES = 50000`, slow request threshold `SLOW_REQUEST_MS = 1500`. +- **Threading/Concurrency**: Scheduler pool size 2, HikariCP pool size 8, worker heartbeat mechanism. +- **Naming conventions**: XML namespaces (`urn:example:shipment:1`, `urn:example:statement`), bean names follow Spring conventions, Perl module exports. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..5f3eaee2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run4/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: D58155F0 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:20Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project centers on a unified toolkit that processes web‑server logs, automates deployment and health monitoring of a payment service, and manages billing documents. Log parsing and aggregation are handled by Perl and shell utilities, while XML infrastructure supports invoicing, reminders, shipment validation, and statement rendering. Together these subsystems provide end‑to‑end support for payment processing, monitoring, and billing workflows. + +#### Packages +- other — A collection of tooling and infrastructure for processing web‑server logs, deploying and monitoring a payment service, and managing invoicing, reminders, and statement rendering in a billing system. +- other/perl — A Perl toolkit that parses web‑server access logs, aggregates per‑host and per‑status statistics, and exposes a command‑line utility for quick reporting or JSON output. +- other/shell — Automates deployment, health monitoring, and nightly data extraction for a payment processing service. +- other/xml — Provides infrastructure for invoicing, reminders, shipment validation, and statement rendering in a billing system. +- . — A toolkit for processing web‑server logs, automating deployment and monitoring of a payment service, and generating, scheduling, and rendering billing documents. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/meta/gpt-oss-20b.json new file mode 100644 index 00000000..3fb2d384 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:44:22Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 32.5, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 28.0, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 4.2, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:45:27Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16083, + "cachedPromptTokens": 16032, + "completionTokens": 5134, + "seconds": 31.9224118 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.00115, + "costUsd": 0.000556, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..22f117dd --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,62 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:05Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A collection of utilities and configuration artifacts that aggregate web‑server logs, automate deployment and worker management, and support billing, logistics, and reporting workflows. + +#### Purpose +- Aggregate and report HTTP access logs by host, status, and latency. +- Deploy application releases, manage queue workers, and extract payment data. +- Build, migrate, and configure a billing service; validate shipment XML; transform statements to HTML. + +#### Responsibilities +- **Log aggregation** – parse, summarize, and flag slow requests (`LogDigest`). +- **Deployment & process control** – host‑by‑host release rollout, worker health monitoring (`deploy_release.sh`, `healthcheck.sh`). +- **Data extraction** – Oracle payment export to CSV (`nightly_extract.ksh`). +- **Build & migration** – Maven packaging, Flyway schema updates, PDF generation. +- **Scheduling** – Spring‑based reminder job for overdue invoices. +- **XML handling** – Shipment notice schema (`shipment.xsd`) and statement‑to‑HTML XSLT (`statement-to-html.xsl`). + +#### Key units +- `LogDigest` (Perl module) – parses log lines, aggregates counts, tracks slow requests. +- `log_digest.pl` – CLI driver for log ingestion and report output. +- `deploy_release.sh` – orchestrates tarball transfer, extraction, symlink, service restart, health check. +- `healthcheck.sh` – PID/heartbeat‑based controller for queue workers. +- `nightly_extract.ksh` – Oracle query driver, CSV spooler, control file generator, gzip compressor. +- `invoice-service-pom.xml` – Maven project with Flyway, PDFbox profile. +- `scheduler-context.xml` – Spring beans for reminder data source, repository, mail gateway, job, and cron trigger. +- `shipment.xsd` – XML schema for shipment notices. +- `statement-to-html.xsl` – XSLT stylesheet converting statement XML to styled HTML. + +#### Data flow +1. **Log processing** – `log_digest.pl` reads files → `LogDigest->add` → `summarize` → formatted output. +2. **Deployment** – `deploy_release.sh` → rsync tarball → SSH extraction → symlink → `systemctl restart` → `/health` poll. +3. **Worker control** – `healthcheck.sh` starts `queue-worker`, writes PID, writes heartbeat; health checks read heartbeat age. +4. **Payment extraction** – `nightly_extract.ksh` runs `sqlplus` query → spools CSV → counts rows → writes control file → gzips CSV. +5. **Build & migration** – Maven compiles → Flyway migrates → packages JAR → optional PDF generation. +6. **Scheduling** – Spring context loads beans → scheduled trigger fires → `OverdueReminderJob` sends emails via `SmtpMailGateway`. +7. **XML validation** – Warehouse emits XML → consumers validate against `shipment.xsd`. +8. **Statement rendering** – XML statement → `statement-to-html.xsl` → HTML output. + +#### Dependencies +- **Perl**: `Getopt::Long`, `JSON::PP`, `List::Util`, `Carp`, `Exporter`. +- **Shell**: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `nohup`, `kill`, `sqlplus`, `gzip`. +- **Oracle**: `PAYPRD` database for payment extraction. +- **Maven**: `org.example.billing:billing-parent`, Jackson, Flyway, PostgreSQL, JUnit, Testcontainers, PDFbox. +- **Spring**: `task`, `context`, HikariCP, custom reminder components. +- **XML**: W3C XSD, `urn:example:shipment:1`, `urn:example:statement`. + +#### Cross-cutting +- **Logging**: Timestamped stderr logs in shell scripts; `LogDigest` normalizes host names. +- **Error handling**: Perl uses `croak`/`die`; shell scripts exit with specific codes; Maven/Flyway rely on defaults. +- **Configuration**: Host lists (`hosts.staging`, `hosts.production`), environment variables (`DEPLOY_USER`, `SSH_KEY`, `PID_FILE`, `HEARTBEAT_FILE`, `ORACLE_SID`), and property files (`reminder.properties`). +- **Retry logic**: `nightly_extract.ksh` retries up to 3 times; deployment scripts log failures but do not retry. +- **Testing**: Maven test scope includes JUnit and Testcontainers for PostgreSQL. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..50b6368f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,71 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:23Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Provides a log‑digesting object for summarizing access logs. +- Offers a helper `top_n` to rank counts. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: `new`, `add`, `summarize`. + +#### Input +- `new(level => $level)` – `$level` must be one of `DEBUG`, `INFO`, `WARN`, `ERROR`; defaults to `WARN`. +- `add($line)` – parses a single log line. +- `parse_line($line)` – regex parses host, time, method, path, status, millis. +- `top_n($counts, $n)` – ranks hash values. + +#### Output +- `add` returns `1` on successful parse, `0` if line ignored. +- `summarize` returns hashref: + - `generated` timestamp UTC. + - `total` total entries. + - `hosts` number of distinct hosts. + - `busiest` max requests per host. + - `slow` count of requests > 1500 ms. + - `statuses` hashref of status counts. +- `top_n` returns array of top `$n` keys. + +#### Core logic +- `new` validates log level, initializes counters. +- `parse_line` extracts fields via regex; normalizes host. +- `add`: + - Enforces `MAX_LINES` limit. + - Increments host and status counters. + - Increments `slow` if `millis` > `SLOW_REQUEST_MS`. +- `summarize` aggregates totals, computes busiest host, timestamps. +- `top_n` sorts keys by count descending, ties by lexical order. + +#### Subs +- `new(%args) -> object` – create digest with level. +- `parse_line($line) -> hashref` – parse log line. +- `add($line) -> 1/0` – add entry, update counters. +- `summarize() -> hashref` – produce summary. +- `top_n($counts, $n) -> array` – rank keys. +- `_normalize_host($host) -> host` – lowercase, strip trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `%LEVEL_RANK = (DEBUG => 0, INFO => 1, WARN => 2, ERROR => 3)` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `croak` if unknown level in `new`. +- `croak` if more than `MAX_LINES` added in `add`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..1c5f81f0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,72 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:27Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Reads web server logs and reports the busiest hosts and status‑code counts, optionally as JSON. + +#### Purpose +- Command‑line tool for summarizing access logs. +- Outputs host usage statistics and slow request counts. + +#### Type +- Script. +- No package; procedural. +- Exports none. + +#### Input +- Options: + - `--top|n=i` → `$top` (default 10). + - `--level=s` → `$level` (default 'WARN'). + - `--json!` → `$as_json` (default 0). + - `--exclude-host=s` → `@exclude_hosts` (multiple allowed). + - `--help|h` → prints usage. +- Positional arguments: `FILE...` (log files). +- Environment: `LOG_DIGEST_CONFIG` → `$config_file` (default `/etc/log-digest.conf`). +- Reads config file lines `from = to` for host aliases. + +#### Output +- If `$as_json`: JSON string of `$summary` hash. +- Else: plain text: + - `printf "%d requests from %d hosts, %d slow\n", $summary->{total}, $summary->{hosts}, $summary->{slow};` + - List of top hosts: each line from `top_n($digest->{hosts}, $top)`. + +#### Core logic +- Load host aliases from config file. +- Build exclusion hash from `@exclude_hosts`. +- Create `LogDigest` object with `level`. +- For each input file: + - Read line by line. + - Extract host (first token). + - Skip if host (or its alias) is excluded. + - Pass line to `$digest->add`. +- After all files, call `$digest->summarize`. +- Output summary in chosen format. + +#### Subs +- `usage() -> string` – prints help text. +- `read_aliases(PATH) -> hash` – parses alias file. +- `main() -> int` – orchestrates processing. + +#### Constants and configuration +- `$config_file = $ENV{LOG_DIGEST_CONFIG} // '/etc/log-digest.conf'`. +- `$top = 10`. +- `$level = 'WARN'`. +- `$as_json = 0`. +- `@exclude_hosts = ()`. + +#### Dependencies +- `FindBin` – `$Bin`. +- `Getopt::Long` – `GetOptions`. +- `JSON::PP` – `JSON::PP->new->canonical->encode`. +- `LogDigest` – `LogDigest->new`, `add`, `summarize`, `top_n`. + +#### Exceptions / Errors +- `die usage()` on bad options. +- `die "--top must be positive\n"` if `$top < 1`. +- `die "cannot read $file: $!\n"` on file open failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..bce634a1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,40 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:55Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Condenses web‑server access logs into per‑host and per‑status summaries, highlighting slow requests and providing a CLI for reporting. + +#### Purpose +- Summarize HTTP access logs by host, status, and latency. +- Offer a command‑line utility to generate human‑readable or JSON reports. + +#### Responsibilities +- **Log parsing & aggregation** – `LogDigest` module parses individual log lines, tracks counts per host and status, and flags slow requests. +- **Reporting** – `log_digest.pl` reads log files, applies host exclusions/aliases, and outputs a concise summary or JSON. + +#### Key units +- `LogDigest` (module) – object with `new`, `add`, `summarize`, `top_n`; exports `parse_line`. +- `log_digest.pl` (script) – orchestrates file reading, option parsing, and output formatting. + +#### Data flow +1. `log_digest.pl` parses CLI options and loads host alias config. +2. For each log file, it reads lines, skips excluded hosts, and feeds each line to `LogDigest->add`. +3. After all input, `LogDigest->summarize` produces a hash of totals, host counts, slow request count, and status tallies. +4. The script formats this hash either as plain text or JSON. + +#### Dependencies +- **Internal**: `LogDigest` module, its exported `parse_line`. +- **External**: `Getopt::Long`, `JSON::PP`, `FindBin`, `POSIX`, `List::Util`, `Carp`, `Exporter`. + +#### Cross-cutting +- Host normalization (lowercase, strip trailing dot) in `LogDigest`. +- Configurable log level with rank mapping (`DEBUG`, `INFO`, `WARN`, `ERROR`). +- Constant limits: `MAX_LINES` (50 000) and `SLOW_REQUEST_MS` (1500 ms). +- Error handling via `croak` for invalid levels or exceeding line limits; `die` for CLI misuse or file I/O failures. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..5fdc4147 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,80 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:31Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploy a specified release to all hosts in an environment. +- Restart `orderd` service and verify health. +- Can run in dry‑run mode. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`) +- `set -euo pipefail` + +#### Input +- Options parsed with `getopts`: + - `-e ` → `ENVIRONMENT` + - `-t ` → `TAG` + - `-n` → `DRY_RUN=1` + - `-p ` → ignored (logged) + - `-h` → usage +- Environment variables: + - `DEPLOY_USER` (default `deploy`) + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`) +- Files read: + - `hosts.staging` or `hosts.production` (based on `ENVIRONMENT`) + - `build/$TAG.tar.gz` (source tarball) + +#### Output +- Copies `build/$TAG.tar.gz` to `/tmp/` on each host. +- Extracts to `$RELEASE_ROOT/$TAG`, updates `$RELEASE_ROOT/current` symlink. +- Restarts `orderd` via `systemctl`. +- Prints deployment status to stderr. +- Exits with status 1 on errors, 0 on success. + +#### Core logic +- Parse options; validate `ENVIRONMENT` and `TAG`. +- `check_prereqs`: ensure `rsync`, `ssh`, `curl` exist and SSH key readable. +- `load_hosts`: read host list from environment‑specific file. +- For each host: + - `deploy_host`: rsync tarball, SSH into host, extract, symlink, restart service. + - `wait_healthy`: poll `/health` endpoint until success or timeout. + - Log deployment. + +#### Functions +- `log` – timestamped stderr output. +- `die` – error log and exit. +- `usage` – prints usage from script comment. +- `check_prereqs` – verifies tools and SSH key. +- `load_hosts` – loads host list. +- `deploy_host` – deploys to a single host. +- `wait_healthy` – waits for health endpoint. +- `cleanup` – removes temporary lock file (unused). + +#### Constants and configuration +- `SCRIPT_DIR` – script directory. +- `DEPLOY_USER` – `deploy` +- `SSH_KEY` – `$HOME/.ssh/deploy_ed25519` +- `RELEASE_ROOT` – `/opt/releases` +- `SERVICE_NAME` – `orderd` +- `HEALTH_TIMEOUT` – `30` +- `HOST_FILES` – `staging=hosts.staging`, `production=hosts.production` + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `mkdir`, `ln`, `sudo`. +- Host files: `hosts.staging`, `hosts.production`. +- Remote service: `http://:8080/health`. + +#### Errors and exit codes +- `die` exits with status 1 on missing tools, unreadable SSH key, empty host list, or health timeout. +- `getopts` errors exit with status 1. +- Missing required options exit with status 2. +- `wait_healthy` exits with status 1 if health check fails after `HEALTH_TIMEOUT` seconds. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..42bf8e31 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,67 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:35Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> A POSIX‑style init wrapper that manages a queue worker, providing start, stop, status, restart, and health‑check commands based on a PID file and heartbeat file. + +#### Purpose +- Controls a queue worker process. +- Exposes `start`, `stop`, `restart`, `status`, and `health` actions. + +#### Type +- POSIX sh (`#!/bin/sh`). +- No strict mode flags used. + +#### Input +- `$1`: command (`start`, `stop`, `restart`, `status`, `health`). +- Environment variables: + - `PID_FILE` (default `/run/queue-worker.pid`). + - `HEARTBEAT_FILE` (default `/var/lib/queue-worker/heartbeat`). +- No command‑line options parsed. + +#### Output +- Writes PID to `PID_FILE` when starting. +- Removes `PID_FILE` when stopping. +- Prints status messages (`running`, `stopped`, `OK`, `WARNING`, `CRITICAL`). +- Exits with codes: `0` success, `1` warning, `2` critical, `3` stopped, `64` usage error. + +#### Core logic +- `is_running`: checks if PID file exists and process is alive. +- `heartbeat_age`: calculates seconds since last heartbeat file modification. +- `start_worker`: starts worker with `nohup`, records PID. +- `stop_worker`: kills process and deletes PID file. +- Command dispatch via `case` on `$1`: + - `start`: invoke `start_worker`. + - `stop`: invoke `stop_worker`. + - `restart`: stop then start. + - `status`: report running/stopped. + - `health`: verify running and heartbeat age against `MAX_HEARTBEAT_AGE` (120 s). + +#### Functions +- `is_running`: check process existence. +- `heartbeat_age`: compute heartbeat age. +- `start_worker`: launch worker, write PID. +- `stop_worker`: terminate worker, clean PID. + +#### Constants and configuration +- `PID_FILE`=`/run/queue-worker.pid` +- `HEARTBEAT_FILE`=`/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE`=`120` +- `WORKER_BIN`=`/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `nohup`, `kill`, `cat`, `date`, `stat`, `echo`. +- Worker binary: `/usr/local/bin/queue-worker` (expects `--heartbeat` option). + +#### Errors and exit codes +- `exit 64`: usage error (unknown command). +- `exit 2`: health check fails because worker not running. +- `exit 1`: heartbeat older than `MAX_HEARTBEAT_AGE`. +- `exit 3`: status reports stopped. +- No traps or retries implemented. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..c0afde6b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,70 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:39Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, creates a control file, and gzips the result. + +#### Purpose +- Runs nightly to export settled payments. +- Executed directly; not sourced. + +#### Type +- `ksh93` (shebang `#!/bin/ksh93`). +- Uses `set -e`? none; relies on `whence -q` and explicit exits. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → variable `business_day`. + - `-o ` → variable `export_dir`. +- Environment variables: + - `ORACLE_SID` (default `PAYPRD`). + - `NLS_LANG` set to `AMERICAN_AMERICA.AL32UTF8`. +- No positional arguments. + +#### Output +- Creates `payments_.csv` in `export_dir`. +- Generates `.ctl` control file with row count and business day. +- Gzips the CSV to `payments_.csv.gz`. +- Prints log messages to stderr. +- Exits with status 0 on success, 1–4 on various failures. + +#### Core logic +- Parse options; set defaults. +- Ensure `export_dir` exists. +- Attempt export up to `MAX_RETRIES` (3): + - Run `run_export` to query Oracle via `sqlplus` and spool CSV. + - On success: write control file, gzip CSV, log success, exit 0. + - On failure: log, sleep 60, retry. +- If all attempts fail, call `fail` with exit code 4. + +#### Functions +- `log` – prints timestamped message to stderr. +- `fail` – logs failure and exits with given code. +- `require_tools` – checks for `sqlplus` and `gzip`; exits if missing. +- `run_export` – runs Oracle query via `sqlplus`, writes CSV. +- `write_control` – counts rows, writes control file. + +#### Constants and configuration +- ``ORACLE_SID_DEFAULT=PAYPRD`` +- ``EXPORT_DIR_DEFAULT=/data/export/payments`` +- ``MAX_RETRIES=3`` +- ``attempt=0`` +- ``business_day=$(date +%Y%m%d)`` +- ``export_dir=$EXPORT_DIR_DEFAULT`` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle connection: `CONNECT / AS SYSDBA` (no credentials in script). +- SQL query reads `settled_payment` table, filters by `business_day`. + +#### Errors and exit codes +- `fail "missing $tool" 3` – missing tool. +- `fail "cannot create $export_dir"` – directory creation failure. +- `fail "giving up after $MAX_RETRIES attempts" 4` – all retries exhausted. +- `fail "usage: nightly_extract.ksh ..." 2` – invalid options. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..50265e39 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,44 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:57Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> A collection of shell utilities for deploying releases, managing a queue worker, and nightly payment extraction. + +#### Purpose +- Deploy and verify application releases across hosts. +- Control a queue worker process with health monitoring. +- Export settled payments from Oracle to CSV for downstream processing. + +#### Responsibilities +- **Deployment**: `deploy_release.sh` handles tarball transfer, extraction, symlink updates, service restart, and health checks. +- **Process Management**: `healthcheck.sh` provides start/stop/status/health commands for a queue worker, tracking PID and heartbeat. +- **Data Extraction**: `nightly_extract.ksh` queries Oracle for settled payments, writes CSV, creates control files, and gzips output. + +#### Key units +- `deploy_release.sh` – orchestrates host‑by‑host deployment and health polling. +- `healthcheck.sh` – PID/heartbeat‑based worker controller. +- `nightly_extract.ksh` – Oracle export driver, retry logic, control file generator. + +#### Data flow +1. **Deployment**: `deploy_release.sh` reads host list → rsync tarball → SSH → extract → symlink → `systemctl restart` → poll `/health` → log status. +2. **Worker**: `healthcheck.sh` starts `queue-worker` with `nohup`, writes PID, writes heartbeat via worker binary; health checks read heartbeat age. +3. **Extraction**: `nightly_extract.ksh` parses date → runs `sqlplus` query → spools CSV → counts rows → writes control file → gzips CSV. + +#### Dependencies +- External utilities: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `nohup`, `kill`, `sqlplus`, `gzip`. +- Remote resources: `/opt/releases`, `/run/queue-worker.pid`, `/var/lib/queue-worker/heartbeat`, Oracle `PAYPRD` database. +- Host configuration files: `hosts.staging`, `hosts.production`. + +#### Cross-cutting +- **Logging**: All scripts use timestamped `stderr` logs via a `log` function. +- **Error handling**: Each script exits with specific codes for missing tools, invalid options, or runtime failures. +- **Configuration**: Default paths and environment variables (`DEPLOY_USER`, `SSH_KEY`, `PID_FILE`, `HEARTBEAT_FILE`, `ORACLE_SID`) are centralized per script. +- **Retry logic**: `nightly_extract.ksh` implements up to 3 retries with sleep; `deploy_release.sh` does not retry but logs failures. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..7f19e0cb --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,58 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:42Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures the Maven build for the Invoice Service module, including dependencies, compiler settings, Flyway migration, and a PDF generation profile. + +#### Purpose +- Builds the `invoice-service` JAR. +- Manages database migrations with Flyway. +- Provides a native PDF generation profile. + +#### Type +- Maven POM + Root element: `project` + Namespaces: `xmlns="http://maven.apache.org/POM/4.0.0"`, `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release` = `17` + - `jackson.version` = `2.19.2` + - `flyway.version` = `11.4.0` + - `invoice.archive.dir` = `${project.build.directory}/archive` +- **Dependencies**: + - `com.fasterxml.jackson.core:jackson-databind` (`${jackson.version}`) + - `org.flywaydb:flyway-core` (`${flyway.version}`) + - `org.postgresql:postgresql` (runtime) + - `org.junit.jupiter:junit-jupiter` (test) + - `org.testcontainers:postgresql` (test) +- **Plugins**: + - `org.flywaydb:flyway-maven-plugin` (`${flyway.version}`) + - `locations`: `filesystem:src/main/resources/db/migration` + - `org.apache.maven.plugins:maven-surefire-plugin` + - `systemPropertyVariables`: `invoice.archive.dir=${invoice.archive.dir}` +- **Profile** `native-pdf`: + - Adds dependency `org.apache.pdfbox:pdfbox:3.0.5` + +#### Configuration +- `maven.compiler.release` = `17` +- `invoice.archive.dir` = `${project.build.directory}/archive` +- Flyway location: `filesystem:src/main/resources/db/migration` +- Surefire system property: `invoice.archive.dir=${invoice.archive.dir}` + +#### Dependencies +- `org.example.billing:billing-parent:2.7.0` +- `com.fasterxml.jackson.core:jackson-databind:${jackson.version}` +- `org.flywaydb:flyway-core:${flyway.version}` +- `org.postgresql:postgresql` (runtime) +- `org.junit.jupiter:junit-jupiter` (test) +- `org.testcontainers:postgresql` (test) +- `org.apache.pdfbox:pdfbox:3.0.5` (profile `native-pdf`) diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..92f863f9 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,51 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:00Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides build configuration, database migration, PDF generation, reminder scheduling, shipment XML schema, and statement-to‑HTML transformation for a billing and logistics system. + +#### Purpose +- Build and package the Invoice Service module. +- Manage database migrations and PDF generation. +- Configure a scheduled reminder system. +- Define shipment notice XML structure. +- Transform monthly statements to HTML. + +#### Responsibilities +- **Build & Deployment** – Maven POM with compiler, dependencies, Flyway, and PDF profile. +- **Database Migration** – Flyway integration for schema changes. +- **Reminder Scheduling** – Spring context wiring for data source, repository, mail gateway, job, and cron trigger. +- **XML Schema Definition** – Shipment notice schema for warehouse notifications. +- **XSLT Transformation** – Statement XML to styled HTML output. + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, Flyway plugin, PDFbox profile. +- `scheduler-context.xml` – Spring beans: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler`. +- `shipment.xsd` – `shipmentNotice` root, `ShipmentNoticeType`, `ParcelType`, `AddressType`, `CarrierCode`, `WeightGrams`. +- `statement-to-html.xsl` – XSLT stylesheet with parameters `currencySymbol`, `highlightAbove`; templates for header, booking rows, and total. + +#### Data flow +1. **Build**: Maven compiles Java, runs Flyway migrations, packages JAR, optionally adds PDFbox for PDF generation. +2. **Scheduling**: Spring context loads data source → repository → job → scheduled trigger → job executes `sendDueReminders` using `mailGateway`. +3. **Shipment**: Warehouse emits XML matching `shipment.xsd`; consumers validate against schema. +4. **Statement**: XML statement (namespace `urn:example:statement`) is fed to `statement-to-html.xsl`; XSLT produces an HTML page with styled rows and totals. + +#### Dependencies +- Maven: `org.example.billing:billing-parent`, Jackson, Flyway, PostgreSQL, JUnit, Testcontainers, PDFbox (profile). +- Spring: `task`, `context`, HikariCP, custom reminder classes (`JdbcReminderRepository`, `SmtpMailGateway`, `OverdueReminderJob`). +- XML: `http://www.w3.org/2001/XMLSchema`, `urn:example:shipment:1`, `urn:example:statement`. + +#### Cross-cutting +- **Configuration placeholders**: `reminder.properties` for DB and SMTP settings. +- **Naming conventions**: XML namespaces (`shp`, `st`), bean names (`reminder*`, `overdueReminderJob`). +- **Error handling**: Not explicitly detailed; relies on Spring and Flyway defaults. +- **Testing**: Maven test scope includes JUnit and Testcontainers for PostgreSQL. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..40e0da31 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,53 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:46Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures a Spring context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled trigger. + +#### Purpose +- Wire reminder scheduler components. +- Define scheduled task for sending due reminders. + +#### Type +- Spring context XML (`` root). +- Namespaces: + - `xmlns="http://www.springframework.org/schema/beans"` + - `xmlns:context="http://www.springframework.org/schema/context"` + - `xmlns:task="http://www.springframework.org/schema/task"` + +#### Definitions +- **Property placeholder**: `reminder.properties` (classpath). +- **Component scan**: `org.example.reminder.web`. +- **Beans**: + - `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`): + - `jdbcUrl` → `${reminder.db.url}` + - `username` → `${reminder.db.user}` + - `maximumPoolSize` → `8` + - `reminderRepository` (`org.example.reminder.JdbcReminderRepository`): constructor arg `reminderDataSource`. + - `mailGateway` (`org.example.reminder.SmtpMailGateway`): + - `host` → `${reminder.smtp.host}` + - `port` → `587` + - `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`): + - constructor args: `reminderRepository`, `mailGateway` + - `graceDays` → `14` +- **Scheduler**: `reminderScheduler` (`task:scheduler`) with `pool-size="2"`. +- **Scheduled task**: `overdueReminderJob.sendDueReminders` triggered by cron `0 0 7 * * MON-FRI`. + +#### Configuration +- `reminder.db.url` – JDBC URL (placeholder). +- `reminder.db.user` – DB username (placeholder). +- `reminder.smtp.host` – SMTP host (placeholder). +- `reminder.db.url`, `reminder.db.user`, `reminder.smtp.host` are resolved from `reminder.properties`. + +#### Dependencies +- `com.zaxxer.hikari.HikariDataSource` (HikariCP). +- `org.example.reminder.JdbcReminderRepository`. +- `org.example.reminder.SmtpMailGateway`. +- `org.example.reminder.OverdueReminderJob`. +- Spring `task` and `context` modules. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..67378193 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,38 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:49Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Specifies the structure of a shipment notice XML document. +- Validates shipment data such as carrier, recipient address, and parcel details. + +#### Type +- XML Schema (`xs:schema`). +- Root element: `shipmentNotice`. +- Namespaces: `xs` → `http://www.w3.org/2001/XMLSchema`; `shp` → `urn:example:shipment:1`. + +#### Definitions +- **Simple types** + - `CarrierCode`: enumeration of `"DHL"`, `"UPS"`, `"GLS"`, `"POST"`. + - `WeightGrams`: positive integer ≤ 31500. +- **Complex types** + - `ParcelType`: sequence of `trackingNumber` (`xs:string`) and `weight` (`shp:WeightGrams`); required attribute `sequence` (`xs:positiveInteger`). + - `AddressType`: sequence of `name`, `street`, `postalCode`, `city` (`xs:string`); optional `country` (`xs:string`, default `"DE"`). + - `ShipmentNoticeType`: sequence of `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one or more `parcel` (`shp:ParcelType`); required attribute `noticeId` (`xs:ID`). +- **Root element** + - `shipmentNotice` of type `shp:ShipmentNoticeType`. + +#### Configuration +- `country` attribute in `AddressType` defaults to `"DE"`. + +#### Dependencies +- Relies on XML Schema namespace `http://www.w3.org/2001/XMLSchema`. +- Uses target namespace `urn:example:shipment:1` for all custom types. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..2fbd1337 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,37 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:44:52Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a monthly account statement XML into an HTML page with header, rows per booking, and total. + +#### Purpose +- Render a monthly account statement as an HTML page. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespaces: `xsl` → `http://www.w3.org/1999/XSL/Transform`; `st` → `urn:example:statement`. + +#### Definitions +- **Parameters** + - `currencySymbol` (default `'EUR'`) + - `highlightAbove` (default `1000`) +- **Key** + - `bookingsByDay` matches `st:booking` using `st:valueDate` +- **Templates** + - `match="/st:statement"`: outputs `` with `` title and `` containing header, table of bookings, and total. + - `name="statementHeader"`: outputs `

` with account number and `

` with period. + - `match="st:booking"`: outputs ``; adds `class="large"` if `st:amount` > `$highlightAbove`; contains `` cells for `st:valueDate`, `st:purpose`, and formatted `st:amount` with `$currencySymbol`. + - `name="statementTotal"`: outputs `

` with total amount formatted. + +#### Configuration +- `xsl:output` method `html`, encoding `UTF-8`, indent `yes`. +- Parameter values: `currencySymbol='EUR'`, `highlightAbove=1000`. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: `statement`, `accountNumber`, `period`, `booking`, `valueDate`, `purpose`, `amount`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..6dff8847 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,60 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:11Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A collection of utilities that aggregate web‑server logs, automate deployment and worker management, and support billing, logistics, and reporting workflows. + +#### Purpose +- Aggregate and report HTTP access logs by host, status, and latency. +- Deploy application releases, manage queue workers, and extract payment data. +- Build, migrate, and configure a billing service; validate shipment XML; transform statements to HTML. + +#### Responsibilities +- **Log aggregation** – parse, summarize, and flag slow requests (`LogDigest`). +- **Deployment & process control** – host‑by‑host release rollout, worker health monitoring (`deploy_release.sh`, `healthcheck.sh`). +- **Data extraction** – Oracle payment export to CSV (`nightly_extract.ksh`). +- **Build & migration** – Maven packaging, Flyway schema updates, PDF generation. +- **Scheduling** – Spring‑based reminder job for overdue invoices. +- **XML handling** – Shipment notice schema (`shipment.xsd`) and statement‑to‑HTML XSLT (`statement-to-html.xsl`). + +#### Key units +- `LogDigest` (Perl module) – parses log lines, aggregates counts, tracks slow requests. +- `log_digest.pl` – CLI driver for log ingestion and report output. +- `deploy_release.sh` – orchestrates tarball transfer, extraction, symlink, service restart, health check. +- `healthcheck.sh` – PID/heartbeat‑based controller for queue workers. +- `nightly_extract.ksh` – Oracle query driver, CSV spooler, control file generator, gzip compressor. +- `invoice-service-pom.xml` – Maven project with Flyway, PDFbox profile. +- `scheduler-context.xml` – Spring beans for reminder data source, repository, mail gateway, job, and cron trigger. +- `shipment.xsd` – XML schema for shipment notices. +- `statement-to-html.xsl` – XSLT stylesheet converting statement XML to styled HTML. + +#### Data flow +1. **Log processing** – `log_digest.pl` reads files → `LogDigest->add` → `summarize` → formatted output. +2. **Deployment** – `deploy_release.sh` → rsync tarball → SSH extraction → symlink → `systemctl restart` → `/health` poll. +3. **Worker control** – `healthcheck.sh` starts `queue-worker`, writes PID, writes heartbeat; health checks read heartbeat age. +4. **Payment extraction** – `nightly_extract.ksh` runs `sqlplus` query → spools CSV → counts rows → writes control file → gzips CSV. +5. **Build & migration** – Maven compiles → Flyway migrates → packages JAR → optional PDF generation. +6. **Scheduling** – Spring context loads beans → scheduled trigger fires → `OverdueReminderJob` sends emails via `SmtpMailGateway`. +7. **XML validation** – Warehouse emits XML → consumers validate against `shipment.xsd`. +8. **Statement rendering** – XML statement → `statement-to-html.xsl` → HTML output. + +#### Dependencies +- **Perl**: `Getopt::Long`, `JSON::PP`, `List::Util`, `Carp`, `Exporter`. +- **Shell**: `rsync`, `ssh`, `curl`, `systemctl`, `tar`, `nohup`, `kill`, `sqlplus`, `gzip`. +- **Oracle**: `PAYPRD` database for payment extraction. +- **Maven**: `org.example.billing:billing-parent`, Jackson, Flyway, PostgreSQL, JUnit, Testcontainers, PDFbox. +- **Spring**: `task`, `context`, HikariCP, custom reminder components. +- **XML**: W3C XSD, `urn:example:shipment:1`, `urn:example:statement`. + +#### Cross-cutting +- **Logging**: Timestamped stderr logs in shell scripts; `LogDigest` normalizes host names. +- **Error handling**: Perl uses `croak`/`die`; shell scripts exit with specific codes; Maven/Flyway rely on defaults. +- **Configuration**: Host lists (`hosts.staging`, `hosts.production`), environment variables (`DEPLOY_USER`, `SSH_KEY`, `PID_FILE`, `HEARTBEAT_FILE`, `ORACLE_SID`), and property files (`reminder.properties`). +- **Retry logic**: `nightly_extract.ksh` retries up to 3 times; deployment scripts log failures but do not retry. +- **Testing**: Maven test scope includes JUnit and Testcontainers for PostgreSQL. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..daf8b42b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run5/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 709BDDCF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:23Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard project centers on a billing and logistics workflow that is driven by web‑server log aggregation and automated deployment. Core utilities in the root package collect logs, launch workers, and orchestrate nightly payment extraction, while the `other/perl` package provides a CLI for summarizing access logs by host and status, flagging slow requests. Shell scripts in `other/shell` handle release deployment and queue worker management, and the `other/xml` package supplies build configuration, database migrations, PDF generation, reminder scheduling, shipment XML schemas, and statement‑to‑HTML transformations to support the billing system. Together, these subsystems form a cohesive pipeline from log ingestion to billing and shipment reporting. + +#### Packages +- other — A collection of utilities and configuration artifacts that aggregate web‑server logs, automate deployment and worker management, and support billing, logistics, and reporting workflows. +- other/perl — Condenses web‑server access logs into per‑host and per‑status summaries, highlighting slow requests and providing a CLI for reporting. +- other/shell — A collection of shell utilities for deploying releases, managing a queue worker, and nightly payment extraction. +- other/xml — Provides build configuration, database migration, PDF generation, reminder scheduling, shipment XML schema, and statement-to‑HTML transformation for a billing and logistics system. +- . — A collection of utilities that aggregate web‑server logs, automate deployment and worker management, and support billing, logistics, and reporting workflows. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/meta/gpt-oss-20b.json new file mode 100644 index 00000000..d5d59b2b --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:45:28Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 31.0, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 16.7, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.0, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:46:17Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16083, + "cachedPromptTokens": 16032, + "completionTokens": 5007, + "seconds": 30.3817115 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.001133, + "costUsd": 0.0, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..e23511ce --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,66 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:08Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A collection of utilities for processing web logs, automating deployment and data extraction, and managing invoicing, shipment, and statement workflows. + +#### Purpose +- Summarize HTTP access logs and expose a reusable digest API. +- Automate release deployment, worker health checks, and nightly Oracle data exports. +- Build, schedule, and validate invoicing and shipment XML, and transform statements to HTML. + +#### Responsibilities +- **Log Analysis** – parsing, counting, and reporting host/status statistics. +- **Deployment & Ops** – tarball distribution, service restart, health polling, and worker lifecycle control. +- **Data Extraction** – Oracle export to CSV, control file generation, and compression. +- **Build & Scheduling** – Maven packaging, Flyway migrations, Spring job wiring. +- **XML Validation & Transformation** – shipment notice schema, statement XSLT rendering. + +#### Key units +- `LogDigest` (Perl module) – `new`, `add`, `summarize`, `top_n`. +- `log_digest.pl` – CLI orchestrator, option parsing, alias handling. +- `deploy_release.sh` – host‑by‑host deployment, rsync/ssh, systemctl restart, health check. +- `healthcheck.sh` – PID/heartbeat worker controller. +- `nightly_extract.ksh` – Oracle `sqlplus` export, CSV generation, control file, gzip. +- `invoice-service-pom.xml` – Maven project, dependencies, Flyway, PDFBox profile. +- `scheduler-context.xml` – Spring beans for reminder job, data source, mail gateway, cron trigger. +- `shipment.xsd` – XML schema for shipment notices. +- `statement-to-html.xsl` – XSLT stylesheet for statement HTML rendering. + +#### Data flow +1. **Log Processing** + CLI → `LogDigest` → parse lines → aggregate → `summarize` → output JSON/text. +2. **Deployment** + Script → rsync tarball → SSH → extract → symlink → systemctl restart → curl health. +3. **Healthcheck** + Start → PID file → worker heartbeat → health command reads age → status report. +4. **Extraction** + Script → `sqlplus` query → CSV → row count → control file → gzip. +5. **Scheduling** + Spring context → data source → repository → job → scheduler → cron → email reminders. +6. **XML Workflow** + External system → shipment XML → validate against `shipment.xsd`. + Statement XML → `statement-to-html.xsl` → HTML output. + +#### Dependencies +- **Perl**: `POSIX`, `List::Util`, `Carp`, `Exporter`, `Getopt::Long`, `JSON::PP`. +- **Shell**: `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `cat`, `sqlplus`, `gzip`. +- **Oracle**: `CONNECT / AS SYSDBA` for nightly export. +- **Maven**: Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, PDFBox, HikariCP, Spring `task`/`context`. +- **XML**: Standard XML Schema namespace; no external imports. + +#### Cross-cutting +- Consistent error handling (`set -euo pipefail`, `croak`/`die`). +- Host normalization (lowercase, strip trailing dot) across log parsing and exclusions. +- Configuration via environment variables, property placeholders, and Maven properties. +- Retry logic in nightly extraction (max 3 attempts). +- Health checks use timeouts (`HEALTH_TIMEOUT`, `MAX_HEARTBEAT_AGE`). +- Scheduler pool size 2; HikariCP max 8 connections. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..7a78626e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,68 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:28Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Provides a log‑digesting class for summarizing access logs. +- Exposes `parse_line` and `top_n` for external use. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: `new`, `add`, `summarize`. + +#### Input +- `new(level => $level)` – `$level` must be one of `DEBUG`, `INFO`, `WARN`, `ERROR`; defaults to `WARN`. +- `add($line)` – a single log line string. +- `parse_line($line)` – parses a log line. +- `top_n($counts, $n)` – selects top `$n` keys from a hash of counts. + +#### Output +- `add` returns `1` on successful parse, `0` if line ignored, dies on too many lines. +- `summarize` returns hashref: + - `generated` – UTC timestamp. + - `total` – total lines processed. + - `hosts` – distinct host count. + - `busiest` – max requests per host. + - `slow` – count of requests > 1500 ms. + - `statuses` – hashref of status counts. +- `top_n` returns list of keys sorted by count descending, then lexicographically. + +#### Core logic +- `new`: validate level, initialize counters. +- `parse_line`: regex extracts host, time, method, path, status, millis; normalizes host. +- `add`: enforce `MAX_LINES`; parse line; increment host and status counters; increment `slow` if millis > `SLOW_REQUEST_MS`. +- `summarize`: compute totals, busiest host, format timestamp. +- `top_n`: sort hash by value descending, key ascending; slice top `$n`. + +#### Subs +- `new(%args) -> object` – create digest with level. +- `parse_line($line) -> hashref` – parse log line. +- `add($line) -> 1/0` – add entry, update stats. +- `summarize() -> hashref` – produce summary. +- `top_n($counts, $n) -> list` – top keys by count. +- `_normalize_host($host) -> host` – lowercase, strip trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `%LEVEL_RANK = (DEBUG => 0, INFO => 1, WARN => 2, ERROR => 3)` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `croak` if unknown level in `new`. +- `croak` if more than `MAX_LINES` added in `add`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..5e8956bc --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,72 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:33Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Aggregates web server logs to report busiest hosts and status‑code counts, optionally outputting JSON. + +#### Purpose +- Script to analyze access logs. +- Outputs busiest hosts and status‑code statistics. + +#### Type +- Script. +- No package; procedural. + +#### Input +- Options: + - `--top|n=i` → `$top` (default 10). + - `--level=s` → `$level` (default 'WARN'). + - `--json!` → `$as_json` (default 0). + - `--exclude-host=s` → `@exclude_hosts`. + - `--help|h` → prints usage. +- Positional arguments: `FILE...` (log files). +- Environment: `LOG_DIGEST_CONFIG` (default `/etc/log-digest.conf`). +- Reads config file for host aliases (`HOST=ALIAS` lines). + +#### Output +- If `$as_json`: JSON string of `$summary` hash. +- Else: plain text: + - Summary line: `printf "%d requests from %d hosts, %d slow\n"`. + - List of top hosts: one per line from `top_n($digest->{hosts}, $top)`. + +#### Core logic +- Load host aliases from config file. +- Build exclusion set from `@exclude_hosts`. +- Create `LogDigest` instance with `level`. +- For each input file: + - Read line by line. + - Extract host (first token). + - Skip if host (or its alias) is excluded. + - Pass line to `$digest->add`. +- After all files: + - `$digest->summarize` → `$summary`. + - Output JSON or text as above. + +#### Subs +- `usage() -> string` – prints help text. +- `read_aliases(PATH) -> hash` – parses alias file. +- `main() -> 0` – orchestrates processing. + +#### Constants and configuration +- `$config_file = $ENV{LOG_DIGEST_CONFIG} // '/etc/log-digest.conf'`. +- `$top = 10`. +- `$level = 'WARN'`. +- `$as_json = 0`. +- `@exclude_hosts = ()`. + +#### Dependencies +- `FindBin` – `$Bin`. +- `Getopt::Long` – `GetOptions`. +- `JSON::PP` – `new`, `canonical`, `encode`. +- `LogDigest` – `new`, `add`, `summarize`, `top_n`. + +#### Exceptions / Errors +- `die usage()` on bad options. +- `die "--top must be positive\n"` if `$top < 1`. +- `die "cannot read $file: $!\n"` on file open failure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..7c6dfdaa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,41 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:59Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Summarizes web‑server access logs, producing per‑host and per‑status statistics and identifying slow requests. + +#### Purpose +- Aggregate and summarize HTTP access logs. +- Expose a reusable `LogDigest` class and a command‑line tool for quick reporting. + +#### Responsibilities +- **Log parsing & counting** – `LogDigest` parses individual log lines, normalizes hosts, and tallies request counts, status codes, and slow requests. +- **Reporting** – `summarize` produces a hash of totals, busiest host, and status distribution; `top_n` selects the most frequent hosts. +- **CLI orchestration** – `log_digest.pl` loads host aliases, applies exclusions, feeds files to `LogDigest`, and outputs either plain text or JSON. + +#### Key units +- `LogDigest` (module) – constructor `new`, methods `add`, `summarize`, `top_n`, helper `_normalize_host`. +- `log_digest.pl` (script) – `main`, `usage`, `read_aliases`. + +#### Data flow +1. **CLI** parses options → creates `LogDigest` with chosen log level. +2. For each input file: read line → optionally skip excluded hosts → `$digest->add($line)`. +3. After all files: `$digest->summarize()` → `$summary`. +4. Output: JSON string or formatted text with total requests, host count, slow request count, and top hosts. + +#### Dependencies +- **Internal**: `LogDigest` module used by the script. +- **External**: `POSIX`, `List::Util`, `Carp`, `Exporter` (module); `FindBin`, `Getopt::Long`, `JSON::PP` (script). + +#### Cross-cutting +- Host normalization (lowercase, strip trailing dot) used by both parsing and exclusion logic. +- Log level validation via `%LEVEL_RANK` ensures consistent verbosity control. +- Constants (`MAX_LINES`, `SLOW_REQUEST_MS`) guard against excessive input and define slow‑request threshold. +- Error handling uses `croak` for module errors and `die` for CLI misuse. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..9a6821f7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,82 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:37Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploys a specified release to all hosts of an environment. +- Runs as a standalone script. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`). +- Strict mode: `set -euo pipefail`. + +#### Input +- Options parsed by `getopts`: + - `-e ` → `ENVIRONMENT`. + - `-t ` → `TAG`. + - `-n` → `DRY_RUN=1`. + - `-p ` → ignored, logged. + - `-h` → prints usage. +- Environment variables: + - `DEPLOY_USER` (default `deploy`). + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`). +- Files read: + - `$SCRIPT_DIR/lib/common.sh` (sourced). + - `$SCRIPT_DIR/${HOST_FILES[$ENVIRONMENT]}` (hosts list). + +#### Output +- Logs to stderr with timestamps. +- Deploys `build/$TAG.tar.gz` to `/tmp/` on each host. +- Extracts to `$RELEASE_ROOT/$TAG`, updates `$RELEASE_ROOT/current`. +- Restarts `orderd` via `systemctl`. +- Verifies health at `http://$host:8080/health`; exits on failure. +- Exit status 0 on success, 1 on error, 2 on missing arguments. + +#### Core logic +- Parse options; validate `ENVIRONMENT` and `TAG`. +- `check_prereqs`: ensure `rsync`, `ssh`, `curl` exist and SSH key readable. +- `load_hosts`: read host list file into `HOSTS`. +- For each host: + - `deploy_host`: + - If `DRY_RUN`, log and skip. + - `rsync` tarball to host. + - SSH into host, create target dir, extract tarball, symlink `current`, restart service. + - Call `wait_healthy` to poll health endpoint until success or timeout. + - Log deployment success. + +#### Functions +- `log` – prints timestamped message to stderr. +- `die` – logs error and exits. +- `usage` – prints usage comment from script header. +- `check_prereqs` – verifies required tools and SSH key. +- `load_hosts` – loads host list into `HOSTS`. +- `deploy_host` – deploys to a single host. +- `wait_healthy` – polls health endpoint with timeout. +- `cleanup` – removes temporary lock file (unused but defined). + +#### Constants and configuration +- `SCRIPT_DIR` – script directory. +- `DEPLOY_USER` – `deploy`. +- `SSH_KEY` – `$HOME/.ssh/deploy_ed25519`. +- `RELEASE_ROOT` – `/opt/releases`. +- `SERVICE_NAME` – `orderd`. +- `HEALTH_TIMEOUT` – `30`. +- `HOST_FILES` – associative array mapping environments to host list files. + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl`. +- Host list files: `hosts.staging`, `hosts.production`. +- Remote hosts: those listed in the selected host file. + +#### Errors and exit codes +- `die` exits with status 1 on missing tools, unreadable SSH key, empty host list, or health check failure. +- Missing required options triggers usage and exit status 2. +- Health check timeout (`HEALTH_TIMEOUT` seconds) causes `die` with status 1. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..4da91be3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,66 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:42Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> A POSIX‑style wrapper that manages a queue worker, providing start, stop, status, and health checks based on a PID file and heartbeat file age. + +#### Purpose +- Controls a queue worker binary. +- Runs directly as a command. + +#### Type +- `sh` (POSIX). +- No strict mode flags. + +#### Input +- `$1` command: `start`, `stop`, `restart`, `status`, `health`. +- Environment variables: + - `PID_FILE` (default `/run/queue-worker.pid`). + - `HEARTBEAT_FILE` (default `/var/lib/queue-worker/heartbeat`). +- No other options or arguments. + +#### Output +- Writes PID to `PID_FILE` when starting. +- Removes `PID_FILE` when stopping. +- Prints status messages (`running`, `stopped`, `OK`, `WARNING`, `CRITICAL`). +- Exits with codes: `0` success, `1` warning, `2` critical, `3` stopped, `64` usage error. + +#### Core logic +- `is_running`: checks if PID file exists and process is alive. +- `heartbeat_age`: computes seconds since last heartbeat file modification. +- `start_worker`: starts worker with `nohup`, records PID. +- `stop_worker`: kills process and removes PID file. +- Command dispatch via `case` on `$1`: + - `start`: invoke `start_worker`. + - `stop`: invoke `stop_worker`. + - `restart`: stop then start. + - `status`: report running/stopped, exit 3 if stopped. + - `health`: verify running and heartbeat age ≤ `MAX_HEARTBEAT_AGE`; warn if older. + +#### Functions +- `is_running`: check if worker process exists. +- `heartbeat_age`: calculate heartbeat staleness. +- `start_worker`: launch worker and record PID. +- `stop_worker`: terminate worker and clean PID file. + +#### Constants and configuration +- `PID_FILE`=`/run/queue-worker.pid` +- `HEARTBEAT_FILE`=`/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE`=`120` +- `WORKER_BIN`=`/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `kill`, `nohup`, `date`, `stat`, `cat`. +- Worker binary: `/usr/local/bin/queue-worker` (expects `--heartbeat` option). + +#### Errors and exit codes +- `exit 64`: invalid command usage. +- `exit 2`: health check fails because worker not running. +- `exit 1`: heartbeat older than `MAX_HEARTBEAT_AGE`. +- `exit 3`: status check reports stopped. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..89e6b4f7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,80 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:45Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, creates a control file, and gzips the result with retry logic. + +#### Purpose +- Run nightly to export settled payments. +- Executed directly; not sourced. + +#### Type +- `ksh93` shell. +- Uses `set -e`? none; relies on `until` loop and explicit exits. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → `business_day` + - `-o

` → `export_dir` +- Environment variables: + - `ORACLE_SID` (default `PAYPRD`) + - `NLS_LANG=AMERICAN_AMERICA.AL32UTF8` +- No positional arguments. + +#### Output +- CSV file: `$export_dir/payments_$business_day.csv` +- Control file: `$export_dir/payments_$business_day.ctl` containing `rows=` and `business_day=`. +- Gzipped CSV: `$export_dir/payments_$business_day.csv.gz` +- Logs to stderr with timestamps. +- Exit status: + - `0` on success. + - `1` on generic failure. + - `2` on usage error. + - `3` if required tool missing. + - `4` after exhausting retries. + +#### Core logic +- Parse options; set defaults. +- Ensure `export_dir` exists. +- Set `csv` path. +- Retry loop (max 3 attempts): + - Run `run_export` to spool SQL query output to `$csv`. + - On success: + - `write_control` counts rows, writes control file. + - `gzip -f "$csv"`. + - Log success and exit. + - On failure: + - Log attempt, sleep 60, retry. +- After retries, call `fail` with exit code 4. + +#### Functions +- `log` – prepend timestamp, write to stderr. +- `fail` – log failure, exit with code. +- `require_tools` – ensure `sqlplus` and `gzip` are available. +- `run_export` – execute SQL query via `sqlplus`, spool to file. +- `write_control` – count rows, write control file. + +#### Constants and configuration +- ``ORACLE_SID_DEFAULT=PAYPRD`` +- ``EXPORT_DIR_DEFAULT=/data/export/payments`` +- ``MAX_RETRIES=3`` +- ``attempt=0`` +- ``business_day=$(date +%Y%m%d)`` +- ``export_dir=$EXPORT_DIR_DEFAULT`` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle connection: `CONNECT / AS SYSDBA` (no credentials in script). +- SQL query reads `settled_payment` table, filters by `business_day`. + +#### Errors and exit codes +- `fail "missing $tool" 3` – missing tool. +- `fail "cannot create $export_dir"` – directory creation failure. +- `fail "usage: nightly_extract.ksh ..." 2` – invalid options. +- `fail "giving up after $MAX_RETRIES attempts" 4` – retries exhausted. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..7962df89 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,46 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:03Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates deployment, health monitoring, and nightly data extraction for a payment processing service. + +#### Purpose +- Deploy release tarballs to multiple hosts, restart services, and verify health. +- Control a queue worker process with start/stop/status/health checks. +- Export settled payments from Oracle to CSV, generate control files, and compress output. + +#### Responsibilities +- **Deployment**: `deploy_release.sh` handles distribution, extraction, service restart, and health polling. +- **Process Management**: `healthcheck.sh` manages a queue worker via PID/heartbeat files. +- **Data Extraction**: `nightly_extract.ksh` runs nightly Oracle exports, writes control metadata, and gzips results. + +#### Key units +- `deploy_release.sh` – orchestrates host‑by‑host deployment, uses `rsync`, `ssh`, `curl`. +- `healthcheck.sh` – PID/heartbeat‑based worker controller (`/usr/local/bin/queue-worker`). +- `nightly_extract.ksh` – Oracle export driver (`sqlplus`), gzip compressor, retry loop. + +#### Data flow +1. **Deployment**: script receives environment and tag → loads host list → rsync tarball → SSH to host → extract → symlink `current` → systemctl restart → curl health endpoint. +2. **Healthcheck**: start → writes PID → worker writes heartbeat → health command reads heartbeat age → reports status. +3. **Extraction**: script parses date and output dir → runs SQL query via `sqlplus` → writes CSV → counts rows → writes control file → gzips CSV. + +#### Dependencies +- External utilities: `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `cat`, `sqlplus`, `gzip`. +- Remote hosts defined in `hosts.staging` / `hosts.production`. +- Oracle database (`CONNECT / AS SYSDBA`). +- Queue worker binary `/usr/local/bin/queue-worker`. + +#### Cross‑cutting +- Strict error handling (`set -euo pipefail` in deploy script; explicit exit codes elsewhere). +- Timestamped logging via `log` functions. +- Configuration via environment variables and defaults (e.g., `DEPLOY_USER`, `PID_FILE`, `HEARTBEAT_FILE`, `ORACLE_SID`). +- Retry logic in nightly extraction (max 3 attempts with sleep). +- Health checks use timeouts (`HEALTH_TIMEOUT`, `MAX_HEARTBEAT_AGE`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..f0d2a79c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,53 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:49Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures the Maven build for the Invoice Service module, defining dependencies, compiler settings, and build plugins. + +#### Purpose +- Builds the `invoice-service` JAR. +- Manages database migrations with Flyway. +- Supplies test and runtime dependencies. + +#### Type +- Maven POM + Root element: `project` + Namespaces: + - `xmlns="http://maven.apache.org/POM/4.0.0"` + - `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release=17` + - `jackson.version=2.19.2` + - `flyway.version=11.4.0` + - `invoice.archive.dir=${project.build.directory}/archive` +- **Dependencies**: + - `com.fasterxml.jackson.core:jackson-databind:${jackson.version}` + - `org.flywaydb:flyway-core:${flyway.version}` + - `org.postgresql:postgresql` (runtime) + - `org.junit.jupiter:junit-jupiter` (test) + - `org.testcontainers:postgresql` (test) +- **Plugins**: + - `org.flywaydb:flyway-maven-plugin:${flyway.version}` + - `locations`: `filesystem:src/main/resources/db/migration` + - `org.apache.maven.plugins:maven-surefire-plugin` + - `systemPropertyVariables`: `invoice.archive.dir=${invoice.archive.dir}` +- **Profile** `native-pdf`: + - Adds dependency `org.apache.pdfbox:pdfbox:3.0.5` + +#### Configuration +- `maven.compiler.release` set to `17`. +- Flyway migration location: `src/main/resources/db/migration`. +- Surefire system property `invoice.archive.dir` points to `${invoice.archive.dir}`. + +#### Dependencies +- External libraries: Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, PDFBox (profile). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..42f1b85a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,49 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:05Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides infrastructure for invoicing, shipment notifications, and statement rendering, with build, scheduling, and XML schema/XSLT support. + +#### Purpose +- Build and package the Invoice Service module. +- Configure a reminder scheduler for overdue invoices. +- Define XML schema for shipment notices. +- Transform monthly statements to HTML. + +#### Responsibilities +- **Build & Deployment** – Maven POM with dependencies, plugins, and profiles. +- **Scheduling** – Spring XML context wiring a reminder job, data source, mail gateway, and cron trigger. +- **Data Validation** – XML Schema (`shipment.xsd`) for shipment notices. +- **Presentation** – XSLT (`statement-to-html.xsl`) to render statements as HTML. + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, Flyway migration, PDFBox profile. +- `scheduler-context.xml` – Spring beans: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler`. +- `shipment.xsd` – Schema types: `CarrierCode`, `WeightGrams`, `ParcelType`, `AddressType`, `ShipmentNoticeType`; root element `shipmentNotice`. +- `statement-to-html.xsl` – XSLT stylesheet with parameters `currencySymbol`, `highlightAbove`; templates for header, booking rows, and total. + +#### Data flow +1. **Build**: Maven compiles source, runs Flyway migrations from `src/main/resources/db/migration`, packages JAR, optionally adds PDFBox for PDF generation. +2. **Scheduling**: Spring context loads data source → repository → job → scheduler; cron triggers `overdueReminderJob.sendDueReminders` which queries repository, formats emails via `mailGateway`, and sends reminders. +3. **Shipment**: External systems generate XML matching `shipmentNotice`; XML is validated against `shipment.xsd`. +4. **Statement Rendering**: XML statement (namespace `urn:example:statement`) is transformed by `statement-to-html.xsl` into an HTML page, highlighting amounts above `highlightAbove`. + +#### Dependencies +- **Internal**: `org.example.reminder` classes, `org.example.billing` parent POM. +- **External**: Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, PDFBox (profile), HikariCP, Spring `task` and `context` modules. +- **Schema**: No external imports; uses standard XML Schema namespace. + +#### Cross-cutting +- **Configuration**: Property placeholders (`reminder.properties`) for DB and SMTP settings; Maven properties for compiler, Jackson, Flyway. +- **Error handling**: Not explicitly defined in summaries; assumed standard Spring and Flyway exception propagation. +- **Threading**: Scheduler pool size set to 2; HikariCP pool max 8. +- **Naming conventions**: XML namespaces (`urn:example:shipment:1`, `urn:example:statement`) and element qualification enforced. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..81d07c62 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,56 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:52Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures a Spring context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled trigger. + +#### Purpose +- Wire components for reminder scheduling. +- Define data source, repository, mail gateway, job, and cron trigger. + +#### Type +- Spring context XML (`` root). +- Namespaces: + - `xmlns="http://www.springframework.org/schema/beans"` + - `xmlns:context="http://www.springframework.org/schema/context"` + - `xmlns:task="http://www.springframework.org/schema/task"` + - `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Property placeholder**: `reminder.properties` +- **Component scan**: `org.example.reminder.web` +- **Beans**: + - `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`) + - `reminderRepository` (`org.example.reminder.JdbcReminderRepository`) + - `mailGateway` (`org.example.reminder.SmtpMailGateway`) + - `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`) +- **Scheduler**: `reminderScheduler` (`pool-size="2"`) +- **Scheduled task**: `overdueReminderJob.sendDueReminders` with cron `0 0 7 * * MON-FRI` + +#### Configuration +- `reminderDataSource` + - `jdbcUrl` = `${reminder.db.url}` + - `username` = `${reminder.db.user}` + - `maximumPoolSize` = `8` +- `mailGateway` + - `host` = `${reminder.smtp.host}` + - `port` = `587` +- `overdueReminderJob` + - `graceDays` = `14` +- `reminderScheduler` + - `pool-size` = `2` +- `overdueReminderJob.sendDueReminders` + - `cron` = `0 0 7 * * MON-FRI` + +#### Dependencies +- `com.zaxxer.hikari.HikariDataSource` +- `org.example.reminder.JdbcReminderRepository` +- `org.example.reminder.SmtpMailGateway` +- `org.example.reminder.OverdueReminderJob` +- Spring `task` and `context` modules. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..d7c26a58 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,39 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:55Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Validates shipment notice documents. +- Provides data types for carriers, weights, parcels, addresses, and the notice itself. + +#### Type +- XML Schema (``) +- Root element: `shipmentNotice` +- Namespaces: `xs` (`http://www.w3.org/2001/XMLSchema`), `shp` (`urn:example:shipment:1`) + +#### Definitions +- **Simple types** + - `CarrierCode`: enumeration of `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: positive integer ≤ 31500. +- **Complex types** + - `ParcelType`: sequence of `trackingNumber` (`xs:string`) and `weight` (`shp:WeightGrams`); required attribute `sequence` (`xs:positiveInteger`). + - `AddressType`: sequence of `name`, `street`, `postalCode`, `city`, optional `country` (`xs:string`, default `DE`). + - `ShipmentNoticeType`: sequence of `orderReference`, `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one or more `parcel` (`shp:ParcelType`); required attribute `noticeId` (`xs:ID`). +- **Root element** + - `shipmentNotice`: type `shp:ShipmentNoticeType`. + +#### Configuration +- `elementFormDefault="qualified"`: elements must be namespace-qualified. +- `targetNamespace="urn:example:shipment:1"`: defines the schema's namespace. + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema`. +- No external schemas or imports. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..30490b2c --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,39 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:45:57Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a monthly account statement XML into an HTML page with header, rows per booking, and a total. + +#### Purpose +- Render a monthly account statement as an HTML page. +- Highlight bookings exceeding a threshold. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespaces: `xsl` (`http://www.w3.org/1999/XSL/Transform`), `st` (`urn:example:statement`). + +#### Definitions +- **Parameters** + - `currencySymbol` (default `'EUR'`) + - `highlightAbove` (default `1000`) +- **Key** + - `bookingsByDay`: matches `st:booking`, indexed by `st:valueDate` +- **Templates** + - `match="/st:statement"`: builds the overall HTML structure. + - `name="statementHeader"`: outputs account number and period. + - `match="st:booking"`: outputs a table row; adds `class="large"` if `st:amount` > `$highlightAbove`. + - `name="statementTotal"`: outputs the sum of all `st:booking/st:amount`. + +#### Configuration +- `xsl:output` method: `html`, encoding: `UTF-8`, indent: `yes`. +- `currencySymbol` parameter: `'EUR'`. +- `highlightAbove` parameter: `1000`. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: `statement`, `booking`, `accountNumber`, `valueDate`, `purpose`, `amount`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..2005d9d7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,58 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:12Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A toolkit that processes web logs, automates deployment, extracts Oracle data, and validates/transforms invoicing and shipment XML. + +#### Purpose +- Provide a reusable log‑digest API and CLI for HTTP access logs. +- Automate release deployment, worker health checks, and nightly Oracle exports. +- Build, schedule, and validate invoicing/shipment XML, converting statements to HTML. + +#### Responsibilities +- **Log Analysis** – parsing, counting, summarizing host/status stats. +- **Deployment & Ops** – tarball distribution, service restart, health polling, worker lifecycle. +- **Data Extraction** – Oracle export to CSV, control file creation, compression. +- **Build & Scheduling** – Maven packaging, Flyway migrations, Spring job wiring. +- **XML Validation & Transformation** – shipment notice schema, statement XSLT rendering. + +#### Key units +- `LogDigest` (Perl module) – `new`, `add`, `summarize`, `top_n`. +- `log_digest.pl` – CLI orchestrator, option parsing, alias handling. +- `deploy_release.sh` – host‑by‑host deployment, rsync/ssh, systemctl restart, health check. +- `healthcheck.sh` – PID/heartbeat worker controller. +- `nightly_extract.ksh` – Oracle `sqlplus` export, CSV generation, control file, gzip. +- `invoice-service-pom.xml` – Maven project, dependencies, Flyway, PDFBox profile. +- `scheduler-context.xml` – Spring beans for reminder job, data source, mail gateway, cron trigger. +- `shipment.xsd` – XML schema for shipment notices. +- `statement-to-html.xsl` – XSLT stylesheet for statement HTML rendering. + +#### Data flow +1. **Log Processing** – CLI → `LogDigest` → parse → aggregate → `summarize` → JSON/text output. +2. **Deployment** – Script → rsync tarball → SSH → extract → symlink → `systemctl restart` → `curl` health. +3. **Healthcheck** – Start → PID file → worker heartbeat → health command reads age → status report. +4. **Extraction** – Script → `sqlplus` query → CSV → row count → control file → gzip. +5. **Scheduling** – Spring context → data source → repository → job → scheduler → cron → email reminders. +6. **XML Workflow** – External system → shipment XML → validate against `shipment.xsd`. + Statement XML → `statement-to-html.xsl` → HTML output. + +#### Dependencies +- **Perl**: `POSIX`, `List::Util`, `Carp`, `Exporter`, `Getopt::Long`, `JSON::PP`. +- **Shell**: `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `cat`, `sqlplus`, `gzip`. +- **Oracle**: `CONNECT / AS SYSDBA` for nightly export. +- **Maven**: Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, PDFBox, HikariCP, Spring `task`/`context`. +- **XML**: Standard XML Schema namespace; no external imports. + +#### Cross-cutting +- Consistent error handling (`set -euo pipefail`, `croak`/`die`). +- Host normalization (lowercase, strip trailing dot) across log parsing and exclusions. +- Configuration via environment variables, property placeholders, and Maven properties. +- Retry logic in nightly extraction (max 3 attempts). +- Health checks use timeouts (`HEALTH_TIMEOUT`, `MAX_HEARTBEAT_AGE`). +- Scheduler pool size 2; HikariCP max 8 connections. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..5db62eaa --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run6/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: F583EB2C +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:16Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The srcmorph‑modelcard project centers on a versatile toolkit for handling web‑log analytics, deployment automation, and payment‑processing workflows. Core subsystems include a log‑processing engine that aggregates per‑host and per‑status statistics while flagging slow requests, a deployment and health‑monitoring framework that orchestrates nightly data extraction and service checks, and an XML‑based invoicing and shipment system that supports schema validation, XSLT rendering, and scheduling. Together these components enable end‑to‑end automation from data extraction to invoice generation and shipment notification. + +#### Packages +- other — A collection of utilities for processing web logs, automating deployment and data extraction, and managing invoicing, shipment, and statement workflows. +- other/perl — Summarizes web‑server access logs, producing per‑host and per‑status statistics and identifying slow requests. +- other/shell — Automates deployment, health monitoring, and nightly data extraction for a payment processing service. +- other/xml — Provides infrastructure for invoicing, shipment notifications, and statement rendering, with build, scheduling, and XML schema/XSLT support. +- . — A toolkit that processes web logs, automates deployment, extracts Oracle data, and validates/transforms invoicing and shipment XML. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/meta/gpt-oss-20b.json new file mode 100644 index 00000000..6174588a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:46:18Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 30.9, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 26.0, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 1.8, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:47:17Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16083, + "cachedPromptTokens": 16032, + "completionTokens": 5037, + "seconds": 30.3052884 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.001137, + "costUsd": 0.001769, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..268b9b51 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,59 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:08Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A collection of utilities for log analysis, deployment automation, and invoicing infrastructure. + +#### Purpose +- Provide reusable log‑digesting logic and a CLI for web‑server logs. +- Automate release deployment, service health checks, and nightly payment extraction for a payment system. +- Build, migrate, schedule, and validate XML for an invoicing and shipment service. + +#### Responsibilities +- **Log Processing** – parsing, aggregating, and summarizing access logs (`LogDigest` module + CLI). +- **Deployment & Ops** – remote tarball deployment, service restart, health polling, queue‑worker lifecycle, and nightly Oracle data export. +- **Build & Data Migration** – Maven build, Flyway migrations, optional PDF support. +- **Scheduling & Messaging** – Spring scheduler for overdue reminders, email gateway integration. +- **XML Validation & Presentation** – shipment notice schema, XSLT for statement rendering. + +#### Key units +- `LogDigest` (Perl module) – parses log lines, aggregates counts, provides `summarize` and `top_n`. +- `log_digest.pl` (Perl script) – CLI wrapper for `LogDigest`, handles aliases, exclusions, JSON output. +- `deploy_release.sh` (Bash) – rsync tarball, remote extraction, symlink, `systemctl restart`, health poll. +- `healthcheck.sh` (Bash) – PID/heartbeat management for queue‑worker, status/health reporting. +- `nightly_extract.ksh` (KornShell) – Oracle `sqlplus` query, CSV/CTL generation, gzip, retry logic. +- `invoice-service-pom.xml` (Maven) – project definition, Flyway, PDF profile. +- `scheduler-context.xml` (Spring) – beans for reminder job, data source, mail gateway, scheduler. +- `shipment.xsd` (XML Schema) – defines `shipmentNotice` structure. +- `statement-to-html.xsl` (XSLT) – transforms statement XML to HTML with amount highlighting. + +#### Data flow +1. **Log Analysis** – CLI → alias/load → `LogDigest->add` per line → `summarize` → text/JSON output. +2. **Deployment** – script → `rsync` tarball → SSH → remote extraction → symlink `current` → `systemctl restart` → `/health` poll. +3. **Healthcheck** – start → `nohup queue-worker` → PID/heartbeat files → health command reads heartbeat age. +4. **Nightly Extract** – script parses dates → `sqlplus` query → CSV + control file → gzip → retry on failure. +5. **Build/Migration** – Maven compiles → Flyway runs migrations → JAR packaged. +6. **Scheduling** – Spring scheduler triggers `OverdueReminderJob` → queries repository → emails via `mailGateway`. +7. **XML Processing** – shipment XML validated against `shipment.xsd`; statement XML transformed by `statement-to-html.xsl`. + +#### Dependencies +- **Perl**: `POSIX`, `List::Util`, `Carp`, `Exporter`, `Getopt::Long`, `JSON::PP`. +- **Shell**: `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `sqlplus`, `gzip`. +- **Oracle**: `settled_payment` table, SYSDBA access. +- **Maven**: Flyway, Jackson, JUnit, Testcontainers, PDFBox (optional), HikariCP, Spring task/context. +- **XML/XSLT**: Standard XSD namespace, XSLT parameters (`currencySymbol`, `highlightAbove`). + +#### Cross-cutting +- **Logging**: All shell scripts use a timestamped `log` function; Perl module validates logging level. +- **Error handling**: Perl `croak` on invalid level or line count; shell scripts exit with codes 1–4 and `die`/`fail` helpers. +- **Configuration**: Host alias files, exclusion sets, deployment host lists, heartbeat age, retry counts, and schema defaults are centrally defined. +- **Concurrency**: Scheduler pool size 2; HikariCP pool size 8; heartbeat age threshold 120 s. +- **Retry logic**: `nightly_extract.ksh` retries up to 3 times with sleep intervals. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..ddf77428 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,67 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:19Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Provides a log‑digesting class for summarizing access logs. +- Offers helper `top_n` for ranking counts. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: constructor `new`, methods `add`, `summarize`. + +#### Input +- `new(level => $level)` – `$level` must be one of `DEBUG`, `INFO`, `WARN`, `ERROR`; defaults to `WARN`. +- `add($line)` – expects a log line matching the regex in `parse_line`. +- `parse_line($line)` – parses a single log line. +- `top_n($counts, $n)` – ranks hash values. + +#### Output +- `add` returns `1` on successful parse, `0` otherwise; dies if line count exceeds `MAX_LINES`. +- `summarize` returns hashref: + - `generated` – UTC timestamp. + - `total` – total entries processed. + - `hosts` – number of distinct hosts. + - `busiest` – max requests per host. + - `slow` – count of requests > `SLOW_REQUEST_MS`. + - `statuses` – hashref of status counts. +- `top_n` returns array of top `$n` keys. + +#### Core logic +- `new`: validate level, initialize counters. +- `parse_line`: regex extracts host, time, method, path, status, millis; normalizes host. +- `add`: enforce `MAX_LINES`; parse line; increment host and status counts; increment `slow` if millis > `SLOW_REQUEST_MS`. +- `summarize`: compute totals, busiest host, generate UTC timestamp. +- `top_n`: sort keys by count descending, then alphabetically; slice top `$n`. + +#### Subs +- `new(%args) -> LogDigest` – create instance with level. +- `parse_line($line) -> hashref` – parse log line. +- `add($line) -> 1|0` – add entry, update stats. +- `summarize() -> hashref` – return digest summary. +- `top_n($counts, $n) -> @keys` – rank counts. +- `_normalize_host($host) -> host` – lowercase, strip trailing dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `croak` if unknown level in `new`. +- `croak` if more than `MAX_LINES` added in `add`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..c9470d84 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,75 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:23Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Reads web server access logs, filters hosts, and reports request counts and slow responses, optionally as JSON. + +#### Purpose +- Script to analyze access logs. +- Outputs busiest hosts and status‑code statistics. + +#### Type +- Script. +- Uses package `LogDigest` (imported `top_n`). + +#### Input +- Command‑line options: + - `--top|n=i` → `$top` (default `10`). + - `--level=s` → `$level` (default `'WARN'`). + - `--json!` → `$as_json` (default `0`). + - `--exclude-host=s` → `@exclude_hosts` (multiple allowed). + - `--help|h` → prints usage. +- Positional arguments: `FILE...` (log files). +- Environment variable: `LOG_DIGEST_CONFIG` → `$config_file` (default `'/etc/log-digest.conf'`). +- Reads alias file: each line `from = to`. + +#### Output +- If `$as_json`: JSON string of `$summary` (canonical order) followed by newline. +- Else: plain text: + - Summary line: `"%d requests from %d hosts, %d slow\n"`. + - Busiest hosts: each on its own line, from `top_n($digest->{hosts}, $top)`. + +#### Core logic +- Load host aliases from config file. +- Build exclusion set from `@exclude_hosts`. +- Create `LogDigest` object with `level`. +- For each input file: + - Read line by line. + - Extract host (first token). + - Skip if host (or its alias) is excluded. + - Pass line to `$digest->add`. +- After all files: + - `$digest->summarize` → `$summary`. + - Output JSON or text as above. + +#### Subs +- `usage() -> string` + Returns usage message. +- `read_aliases($path) -> hash` + Parses alias file into `%aliases`. +- `main() -> int` + Orchestrates parsing, digesting, and output. + +#### Constants and configuration +- `$config_file` → `ENV{LOG_DIGEST_CONFIG}` or `'/etc/log-digest.conf'`. +- `$top` → `10`. +- `$level` → `'WARN'`. +- `$as_json` → `0`. +- `@exclude_hosts` → empty array. + +#### Dependencies +- `FindBin` (`$Bin`). +- `Getopt::Long` (`GetOptions`). +- `JSON::PP` (`JSON::PP->new->canonical->encode`). +- `LogDigest` (`top_n`, `new`, `add`, `summarize`). + +#### Exceptions / Errors +- `die usage()` on bad options. +- `die "--top must be positive\n"` if `$top < 1`. +- `die "cannot read $file: $!\n"` if file open fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..c22e263f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,42 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:50Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Summarizes web‑server access logs, counting per‑host requests, status codes, and slow responses, and reports the busiest hosts. + +#### Purpose +- Provide a reusable log‑digesting class and a command‑line tool to analyze access logs. + +#### Responsibilities +- **Log parsing & aggregation** – `LogDigest` parses individual log lines, normalizes hosts, and tallies counts. +- **Statistical summarization** – `summarize` produces totals, busiest host, slow‑request count, and status‑code histogram. +- **Ranking helper** – `top_n` returns the top N keys by count. +- **CLI orchestration** – `log_digest.pl` loads host aliases, applies exclusions, feeds lines to `LogDigest`, and outputs a text or JSON summary. + +#### Key units +- `LogDigest` (module) – constructor `new(level => $level)`, methods `add($line)`, `summarize()`, exported `parse_line`, `top_n`. +- `log_digest.pl` (script) – `main()`, `usage()`, `read_aliases($path)`. + +#### Data flow +1. **CLI** parses options, loads alias file, builds exclusion set. +2. For each input log file, reads lines, skips excluded hosts, and passes each line to `$digest->add`. +3. After all files, `$digest->summarize` produces a hashref of statistics. +4. Output is formatted as plain text or JSON based on `--json`. + +#### Dependencies +- **Internal** – `LogDigest` module, `top_n` helper. +- **External** – `POSIX qw(strftime)`, `List::Util qw(max sum)`, `Carp qw(croak)`, `Exporter`, `Getopt::Long`, `JSON::PP`, `FindBin`, `LogDigest` (for script). + +#### Cross-cutting +- Host normalization (`_normalize_host`) ensures consistent counting. +- `MAX_LINES` limits input size; exceeding it triggers a `croak`. +- Logging level validation in `new` enforces one of `DEBUG`, `INFO`, `WARN`, `ERROR`. +- `top_n` sorts by count descending then alphabetically, providing deterministic ranking. +- Configuration via `LOG_DIGEST_CONFIG` and alias file supports host aliasing and exclusion. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..52ce85ce --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,80 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:28Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploys a specified release to all hosts in an environment. +- Runs as a standalone script. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`) +- `set -euo pipefail` + +#### Input +- Options parsed with `getopts`: + - `-e ` → `ENVIRONMENT` + - `-t ` → `TAG` + - `-n` → `DRY_RUN=1` + - `-p ` → ignored, logged + - `-h` → prints usage +- Environment variables: + - `DEPLOY_USER` (default `deploy`) + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`) +- Files read: + - `hosts.staging` or `hosts.production` in `$SCRIPT_DIR` + - `build/$TAG.tar.gz` + +#### Output +- Copies `build/$TAG.tar.gz` to `/tmp/` on each host. +- Extracts to `$RELEASE_ROOT/$TAG` on host. +- Creates symlink `$RELEASE_ROOT/current`. +- Restarts `orderd` via `systemctl`. +- Prints deployment status to stderr. +- Exits with `1` on errors, `2` on missing arguments. + +#### Core logic +- Parse options; validate `ENVIRONMENT` and `TAG`. +- Verify required tools (`rsync`, `ssh`, `curl`) and SSH key. +- Load host list from environment-specific file. +- For each host: + - If dry‑run, log action and skip. + - `rsync` tarball to host. + - SSH into host, extract tarball, update symlink, restart service. + - Poll `/health` endpoint until success or timeout. + +#### Functions +- `log` – prints timestamped message to stderr. +- `die` – logs error and exits. +- `usage` – prints usage from script comment. +- `check_prereqs` – ensures tools and SSH key exist. +- `load_hosts` – reads host list file into `HOSTS`. +- `deploy_host` – performs deployment steps for one host. +- `wait_healthy` – polls health endpoint with timeout. +- `cleanup` – removes temporary lock file (unused). + +#### Constants and configuration +- `SCRIPT_DIR` – script directory. +- `DEPLOY_USER` – `deploy`. +- `SSH_KEY` – `$HOME/.ssh/deploy_ed25519`. +- `RELEASE_ROOT` – `/opt/releases`. +- `SERVICE_NAME` – `orderd`. +- `HEALTH_TIMEOUT` – `30`. +- `HOST_FILES` – associative array mapping environments to host files. + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl`. +- Host files: `hosts.staging`, `hosts.production`. +- Remote host directories: `/tmp/`, `$RELEASE_ROOT/`. + +#### Errors and exit codes +- `1` – missing prerequisites, unreadable SSH key, empty host list, deployment failure, health check timeout. +- `2` – missing required options (`-e`, `-t`). +- `die` triggers exit `1` with error message. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..6d487d63 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,66 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:31Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> A POSIX‑style wrapper that manages a queue worker process, providing start, stop, status, restart, and health‑check commands based on a PID file and a heartbeat file. + +#### Purpose +- Controls a queue worker binary (`/usr/local/bin/queue-worker`). +- Intended to be executed directly as a service script. + +#### Type +- `sh` (POSIX sh). +- No strict mode flags set. + +#### Input +- `$1` command: `start`, `stop`, `restart`, `status`, `health`. +- Environment variables: + - `PID_FILE` (default `/run/queue-worker.pid`). + - `HEARTBEAT_FILE` (default `/var/lib/queue-worker/heartbeat`). +- No command‑line options parsed. + +#### Output +- Writes the worker PID to `$PID_FILE` on start. +- Removes `$PID_FILE` on stop. +- Prints status messages (`running`, `stopped`, `OK`, `WARNING`, `CRITICAL`). +- Exits with codes: `0` success, `1` warning, `2` critical, `3` stopped, `64` usage error. + +#### Core logic +- `is_running`: checks if PID file exists and process is alive. +- `heartbeat_age`: computes seconds since last heartbeat file modification. +- `start_worker`: starts worker with `nohup`, records PID. +- `stop_worker`: kills process and removes PID file. +- Command dispatch via `case` on `$1`: + - `start`: invoke `start_worker`. + - `stop`: invoke `stop_worker`. + - `restart`: stop then start. + - `status`: report running/stopped, exit 3 if stopped. + - `health`: verify running and heartbeat age ≤ `MAX_HEARTBEAT_AGE` (120 s); warn if older. + +#### Functions +- `is_running`: check if worker process is active. +- `heartbeat_age`: calculate age of heartbeat file. +- `start_worker`: launch worker, record PID. +- `stop_worker`: terminate worker, clean PID file. + +#### Constants and configuration +- `PID_FILE`=`/run/queue-worker.pid` +- `HEARTBEAT_FILE`=`/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE`=`120` +- `WORKER_BIN`=`/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `kill`, `nohup`, `date`, `stat`, `cat`, `echo`. +- Worker binary: `/usr/local/bin/queue-worker` (expects `--heartbeat` option). + +#### Errors and exit codes +- Exit `64` on invalid command. +- Exit `2` if health check finds worker not running. +- Exit `1` if heartbeat age exceeds `MAX_HEARTBEAT_AGE`. +- Exit `3` if status reports stopped. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..8efce38e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,75 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:36Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, creates a control file, and gzips the result. + +#### Purpose +- Run nightly to export settled payments. +- Executed directly; not sourced. + +#### Type +- `ksh93` (shebang `#!/bin/ksh93`). +- Uses `set -e`? none; uses `typeset` and `whence`. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → variable `business_day`. + - `-o ` → variable `export_dir`. +- Environment variables read: + - `ORACLE_SID` (default `PAYPRD`). + - `NLS_LANG` set to `AMERICAN_AMERICA.AL32UTF8`. +- Files read: + - Oracle database via `sqlplus`. + +#### Output +- Writes `payments_.csv` in `export_dir`. +- Creates control file `payments_.ctl` with row count and business day. +- Gzips the CSV to `payments_.csv.gz`. +- Prints log messages to stderr. +- Exit status: `0` on success, `1` on failure, `3` if tools missing, `4` if retries exhausted. + +#### Core logic +- Parse options; set defaults. +- Ensure `export_dir` exists. +- Set `csv` path. +- Retry loop up to `MAX_RETRIES`: + - Run `run_export` to generate CSV via `sqlplus`. + - If successful: + - `write_control` to create `.ctl`. + - `gzip -f` the CSV. + - Log success and exit. + - On failure: log, sleep 60, retry. +- On exhausting retries: call `fail`. + +#### Functions +- `log` – prints timestamped message to stderr. +- `fail` – logs failure and exits with code. +- `require_tools` – checks `sqlplus` and `gzip` availability. +- `run_export` – runs SQL query via `sqlplus`, writes CSV. +- `write_control` – counts rows, writes control file. + +#### Constants and configuration +- ``ORACLE_SID_DEFAULT=PAYPRD`` +- ``EXPORT_DIR_DEFAULT=/data/export/payments`` +- ``MAX_RETRIES=3`` +- ``attempt=0`` +- ``business_day=$(date +%Y%m%d)`` +- ``export_dir=$EXPORT_DIR_DEFAULT`` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle database connection via `sqlplus` (SYSDBA). +- SQL query selects from `settled_payment` table. + +#### Errors and exit codes +- `fail` with code `3` if `sqlplus` or `gzip` missing. +- `fail` with code `4` after exceeding `MAX_RETRIES`. +- `fail` with code `2` on usage error. +- Traps: none defined. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..50fc86f3 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,46 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:59Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates deployment, health monitoring, and nightly data extraction for a payment processing service. + +#### Purpose +- Deploy release tarballs to multiple hosts, restart services, and verify health. +- Control a queue‑worker process with start/stop/status/health commands. +- Export settled payments from Oracle to CSV, create control files, and compress output. + +#### Responsibilities +- **Deployment**: `deploy_release.sh` handles environment‑specific host lists, tarball transfer, extraction, symlink updates, service restart, and health polling. +- **Process Management**: `healthcheck.sh` provides a POSIX‑style service wrapper for a queue worker, managing PID files, heartbeats, and status reporting. +- **Data Extraction**: `nightly_extract.ksh` runs nightly to query Oracle, write CSVs, generate control files, and gzip the results with retry logic. + +#### Key units +- `deploy_release.sh` – orchestrates remote deployment via `rsync`/`ssh`, updates `/opt/releases`, restarts `orderd`, and checks `/health`. +- `healthcheck.sh` – manages `/usr/local/bin/queue-worker`, uses `/run/queue-worker.pid` and `/var/lib/queue-worker/heartbeat`, enforces `MAX_HEARTBEAT_AGE` (120 s). +- `nightly_extract.ksh` – executes `sqlplus` against `settled_payment`, writes `payments_.csv`, creates `payments_.ctl`, gzips the CSV, with up to 3 retries. + +#### Data flow +1. **Deployment**: script → `rsync` tarball → SSH → remote `/tmp/` → extraction → `/opt/releases/` → symlink `current` → `systemctl restart orderd` → `curl /health` poll. +2. **Healthcheck**: start → `nohup queue-worker --heartbeat` → PID file → heartbeat file updated by worker → health command reads heartbeat age → status output. +3. **Nightly Extract**: parse `-d`/`-o` → `sqlplus` query → CSV output → `write_control` counts rows → gzip → control file records row count and day. + +#### Dependencies +- **External tools**: `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `sqlplus`, `gzip`. +- **Remote paths**: `/opt/releases`, `/run/queue-worker.pid`, `/var/lib/queue-worker/heartbeat`. +- **Oracle**: `settled_payment` table, SYSDBA connection. +- **Environment files**: `hosts.staging`, `hosts.production`. + +#### Cross‑cutting +- **Logging**: All scripts use a `log` function that prefixes timestamps to stderr. +- **Error handling**: `die`/`fail` functions exit with specific codes (1–4) and print messages. +- **Configuration**: Default values for users, SSH keys, release roots, service names, heartbeat age, and export directories are defined as constants. +- **Retry logic**: `nightly_extract.ksh` retries failed exports up to `MAX_RETRIES` with sleep intervals. +- **Health checks**: `deploy_release.sh` waits for `/health` after restart; `healthcheck.sh` verifies heartbeat age against `MAX_HEARTBEAT_AGE`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..866105c8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,56 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:39Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures the Maven build for the Invoice Service module, defining dependencies, compiler settings, and build plugins. + +#### Purpose +- Builds the `invoice-service` JAR. +- Provides database migration via Flyway. +- Supplies test dependencies and optional PDF support. + +#### Type +- Maven POM + Root: `project` + Namespaces: `xmlns="http://maven.apache.org/POM/4.0.0"`, `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release` = `17` + - `jackson.version` = `2.19.2` + - `flyway.version` = `11.4.0` + - `invoice.archive.dir` = `${project.build.directory}/archive` +- **Dependencies** (5): + - `com.fasterxml.jackson.core:jackson-databind` (`${jackson.version}`) + - `org.flywaydb:flyway-core` (`${flyway.version}`) + - `org.postgresql:postgresql` (`runtime`) + - `org.junit.jupiter:junit-jupiter` (`test`) + - `org.testcontainers:postgresql` (`test`) +- **Build Plugins** (2): + - `org.flywaydb:flyway-maven-plugin` (`${flyway.version}`) + - Configuration: `locations` → `filesystem:src/main/resources/db/migration` + - `org.apache.maven.plugins:maven-surefire-plugin` + - Configuration: `systemPropertyVariables` → `invoice.archive.dir=${invoice.archive.dir}` +- **Profile** `native-pdf`: + - Adds dependency `org.apache.pdfbox:pdfbox:3.0.5` + +#### Configuration +- `maven.compiler.release` = `17` +- `jackson.version` = `2.19.2` +- `flyway.version` = `11.4.0` +- `invoice.archive.dir` = `${project.build.directory}/archive` +- Flyway location: `filesystem:src/main/resources/db/migration` +- Surefire system property: `invoice.archive.dir=${invoice.archive.dir}` + +#### Dependencies +- Parent: `org.example.billing:billing-parent:2.7.0` +- Libraries: `jackson-databind`, `flyway-core`, `postgresql`, `junit-jupiter`, `testcontainers:postgresql`, `pdfbox` (profile) +- External systems: PostgreSQL database, Flyway migrations. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..4f23e42f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,49 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:05Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides build, data‑migration, scheduling, and XML/XSLT utilities for an invoicing and shipment system. + +#### Purpose +- Build the Invoice Service JAR with Maven, including Flyway migrations and optional PDF support. +- Configure a Spring reminder scheduler that sends overdue reminders via email. +- Define XML schemas for shipment notices and XSLT for rendering account statements. + +#### Responsibilities +- **Build & Deployment** – Maven POM, compiler settings, test dependencies, Flyway plugin. +- **Data Migration** – Flyway migrations located in `src/main/resources/db/migration`. +- **Scheduling** – Spring XML context wiring for a daily reminder job. +- **XML Validation** – `shipment.xsd` schema for shipment notices. +- **Presentation** – `statement-to-html.xsl` stylesheet for converting statement XML to HTML. + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, Flyway configuration, PDF profile. +- `scheduler-context.xml` – Spring bean definitions: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler`. +- `shipment.xsd` – XML Schema defining `shipmentNotice`, `ParcelType`, `AddressType`, `CarrierCode`, `WeightGrams`. +- `statement-to-html.xsl` – XSLT stylesheet rendering `st:statement` to HTML, highlighting amounts > `highlightAbove`. + +#### Data flow +1. **Build**: Maven compiles source, runs Flyway migrations, packages JAR. +2. **Scheduler**: At 7 AM Mon‑Fri, `OverdueReminderJob.sendDueReminders` queries `reminderRepository`, uses `mailGateway` to email reminders. +3. **Shipment Notice**: XML documents validated against `shipment.xsd` before processing. +4. **Statement Rendering**: Input XML in `urn:example:statement` namespace is transformed by `statement-to-html.xsl` into an HTML page. + +#### Dependencies +- **Internal**: `org.example.reminder` classes, `org.example.billing` parent POM. +- **External**: PostgreSQL (runtime), Flyway, Jackson, JUnit, Testcontainers, PDFBox (optional), HikariCP, Spring task/context modules. +- **Schema**: Standard XML Schema namespace; no external XSD imports. + +#### Cross-cutting +- **Configuration**: Property placeholders (`reminder.properties`), Maven properties (`jackson.version`, `flyway.version`). +- **Error handling**: Not explicitly defined in summaries; assumed standard Spring and Flyway mechanisms. +- **Concurrency**: Scheduler pool size set to 2; HikariCP pool size 8. +- **Defaults**: `AddressType.country` defaults to `DE`; XSLT parameters `currencySymbol='EUR'`, `highlightAbove=1000`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..a7b0d275 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,47 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:42Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures a Spring context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled task. + +#### Purpose +- Wire reminder scheduler components. +- Schedule `OverdueReminderJob.sendDueReminders` daily at 7 AM Monday‑Friday. + +#### Type +- Spring XML configuration (`` root). +- Namespaces: `http://www.springframework.org/schema/beans` (default), `http://www.springframework.org/schema/context`, `http://www.springframework.org/schema/task`. + +#### Definitions +- **Property placeholder**: `reminder.properties`. +- **Component scan**: `org.example.reminder.web`. +- **Beans**: + - `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`): `jdbcUrl` `${reminder.db.url}`, `username` `${reminder.db.user}`, `maximumPoolSize` `8`. + - `reminderRepository` (`org.example.reminder.JdbcReminderRepository`): constructor `reminderDataSource`. + - `mailGateway` (`org.example.reminder.SmtpMailGateway`): `host` `${reminder.smtp.host}`, `port` `587`. + - `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`): constructor `reminderRepository`, `mailGateway`; property `graceDays` `14`. +- **Scheduler**: `reminderScheduler` (`task:scheduler`) with `pool-size` `2`. +- **Scheduled task**: `overdueReminderJob.sendDueReminders` with cron `0 0 7 * * MON-FRI`. + +#### Configuration +- `reminder.db.url` – JDBC URL. +- `reminder.db.user` – DB username. +- `reminder.smtp.host` – SMTP host. +- `reminder.smtp.port` – SMTP port `587`. +- `reminder.db.maximumPoolSize` – `8`. +- `overdueReminderJob.graceDays` – `14`. +- Scheduler pool size – `2`. +- Cron expression – `0 0 7 * * MON-FRI`. + +#### Dependencies +- `com.zaxxer.hikari.HikariDataSource`. +- `org.example.reminder.JdbcReminderRepository`. +- `org.example.reminder.SmtpMailGateway`. +- `org.example.reminder.OverdueReminderJob`. +- Spring `task` and `context` modules. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..17300065 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,38 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:45Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Validates shipment notice documents. +- Provides type definitions for carrier codes, parcel details, addresses, and the overall notice structure. + +#### Type +- XML Schema (``). +- Root element: `shipmentNotice`. +- Namespaces: `xs` (http://www.w3.org/2001/XMLSchema), `shp` (urn:example:shipment:1). + +#### Definitions +- **Simple types** + - `CarrierCode`: enumeration of `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: positive integer ≤ 31500. +- **Complex types** + - `ParcelType`: sequence of `trackingNumber` (`xs:string`) and `weight` (`shp:WeightGrams`); required attribute `sequence` (`xs:positiveInteger`). + - `AddressType`: sequence of `name`, `street`, `postalCode`, `city`, optional `country` (`xs:string`, default `DE`). + - `ShipmentNoticeType`: sequence of `orderReference`, `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one or more `parcel` (`shp:ParcelType`); required attribute `noticeId` (`xs:ID`). +- **Root element** + - `shipmentNotice` of type `shp:ShipmentNoticeType`. + +#### Configuration +- `country` attribute in `AddressType` defaults to `DE`. +- `WeightGrams` maximum inclusive value: `31500`. + +#### Dependencies +- None beyond standard XML Schema namespace. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..a1527c92 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,43 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:46:47Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a monthly account statement XML into an HTML page with header, rows per booking, and total. + +#### Purpose +- Render monthly account statements as HTML. +- Highlight bookings exceeding a threshold. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespace: `xmlns:st="urn:example:statement"`. +- Output method: `html`. + +#### Definitions +- **Parameters** + - `currencySymbol` (`'EUR'`). + - `highlightAbove` (`1000`). +- **Key** + - `bookingsByDay`: matches `st:booking` elements, indexed by `st:valueDate`. +- **Templates** + - `match="/st:statement"`: builds `` with header, table of bookings, and total. + - `name="statementHeader"`: outputs account number and period. + - `match="st:booking"`: outputs a `` for each booking; adds `class="large"` if `st:amount` > `$highlightAbove`. + - `name="statementTotal"`: outputs total amount of all bookings. + +#### Configuration +- `xsl:output` method `html`, encoding `UTF-8`, indent `yes`. +- `currencySymbol` default `'EUR'`. +- `highlightAbove` default `1000`. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: + - `st:statement` (attributes: `period`, child `st:accountNumber`). + - `st:booking` (children: `st:valueDate`, `st:purpose`, `st:amount`). +- No external files or schemas referenced. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..735a4558 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,57 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:12Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A collection of reusable utilities for log analysis, deployment automation, and invoicing infrastructure. + +#### Purpose +- Provide a CLI for parsing and summarizing web‑server logs. +- Automate release deployment, health checks, and nightly payment extraction. +- Build, migrate, schedule, and validate XML for invoicing and shipment services. + +#### Responsibilities +- **Log Processing** – `LogDigest` module and `log_digest.pl` CLI. +- **Deployment & Ops** – `deploy_release.sh`, `healthcheck.sh`, `nightly_extract.ksh`. +- **Build & Migration** – Maven `pom.xml` with Flyway, optional PDF support. +- **Scheduling & Messaging** – Spring scheduler (`scheduler-context.xml`) and email gateway. +- **XML Validation & Presentation** – `shipment.xsd` schema and `statement-to-html.xsl` XSLT. + +#### Key units +- `LogDigest` (Perl) – parses log lines, aggregates counts, exposes `summarize` and `top_n`. +- `log_digest.pl` – CLI wrapper for `LogDigest`, handles aliases, exclusions, JSON output. +- `deploy_release.sh` – rsync tarball, remote extraction, symlink, `systemctl restart`, health poll. +- `healthcheck.sh` – PID/heartbeat management for queue‑worker, status reporting. +- `nightly_extract.ksh` – Oracle `sqlplus` query, CSV/CTL generation, gzip, retry logic. +- `invoice-service-pom.xml` – Maven project, Flyway migrations, PDF profile. +- `scheduler-context.xml` – Spring beans for overdue reminder job, data source, mail gateway, scheduler. +- `shipment.xsd` – XML Schema for `shipmentNotice`. +- `statement-to-html.xsl` – XSLT for transforming statement XML to HTML with amount highlighting. + +#### Data flow +1. **Log Analysis** – CLI → `LogDigest->add` per line → `summarize` → output. +2. **Deployment** – Script → `rsync` → SSH → remote extraction → symlink → `systemctl restart` → `/health` poll. +3. **Healthcheck** – Start worker → PID/heartbeat files → health command reads heartbeat age. +4. **Nightly Extract** – Script parses dates → `sqlplus` query → CSV + control file → gzip → retry on failure. +5. **Build/Migration** – Maven compiles → Flyway runs migrations → JAR packaged. +6. **Scheduling** – Spring scheduler triggers `OverdueReminderJob` → queries repository → emails via `mailGateway`. +7. **XML Processing** – Shipment XML validated against `shipment.xsd`; statement XML transformed by `statement-to-html.xsl`. + +#### Dependencies +- **Perl**: `POSIX`, `List::Util`, `Carp`, `Exporter`, `Getopt::Long`, `JSON::PP`. +- **Shell**: `rsync`, `ssh`, `curl`, `kill`, `nohup`, `date`, `stat`, `sqlplus`, `gzip`. +- **Oracle**: `settled_payment` table, SYSDBA access. +- **Maven**: Flyway, Jackson, JUnit, Testcontainers, PDFBox (optional), HikariCP, Spring task/context. +- **XML/XSLT**: Standard XSD namespace, XSLT parameters (`currencySymbol`, `highlightAbove`). + +#### Cross-cutting +- **Logging**: Timestamped `log` function in shell scripts; Perl module validates logging level. +- **Error handling**: Perl `croak` on invalid input; shell scripts exit with codes 1–4 and `die`/`fail` helpers. +- **Configuration**: Central host alias files, exclusion sets, deployment host lists, heartbeat age, retry counts, schema defaults. +- **Concurrency**: Scheduler pool size 2; HikariCP pool size 8; heartbeat age threshold 120 s. +- **Retry logic**: `nightly_extract.ksh` retries up to 3 times with sleep intervals. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..86f0edd7 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run7/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 5276B250 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:16Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project centers on a reusable utilities library that powers log analysis, deployment automation, and invoicing infrastructure. Core subsystems include a Perl module that parses web‑server access logs to count per‑host requests, status codes, and slow responses, and a shell script suite that automates deployment, health monitoring, and nightly data extraction for a payment processing service. XML utilities provide build, data‑migration, scheduling, and XSLT support for invoicing and shipment workflows, tying the various subsystems together into a cohesive infrastructure toolkit. + +#### Packages +- other — A collection of utilities for log analysis, deployment automation, and invoicing infrastructure. +- other/perl — Summarizes web‑server access logs, counting per‑host requests, status codes, and slow responses, and reports the busiest hosts. +- other/shell — Automates deployment, health monitoring, and nightly data extraction for a payment processing service. +- other/xml — Provides build, data‑migration, scheduling, and XML/XSLT utilities for an invoicing and shipment system. +- . — A collection of reusable utilities for log analysis, deployment automation, and invoicing infrastructure. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/meta/gpt-oss-20b.json new file mode 100644 index 00000000..331d12ac --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:47:18Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 26.6, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 24.0, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.1, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:48:11Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16083, + "cachedPromptTokens": 16032, + "completionTokens": 5016, + "seconds": 26.0293167 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.001135, + "costUsd": 0.000976, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..20f46122 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,68 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:57Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A multi‑layered toolkit for processing web logs, automating deployment and data extraction, and configuring an invoice‑reminder service with XML schemas and XSLT rendering. + +#### Purpose +- Aggregate HTTP access logs into host‑ and status‑level summaries, flagging slow requests. +- Automate release deployment, queue‑worker lifecycle, and nightly Oracle data export for a payment service. +- Build, schedule, validate, and render invoice‑related XML data for a Spring‑based reminder system. + +#### Responsibilities +- **Log Aggregation** – parsing, normalizing, counting, and reporting HTTP logs (Perl). +- **Deployment & Monitoring** – host‑by‑host release rollout, service restarts, health polling, and worker process control (Shell). +- **Data Extraction** – Oracle `settled_payment` export to CSV/CTL, compression, and retry logic (Shell). +- **Build & Migration** – Maven project setup with Flyway and optional PDFBox profile (XML). +- **Scheduling & Email** – Spring job that emails overdue invoices (XML). +- **Schema Validation** – XSD for shipment notices (XML). +- **Presentation** – XSLT that transforms statement XML to styled HTML (XML). + +#### Key units +- **Perl** + - `LogDigest` – OO class for log ingestion, aggregation, and top‑N host reporting. + - `log_digest.pl` – CLI driver handling options, host exclusions, and output formatting. + +- **Shell** + - `deploy_release.sh` – orchestrates tarball distribution, symlink updates, service restarts, and health checks. + - `healthcheck.sh` – PID/heartbeat‑based lifecycle and health status for the queue worker. + - `nightly_extract.ksh` – Oracle `sqlplus` dump of `settled_payment`, CSV/CTL generation, gzip, and retry loop. + +- **XML** + - `invoice-service-pom.xml` – Maven POM with Flyway migration path and PDFBox profile. + - `scheduler-context.xml` – Spring beans for reminder data source, repository, mail gateway, job, and scheduler. + - `shipment.xsd` – XML schema for `` with carrier, parcel, and address types. + - `statement-to-html.xsl` – XSLT stylesheet converting `` to `` with currency and highlight parameters. + +#### Data flow +1. **Log Aggregation** – CLI → `LogDigest` → summary hash → plain text/JSON output. +2. **Deployment** – `deploy_release.sh` → rsync → SSH → extraction → symlink → service restart → health poll. +3. **Health Check** – `healthcheck.sh` reads PID/heartbeat → reports status. +4. **Data Export** – `nightly_extract.ksh` runs `sqlplus` → CSV/CTL → gzip → log. +5. **Invoice Service** – Maven build → Flyway migrations → optional PDFBox PDF generation. +6. **Reminder Scheduler** – Spring context → repository → overdue invoices → email via `SmtpMailGateway`. +7. **Shipment Notice** – Warehouse emits XML → validated against `shipment.xsd`. +8. **Statement Rendering** – XML statement → `statement-to-html.xsl` → HTML output. + +#### Dependencies +- **Perl** – `Getopt::Long`, `JSON::PP`, `List::Util`, `Carp`, `Exporter`. +- **Shell** – `rsync`, `ssh`, `curl`, `nohup`, `kill`, `sqlplus`, `gzip`. +- **XML** – Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, PDFBox, HikariCP, Spring Task Scheduler. +- **External tables** – Oracle `settled_payment`; PostgreSQL for Flyway migrations. +- **Configuration files** – `LOG_DIGEST_CONFIG`, host lists (`hosts.staging`, `hosts.production`), `reminder.properties`. + +#### Cross‑cutting +- Consistent logging with timestamps across all scripts. +- Error handling via `croak`/`die` in Perl; `die`/`fail` with exit codes in Shell. +- Host normalization (lower‑case, strip trailing dot) in log parsing. +- Constants for limits (`MAX_LINES`, `SLOW_REQUEST_MS`) and retry counts in Shell scripts. +- XML namespaces (`xs`, `shp`, `st`) uniformly applied in schemas and XSLT. +- Parameterization in XSLT (`currencySymbol`, `highlightAbove`) for flexible rendering. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..cb8ba5ee --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,69 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:18Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Provides a log digesting utility. +- Counts requests per host and status, tracks slow requests. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: `new`, `add`, `summarize`. + +#### Input +- `new(level => $level)` – `$level` must be one of `DEBUG`, `INFO`, `WARN`, `ERROR`; defaults to `WARN`. +- `add($line)` – expects a log line matching the regex in `parse_line`. +- `parse_line($line)` – parses a single log line. +- `top_n($counts, $n)` – receives a hashref of counts. + +#### Output +- `add` returns `1` on successful parse, `0` if line ignored. +- `summarize` returns hashref: + - `generated` – UTC timestamp. + - `total` – total request count. + - `hosts` – number of distinct hosts. + - `busiest` – max requests from a single host. + - `slow` – number of requests > 1500 ms. + - `statuses` – hashref of status counts. +- `top_n` returns list of top `$n` keys sorted by count. + +#### Core logic +- `new`: validate level, initialize counters. +- `parse_line`: regex extracts host, time, method, path, status, millis; normalizes host. +- `add`: enforce `MAX_LINES`; parse line; increment host and status counters; increment `slow` if millis > `SLOW_REQUEST_MS`. +- `summarize`: compute totals, busiest host, and assemble summary hash. +- `top_n`: sort counts descending, return top `$n` keys. +- `_normalize_host`: lowercase, strip trailing dot. + +#### Subs +- `new(%args) -> object` – create digest with level. +- `parse_line($line) -> hashref` – parse log line. +- `add($line) -> 1|0` – add entry, update counters. +- `summarize() -> hashref` – produce summary. +- `top_n($counts, $n) -> list` – top N keys by count. +- `_normalize_host($host) -> host` – lowercase, strip dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` +- `%LEVEL_RANK = (DEBUG => 0, INFO => 1, WARN => 2, ERROR => 3)` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `new`: `croak "unknown level '$level'"` if level invalid. +- `add`: `croak 'more than ' . MAX_LINES . ' lines'` when limit exceeded. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..3047e38f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,74 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:22Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> A command‑line tool that parses web‑server access logs, filters hosts, and reports request counts and slow requests, optionally as JSON. + +#### Purpose +- Parses access log files. +- Filters out excluded hosts. +- Reports total requests, unique hosts, slow requests. +- Outputs top N hosts by request count. + +#### Type +- Script. +- No package; procedural. +- Exports none. + +#### Input +- `--top|n=i` → `$top` (default 10). +- `--level=s` → `$level` (default 'WARN'). +- `--json!` → `$as_json` (default 0). +- `--exclude-host=s` → `@exclude_hosts` (multiple allowed). +- `--help|h` → prints usage and exits. +- Positional arguments: `FILE...` (log files). +- Environment: `LOG_DIGEST_CONFIG` → `$config_file` (default `/etc/log-digest.conf`). +- Reads `$config_file` for host alias mappings (`from=to` lines). + +#### Output +- If `$as_json`: JSON string of `$summary` hash. +- Else: plain text: + - One line: `" requests from hosts, slow"`. + - Followed by top N hosts, one per line (from `top_n`). +- Exit status 0 on success; non‑zero on errors. + +#### Core logic +- Load host aliases from config file. +- Build exclusion hash from `@exclude_hosts`. +- Create `LogDigest` object with `level`. +- For each input file: + - Read line by line. + - Extract host (first token). + - Skip if host (or its alias) is excluded. + - Pass line to `$digest->add`. +- After all files, call `$digest->summarize`. +- Output summary in chosen format. + +#### Subs +- `usage() -> string` – returns help text. +- `read_aliases(path) -> hash` – parses alias file. +- `main() -> int` – orchestrates processing and output. + +#### Constants and configuration +- `$config_file` – `LOG_DIGEST_CONFIG` or `/etc/log-digest.conf`. +- `$top` – 10. +- `$level` – 'WARN'. +- `$as_json` – 0. +- `@exclude_hosts` – empty array. + +#### Dependencies +- `FindBin` – `$Bin`. +- `Getopt::Long` – `GetOptions`. +- `JSON::PP` – `->new->canonical->encode`. +- `LogDigest` – `new`, `add`, `summarize`, `hosts`, `top_n`. + +#### Exceptions / Errors +- `die usage()` on bad options. +- `die "--top must be positive\n"` if `$top < 1`. +- `die "cannot read $file: $!\n"` if file open fails. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..03f3de9d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,43 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:45Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> A Perl utility that aggregates web‑server access logs, producing per‑host and per‑status statistics while flagging slow requests. + +#### Purpose +- Aggregate and summarize HTTP access logs. +- Identify slow requests and top request‑heavy hosts. + +#### Responsibilities +- **Log parsing & normalization** – extract host, status, latency from each line. +- **Counting & aggregation** – maintain per‑host and per‑status tallies, track slow requests. +- **Reporting** – generate a summary hash and output either plain text or JSON. +- **CLI orchestration** – handle command‑line options, host exclusions, and configuration. + +#### Key units +- **`LogDigest` module** – OO class with `new`, `add`, `summarize`, `top_n`; exports parsing helpers. +- **`log_digest.pl` script** – command‑line driver that loads host aliases, filters hosts, feeds lines to `LogDigest`, and prints the final report. + +#### Data flow +1. **CLI** parses options → creates `LogDigest` instance. +2. For each input file: read line → check exclusion → pass to `$digest->add`. +3. After all files: `$digest->summarize` → hash of totals, hosts, slow count, status counts. +4. Output: plain text or JSON via `JSON::PP`. + +#### Dependencies +- **Internal**: `LogDigest` module. +- **External**: `Getopt::Long`, `JSON::PP`, `FindBin`, `POSIX`, `List::Util`, `Carp`, `Exporter`. + +#### Cross-cutting +- **Host normalization**: lower‑case, strip trailing dot. +- **Logging level validation**: `DEBUG`, `INFO`, `WARN`, `ERROR`. +- **Error handling**: `croak` for invalid levels or line limits; `die` for CLI errors. +- **Configuration**: optional host alias file (`LOG_DIGEST_CONFIG`), default `/etc/log-digest.conf`. +- **Constants**: `MAX_LINES = 50000`, `SLOW_REQUEST_MS = 1500`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..09debab5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,85 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:25Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploys a specified release to all hosts in an environment. +- Runs as a standalone script. + +#### Type +- `bash` (shebang `#!/usr/bin/env bash`) +- `set -euo pipefail` + +#### Input +- Options parsed with `getopts`: + - `-e ` → `ENVIRONMENT` + - `-t ` → `TAG` + - `-n` → `DRY_RUN=1` + - `-p ` → ignored, logged + - `-h` → prints usage +- Environment variables: + - `DEPLOY_USER` (default `deploy`) + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`) +- Files read: + - `$SCRIPT_DIR/${HOST_FILES[$ENVIRONMENT]}` (hosts list) + - `build/$TAG.tar.gz` (release archive) + +#### Output +- Copies `build/$TAG.tar.gz` to each host via `rsync`. +- Extracts archive to `$RELEASE_ROOT/$TAG` on host. +- Creates symlink `$RELEASE_ROOT/current`. +- Restarts `orderd` service via `systemctl`. +- Checks health endpoint `http://$host:8080/health` until success or timeout. +- Logs actions to stderr. +- Exit status 0 on success; non‑zero on failure. + +#### Core logic +- Parse options; validate `ENVIRONMENT` and `TAG`. +- `check_prereqs`: ensure `rsync`, `ssh`, `curl` exist and SSH key readable. +- `load_hosts`: read host list file into `HOSTS` array. +- For each host: + - `deploy_host`: + - If `DRY_RUN`, log and skip. + - `rsync` archive to `/tmp/`. + - SSH into host, create target dir, extract archive, update symlink, restart service. + - Call `wait_healthy` to poll health endpoint. + - Log deployment success. + +#### Functions +- `log` – prints timestamped message to stderr. +- `die` – logs error and exits. +- `usage` – prints usage from script comment. +- `check_prereqs` – verifies required tools and SSH key. +- `load_hosts` – loads host list file. +- `deploy_host` – deploys to a single host. +- `wait_healthy` – polls health endpoint until success or timeout. +- `cleanup` – removes temporary lock file (unused). + +#### Constants and configuration +- `SCRIPT_DIR` – script directory. +- `DEPLOY_USER` – `deploy`. +- `SSH_KEY` – `$HOME/.ssh/deploy_ed25519`. +- `RELEASE_ROOT` – `/opt/releases`. +- `SERVICE_NAME` – `orderd`. +- `HEALTH_TIMEOUT` – `30`. +- `HOST_FILES` – `([staging]="hosts.staging" [production]="hosts.production")`. + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl`. +- Host files: `hosts.staging`, `hosts.production`. +- Archive: `build/$TAG.tar.gz`. + +#### Errors and exit codes +- `die` exits with status 1 on missing tools, unreadable SSH key, unknown environment, empty host list, or health timeout. +- `getopts` errors exit with status 1. +- Missing required options exit with status 2. +- Health check timeout (`HEALTH_TIMEOUT` seconds) triggers `die` with message. +- `trap cleanup EXIT` ensures temporary lock file removal. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..63c644c2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,68 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:29Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> A POSIX init-style wrapper that manages a queue worker process, providing start, stop, status, restart, and health check based on PID and heartbeat files. + +#### Purpose +- Controls `queue-worker` lifecycle. +- Exposes health probe for monitoring. +- Intended to be run directly as a script. + +#### Type +- `sh` (POSIX). +- No strict mode flags used. + +#### Input +- `$1` command: `start`, `stop`, `restart`, `status`, `health`. +- Environment variables: + - `PID_FILE` (default `/run/queue-worker.pid`). + - `HEARTBEAT_FILE` (default `/var/lib/queue-worker/heartbeat`). +- No other options or arguments. + +#### Output +- Writes PID to `$PID_FILE` when starting. +- Removes `$PID_FILE` when stopping. +- Prints status messages (`running`, `stopped`, `OK`, `WARNING`, `CRITICAL`). +- Exits with codes: + - `0` success. + - `1` heartbeat too old. + - `2` not running. + - `3` stopped status. + - `64` invalid usage. + +#### Core logic +- `is_running`: checks PID file and process liveness. +- `heartbeat_age`: calculates seconds since last heartbeat file modification. +- `start_worker`: starts `queue-worker` with `--heartbeat`, records PID. +- `stop_worker`: kills process and removes PID file. +- Command dispatch via `case` on `$1`. + +#### Functions +- `is_running`: test if worker is active. +- `heartbeat_age`: compute age of heartbeat file. +- `start_worker`: launch worker, write PID. +- `stop_worker`: terminate worker, clean PID. + +#### Constants and configuration +- `PID_FILE`=`/run/queue-worker.pid` +- `HEARTBEAT_FILE`=`/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE`=`120` +- `WORKER_BIN`=`/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `nohup`, `kill`, `cat`, `date`, `stat`. +- `queue-worker` binary at `/usr/local/bin/queue-worker`. + +#### Errors and exit codes +- `exit 2` if health check finds no running process. +- `exit 1` if heartbeat age exceeds `MAX_HEARTBEAT_AGE`. +- `exit 3` if status reports stopped. +- `exit 64` for invalid command usage. +- No traps or cleanup beyond PID file removal. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..00ee1cf4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,74 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:32Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, creates a control file, and gzips the output, retrying up to three times. + +#### Purpose +- Performs nightly export of settled payments. +- Runs directly as a script. + +#### Type +- `ksh93` +- Uses `set -e`? none; uses `typeset` and `print`. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → sets `business_day`. + - `-o dir` → sets `export_dir`. +- Environment variables: + - `ORACLE_SID` (default `PAYPRD`). + - `NLS_LANG` set to `AMERICAN_AMERICA.AL32UTF8`. +- No positional arguments. + +#### Output +- Creates `payments_.csv` in `export_dir`. +- Creates control file `payments_.ctl` with row count and business day. +- Gzips the CSV to `payments_.csv.gz`. +- Prints log messages to stderr. +- Exit status: `0` on success, `1` on failure, `2` on usage error, `3` if required tool missing, `4` after exhausting retries. + +#### Core logic +- Parse options; set defaults. +- Ensure `export_dir` exists. +- Set `csv` path. +- Retry loop (max 3 attempts): + - Run `run_export` to dump data via `sqlplus` into `csv`. + - If successful: + - Write control file via `write_control`. + - Gzip the CSV. + - Log success and exit. + - On failure: log, sleep 60, retry. +- On exhaustion: call `fail` with exit code 4. + +#### Functions +- `log` – prints timestamped message to stderr. +- `fail` – logs failure and exits with code. +- `require_tools` – checks for `sqlplus` and `gzip`; exits if missing. +- `run_export` – runs SQL*Plus to export settled payments to a file. +- `write_control` – writes row count and business day to a `.ctl` file. + +#### Constants and configuration +- ``ORACLE_SID_DEFAULT=PAYPRD`` +- ``EXPORT_DIR_DEFAULT=/data/export/payments`` +- ``MAX_RETRIES=3`` +- ``attempt=0`` +- ``business_day=$(date +%Y%m%d)`` +- ``export_dir=$EXPORT_DIR_DEFAULT`` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle connection: `CONNECT / AS SYSDBA` via `sqlplus`. +- SQL query reads from table `settled_payment`. + +#### Errors and exit codes +- `fail` with code 1: generic failure. +- `fail` with code 2: usage error. +- `fail` with code 3: missing required tool. +- `fail` with code 4: exceeded retry limit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..1e5c653d --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,47 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:48Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates deployment, health monitoring, and nightly data extraction for a payment processing service. + +#### Purpose +- Deploy release archives to multiple hosts, restart services, and verify health. +- Control and report the lifecycle of a queue‑worker process. +- Export settled payments from Oracle to CSV, generate control files, and compress output. + +#### Responsibilities +- **Deployment**: `deploy_release.sh` handles distribution of release tarballs, symlink updates, service restarts, and health polling. +- **Process Management**: `healthcheck.sh` provides start/stop/status/health commands for a queue worker, using PID and heartbeat files. +- **Data Export**: `nightly_extract.ksh` extracts settled payments, writes CSV and control files, gzips results, and retries on failure. + +#### Key units +- `deploy_release.sh` – Bash script orchestrating host‑by‑host deployment. +- `healthcheck.sh` – POSIX shell wrapper for queue‑worker lifecycle and health checks. +- `nightly_extract.ksh` – Korn shell script exporting Oracle data to CSV and control files. + +#### Data flow +1. **Deployment**: + `deploy_release.sh` reads a host list → rsyncs `build/$TAG.tar.gz` → SSH to host → extracts → updates `$RELEASE_ROOT/current` → restarts `orderd` → polls `http://$host:8080/health`. +2. **Health Check**: + `healthcheck.sh` checks PID file → verifies process liveness → reads heartbeat file → reports status or exits with error codes. +3. **Data Export**: + `nightly_extract.ksh` runs `sqlplus` to dump `settled_payment` rows → writes CSV → creates `.ctl` with row count → gzips CSV → logs progress. + +#### Dependencies +- External utilities: `rsync`, `ssh`, `curl`, `nohup`, `kill`, `sqlplus`, `gzip`. +- Files: host lists (`hosts.staging`, `hosts.production`), release archives (`build/*.tar.gz`), Oracle tables (`settled_payment`). +- Environment variables: `DEPLOY_USER`, `SSH_KEY`, `ORACLE_SID`, `NLS_LANG`, `PID_FILE`, `HEARTBEAT_FILE`. + +#### Cross‑cutting +- **Logging**: All scripts use a `log` function that prefixes messages with timestamps. +- **Error handling**: `die`/`fail` functions exit with specific codes; scripts trap `EXIT` for cleanup. +- **Configuration**: Constants are defined at the top of each script (e.g., `RELEASE_ROOT`, `SERVICE_NAME`, `MAX_HEARTBEAT_AGE`, `MAX_RETRIES`). +- **Process control**: PID files and heartbeat files coordinate worker status across scripts. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..6da7b6b5 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,54 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:35Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures the Maven build for the Invoice Service module, including dependencies, compiler settings, Flyway migrations, and a native‑PDF profile. + +#### Purpose +- Builds the `invoice-service` JAR. +- Manages database migrations with Flyway. +- Provides a PDF generation profile. + +#### Type +- Maven POM + Root element: `project` + Namespaces: + - `xmlns="http://maven.apache.org/POM/4.0.0"` + - `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release=17` + - `jackson.version=2.19.2` + - `flyway.version=11.4.0` + - `invoice.archive.dir=${project.build.directory}/archive` +- **Dependencies**: + - `com.fasterxml.jackson.core:jackson-databind:${jackson.version}` + - `org.flywaydb:flyway-core:${flyway.version}` + - `org.postgresql:postgresql` (runtime) + - `org.junit.jupiter:junit-jupiter` (test) + - `org.testcontainers:postgresql` (test) +- **Plugins**: + - `org.flywaydb:flyway-maven-plugin:${flyway.version}` + - `locations`: `filesystem:src/main/resources/db/migration` + - `org.apache.maven.plugins:maven-surefire-plugin` + - `systemPropertyVariables`: `invoice.archive.dir=${invoice.archive.dir}` +- **Profile** `native-pdf` + - Adds dependency `org.apache.pdfbox:pdfbox:3.0.5` + +#### Configuration +- `maven.compiler.release` set to `17`. +- Flyway `locations` points to `src/main/resources/db/migration`. +- Surefire passes `invoice.archive.dir` system property. +- Profile `native-pdf` activates PDFBox dependency. + +#### Dependencies +- External libraries: Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, PDFBox (profile). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..026bdec0 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,48 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:52Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> A collection of configuration, schema, and transformation files that support the Invoice Service, a reminder scheduler, shipment notifications, and statement rendering. + +#### Purpose +- Build and configure the Invoice Service module. +- Wire a Spring‑based reminder scheduler. +- Define XML contracts for shipment notices. +- Provide XSLT for rendering account statements to HTML. + +#### Responsibilities +- **Build & Migration** – Maven POM with Flyway and PDFBox profiles. +- **Scheduling** – Spring XML context for a reminder job that emails overdue invoices. +- **Data Validation** – XSD for shipment notices sent by warehouses. +- **Presentation** – XSLT stylesheet that turns statement XML into styled HTML. + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, Flyway migration location, PDFBox profile. +- `scheduler-context.xml` – Spring beans: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`, `reminderScheduler`. +- `shipment.xsd` – Schema for `` with `ShipmentNoticeType`, `ParcelType`, `AddressType`, and enumerated `CarrierCode`. +- `statement-to-html.xsl` – XSLT that outputs `` from ``, with parameters `currencySymbol` and `highlightAbove`. + +#### Data flow +1. **Invoice Service**: Maven builds JAR → Flyway applies DB migrations → optional PDFBox profile generates PDFs. +2. **Reminder Scheduler**: Spring context loads data source → repository reads overdue invoices → job composes emails via `SmtpMailGateway` → scheduled by cron. +3. **Shipment Notice**: Warehouse emits XML → validated against `shipment.xsd` before processing. +4. **Statement Rendering**: XML statement → XSLT transforms to HTML, highlighting large amounts. + +#### Dependencies +- **External libs**: Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, PDFBox (profile), HikariCP, Spring Task Scheduler. +- **Internal**: `org.example.reminder` package classes (`JdbcReminderRepository`, `SmtpMailGateway`, `OverdueReminderJob`). +- **Schema**: `urn:example:shipment:1` for shipment notices; `urn:example:statement` for statements. + +#### Cross-cutting +- Spring property placeholders (`reminder.properties`) for DB and SMTP settings. +- Consistent use of XML namespaces (`xs`, `shp`, `st`) across schemas and XSLT. +- Parameterization in XSLT (`currencySymbol`, `highlightAbove`) for flexible rendering. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..04766a1f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,45 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:38Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures a Spring context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled trigger. + +#### Purpose +- Wire reminder scheduler components. +- Schedule overdue reminder job. + +#### Type +- Spring context XML (`` root). +- Namespaces: `http://www.springframework.org/schema/beans` (default), `http://www.springframework.org/schema/context`, `http://www.springframework.org/schema/task`. + +#### Definitions +- **Property placeholder**: `reminder.properties`. +- **Component scan**: `org.example.reminder.web`. +- **Beans**: + - `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`): `jdbcUrl` `${reminder.db.url}`, `username` `${reminder.db.user}`, `maximumPoolSize` `8`. + - `reminderRepository` (`org.example.reminder.JdbcReminderRepository`): constructor arg `reminderDataSource`. + - `mailGateway` (`org.example.reminder.SmtpMailGateway`): `host` `${reminder.smtp.host}`, `port` `587`. + - `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`): constructor args `reminderRepository`, `mailGateway`; property `graceDays` `14`. +- **Scheduler**: `reminderScheduler` (`task:scheduler`) with `pool-size` `2`. +- **Scheduled task**: `overdueReminderJob.sendDueReminders` triggered by cron `0 0 7 * * MON-FRI`. + +#### Configuration +- `reminder.db.url` – JDBC URL. +- `reminder.db.user` – DB username. +- `reminder.smtp.host` – SMTP host. +- `reminder.smtp.port` – SMTP port `587`. +- `overdueReminderJob.graceDays` – `14`. +- Scheduler pool size – `2`. +- Cron expression – `0 0 7 * * MON-FRI`. + +#### Dependencies +- `com.zaxxer.hikari.HikariDataSource`. +- `org.example.reminder.JdbcReminderRepository`. +- `org.example.reminder.SmtpMailGateway`. +- `org.example.reminder.OverdueReminderJob`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..46a93992 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,39 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:40Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Validates shipment notice documents. +- Enforces structure for parcels, addresses, and carrier codes. + +#### Type +- XML Schema (``). +- Root element: `shipmentNotice`. +- Namespaces: `xs` (http://www.w3.org/2001/XMLSchema), `shp` (urn:example:shipment:1). + +#### Definitions +- **Simple types** + - `CarrierCode`: enumeration of `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: positive integer ≤ 31500. +- **Complex types** + - `ParcelType`: sequence of `trackingNumber` (`xs:string`) and `weight` (`shp:WeightGrams`); required attribute `sequence` (`xs:positiveInteger`). + - `AddressType`: sequence of `name`, `street`, `postalCode`, `city`, optional `country` (`xs:string`, default `DE`). + - `ShipmentNoticeType`: sequence of `orderReference`, `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one or more `parcel` (`shp:ParcelType`); required attribute `noticeId` (`xs:ID`). +- **Element** + - `shipmentNotice`: type `shp:ShipmentNoticeType`. + +#### Configuration +- `elementFormDefault="qualified"`. +- `targetNamespace="urn:example:shipment:1"`. + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema`. +- No external schema imports or includes. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..b5a5421e --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,38 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:47:42Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a monthly account statement XML into an HTML page with header, rows per booking, and a total. + +#### Purpose +- Render a monthly account statement as an HTML page. +- Highlight bookings exceeding a threshold. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespaces: `xsl` (`http://www.w3.org/1999/XSL/Transform`), `st` (`urn:example:statement`). + +#### Definitions +- **Parameters** + - `currencySymbol` (default `'EUR'`) + - `highlightAbove` (default `1000`) +- **Key** + - `bookingsByDay` – matches `st:booking`, indexed by `st:valueDate`. +- **Templates** + - `match="/st:statement"` – main entry, outputs ``. + - `name="statementHeader"` – outputs account number and period. + - `match="st:booking"` – outputs a `` for each booking, adds `class="large"` if `st:amount > $highlightAbove`. + - `name="statementTotal"` – outputs total amount of all bookings. + +#### Configuration +- `xsl:output` method `html`, encoding `UTF-8`, indent `yes`. +- `currencySymbol` and `highlightAbove` parameters are configurable. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: `statement`, `accountNumber`, `period`, `booking`, `valueDate`, `purpose`, `amount`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..e237aeac --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,66 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:03Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A multi‑layered toolkit that aggregates web logs, automates deployment and data export, and builds a Spring‑based invoice‑reminder service with XML validation and XSLT rendering. + +#### Purpose +- Aggregate HTTP access logs into host‑ and status‑level summaries, flagging slow requests. +- Automate release deployment, queue‑worker lifecycle, and nightly Oracle data export for a payment service. +- Build, schedule, validate, and render invoice‑related XML data for a Spring‑based reminder system. + +#### Responsibilities +- **Log Aggregation** – Perl parsing, normalization, counting, and reporting of HTTP logs. +- **Deployment & Monitoring** – Shell orchestration of tarball distribution, symlink updates, service restarts, health polling, and worker lifecycle. +- **Data Extraction** – Shell export of Oracle `settled_payment` to CSV/CTL, compression, and retry logic. +- **Build & Migration** – Maven project setup with Flyway and optional PDFBox profile. +- **Scheduling & Email** – Spring job that emails overdue invoices. +- **Schema Validation** – XSD for shipment notices. +- **Presentation** – XSLT that transforms statement XML to styled HTML. + +#### Key units +- **Perl** + - `LogDigest` – OO class for log ingestion, aggregation, and top‑N host reporting. + - `log_digest.pl` – CLI driver handling options, host exclusions, and output formatting. + +- **Shell** + - `deploy_release.sh` – orchestrates tarball distribution, symlink updates, service restarts, and health checks. + - `healthcheck.sh` – PID/heartbeat‑based lifecycle and health status for the queue worker. + - `nightly_extract.ksh` – Oracle `sqlplus` dump of `settled_payment`, CSV/CTL generation, gzip, and retry loop. + +- **XML** + - `invoice-service-pom.xml` – Maven POM with Flyway migration path and PDFBox profile. + - `scheduler-context.xml` – Spring beans for reminder data source, repository, mail gateway, job, and scheduler. + - `shipment.xsd` – XML schema for `` with carrier, parcel, and address types. + - `statement-to-html.xsl` – XSLT stylesheet converting `` to `` with currency and highlight parameters. + +#### Data flow +1. **Log Aggregation** – CLI → `LogDigest` → summary hash → plain text/JSON output. +2. **Deployment** – `deploy_release.sh` → rsync → SSH → extraction → symlink → service restart → health poll. +3. **Health Check** – `healthcheck.sh` reads PID/heartbeat → reports status. +4. **Data Export** – `nightly_extract.ksh` runs `sqlplus` → CSV/CTL → gzip → log. +5. **Invoice Service** – Maven build → Flyway migrations → optional PDFBox PDF generation. +6. **Reminder Scheduler** – Spring context → repository → overdue invoices → email via `SmtpMailGateway`. +7. **Shipment Notice** – Warehouse emits XML → validated against `shipment.xsd`. +8. **Statement Rendering** – XML statement → `statement-to-html.xsl` → HTML output. + +#### Dependencies +- **Perl** – `Getopt::Long`, `JSON::PP`, `List::Util`, `Carp`, `Exporter`. +- **Shell** – `rsync`, `ssh`, `curl`, `nohup`, `kill`, `sqlplus`, `gzip`. +- **XML** – Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, PDFBox, HikariCP, Spring Task Scheduler. +- **External tables** – Oracle `settled_payment`; PostgreSQL for Flyway migrations. +- **Configuration files** – `LOG_DIGEST_CONFIG`, host lists (`hosts.staging`, `hosts.production`), `reminder.properties`. + +#### Cross‑cutting +- Consistent timestamped logging across scripts. +- Error handling via `croak`/`die` in Perl; `die`/`fail` with exit codes in Shell. +- Host normalization (lower‑case, strip trailing dot) in log parsing. +- Constants for limits (`MAX_LINES`, `SLOW_REQUEST_MS`) and retry counts in Shell scripts. +- Uniform XML namespaces (`xs`, `shp`, `st`) in schemas and XSLT. +- Parameterized XSLT (`currencySymbol`, `highlightAbove`) for flexible rendering. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..c93474a6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run8/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 8FA5224B +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:09Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The core of srcmorph‑modelcard is a multi‑layered toolkit that aggregates web logs, automates deployment and data export, and powers a Spring‑based invoice‑reminder service. Log aggregation is handled by Perl and shell utilities that produce per‑host and per‑status statistics, flag slow requests, and feed nightly extraction jobs for payment processing. The invoice service relies on a rich XML configuration, schema, and XSLT transformation set to validate data, schedule reminders, send shipment notifications, and render statements. All components are orchestrated to provide a cohesive pipeline from raw log ingestion to automated billing and notification workflows. + +#### Packages +- other — A multi‑layered toolkit for processing web logs, automating deployment and data extraction, and configuring an invoice‑reminder service with XML schemas and XSLT rendering. +- other/perl — A Perl utility that aggregates web‑server access logs, producing per‑host and per‑status statistics while flagging slow requests. +- other/shell — Automates deployment, health monitoring, and nightly data extraction for a payment processing service. +- other/xml — A collection of configuration, schema, and transformation files that support the Invoice Service, a reminder scheduler, shipment notifications, and statement rendering. +- . — A multi‑layered toolkit that aggregates web logs, automates deployment and data export, and builds a Spring‑based invoice‑reminder service with XML validation and XSLT rendering. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/meta/gpt-oss-20b.json b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/meta/gpt-oss-20b.json new file mode 100644 index 00000000..044a4363 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/meta/gpt-oss-20b.json @@ -0,0 +1,78 @@ +{ + "key": "gpt-oss-20b", + "name": "gpt-oss-20b", + "backend": "openrouter", + "definition": { + "key": "gpt-oss-20b", + "maxOutputTokens": 4096, + "temperature": 0.2, + "provider": "openai-compatible", + "baseUrl": "https://openrouter.ai/api/v1", + "contextSize": 131072, + "reasoningEffort": "low", + "remoteModel": "openai/gpt-oss-20b" + }, + "javaCommit": null, + "corpus": "corpus-languages", + "profile": "v3", + "javaPrompt": "file-body-oop", + "facts": false, + "oversize": null, + "maxChunks": null, + "profileHashes": { + "file-body-contract.md": "34b65f0a7de7be00bf14a2d61bc8f01ffba1dd3178345f600ab4e3a3f33c05b7", + "file-body-fallback.md": "2e57ccbb77fb6866ea5092e54e70e462d9fff32a0860a2df31b28a089101ee6a", + "file-body-oop.md": "66e9016d66782bd404e117c38cc62100374deac6a4bad223b535767383650eda", + "file-body-ops.md": "bba1a8aeddbb2be82e30fa511007b2753cb059af7b590943a8375c7bf8b5c72d", + "file-body-perl.md": "08631597d92190dd6d391a20a58e215f692b67f09953cd15f586804b86d0978c", + "file-body-shell.md": "85d03e187ea5417ee8104b4049fa2418a0c460bc918ffdd00109b9272c9d667b", + "file-body-sql.md": "7ccbdab6eefea1156e5ed29c3f8ff84a74ea99bd4cbafd85601019e5d82d828e", + "file-body-view.md": "a42545c0f88a7ed9dc7101b5e35d1b74a38a60a631778cd43d2e665040ced331", + "file-body-xml.md": "fed6968a01666d82687b711aca52ab3ceba307a4f3cc98a2e77bb5ea21c06b36", + "map-chunk.md": "ebc4aa4592de553fb7616b66f1e727fd94da30828c8c1d76986a8ee4e885aec3", + "package-body.md": "e4398dd0c0e4a01648166b2db2decf78a42b63e5298c04739568a98e8b5406e4", + "project-body.md": "2ccf5e75f1fb1140f98cfa1033a9b88bb3c1e7eb222cbef0387a6b0136b86241", + "reduce-parts.md": "067474a90b6a35bc6092fccc5b9c929daccf18506fad638c0d4eee98316032b7" + }, + "cli": { + "jar": "srcmorph-cli-1.5.0-SNAPSHOT.jar", + "sha256": "acac779d219fe7a1ebefbd9c238c4f03df2ffa001d68361a0a4dd43c48cd2686" + }, + "java": "openjdk version \"25.0.1\" 2025-10-21 LTS", + "startedAt": "2026-11-04T12:48:11Z", + "phases": { + "GenerateFileIndex": { + "exit": 0, + "seconds": 31.0, + "cutOff": [] + }, + "AggregatePackages": { + "exit": 0, + "seconds": 22.5, + "cutOff": [] + }, + "AggregateProject": { + "exit": 0, + "seconds": 2.6, + "cutOff": [] + } + }, + "finishedAt": "2026-11-04T12:49:08Z", + "fileTokens": { + "files": 9, + "written": 9, + "unchanged": 0, + "failed": 0, + "calls": 9, + "promptTokens": 16083, + "cachedPromptTokens": 16032, + "completionTokens": 4783, + "seconds": 30.4463022 + }, + "finishReasons": { + "stop": 9 + }, + "tokenCostUsd": 0.001104, + "costUsd": 0.001018, + "files": 15 +} diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/package.ai.md new file mode 100644 index 00000000..9b9078f4 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/package.ai.md @@ -0,0 +1,53 @@ +### other +- H: 1.0 +- C: 8B47BE8A +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:55Z +- G: +- A: 0.0.0 +- X: package +- F: [perl/](perl/package.ai.md) +- F: [shell/](shell/package.ai.md) +- F: [xml/](xml/package.ai.md) +--- +> A collection of scripts and modules that aggregate web‑server logs, automate deployment and health checks for a payment system, and build a Java invoicing service with XML validation and HTML rendering. + +#### Purpose +- Aggregate and report HTTP access logs. +- Deploy, monitor, and extract nightly data for a distributed payment platform. +- Build, schedule, and format invoices and shipment notices in a Java service. + +#### Responsibilities +- **Log Processing** – Perl module `LogDigest` parses logs, aggregates per‑host/status, flags slow requests; CLI `log_digest.pl` outputs summaries. +- **Deployment & Monitoring** – Shell scripts `deploy_release.sh`, `healthcheck.sh`, and `nightly_extract.ksh` handle tarball distribution, service restarts, worker lifecycle, health polling, and Oracle data export. +- **Invoice Service Build & Runtime** – Maven POM compiles the `invoice-service` JAR, runs Flyway migrations; Spring context schedules overdue reminders; XML schema validates shipment notices; XSLT transforms statements to HTML. + +#### Key units +- `LogDigest` (Perl) – `new`, `add`, `summarize`, `top_n`; constants `MAX_LINES`, `SLOW_REQUEST_MS`. +- `log_digest.pl` – CLI entry point; options `--top`, `--level`, `--json`, `--exclude-host`. +- `deploy_release.sh` – Orchestrates rsync, SSH extraction, symlink, `systemctl restart`, health polling. +- `healthcheck.sh` – PID/heartbeat worker controller (`start_worker`, `stop_worker`, `is_running`, `heartbeat_age`). +- `nightly_extract.ksh` – Oracle export driver (`run_export`, `write_control`, retry loop, gzip). +- `invoice-service-pom.xml` – Maven project, Flyway migration path, Java 17. +- `scheduler-context.xml` – Spring beans: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`; scheduler `reminderScheduler`. +- `shipment.xsd` – XML Schema for `shipmentNotice`. +- `statement-to-html.xsl` – XSLT stylesheet for `st:statement` → styled HTML. + +#### Data flow +1. **Log Aggregation** – CLI → `LogDigest` → per‑host/status totals → JSON/text output. +2. **Deployment** – `deploy_release.sh` → rsync tarball → SSH extraction → symlink update → `systemctl restart` → HTTP health check. +3. **Health Monitoring** – `healthcheck.sh` reads PID/heartbeat → reports status/health. +4. **Nightly Extraction** – `nightly_extract.ksh` runs SQL query → CSV + control file → gzip. +5. **Invoice Service** – Maven builds JAR → Flyway migrates DB → Spring scheduler triggers `OverdueReminderJob` → mail gateway sends reminders. +6. **Shipment/Statement Processing** – External XML → validated by `shipment.xsd`; service receives `st:statement` → XSLT renders HTML. + +#### Dependencies +- **Perl** – `Getopt::Long`, `JSON::PP`, `FindBin`, `POSIX`, `List::Util`, `Carp`, `Exporter`. +- **Shell** – `rsync`, `ssh`, `curl`, `nohup`, `kill`, `sqlplus`, `gzip`; environment vars `DEPLOY_USER`, `SSH_KEY`, `ORACLE_SID`, `NLS_LANG`. +- **Java** – Maven, Flyway Core, Jackson Databind, PostgreSQL JDBC, PDFBox (profile), Spring Core/Context/Scheduler, JUnit Jupiter, Testcontainers PostgreSQL. + +#### Cross-cutting +- Consistent error handling (`croak`/`die`, `set -euo pipefail`). +- Configuration via files (`/etc/log-digest.conf`, `hosts.*`, `reminder.properties`) and environment variables. +- Host normalization in `LogDigest`; heartbeat file timestamps for worker health. +- Scheduler pool size 2 for concurrent job execution; XML namespaces and XSLT parameters for styling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md new file mode 100644 index 00000000..c092f978 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/perl/LogDigest.pm.ai.md @@ -0,0 +1,63 @@ +### LogDigest.pm +- H: 1.0 +- C: 63E90A09 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:12Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Condenses web‑server access logs into per‑host and per‑status counts, tracking slow requests. + +#### Purpose +- Parse and aggregate web‑server log lines. +- Provide per‑host, per‑status summaries and slow‑request statistics. + +#### Type +- Module `LogDigest`. +- Exports `parse_line`, `top_n`. +- Object‑oriented: constructor `new`, methods `add`, `summarize`. + +#### Input +- `parse_line($line)` expects a log line matching + `host date method path status millis`. +- `add($line)` reads a single log line. +- `new(level => $level)` accepts `level` (`DEBUG`, `INFO`, `WARN`, `ERROR`). + +#### Output +- `parse_line` returns hashref `{host, time, method, path, status, millis}` or `undef`. +- `add` returns `1` on success, `0` if line unparsable, dies on line limit. +- `summarize` returns hashref `{generated, total, hosts, busiest, slow, statuses}`. +- `top_n` returns list of top N keys from a count hash. + +#### Core logic +- `new`: validate level, initialize counters. +- `parse_line`: regex extraction, host normalization. +- `add`: limit to `MAX_LINES`; update host/status counts; increment slow counter if `millis > SLOW_REQUEST_MS`. +- `summarize`: compute total requests, host count, busiest host, slow count, copy status counts; timestamp with UTC. +- `top_n`: sort counts descending, tie‑break by key lexicographically, slice top N. +- `_normalize_host`: lowercase, strip trailing dot. + +#### Subs +- `new(%args) -> object` – create digest with level. +- `parse_line($line) -> hashref` – parse log line. +- `add($line) -> 1/0` – add entry, update stats. +- `summarize() -> hashref` – aggregate summary. +- `top_n($counts, $n) -> list` – top N keys. +- `_normalize_host($host) -> host` – lowercase, strip dot. + +#### Constants and configuration +- `MAX_LINES => 50000` +- `DEFAULT_LEVEL => 'WARN'` +- `SLOW_REQUEST_MS => 1500` + +#### Dependencies +- `POSIX qw(strftime)` +- `List::Util qw(max sum)` +- `Carp qw(croak)` +- `Exporter` (parent) + +#### Exceptions / Errors +- `croak` on unknown level in `new`. +- `croak` if more than `MAX_LINES` added in `add`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md new file mode 100644 index 00000000..6f5aa5a2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/perl/log_digest.pl.ai.md @@ -0,0 +1,77 @@ +### log_digest.pl +- H: 1.0 +- C: 8D4DDD59 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:18Z +- G: +- A: 0.0.0 +- X: file +- P: 94FD0195 +--- +> Reads web server logs and reports the busiest hosts and status‑code counts, optionally as JSON. + +#### Purpose +- Command‑line tool for summarizing access logs. +- Outputs host usage statistics and slow request counts. + +#### Type +- Script +- Uses package `LogDigest` (imported `top_n`). + +#### Input +- Options: + - `--top|n=i` → `$top` (default 10) + - `--level=s` → `$level` (default 'WARN') + - `--json!` → `$as_json` (default 0) + - `--exclude-host=s` → `@exclude_hosts` + - `--help|h` → prints usage +- Positional arguments: `FILE...` (log files) +- Environment: + - `LOG_DIGEST_CONFIG` → `$config_file` (default `/etc/log-digest.conf`) +- Files read: + - `$config_file` (host alias mapping) + - Each `FILE` (log entries) + +#### Output +- If `$as_json`: + - JSON string of `$summary` hash, newline terminated. +- Else: + - One line: `" requests from hosts, slow"` + - Followed by `$top` lines of host statistics from `top_n`. +- Exit status: 0 on success, non‑zero on error. + +#### Core logic +- Load host aliases from config file. +- Build exclusion set from `@exclude_hosts`. +- Create `LogDigest` object with `level`. +- For each log file: + - Read line by line. + - Extract host (first field). + - Skip if host (or its alias) is excluded. + - Feed line to `$digest->add`. +- After all files: + - `$digest->summarize` → `$summary`. + - Output JSON or formatted text as above. + +#### Subs +- `usage() -> string` – prints help text. +- `read_aliases(path) -> hash` – parses `key = value` lines, ignores comments. +- `main() -> int` – orchestrates parsing, digesting, output. + +#### Constants and configuration +- `$config_file = $ENV{LOG_DIGEST_CONFIG} // '/etc/log-digest.conf'` +- `$top = 10` +- `$level = 'WARN'` +- `$as_json = 0` +- `@exclude_hosts = ()` + +#### Dependencies +- `FindBin` – `$Bin` +- `Getopt::Long` – `GetOptions` +- `JSON::PP` – `->new->canonical->encode` +- `LogDigest` – `new`, `add`, `summarize`, `top_n` + +#### Exceptions / Errors +- `die usage()` on bad options. +- `die "--top must be positive\n"` if `$top < 1`. +- `die "cannot read $file: $!\n"` if a log file cannot be opened. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/perl/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/perl/package.ai.md new file mode 100644 index 00000000..aa74bf02 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/perl/package.ai.md @@ -0,0 +1,41 @@ +### other/perl +- H: 1.0 +- C: 68C82992 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:43Z +- G: +- A: 0.0.0 +- X: package +- F: [LogDigest.pm](LogDigest.pm.ai.md) +- F: [log_digest.pl](log_digest.pl.ai.md) +--- +> Condenses web‑server access logs into per‑host and per‑status summaries, highlighting slow requests and providing a CLI for reporting. + +#### Purpose +- Aggregate and summarize HTTP access logs. +- Expose a command‑line tool for quick host‑usage and status‑code reporting. + +#### Responsibilities +- **Log parsing & aggregation** – `LogDigest` module parses individual log lines, normalizes hosts, counts requests per host and status, tracks slow requests. +- **Reporting** – `log_digest.pl` reads log files, applies host exclusions, outputs a concise summary or JSON, and supports configuration via a host‑alias file. + +#### Key units +- `LogDigest` (module) – constructor `new`, `add`, `summarize`, `top_n`; constants `MAX_LINES`, `SLOW_REQUEST_MS`. +- `log_digest.pl` (script) – `main`, `usage`, `read_aliases`; options `--top`, `--level`, `--json`, `--exclude-host`. + +#### Data flow +1. **CLI** parses options → creates `LogDigest` with chosen level. +2. **File loop**: each log line is read, host checked against exclusion set, then passed to `$digest->add`. +3. After all files, `$digest->summarize` produces a hash of totals, host counts, slow request count, and status counts. +4. **Output**: either JSON via `JSON::PP` or formatted text with `top_n` host statistics. + +#### Dependencies +- Internal: `LogDigest` module. +- External Perl modules: `Getopt::Long`, `JSON::PP`, `FindBin`, `POSIX`, `List::Util`, `Carp`, `Exporter`. +- External data: optional host‑alias config file (`/etc/log-digest.conf`). + +#### Cross-cutting +- Host normalization (`_normalize_host`) ensures consistent counting. +- Error handling via `croak` in the module and `die` in the script for invalid options or file I/O. +- Logging level validation in `LogDigest::new`. +- Constants (`MAX_LINES`, `SLOW_REQUEST_MS`) guard against excessive input and define slow‑request threshold. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md new file mode 100644 index 00000000..7f8c7520 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/deploy_release.sh.ai.md @@ -0,0 +1,83 @@ +### deploy_release.sh +- H: 1.0 +- C: A7D83074 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:22Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Deploys a release tarball to each host in an environment, restarting the service and verifying health. + +#### Purpose +- Deploys a specified release tarball to all hosts in an environment. +- Runs as a standalone script, not sourced. + +#### Type +- Bash (`#!/usr/bin/env bash`) +- Strict mode: `set -euo pipefail` + +#### Input +- Options parsed with `getopts`: + - `-e ` → `ENVIRONMENT` + - `-t ` → `TAG` + - `-n` → `DRY_RUN=1` + - `-p ` → ignored, logged + - `-h` → prints usage +- Environment variables: + - `DEPLOY_USER` (default `deploy`) + - `SSH_KEY` (default `$HOME/.ssh/deploy_ed25519`) +- Files read: + - `$SCRIPT_DIR/${HOST_FILES[$ENVIRONMENT]}` (hosts list) + - `build/$TAG.tar.gz` (release archive) + +#### Output +- Copies `build/$TAG.tar.gz` to `/tmp/` on each host via `rsync`. +- Extracts archive to `$RELEASE_ROOT/$TAG` on host. +- Creates symlink `$RELEASE_ROOT/current` → `$RELEASE_ROOT/$TAG`. +- Restarts `orderd` service with `systemctl`. +- Checks health endpoint `http://$host:8080/health`; exits on failure. +- Logs actions to stderr. +- Exit status 0 on success, 1 on error, 2 on missing arguments. + +#### Core logic +- Parse options; validate `ENVIRONMENT` and `TAG`. +- Verify required tools (`rsync`, `ssh`, `curl`) and SSH key. +- Load host list from environment-specific file. +- For each host: + - If `DRY_RUN`, log intended action. + - Else: + - `rsync` archive to host. + - SSH into host, create target dir, extract archive, update symlink, restart service. + - Poll health endpoint until success or timeout. + - Log deployment completion. + +#### Functions +- `log` – prints timestamped message to stderr. +- `die` – logs error and exits. +- `usage` – prints usage comment from script header. +- `check_prereqs` – ensures required tools and SSH key exist. +- `load_hosts` – reads host list file into `HOSTS` array. +- `deploy_host` – performs rsync, extraction, restart, health check for one host. +- `wait_healthy` – polls health endpoint with timeout. +- `cleanup` – removes temporary lock file on exit. + +#### Constants and configuration +- `SCRIPT_DIR` – directory of script. +- `DEPLOY_USER` – `deploy` +- `SSH_KEY` – `$HOME/.ssh/deploy_ed25519` +- `RELEASE_ROOT` – `/opt/releases` +- `SERVICE_NAME` – `orderd` +- `HEALTH_TIMEOUT` – `30` +- `HOST_FILES` – associative array mapping `staging` → `hosts.staging`, `production` → `hosts.production` + +#### Dependencies +- External commands: `rsync`, `ssh`, `curl` +- Host files: `hosts.staging`, `hosts.production` +- Archive: `build/$TAG.tar.gz` + +#### Errors and exit codes +- `die` exits with status 1 for missing tools, unreadable SSH key, empty host list, or health timeout. +- Missing required options triggers usage and exit status 2. +- `wait_healthy` exits with status 1 if health check fails after `HEALTH_TIMEOUT` seconds. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md new file mode 100644 index 00000000..441b1d34 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/healthcheck.sh.ai.md @@ -0,0 +1,66 @@ +### healthcheck.sh +- H: 1.0 +- C: FCA7DDB5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:25Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> A POSIX‑style init wrapper that manages a queue worker, providing start, stop, status, restart, and health‑check commands based on a PID file and heartbeat file. + +#### Purpose +- Controls a queue worker process. +- Exposes `start`, `stop`, `restart`, `status`, and `health` actions. + +#### Type +- POSIX sh (`#!/bin/sh`). +- No strict mode flags used. + +#### Input +- `$1`: command (`start`, `stop`, `restart`, `status`, `health`). +- Environment variables: + - `PID_FILE` (default `/run/queue-worker.pid`). + - `HEARTBEAT_FILE` (default `/var/lib/queue-worker/heartbeat`). +- No command‑line options parsed. + +#### Output +- Writes PID to `PID_FILE` when starting. +- Removes `PID_FILE` on stop. +- Prints status messages to stdout or stderr. +- Exits with codes: + - `0` on success. + - `1` if heartbeat too old. + - `2` if not running during health check. + - `3` if status reports stopped. + - `64` on usage error. + +#### Core logic +- `is_running`: checks PID file and verifies process existence. +- `heartbeat_age`: calculates seconds since heartbeat file modification. +- `start_worker`: starts worker with `nohup`, records PID. +- `stop_worker`: kills process and removes PID file. +- Command dispatch via `case` on `$1`. + +#### Functions +- `is_running`: check if worker is active. +- `heartbeat_age`: compute heartbeat age. +- `start_worker`: launch worker, write PID. +- `stop_worker`: terminate worker, clean PID. + +#### Constants and configuration +- `PID_FILE`=`/run/queue-worker.pid` +- `HEARTBEAT_FILE`=`/var/lib/queue-worker/heartbeat` +- `MAX_HEARTBEAT_AGE`=`120` +- `WORKER_BIN`=`/usr/local/bin/queue-worker` + +#### Dependencies +- External commands: `nohup`, `kill`, `cat`, `date`, `stat`, `echo`. +- Worker binary: `/usr/local/bin/queue-worker` (expects `--heartbeat` option). + +#### Errors and exit codes +- `exit 64`: usage error. +- `exit 2`: health check fails because worker not running. +- `exit 1`: heartbeat older than `MAX_HEARTBEAT_AGE`. +- `exit 3`: status reports stopped. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md new file mode 100644 index 00000000..75cd5506 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/nightly_extract.ksh.ai.md @@ -0,0 +1,71 @@ +### nightly_extract.ksh +- H: 1.0 +- C: 5A355E24 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:28Z +- G: +- A: 0.0.0 +- X: file +- P: A1309C5E +--- +> Extracts settled payments for a specified business day from Oracle, writes a CSV, creates a control file, and gzips the result. + +#### Purpose +- Performs nightly export of settled payments. +- Runs as a standalone script. + +#### Type +- `ksh93` +- Uses `set -e`? none; uses `typeset` and `whence`. + +#### Input +- Options parsed by `getopts`: + - `-d YYYYMMDD` → sets `business_day`. + - `-o ` → sets `export_dir`. +- Environment variables: + - `ORACLE_SID` (default `PAYPRD`). + - `NLS_LANG` set to `AMERICAN_AMERICA.AL32UTF8`. +- No positional arguments. + +#### Output +- Creates `payments_.csv` in `export_dir`. +- Generates control file `payments_.ctl` with row count. +- Gzips the CSV to `payments_.csv.gz`. +- Prints log messages to stderr. +- Exits with status 0 on success, 1–4 on various failures. + +#### Core logic +- Parse options; set defaults. +- Ensure `export_dir` exists. +- Attempt export up to `MAX_RETRIES`: + - Run `run_export` to query Oracle via `sqlplus`. + - If successful, write control file, gzip CSV, log success, exit. + - On failure, log, sleep 60, retry. +- On exhausting retries, call `fail` with exit code 4. + +#### Functions +- `log` – prints timestamped message to stderr. +- `fail` – logs failure and exits with code. +- `require_tools` – checks for `sqlplus` and `gzip`. +- `run_export` – runs SQL query, writes CSV. +- `write_control` – writes row count and business day to control file. + +#### Constants and configuration +- `ORACLE_SID_DEFAULT=PAYPRD` +- `EXPORT_DIR_DEFAULT=/data/export/payments` +- `MAX_RETRIES=3` +- `attempt=0` +- `business_day=$(date +%Y%m%d)` +- `export_dir=$EXPORT_DIR_DEFAULT` + +#### Dependencies +- External commands: `sqlplus`, `gzip`. +- Oracle connection via `/ AS SYSDBA`. +- SQL query selects from `settled_payment` where `business_day = TO_DATE('$business_day', 'YYYYMMDD')`. + +#### Errors and exit codes +- `fail` exit codes: + - 1: generic failure (e.g., missing tool). + - 2: usage error. + - 3: missing required tool. + - 4: exceeded retry limit. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/package.ai.md new file mode 100644 index 00000000..f117ead6 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/shell/package.ai.md @@ -0,0 +1,44 @@ +### other/shell +- H: 1.0 +- C: 4658B0EC +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:46Z +- G: +- A: 0.0.0 +- X: package +- F: [deploy_release.sh](deploy_release.sh.ai.md) +- F: [healthcheck.sh](healthcheck.sh.ai.md) +- F: [nightly_extract.ksh](nightly_extract.ksh.ai.md) +--- +> Automates deployment, health monitoring, and nightly data extraction for a distributed payment processing system. + +#### Purpose +- Deploy release tarballs to multiple hosts, restart services, and verify health. +- Manage a queue worker’s lifecycle and health status. +- Export settled payments from Oracle nightly, producing CSVs and control files. + +#### Responsibilities +- **Deployment**: `deploy_release.sh` handles packaging, distribution, service restart, and health checks across environments. +- **Process Management**: `healthcheck.sh` provides start/stop/status/health for a queue worker, using PID and heartbeat files. +- **Data Extraction**: `nightly_extract.ksh` queries Oracle for settled payments, writes CSV, control file, and gzips output. + +#### Key units +- `deploy_release.sh` – orchestrates host‑by‑host deployment, rsync, extraction, symlink, systemctl restart, and curl health polling. +- `healthcheck.sh` – PID/heartbeat‑based worker controller (`start_worker`, `stop_worker`, `is_running`, `heartbeat_age`). +- `nightly_extract.ksh` – Oracle export driver (`run_export`, `write_control`, retry loop, gzip). + +#### Data flow +1. **Deployment**: script parses `-e`/`-t`, loads host list, rsyncs `build/$TAG.tar.gz` to each host, SSH‑executes extraction, updates `$RELEASE_ROOT/current`, restarts `orderd`, polls `http://$host:8080/health`. +2. **Health Check**: `healthcheck.sh` reads `PID_FILE`, verifies process, checks `HEARTBEAT_FILE` age, reports status or health. +3. **Nightly Extract**: script parses `-d`/`-o`, ensures export dir, runs `sqlplus` query, writes CSV, creates control file with row count, gzips CSV. + +#### Dependencies +- **External tools**: `rsync`, `ssh`, `curl`, `nohup`, `kill`, `sqlplus`, `gzip`. +- **Files**: `hosts.staging`, `hosts.production`, `build/$TAG.tar.gz`, `/usr/local/bin/queue-worker`. +- **Environment**: `DEPLOY_USER`, `SSH_KEY`, `ORACLE_SID`, `NLS_LANG`. + +#### Cross-cutting +- Strict error handling (`set -euo pipefail` in deploy, `set -e` in nightly). +- Logging via timestamped `log` functions. +- Configuration via environment variables and associative arrays. +- Health checks use heartbeat file timestamps and HTTP polling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md new file mode 100644 index 00000000..5a88f9f2 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/invoice-service-pom.xml.ai.md @@ -0,0 +1,50 @@ +### invoice-service-pom.xml +- H: 1.0 +- C: 1C5813B5 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:32Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures the Maven build for the Invoice Service module, defining dependencies, compiler settings, and build plugins. + +#### Purpose +- Builds the `invoice-service` JAR. +- Manages database migrations with Flyway. +- Sets test and runtime dependencies. + +#### Type +- Maven POM + Root element: `project` + Namespaces: `xmlns="http://maven.apache.org/POM/4.0.0"`, `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` + +#### Definitions +- **Parent**: `org.example.billing:billing-parent:2.7.0` +- **Artifact**: `invoice-service` (jar) +- **Properties**: + - `maven.compiler.release=17` + - `jackson.version=2.19.2` + - `flyway.version=11.4.0` + - `invoice.archive.dir=${project.build.directory}/archive` +- **Dependencies**: + - `com.fasterxml.jackson.core:jackson-databind:${jackson.version}` + - `org.flywaydb:flyway-core:${flyway.version}` + - `org.postgresql:postgresql` (runtime) + - `org.junit.jupiter:junit-jupiter` (test) + - `org.testcontainers:postgresql` (test) +- **Plugins**: + - `org.flywaydb:flyway-maven-plugin:${flyway.version}` + - `locations`: `filesystem:src/main/resources/db/migration` + - `org.apache.maven.plugins:maven-surefire-plugin` + - `systemPropertyVariables`: `invoice.archive.dir=${invoice.archive.dir}` +- **Profile** `native-pdf` adds dependency `org.apache.pdfbox:pdfbox:3.0.5`. + +#### Configuration +- Compiler release: `17` +- Flyway migration location: `filesystem:src/main/resources/db/migration` +- Surefire system property: `invoice.archive.dir=${invoice.archive.dir}` + +#### Dependencies +- External libraries: Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, PDFBox (profile). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/package.ai.md new file mode 100644 index 00000000..11bcdff8 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/package.ai.md @@ -0,0 +1,50 @@ +### other/xml +- H: 1.0 +- C: 1F3F74FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:50Z +- G: +- A: 0.0.0 +- X: package +- F: [invoice-service-pom.xml](invoice-service-pom.xml.ai.md) +- F: [scheduler-context.xml](scheduler-context.xml.ai.md) +- F: [shipment.xsd](shipment.xsd.ai.md) +- F: [statement-to-html.xsl](statement-to-html.xsl.ai.md) +--- +> Provides build, configuration, and data‑formatting support for an invoicing and reminder system, including Maven build, Spring scheduling, XML schema for shipments, and XSLT for statement rendering. + +#### Purpose +- Build and package the `invoice-service` JAR with database migration and optional PDF support. +- Configure a Spring reminder scheduler that sends overdue notifications. +- Define XML contracts for shipment notices and account statements. +- Transform statement XML into styled HTML. + +#### Responsibilities +- **Build & Dependency Management** – Maven POM with Flyway, Jackson, PostgreSQL, PDFBox. +- **Scheduling & Messaging** – Spring context for reminder jobs, data source, repository, mail gateway. +- **Data Validation** – XML Schema (`shipment.xsd`) for shipment notices. +- **Presentation** – XSLT (`statement-to-html.xsl`) to render statements as HTML. + +#### Key units +- `invoice-service-pom.xml` – Maven project definition, Flyway migration location, compiler release 17. +- `scheduler-context.xml` – Spring beans: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`; scheduler `reminderScheduler`. +- `shipment.xsd` – Schema for `shipmentNotice` with carrier, parcel, and address types. +- `statement-to-html.xsl` – XSLT stylesheet producing HTML from `st:statement` XML, highlighting amounts > 1000. + +#### Data flow +1. **Build**: Maven compiles source, runs Flyway migrations from `src/main/resources/db/migration`, packages JAR. +2. **Runtime**: Spring context loads `scheduler-context.xml`; `reminderScheduler` triggers `overdueReminderJob.sendDueReminders()` daily at 07:00 UTC. +3. **Shipment**: External warehouse emits `shipmentNotice` XML validated against `shipment.xsd`. +4. **Statement**: Service receives `st:statement` XML, applies `statement-to-html.xsl` to produce an HTML page. + +#### Dependencies +- **Internal**: `org.example.reminder.JdbcReminderRepository`, `SmtpMailGateway`, `OverdueReminderJob`. +- **External libraries**: Jackson Databind, Flyway Core, PostgreSQL JDBC, JUnit Jupiter, Testcontainers PostgreSQL, PDFBox (profile). +- **Frameworks**: Spring Core, Spring Context, Spring Task Scheduler. +- **Data**: PostgreSQL database for reminders; XML schemas for shipments and statements. + +#### Cross-cutting +- **Configuration**: Property placeholders (`reminder.properties`) for DB and SMTP settings. +- **Error handling**: Not explicitly defined in summaries; assumed standard Spring and JDBC exception propagation. +- **Threading**: Scheduler pool size set to 2, allowing concurrent job execution. +- **Naming conventions**: XML namespaces (`urn:example:shipment:1`, `urn:example:statement`) and XSLT parameters (`currencySymbol`, `highlightAbove`). diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md new file mode 100644 index 00000000..95dbf979 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/scheduler-context.xml.ai.md @@ -0,0 +1,47 @@ +### scheduler-context.xml +- H: 1.0 +- C: 76DD20FB +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:35Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Configures a Spring context for a reminder scheduler, defining data source, repository, mail gateway, job, and scheduled trigger. + +#### Purpose +- Wire reminder scheduler components. +- Schedule overdue reminder job. + +#### Type +- Spring context XML. +- Root element: `beans`. +- Namespaces: `http://www.springframework.org/schema/beans` (default), `http://www.springframework.org/schema/context` (`context`), `http://www.springframework.org/schema/task` (`task`). + +#### Definitions +- **Property placeholder**: `reminder.properties`. +- **Component scan**: `org.example.reminder.web`. +- **Beans**: + - `reminderDataSource` (`com.zaxxer.hikari.HikariDataSource`), properties: `jdbcUrl`, `username`, `maximumPoolSize`. + - `reminderRepository` (`org.example.reminder.JdbcReminderRepository`), constructor arg: `reminderDataSource`. + - `mailGateway` (`org.example.reminder.SmtpMailGateway`), properties: `host`, `port`. + - `overdueReminderJob` (`org.example.reminder.OverdueReminderJob`), constructor args: `reminderRepository`, `mailGateway`; property: `graceDays`. +- **Scheduler**: `reminderScheduler` (`task:scheduler`), `pool-size="2"`. +- **Scheduled task**: reference `overdueReminderJob`, method `sendDueReminders`, cron `0 0 7 * * MON-FRI`. + +#### Configuration +- `reminder.db.url` → `${reminder.db.url}` +- `reminder.db.user` → `${reminder.db.user}` +- `reminder.smtp.host` → `${reminder.smtp.host}` +- `maximumPoolSize` = `8` +- `port` = `587` +- `graceDays` = `14` +- `cron` = `0 0 7 * * MON-FRI` + +#### Dependencies +- `com.zaxxer.hikari.HikariDataSource` +- `org.example.reminder.JdbcReminderRepository` +- `org.example.reminder.SmtpMailGateway` +- `org.example.reminder.OverdueReminderJob` +- Spring `task` and `context` modules. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md new file mode 100644 index 00000000..514cb278 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/shipment.xsd.ai.md @@ -0,0 +1,37 @@ +### shipment.xsd +- H: 1.0 +- C: E7230D69 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:38Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Defines the XML schema for a shipment notice sent by a warehouse when parcels leave the building. + +#### Purpose +- Validates shipment notice documents. +- Specifies allowed carriers, parcel details, and recipient address. + +#### Type +- XML Schema (``) +- Root element: `shipmentNotice` +- Namespace: `urn:example:shipment:1` (prefix `shp`) + +#### Definitions +- **SimpleTypes** + - `CarrierCode`: enumeration of `DHL`, `UPS`, `GLS`, `POST`. + - `WeightGrams`: positive integer ≤ 31500. +- **ComplexTypes** + - `ParcelType`: sequence of `trackingNumber` (`xs:string`) and `weight` (`shp:WeightGrams`); required attribute `sequence` (`xs:positiveInteger`). + - `AddressType`: sequence of `name`, `street`, `postalCode`, `city` (`xs:string`); optional `country` (`xs:string`, default `DE`). + - `ShipmentNoticeType`: sequence of `orderReference` (`xs:string`), `shippedAt` (`xs:dateTime`), `carrier` (`shp:CarrierCode`), `recipient` (`shp:AddressType`), and one or more `parcel` (`shp:ParcelType`); required attribute `noticeId` (`xs:ID`). +- **Element** + - `shipmentNotice`: type `shp:ShipmentNoticeType`. + +#### Configuration +- `elementFormDefault="qualified"`: all elements must be namespace-qualified. + +#### Dependencies +- XML Schema namespace `http://www.w3.org/2001/XMLSchema`. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md new file mode 100644 index 00000000..c5a0ecc1 --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/other/xml/statement-to-html.xsl.ai.md @@ -0,0 +1,42 @@ +### statement-to-html.xsl +- H: 1.0 +- C: E1851E80 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:48:40Z +- G: +- A: 0.0.0 +- X: file +- P: D9E787D0 +--- +> Transforms a monthly account statement XML into an HTML page with header, rows per booking, and a total. + +#### Purpose +- Render a monthly account statement as an HTML page. +- Highlight bookings exceeding a threshold. + +#### Type +- XSLT stylesheet (`xsl:stylesheet` root). +- Namespace: `xmlns:st="urn:example:statement"`. +- Output method: `html`. + +#### Definitions +- **Parameters** + - `currencySymbol` (`'EUR'`). + - `highlightAbove` (`1000`). +- **Key** + - `bookingsByDay`: matches `st:booking` elements, indexed by `st:valueDate`. +- **Templates** + - `match="/st:statement"`: builds the overall HTML structure. + - `name="statementHeader"`: outputs account number and period. + - `match="st:booking"`: renders a table row; adds `class="large"` if `st:amount` > `$highlightAbove`. + - `name="statementTotal"`: outputs the sum of all `st:booking/st:amount`. + +#### Configuration +- `xsl:param` values: `currencySymbol='EUR'`, `highlightAbove=1000`. +- `xsl:output` method: `html`, encoding: `UTF-8`, indent: `yes`. + +#### Dependencies +- Input XML must use namespace `urn:example:statement` with elements: + - `st:statement` (attributes: `period`, child: `st:accountNumber`). + - `st:booking` (children: `st:valueDate`, `st:purpose`, `st:amount`). +- No external schemas or files referenced. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/package.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/package.ai.md new file mode 100644 index 00000000..ef45ac2a --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/package.ai.md @@ -0,0 +1,51 @@ +### ai +- H: 1.0 +- C: 865350EF +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:49:00Z +- G: +- A: 0.0.0 +- X: package +- F: [other/](other/package.ai.md) +--- +> A toolkit for aggregating web‑server logs, automating deployment and monitoring of a payment platform, and building a Java invoicing service with XML validation and HTML rendering. + +#### Purpose +- Aggregate HTTP access logs and produce host‑/status‑level summaries. +- Deploy, monitor, and nightly‑extract data for a distributed payment system. +- Build, schedule, and format invoices and shipment notices in a Java service. + +#### Responsibilities +- **Log Processing** – Perl module `LogDigest` and CLI `log_digest.pl` parse and aggregate logs, flag slow requests, and output JSON/text summaries. +- **Deployment & Monitoring** – Shell scripts `deploy_release.sh`, `healthcheck.sh`, and `nightly_extract.ksh` manage tarball distribution, service restarts, worker lifecycle, health polling, and Oracle data export. +- **Invoice Service Build & Runtime** – Maven POM compiles the `invoice-service` JAR, runs Flyway migrations; Spring context schedules overdue reminders; XML schema validates shipment notices; XSLT transforms statements to styled HTML. + +#### Key units +- `LogDigest` (Perl) – `new`, `add`, `summarize`, `top_n`; constants `MAX_LINES`, `SLOW_REQUEST_MS`. +- `log_digest.pl` – CLI entry point; options `--top`, `--level`, `--json`, `--exclude-host`. +- `deploy_release.sh` – Orchestrates rsync, SSH extraction, symlink, `systemctl restart`, health polling. +- `healthcheck.sh` – PID/heartbeat worker controller (`start_worker`, `stop_worker`, `is_running`, `heartbeat_age`). +- `nightly_extract.ksh` – Oracle export driver (`run_export`, `write_control`, retry loop, gzip). +- `invoice-service-pom.xml` – Maven project, Flyway migration path, Java 17. +- `scheduler-context.xml` – Spring beans: `reminderDataSource`, `reminderRepository`, `mailGateway`, `overdueReminderJob`; scheduler `reminderScheduler`. +- `shipment.xsd` – XML Schema for `shipmentNotice`. +- `statement-to-html.xsl` – XSLT stylesheet for `st:statement` → styled HTML. + +#### Data flow +1. **Log Aggregation** – CLI → `LogDigest` → per‑host/status totals → JSON/text output. +2. **Deployment** – `deploy_release.sh` → rsync tarball → SSH extraction → symlink update → `systemctl restart` → HTTP health check. +3. **Health Monitoring** – `healthcheck.sh` reads PID/heartbeat → reports status/health. +4. **Nightly Extraction** – `nightly_extract.ksh` runs SQL query → CSV + control file → gzip. +5. **Invoice Service** – Maven builds JAR → Flyway migrates DB → Spring scheduler triggers `OverdueReminderJob` → mail gateway sends reminders. +6. **Shipment/Statement Processing** – External XML → validated by `shipment.xsd`; service receives `st:statement` → XSLT renders HTML. + +#### Dependencies +- **Perl** – `Getopt::Long`, `JSON::PP`, `FindBin`, `POSIX`, `List::Util`, `Carp`, `Exporter`. +- **Shell** – `rsync`, `ssh`, `curl`, `nohup`, `kill`, `sqlplus`, `gzip`; environment vars `DEPLOY_USER`, `SSH_KEY`, `ORACLE_SID`, `NLS_LANG`. +- **Java** – Maven, Flyway Core, Jackson Databind, PostgreSQL JDBC, PDFBox (profile), Spring Core/Context/Scheduler, JUnit Jupiter, Testcontainers PostgreSQL. + +#### Cross-cutting +- Consistent error handling (`croak`/`die`, `set -euo pipefail`). +- Configuration via files (`/etc/log-digest.conf`, `hosts.*`, `reminder.properties`) and environment variables. +- Host normalization in `LogDigest`; heartbeat file timestamps for worker health. +- Scheduler pool size 2 for concurrent job execution; XML namespaces and XSLT parameters for styling. diff --git a/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/project.ai.md b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/project.ai.md new file mode 100644 index 00000000..de113d6f --- /dev/null +++ b/docs/ai-index-benchmark/remeasure-2026-11-04b/languages/run9/out/gpt-oss-20b/project.ai.md @@ -0,0 +1,25 @@ +### srcmorph-modelcard +- H: 1.0 +- C: 98D1E8A1 +- D: 2026-11-02T16:51:10Z +- T: 2026-11-04T12:49:06Z +- G: +- A: 0.0.0 +- X: project +- F: [other](other/package.ai.md) +- F: [other/perl](other/perl/package.ai.md) +- F: [other/shell](other/shell/package.ai.md) +- F: [other/xml](other/xml/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of srcmorph-modelcard: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project centers on a payment platform that aggregates web‑server logs, automates deployment, and monitors system health. It provides a Perl‑based CLI for summarizing access logs by host and status, highlighting slow requests, while shell scripts handle nightly data extraction and health checks. A Java invoicing service is built on Maven and Spring, using XML schemas for shipments and XSLT for statement rendering, with built‑in XML validation and HTML output. Together, these subsystems enable end‑to‑end processing from log collection to invoicing and reporting. + +#### Packages +- other — A collection of scripts and modules that aggregate web‑server logs, automate deployment and health checks for a payment system, and build a Java invoicing service with XML validation and HTML rendering. +- other/perl — Condenses web‑server access logs into per‑host and per‑status summaries, highlighting slow requests and providing a CLI for reporting. +- other/shell — Automates deployment, health monitoring, and nightly data extraction for a distributed payment processing system. +- other/xml — Provides build, configuration, and data‑formatting support for an invoicing and reminder system, including Maven build, Spring scheduling, XML schema for shipments, and XSLT for statement rendering. +- . — A toolkit for aggregating web‑server logs, automating deployment and monitoring of a payment platform, and building a Java invoicing service with XML validation and HTML rendering. diff --git a/docs/ai-index-benchmark/tools/agentic-bench.sh b/docs/ai-index-benchmark/tools/agentic-bench.sh index 5b209fc5..5018b833 100644 --- a/docs/ai-index-benchmark/tools/agentic-bench.sh +++ b/docs/ai-index-benchmark/tools/agentic-bench.sh @@ -6,8 +6,8 @@ # Agentic reaction-time bench for local GGUF models via llama-server (tool-calling). # Usage: agentic_bench.sh [model2.gguf ...] set -uo pipefail -LS="/c/Users/berna/AppData/Local/Microsoft/WinGet/Packages/ggml.llamacpp_Microsoft.Winget.Source_8wekyb3d8bbwe/llama-server.exe" -MODELDIR="X:/Modelle" +LS="${LLAMA_SERVER:-llama-server}" # llama-server: on the PATH unless LLAMA_SERVER names it +MODELDIR="${MODELDIR:-M:/Modelle}" PORT=8090 HERE="$(dirname "$0")" OUT="$1"; shift diff --git a/docs/ai-index-benchmark/tools/agentic-cpu-ctx.sh b/docs/ai-index-benchmark/tools/agentic-cpu-ctx.sh index 0b8912b0..ffae17ef 100644 --- a/docs/ai-index-benchmark/tools/agentic-cpu-ctx.sh +++ b/docs/ai-index-benchmark/tools/agentic-cpu-ctx.sh @@ -7,8 +7,8 @@ # then measures a tool-call at several context sizes. # Usage: agentic_cpu_ctx.sh [ ...] set -uo pipefail -LS="/c/Users/berna/AppData/Local/Microsoft/WinGet/Packages/ggml.llamacpp_Microsoft.Winget.Source_8wekyb3d8bbwe/llama-server.exe" -MODELDIR="X:/Modelle"; PORT=8090; HERE="$(dirname "$0")" +LS="${LLAMA_SERVER:-llama-server}" # llama-server: on the PATH unless LLAMA_SERVER names it +MODELDIR="${MODELDIR:-M:/Modelle}"; PORT=8090; HERE="$(dirname "$0")" OUT="$1"; shift EXPECT="run_tests" FILL_LEVELS="${FILL_LEVELS:-512 3072 16384}" # override via env for finer sweeps diff --git a/docs/copilot-api-gateway.md b/docs/copilot-api-gateway.md index da563a12..a1045aae 100644 --- a/docs/copilot-api-gateway.md +++ b/docs/copilot-api-gateway.md @@ -90,8 +90,13 @@ aiDefinitions: [`examples/copilot-api-gateway/srcmorph-luna.yaml`](../examples/copilot-api-gateway/srcmorph-luna.yaml) is the full form with one model: GPT-6 Luna (`remoteModel: gpt-6-luna`, `contextSize: 120000` as in the measured run below) for every file, package and the project, a rule per kind of source with -its prompt and exact fact counters (Java, SQL, shell, Perl, POM, XML; every other file takes the -fallback rule, for which profile v3 has no counters), and `onOversize: mapReduce` on every rule, the +its prompt and exact fact counters (Java, SQL, shell, Perl, POM and XML, and the enterprise kinds: +Jakarta EE code and descriptors, JPA and MyBatis mappings, Camel and other integration routes, BPMN, +DMN, WSDL, JSP and Facelets views, OpenAPI, AsyncAPI, Protobuf, Avro and GraphQL contracts, Kotlin, +Groovy and Scala, GitHub Actions, Kubernetes, Docker, Compose, Ansible, Terraform, Gradle, +properties, PowerShell and batch files; every other YAML takes the ops rule without counters, every +other file the fallback rule), a rule that skips the files holding credentials, and +`onOversize: mapReduce` on every rule, the package and project rules too, so an input larger than the window is read chunk by chunk, one request per chunk, never sampled. It indexes the whole project (`subtrees: "."`, without `target/`, `.git/`, `.idea/`, `node_modules/` and the other tool directories its `excludes` name). diff --git a/docs/windows-intel-core-ultra.md b/docs/windows-intel-core-ultra.md index d7b85b87..7ffeb505 100644 --- a/docs/windows-intel-core-ultra.md +++ b/docs/windows-intel-core-ultra.md @@ -24,8 +24,10 @@ covers every OS, CPU and GPU. Yours carries only the natives of this machine (32 below) and the GPU module you choose. > [!NOTE] -> This is for **srcmorph 1.4.0** (on `net.ladenthin:llama` 6.0.0); both resolve from Maven Central. -> For 1.3.0, read this page at the `v1.3.0` tag: its configuration keys differ. +> The jar's `pom.xml` takes **srcmorph 1.4.0** (on `net.ladenthin:llama` 6.0.0), both from Maven +> Central; the configuration files on `main` need the next release: until it is out, `mvn install` +> the reactor and pass `-Dsrcmorph.version=1.5.0-SNAPSHOT`, or read this page at the `v1.4.0` tag. +> For 1.3.0, read it at the `v1.3.0` tag: its configuration keys differ. ## Step 1 — pick the GPU module, build the jar diff --git a/examples/build-your-own-jar/pom.xml b/examples/build-your-own-jar/pom.xml index 62ecee48..d32ac799 100644 --- a/examples/build-your-own-jar/pom.xml +++ b/examples/build-your-own-jar/pom.xml @@ -27,10 +27,11 @@ SPDX-License-Identifier: MIT OR Apache-2.0 jar - + 1.4.0 6.0.0 UTF-8 diff --git a/examples/build-your-own-jar/srcmorph.yaml b/examples/build-your-own-jar/srcmorph.yaml index 4df2bba7..dd1d55b4 100644 --- a/examples/build-your-own-jar/srcmorph.yaml +++ b/examples/build-your-own-jar/srcmorph.yaml @@ -66,6 +66,17 @@ srcMorph: - "**/package-info.java" - "**/module-info.java" + # When a summary is rewritten. force: true rewrites every one. Otherwise a summary is rewritten when + # it is missing or empty, its aiVersion changed, or a change below whose switch is true (each one is + # by default); false keeps the summary and records the new value at its next rewrite. + force: false + regenerateOn: + source: true # C: the file's source, a package's files, the project's packages + prompt: true # P: the rule's prompts, its map and reduce prompts too + facts: true # N: the rule's fact counters + model: true # M: the rule's model (definition key, remoteModel, model file) + children: true # K: the summaries a package or the project is written from + generationProvider: llamacpp-jni # "mock" runs without a model, for a dry test of the setup modelDirectory: "/path/to/models" # a relative modelPath below is relative to this directory @@ -126,8 +137,29 @@ srcMorph: # By priority, the most specific wins: huge (>1 MB) -> H-1B over sampled chunks, big # (~275 KB .. 1 MB) -> H-Tiny map-reduce, then gpt-oss for Java, SQL and every other file. fieldGenerations: + # Files that hold credentials are never sent to a model, whatever their extension: the highest + # priority, so no other rule takes them. The prompts name a secret and never copy it; this keeps + # the file out altogether. fileNames match the name in any case. + - id: secrets + skip: true + priority: 1000 + condition: + fileNames: + - ".env" + - ".env.*" + - "*.tfvars" + - "*.tfstate" + - "*.tfstate.backup" + - "settings.xml" # Maven: server passwords + - "settings-security.xml" + - "*.pem" + - "*.key" + - "id_rsa*" + - "id_ed25519*" + - "vault*.{yml,yaml}" + - "*{secret,secrets,credential,credentials}*.{yml,yaml,properties,json,xml,conf,env}" - id: huge-java - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: granite-4.0-h-1b-fastchunk priority: 200 mapPromptKey: map-chunk @@ -156,7 +188,7 @@ srcMorph: - extensions: [".sql"] - size: {min: 1000000} - id: big-java - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: granite-4.0-h-tiny-mapreduce priority: 100 mapPromptKey: map-chunk @@ -182,7 +214,7 @@ srcMorph: - extensions: [".sql"] - size: {min: 275000} - id: java - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: gpt-oss-20B-mxfp4 factsKey: java-facts condition: diff --git a/examples/config_All.json b/examples/config_All.json index 901f7200..38974429 100644 --- a/examples/config_All.json +++ b/examples/config_All.json @@ -40,7 +40,7 @@ "fieldGenerations": [ { "id": "java", - "promptKey": "file-body-java", + "promptKey": "file-body-oop", "aiDefinitionKey": "mock-model", "condition": { "extensions": [ diff --git a/examples/config_GenerateFileIndex.yaml b/examples/config_GenerateFileIndex.yaml index 27d4c8ee..e7c95acb 100644 --- a/examples/config_GenerateFileIndex.yaml +++ b/examples/config_GenerateFileIndex.yaml @@ -6,6 +6,17 @@ srcMorph: - "src/main/java" fileExtensions: - ".java" + # When a summary is rewritten. force: true rewrites every one. Otherwise a summary is rewritten when + # it is missing or empty, its aiVersion changed, or a change below whose switch is true (each one is + # by default); false keeps the summary and records the new value at its next rewrite. + force: false + regenerateOn: + source: true # C: the file's source, a package's files, the project's packages + prompt: true # P: the rule's prompts, its map and reduce prompts too + facts: true # N: the rule's fact counters + model: true # M: the rule's model (definition key, remoteModel, model file) + children: true # K: the summaries a package or the project is written from + generationProvider: mock profileDirectory: "../profiles/v3" # the measured prompts of this repository, see profiles/README.md aiDefinitions: diff --git a/examples/copilot-api-gateway/srcmorph-luna.yaml b/examples/copilot-api-gateway/srcmorph-luna.yaml index 72883a0f..cb1349fa 100644 --- a/examples/copilot-api-gateway/srcmorph-luna.yaml +++ b/examples/copilot-api-gateway/srcmorph-luna.yaml @@ -39,8 +39,8 @@ srcMorph: outputDirectory: "/path/to/project/target/srcmorph-ai" subtrees: - "." # the whole project, the root pom.xml too - # A kind without an extension here is not indexed. C, Python, JavaScript and every other kind - # without a prompt of its own take the fallback rule. + # A kind without an extension here (or a name under fileNames) is not indexed. C, Python, + # JavaScript and every other kind without a prompt of its own take the fallback rule. fileExtensions: - ".java" - ".sql" @@ -60,9 +60,56 @@ srcMorph: - ".xslt" - ".wsdl" - ".xhtml" + - ".kt" + - ".kts" + - ".groovy" + - ".gvy" + - ".gradle" + - ".scala" + - ".jsp" + - ".jspf" + - ".jspx" + - ".tag" + - ".tagx" + - ".bpmn" + - ".dmn" + - ".yml" + - ".yaml" + - ".proto" + - ".avsc" + - ".graphql" + - ".graphqls" + - ".gql" + - ".tf" + - ".hcl" + - ".properties" + - ".ps1" + - ".psm1" + - ".bat" + - ".cmd" - ".py" - ".c" - ".h" + # Files without an extension, or with one not listed above, by name (globs, any case). + fileNames: + - "Dockerfile" + - "Dockerfile.*" + - "*.dockerfile" + - "Containerfile" + - "Jenkinsfile" + - "openapi*.json" + - "swagger*.json" + - "asyncapi*.json" + # Scripts without an extension (bin/deploy, a Git hook), by the interpreter their #! line names; a + # name also matches its versions (python matches python3 and python3.12). + fileInterpreters: + - "bash" + - "sh" + - "ksh" + - "zsh" + - "dash" + - "perl" + - "python" # Globs against the path below baseDirectory, "/" as separator; "**/" matches no directory too, so # "**/target/**" excludes target/ at the root and the target/ of every module. excludes: @@ -76,6 +123,18 @@ srcMorph: - "**/node_modules/**" - "**/.claude/**" # agent worktrees: a second copy of the sources + # When a summary is rewritten. force: true rewrites every one. Otherwise a summary is rewritten when + # it is missing or empty, its aiVersion changed, or a change below whose switch is true (each one is + # by default); false keeps the summary and records the new value at its next rewrite. Every rewrite + # is one request of the plan's quota: after a prompt edit, prompt: false keeps the old summaries. + force: false + regenerateOn: + source: true # C: the file's source, a package's files, the project's packages + prompt: true # P: the rule's prompts, its map and reduce prompts too + facts: true # N: the rule's fact counters + model: true # M: the rule's model (definition key, remoteModel, model file) + children: true # K: the summaries a package or the project is written from + generationProvider: openai-compatible # The profile (profiles/README.md), relative to this file's directory: a rule's promptKey names @@ -102,8 +161,29 @@ srcMorph: # read chunk by chunk (mapReduce): Luna named every name planted in the middle of a 1.6 MB SQL dump, # an 870 KB XML catalog and a 283 KB Java enum in three of three runs (MODEL-CARD finding 7). fieldGenerations: + # Files that hold credentials are never sent to a model, whatever their extension: the highest + # priority, so no other rule takes them. The prompts name a secret and never copy it; this keeps + # the file out altogether. fileNames match the name in any case. + - id: secrets + skip: true + priority: 1000 + condition: + fileNames: + - ".env" + - ".env.*" + - "*.tfvars" + - "*.tfstate" + - "*.tfstate.backup" + - "settings.xml" # Maven: server passwords + - "settings-security.xml" + - "*.pem" + - "*.key" + - "id_rsa*" + - "id_ed25519*" + - "vault*.{yml,yaml}" + - "*{secret,secrets,credential,credentials}*.{yml,yaml,properties,json,xml,conf,env}" - id: java - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: luna factsKey: java-facts onOversize: mapReduce @@ -128,7 +208,10 @@ srcMorph: mapPromptKey: map-chunk reducePromptKey: reduce-parts condition: - extensions: [".sh", ".bash", ".ksh", ".zsh", ".bats"] + or: + conditions: + - extensions: [".sh", ".bash", ".ksh", ".zsh", ".bats"] + - interpreters: ["bash", "sh", "ksh", "zsh", "dash"] - id: perl promptKey: file-body-perl aiDefinitionKey: luna @@ -137,7 +220,10 @@ srcMorph: mapPromptKey: map-chunk reducePromptKey: reduce-parts condition: - extensions: [".pl", ".pm", ".t", ".cgi", ".psgi"] + or: + conditions: + - extensions: [".pl", ".pm", ".t", ".cgi", ".psgi"] + - interpreters: ["perl"] - id: pom # matches xml too; the priority gives a POM the Maven counters promptKey: file-body-xml aiDefinitionKey: luna @@ -156,7 +242,332 @@ srcMorph: mapPromptKey: map-chunk reducePromptKey: reduce-parts condition: - extensions: [".xml", ".xsd", ".xsl", ".xslt", ".wsdl", ".xhtml"] + extensions: [".xml", ".xsd", ".xsl", ".xslt"] # .wsdl and .xhtml have rules of their own + - id: java-ee # Java using Jakarta EE: the EE counters too + promptKey: file-body-oop + aiDefinitionKey: luna + priority: 10 + factsKey: java-ee-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + and: + conditions: + - extensions: [".java"] + # an import, or an annotation written with its package and no import + - contentMatches: '(?m)(?:^import[ \t]+(?:static[ \t]+)?|@)(?:javax|jakarta)\.(?:ejb|persistence|ws\.rs|servlet|jws|xml\.ws|inject|transaction|enterprise|annotation\.security)\.' + - id: kotlin # the prompt Java, Kotlin, Groovy, Scala share + promptKey: file-body-oop + aiDefinitionKey: luna + factsKey: kotlin-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".kt", ".kts"] + - id: groovy + promptKey: file-body-oop + aiDefinitionKey: luna + factsKey: groovy-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".groovy", ".gvy"] + - id: scala + promptKey: file-body-oop + aiDefinitionKey: luna + factsKey: scala-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".scala"] + - id: jee # Jakarta EE descriptors + promptKey: file-body-xml + aiDefinitionKey: luna + priority: 10 + factsKey: jee-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + fileNames: ["web.xml", "web-fragment.xml", "ejb-jar.xml", "application.xml"] + - id: persistence + promptKey: file-body-xml + aiDefinitionKey: luna + priority: 10 + factsKey: persistence-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + fileNames: ["persistence.xml", "orm.xml", "*.hbm.xml"] + - id: mybatis + promptKey: file-body-xml + aiDefinitionKey: luna + priority: 10 + factsKey: mybatis-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + and: + conditions: + - extensions: [".xml"] + - contentMatches: 'mybatis\.org//DTD Mapper' + - id: integration # Camel, Spring Integration, Mule, Synapse + promptKey: file-body-xml + aiDefinitionKey: luna + priority: 10 + factsKey: integration-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + and: + conditions: + - extensions: [".xml"] + - contentMatches: 'camel\.apache\.org/schema|springframework\.org/schema/integration|mulesoft\.org/schema/mule|ws\.apache\.org/ns/synapse' + - id: bpmn + promptKey: file-body-xml + aiDefinitionKey: luna + priority: 10 + factsKey: bpmn-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".bpmn"] + - id: dmn + promptKey: file-body-xml + aiDefinitionKey: luna + priority: 10 + factsKey: dmn-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".dmn"] + - id: wsdl + promptKey: file-body-xml + aiDefinitionKey: luna + priority: 10 + factsKey: wsdl-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".wsdl"] + - id: jsp + promptKey: file-body-view + aiDefinitionKey: luna + factsKey: jsp-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".jsp", ".jspf", ".jspx", ".tag", ".tagx"] + - id: facelets + promptKey: file-body-view + aiDefinitionKey: luna + factsKey: facelets-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".xhtml"] + - id: openapi + promptKey: file-body-contract + aiDefinitionKey: luna + priority: 10 + factsKey: openapi-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + or: + conditions: + - and: + conditions: + - extensions: [".yml", ".yaml"] + - contentMatches: '(?m)^["'']?(?:openapi|swagger)["'']?[ \t]*:' + - fileNames: ["openapi*.json", "swagger*.json"] + - id: asyncapi + promptKey: file-body-contract + aiDefinitionKey: luna + priority: 10 + factsKey: asyncapi-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + or: + conditions: + - and: + conditions: + - extensions: [".yml", ".yaml"] + - contentMatches: '(?m)^["'']?asyncapi["'']?[ \t]*:' + - fileNames: ["asyncapi*.json"] + - id: proto + promptKey: file-body-contract + aiDefinitionKey: luna + factsKey: proto-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".proto"] + - id: avro + promptKey: file-body-contract + aiDefinitionKey: luna + factsKey: avro-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".avsc"] + - id: graphql + promptKey: file-body-contract + aiDefinitionKey: luna + factsKey: graphql-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".graphql", ".graphqls", ".gql"] + - id: actions + promptKey: file-body-ops + aiDefinitionKey: luna + priority: 10 + factsKey: actions-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + pathGlob: "**/.github/{workflows,actions}/**/*.{yml,yaml}" + - id: camel-yaml # Camel routes in the YAML DSL + promptKey: file-body-ops + aiDefinitionKey: luna + priority: 10 + factsKey: camel-yaml-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + and: + conditions: + - extensions: [".yml", ".yaml"] + - contentMatches: '(?m)^-[ \t]+(?:route|routeTemplate|from|rest)[ \t]*:' + - id: k8s # Kubernetes manifests and Helm templates + promptKey: file-body-ops + aiDefinitionKey: luna + priority: 5 + factsKey: k8s-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + and: + conditions: + - extensions: [".yml", ".yaml"] + - contentMatches: '(?m)^kind:[ \t]*[A-Z]' + - id: dockerfile + promptKey: file-body-ops + aiDefinitionKey: luna + factsKey: dockerfile-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + fileNames: ["Dockerfile", "Dockerfile.*", "*.dockerfile", "Containerfile"] + - id: compose + promptKey: file-body-ops + aiDefinitionKey: luna + priority: 10 + factsKey: compose-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + fileNames: ["docker-compose*.{yml,yaml}", "compose*.{yml,yaml}"] + - id: ansible # playbooks and the YAML of a role + promptKey: file-body-ops + aiDefinitionKey: luna + priority: 5 + factsKey: ansible-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + or: + conditions: + - pathGlob: "**/roles/*/{tasks,handlers,defaults,vars,meta}/*.{yml,yaml}" + - and: + conditions: + - extensions: [".yml", ".yaml"] + - contentMatches: '(?m)^-[ \t]++(?:name[ \t]*+:[^\n]*+\n[ \t]++)?hosts[ \t]*+:' + - id: terraform + promptKey: file-body-ops + aiDefinitionKey: luna + factsKey: terraform-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".tf", ".hcl"] + - id: gradle # build scripts of both DSLs; .gradle.kts over the Kotlin rule + promptKey: file-body-ops + aiDefinitionKey: luna + priority: 10 + factsKey: gradle-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + or: + conditions: + - extensions: [".gradle"] + - fileNames: ["*.gradle.kts"] + - id: properties + promptKey: file-body-ops + aiDefinitionKey: luna + factsKey: properties-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".properties"] + - id: powershell # no prompt of its own: the fallback prompt with counters + promptKey: file-body-fallback + aiDefinitionKey: luna + factsKey: powershell-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".ps1", ".psm1"] + - id: batch + promptKey: file-body-fallback + aiDefinitionKey: luna + factsKey: batch-facts + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + extensions: [".bat", ".cmd"] + - id: ops # every other YAML, Jenkinsfile + promptKey: file-body-ops + aiDefinitionKey: luna + onOversize: mapReduce + mapPromptKey: map-chunk + reducePromptKey: reduce-parts + condition: + or: + conditions: + - extensions: [".yml", ".yaml"] + - fileNames: ["Jenkinsfile", ".gitlab-ci.yml"] - id: fallback # every other file; profile v3 has no counters for it promptKey: file-body-fallback aiDefinitionKey: luna diff --git a/examples/copilot-api-gateway/srcmorph.yaml b/examples/copilot-api-gateway/srcmorph.yaml index c450cf01..9ee4ed58 100644 --- a/examples/copilot-api-gateway/srcmorph.yaml +++ b/examples/copilot-api-gateway/srcmorph.yaml @@ -25,6 +25,17 @@ srcMorph: fileExtensions: - ".java" + # When a summary is rewritten. force: true rewrites every one. Otherwise a summary is rewritten when + # it is missing or empty, its aiVersion changed, or a change below whose switch is true (each one is + # by default); false keeps the summary and records the new value at its next rewrite. + force: false + regenerateOn: + source: true # C: the file's source, a package's files, the project's packages + prompt: true # P: the rule's prompts, its map and reduce prompts too + facts: true # N: the rule's fact counters + model: true # M: the rule's model (definition key, remoteModel, model file) + children: true # K: the summaries a package or the project is written from + generationProvider: openai-compatible # The profile: the measured prompts of this repository (profiles/README.md), one file per key. A @@ -45,7 +56,7 @@ srcMorph: temperature: 0.2 fieldGenerations: - - promptKey: file-body-java + - promptKey: file-body-oop aiDefinitionKey: copilot fallback: true # the rule for every file no other rule matches onOversize: sample # default "fail" stops the run on a file larger than the window diff --git a/profiles/README.md b/profiles/README.md index 93f28400..98e2b2bd 100644 --- a/profiles/README.md +++ b/profiles/README.md @@ -11,11 +11,14 @@ handed on as a whole. | File | Key | For | |---|---|---| -| [`v3/file-body-java.md`](v3/file-body-java.md) | `promptKey: file-body-java` | one Java source file | +| [`v3/file-body-oop.md`](v3/file-body-oop.md) | `promptKey: file-body-oop` | one source file of a class-based language: Java, Kotlin, Groovy, Scala | +| [`v3/file-body-view.md`](v3/file-body-view.md) | `promptKey: file-body-view` | one server-side view: JSP, JSP fragment, tag file, Facelets | +| [`v3/file-body-contract.md`](v3/file-body-contract.md) | `promptKey: file-body-contract` | one API contract: OpenAPI, AsyncAPI, JSON Schema, Avro, Protobuf, GraphQL | +| [`v3/file-body-ops.md`](v3/file-body-ops.md) | `promptKey: file-body-ops` | one build, deploy or configuration file: CI, Dockerfile, Compose, Kubernetes, Helm, Ansible, Terraform | | [`v3/file-body-sql.md`](v3/file-body-sql.md) | `promptKey: file-body-sql` | one SQL file, as schema | | [`v3/file-body-shell.md`](v3/file-body-shell.md) | `promptKey: file-body-shell` | one Bash, POSIX sh or ksh93 script | | [`v3/file-body-perl.md`](v3/file-body-perl.md) | `promptKey: file-body-perl` | one Perl script or module | -| [`v3/file-body-xml.md`](v3/file-body-xml.md) | `promptKey: file-body-xml` | one XML file: a POM, a Spring context, an XSD, an XSLT | +| [`v3/file-body-xml.md`](v3/file-body-xml.md) | `promptKey: file-body-xml` | one XML file: a POM, a Spring context, a Jakarta EE descriptor, a JPA, Hibernate or MyBatis mapping, an integration route, BPMN or DMN, WSDL, an XSD, an XSLT | | [`v3/file-body-fallback.md`](v3/file-body-fallback.md) | `promptKey: file-body-fallback` | any other source file | | [`v3/package-body.md`](v3/package-body.md) | `promptKey: package-body` | a package, from its file summaries | | [`v3/project-body.md`](v3/project-body.md) | `promptKey: project-body` | the project overview, from the package leads | @@ -27,16 +30,32 @@ handed on as a whole. | [`v3/perl-facts.tsv`](v3/perl-facts.tsv) | `factsKey: perl-facts` | the same for Perl scripts and modules | | [`v3/xml-facts.tsv`](v3/xml-facts.tsv) | `factsKey: xml-facts` | the same for XML, XSD and XSLT files | | [`v3/pom-facts.tsv`](v3/pom-facts.tsv) | `factsKey: pom-facts` | the same for Maven POMs (a rule matching `**/*pom.xml`) | +| [`v3/kotlin-facts.tsv`](v3/kotlin-facts.tsv), [`v3/groovy-facts.tsv`](v3/groovy-facts.tsv), [`v3/scala-facts.tsv`](v3/scala-facts.tsv) | `factsKey: kotlin-facts`, `groovy-facts`, `scala-facts` | Kotlin; Groovy and Spock specifications; Scala 2 and 3 (with `file-body-oop`) | +| [`v3/java-ee-facts.tsv`](v3/java-ee-facts.tsv) | `factsKey: java-ee-facts` | `java-facts` plus the EJB, JPA, CDI, JAX-RS, JAX-WS, Servlet, JTA and security annotations | +| [`v3/jee-facts.tsv`](v3/jee-facts.tsv), [`v3/persistence-facts.tsv`](v3/persistence-facts.tsv), [`v3/mybatis-facts.tsv`](v3/mybatis-facts.tsv) | `factsKey: jee-facts`, `persistence-facts`, `mybatis-facts` | `web.xml`, `ejb-jar.xml`, `application.xml`; `persistence.xml`, `orm.xml`, `*.hbm.xml`; MyBatis mappers | +| [`v3/integration-facts.tsv`](v3/integration-facts.tsv), [`v3/bpmn-facts.tsv`](v3/bpmn-facts.tsv), [`v3/dmn-facts.tsv`](v3/dmn-facts.tsv), [`v3/wsdl-facts.tsv`](v3/wsdl-facts.tsv) | `factsKey: integration-facts`, `bpmn-facts`, `dmn-facts`, `wsdl-facts` | Camel, Spring Integration, Mule and Synapse routes; BPMN processes; DMN decisions (inputs, outputs, rules, hit policies); WSDL | +| [`v3/jsp-facts.tsv`](v3/jsp-facts.tsv), [`v3/facelets-facts.tsv`](v3/facelets-facts.tsv) | `factsKey: jsp-facts`, `facelets-facts` | JSP and tag files; Facelets views (with `file-body-view`) | +| [`v3/openapi-facts.tsv`](v3/openapi-facts.tsv), [`v3/asyncapi-facts.tsv`](v3/asyncapi-facts.tsv) | `factsKey: openapi-facts`, `asyncapi-facts` | OpenAPI and Swagger; AsyncAPI 2 and 3; YAML or JSON (with `file-body-contract`) | +| [`v3/proto-facts.tsv`](v3/proto-facts.tsv), [`v3/avro-facts.tsv`](v3/avro-facts.tsv), [`v3/graphql-facts.tsv`](v3/graphql-facts.tsv) | `factsKey: proto-facts`, `avro-facts`, `graphql-facts` | Protocol Buffers; Avro schemas (`.avsc`); GraphQL schemas and operations (with `file-body-contract`) | +| [`v3/k8s-facts.tsv`](v3/k8s-facts.tsv), [`v3/actions-facts.tsv`](v3/actions-facts.tsv), [`v3/dockerfile-facts.tsv`](v3/dockerfile-facts.tsv) | `factsKey: k8s-facts`, `actions-facts`, `dockerfile-facts` | Kubernetes and Helm; GitHub Actions; Dockerfiles (with `file-body-ops`) | +| [`v3/compose-facts.tsv`](v3/compose-facts.tsv), [`v3/ansible-facts.tsv`](v3/ansible-facts.tsv), [`v3/terraform-facts.tsv`](v3/terraform-facts.tsv), [`v3/camel-yaml-facts.tsv`](v3/camel-yaml-facts.tsv) | `factsKey: compose-facts`, `ansible-facts`, `terraform-facts`, `camel-yaml-facts` | Docker Compose; Ansible playbooks and roles; Terraform, OpenTofu and Terragrunt; Camel's YAML DSL (with `file-body-ops`) | +| [`v3/gradle-facts.tsv`](v3/gradle-facts.tsv), [`v3/properties-facts.tsv`](v3/properties-facts.tsv) | `factsKey: gradle-facts`, `properties-facts` | Gradle build and settings scripts, Groovy and Kotlin DSL; Java `.properties` files (with `file-body-ops`) | +| [`v3/powershell-facts.tsv`](v3/powershell-facts.tsv), [`v3/batch-facts.tsv`](v3/batch-facts.tsv) | `factsKey: powershell-facts`, `batch-facts` | PowerShell scripts and modules; Windows batch files (with `file-body-fallback`: no prompt of their own) | ## Prompt files A `.md` file is the **system prompt** of its key, sent verbatim: no placeholders, no license header -(it would reach the model). srcmorph sends the file or package name and the source (or the child -summaries) as a separate user message. Each file starts with a domain lead line, then fixed `####` +(it would reach the model). srcmorph sends the file's path below the base directory (a package's +name) and the source (or the child summaries) as a separate user message, so two `web.xml` of +different modules read apart. Each file starts with a domain lead line, then fixed `####` sections (Purpose, Type, Input, Output, Core logic, Public API, Dependencies, Exceptions, Concurrency for Java; Schema, Reads, Writes, Relationships, Routine logic for SQL; Constants and configuration for shell, Perl and other files; Definitions, Configuration and Dependencies for XML), with the rules against code fences, `###` headings and invented names, and the "index -only what is literally present" guard for truncated sources. +only what is literally present" guard for truncated sources. Every file prompt has the same secrets +rule: a password, private key, token, API key or credentials in a URL is named, its value written as +`***`. A configuration keeps the files that hold credentials away from the model altogether with a +`skip` rule; the examples and the self-test carry one (`id: secrets`: `.env`, `*.tfvars`, +`*.tfstate`, Maven's `settings.xml`, keys, `*secret*` and `*credential*` configuration files). `map-chunk.md` and `reduce-parts.md` (keys `map-chunk`, `reduce-parts`) are not prompts of their own: a rule's `mapPromptKey` and `reducePromptKey` append them to its prompt (after a blank line) in the map and the reduce calls of @@ -52,9 +71,18 @@ and writes them as one line before the AI summary, for example sampled or chunked summary cannot count reliably, these lines can. Every pattern is compiled when the run starts, so a broken one fails it with the file and line. +A line `[include]` puts the counters of `.tsv` of the profile directory at its place, +its `[ignore]` lines included: `jee-facts` is `xml-facts` plus the descriptor counters, +`java-ee-facts` is `java-facts` plus the annotations, so a kind that extends another adds its own +counters and copies none. An included file may include others; one that includes itself, also +through others, fails the run naming the chain, and so does a label that two of the files use. A +label must not start with `#`, which makes the line a comment. + A label starting with `[ignore]` marks a region instead of a counter: its matches are blanked out -before the other counters count, every character except the line breaks, so `^` anchors and line -counts see the same lines as before. That is how a sub named in Perl's POD, a function or a `set -e` +before the other counters count: a region over several lines keeps only its line breaks, so `^` +anchors and line counts see the same lines as before, and a region within one line becomes one +space, so the words around it stay apart, or nothing at the start of a line, so the line still +starts with what follows it (`/* x */class A` counts for `^class`). That is how a sub named in Perl's POD, a function or a `set -e` in a shell heredoc, a commented-out POM dependency or an `INSERT` inside a SQL block comment stays out of the counts. An ignore line is not reported. The prefix may be written in any case; any other label starting with `[` is refused as an unknown marker. In a configuration the same is a counter @@ -62,11 +90,31 @@ with `ignore: true`, and its label must not start with `[`. A configuration's `f are held to the same rules: a label and a pattern on every counter, no label twice, and at least one counter that is not an ignore counter. +Two more markers open a counter's label, in any order and case. `[raw]` counts the source as written, +before any ignore line blanked it: a marker that lives in comments, `java-facts`' `TODO/FIXME` and +PowerShell's `#Requires`, counts next to counters that skip comments. `[distinct]` counts the +different texts a pattern matched instead of its matches: the first group of the pattern where it +took part, the whole match otherwise, so twelve `@Inject Clock` fields are one injected type where a +plain counter counts twelve injection points. In a configuration they are `raw: true` and +`distinct: true`; an ignore counter is neither (it counts nothing). A summary written before these +markers existed keeps its facts hash: they enter it only where set. + +Every pattern has a time limit, counted in characters the matcher reads rather than in seconds, so +it holds the same on every machine: 2,000 per character of the source plus 1,000,000. The patterns +here read at most about 830 per character, `java-facts`' field initializer (read up to 10,000 +characters) over a file of nothing but `public a b=` lines, most of them a few +(`ProfileFactPatternsLinearityTest` asserts that none reaches the limit), so it stops only a +pattern that backtracks without end, a nested quantifier or a lazy scan for a closer that never +comes, in a counter of your own: that counter is left out of +the facts line, an ignore counter blanks nothing, and the run logs a warning naming it. A +backtracking pattern therefore costs at most that many reads per file instead of hanging the run. + Several ignore lines blank in file order, each over the text the one before left, so a region that can hold another one's opener (a `) is sent to the browser and its <% %> still runs on the +# server, so it is kept. A JSP comment that is never closed runs to the end of the file. "scriptlets" +# counts <% blocks that are neither directives, expressions, declarations nor comments; "prefixed +# tags" every opening tag with a namespace prefix (JSTL, Spring form, custom tags); "request +# parameters read" both EL's param and getParameter in Java. ViewFactPatternsTest pins every case; +# ProfileFactPatternsLinearityTest measures that every pattern reads linearly. +[ignore] JSP comments (?s)<%--(?:.*?--%>|.*+) +page directives <%@[ \t\r\n]*+page\b +taglib directives <%@[ \t\r\n]*+taglib\b +includes and forwards <%@[ \t\r\n]*+include\b|] +input fields <(?:[A-Za-z][\w-]*+:)?(?:input\w*+|select\w*+|textarea|password|checkbox)[ \t\r\n/>] +request parameters read \bparam(?:Values)?+(?:\.|\[)|\bgetParameter(?:Values)?+[ \t]*+\( diff --git a/profiles/v3/k8s-facts.tsv b/profiles/v3/k8s-facts.tsv new file mode 100644 index 00000000..3e3345aa --- /dev/null +++ b/profiles/v3/k8s-facts.tsv @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +# +# Kubernetes manifest and Helm template counters, for a rule with the prompt file-body-ops: one per +# line, label TAB pattern (Java regex). The [ignore] line blanks YAML comments and Helm comments +# ({{/* */}}, also with the - trim markers); a Helm comment that is never closed runs to the end of +# the file. "resources" counts a kind: at column 0 only, so a manifest quoted in a ConfigMap's block +# scalar does not count; a "Helm control actions" count is approximate, every if, else if, range, +# with, define, template, include and block action. OpsFactPatternsTest pins every case; +# ProfileFactPatternsLinearityTest measures that every pattern reads linearly. +[ignore] YAML and template comments (?ms)\{\{-?[ \t]*+/\*(?:.*?\*/[ \t]*+-?\}\}|.*+)|^[ \t]*#[^\n]*+|(?<=[ \t])#[^\n]*+ +resources (?m)^kind:[ \t]*+["']?[A-Z] +workloads (?m)^kind:[ \t]*+["']?(?:Deployment|StatefulSet|DaemonSet|Job|CronJob|Pod|ReplicaSet|DeploymentConfig)\b +Services, Ingresses and Routes (?m)^kind:[ \t]*+["']?(?:Service|Ingress|Route|HTTPRoute|Gateway|VirtualService)\b +ConfigMaps and Secrets (?m)^kind:[ \t]*+["']?(?:ConfigMap|Secret|SealedSecret|ExternalSecret)\b +container images (?m)^[ \t]*(?:-[ \t]+)?image:[ \t]*+[^\s#] +container ports (?m)^[ \t]*(?:-[ \t]+)?containerPort: +probes (?m)^[ \t]*(?:liveness|readiness|startup)Probe: +secret references (?m)^[ \t]*(?:-[ \t]+)?(?:secretKeyRef|secretRef|secretName): +Helm control actions (approx) \{\{-?[ \t]*+(?:if|else[ \t]+if|range|with|define|template|include|block)\b +.Values references \.Values\.[A-Za-z_][\w.]*+ diff --git a/profiles/v3/kotlin-facts.tsv b/profiles/v3/kotlin-facts.tsv new file mode 100644 index 00000000..a692de2e --- /dev/null +++ b/profiles/v3/kotlin-facts.tsv @@ -0,0 +1,29 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +# +# Kotlin fact counters (.kt, .kts), for a rule with the shared prompt file-body-oop: one per line, +# label TAB pattern (Java regex), counted over the whole file. The [ignore] line runs first and reads +# the file as the Kotlin lexer does, leftmost region first: it blanks line comments, block comments +# (nested, as Kotlin nests them), raw strings ("""...""") and string and character literals with their +# ${...} templates, so a "fun" or "class" in a KDoc, a string or a commented-out block does not count. +# A region that is never closed runs to the end of the file. "functions (approx)" counts every fun +# declared at the start of a line (members, top-level, local and extension functions), not a fun +# interface; "constructor properties" every val or var after "(" or ",", which is a primary +# constructor's property and, rarely, a lambda's destructuring. Counts are regex heuristics: a +# declaration that starts after another on the same line, or a string template nested more than one +# level, is not read as the compiler reads it. JvmFactPatternsTest pins every case; +# ProfileFactPatternsLinearityTest measures that every pattern reads linearly. +[ignore] comments and string literals (?s)//[^\n]*+|/\*(?:[^*/]++|\*(?!/)|/(?!\*)|/\*(?:[^*]++|\*(?!/))*+(?:\*/|\z))*+(?:\*/|\z)|""".*?(?:"""|\z)|"(?:[^"\\\n$]|\\.|\$(?!\{)|\$\{(?:[^{}"\n]|"(?:[^"\\\n]|\\.)*+"|\{[^{}\n]*+\})*+\})*+"|'(?:[^'\\\n]|\\.)*+' +type declarations (?m)^[ \t]*+(?:@[\w.:]++(?:\([^()\n]*+\))?[ \t]++)*+(?:(?:public|private|internal|protected|open|abstract|sealed|final|data|enum|annotation|inner|value|inline|expect|actual|external|fun)[ \t]++)*+(?:class|interface|object)\b +companion objects (?m)^[ \t]*+(?:(?:public|private|internal|protected)[ \t]++)?companion[ \t]++object\b +data classes \bdata[ \t]++class\b +sealed types \bsealed[ \t]++(?:class|interface)\b +functions (approx) (?m)^[ \t]*+(?:@[\w.:]++(?:\([^()\n]*+\))?[ \t]++)*+(?:(?:public|private|internal|protected|open|abstract|final|override|suspend|inline|infix|operator|tailrec|external|expect|actual)[ \t]++)*+fun\b(?![ \t]++interface\b) +extension functions \bfun[ \t]++(?:<[^>\n]*+>[ \t]*+)?[A-Za-z_][\w.]*(?:<[^>\n]*+>)?\??\.[A-Za-z_`] +suspend functions \bsuspend[ \t]++(?:[a-z]++[ \t]++){0,8}?fun\b +secondary constructors (?m)^[ \t]*+(?:(?:public|private|internal|protected)[ \t]++)?constructor[ \t]*+\( +constructor properties (approx) [(,][ \t\n]*+(?:@[\w.:]++(?:\([^()\n]*+\))?[ \t\n]++)*+(?:(?:public|private|internal|protected|open|override)[ \t]++)*+(?:val|var)[ \t]++[A-Za-z_`] +const vals \bconst[ \t]++val\b +lateinit properties \blateinit[ \t]++var\b +imports (?m)^import[ \t]++ diff --git a/profiles/v3/mybatis-facts.tsv b/profiles/v3/mybatis-facts.tsv new file mode 100644 index 00000000..c381769e --- /dev/null +++ b/profiles/v3/mybatis-facts.tsv @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +# +# MyBatis mapper counters (the XML mapper files of MyBatis and iBATIS): one per line, label TAB +# pattern (Java regex). The [ignore] line blanks comments, processing instructions and the DOCTYPE, +# but not CDATA: a mapper writes its SQL in CDATA, and its #{} parameters and ${} substitutions are +# what the counters read. A region that is never closed runs to the end of the file. "dynamic SQL +# tags" counts every , , , , , , , and +# ; a ${} substitution is spliced into the SQL unescaped, which a reader of the index wants to +# find. EnterpriseXmlFactPatternsTest pins every case; ProfileFactPatternsLinearityTest measures that every +# pattern reads linearly. +[ignore] comments, processing instructions and the DOCTYPE (?s)|.*+)|<\?(?:.*?\?>|.*+)|]*+(?:\[(?:.*?\]|.*+))?[^>]*+>? +mapper namespaces ] +parameters #{} #\{[^}\r\n]*+\} +substitutions ${} \$\{[^}\r\n]*+\} diff --git a/profiles/v3/openapi-facts.tsv b/profiles/v3/openapi-facts.tsv new file mode 100644 index 00000000..e20639f8 --- /dev/null +++ b/profiles/v3/openapi-facts.tsv @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +# +# OpenAPI 3.x and Swagger 2.0 counters, YAML or JSON, for a rule with the prompt file-body-contract: +# one per line, label TAB pattern (Java regex). The [ignore] line blanks YAML comments (a whole line, +# or from a # after a blank) and the body of a block scalar (| or > and the lines indented below it), +# so a description that quotes a path or a "type: object" does not count. A key counts with or +# without JSON quotes, so a minified JSON spec counts too. "operations" counts a get, put, post, +# delete, options, head, patch or trace key that opens a mapping; "parameters" an in: of one of the +# six locations. OpsFactPatternsTest pins every case; ProfileFactPatternsLinearityTest measures +# that every pattern reads linearly. +[ignore] comments and block scalars (?m)^([ \t]*+)[^\n#]*?[:-][ \t]++[|>][-+1-9]{0,2}[ \t]*+(?:#[^\n]*+)?\n(?:[ \t]*+\n)*+(\1[ \t]++)[^ \t\n][^\n]*+(?:\n(?:\2[^\n]*+|[ \t]*+)(?=\n|\z))*+|^[ \t]*#[^\n]*+|(?<=[ \t])#[^\n]*+ +paths (?m)^[ \t]+/[^\s:#]*+[ \t]*:|["']/[^"'\n]*+["'][ \t]*: +operations (approx) (?m)(?:^[ \t]+|[{,][ \t]*)["']?(?:get|put|post|delete|options|head|patch|trace)["']?[ \t]*:[ \t]*+(?:\{|$) +operationIds ["']?\boperationId["']?[ \t]*: +parameters ["']?\bin["']?[ \t]*:[ \t]*["']?(?:path|query|header|cookie|body|formData)\b +$ref references ["']?\$ref["']?[ \t]*: +object schemas ["']?\btype["']?[ \t]*:[ \t]*["']?object\b +security schemes ["']?\btype["']?[ \t]*:[ \t]*["']?(?:apiKey|http|oauth2|openIdConnect|mutualTLS|basic)\b +deprecated operations and fields ["']?\bdeprecated["']?[ \t]*:[ \t]*true\b diff --git a/profiles/v3/persistence-facts.tsv b/profiles/v3/persistence-facts.tsv new file mode 100644 index 00000000..fd972da7 --- /dev/null +++ b/profiles/v3/persistence-facts.tsv @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +# +# Persistence mapping counters (JPA persistence.xml and orm.xml, Hibernate *.hbm.xml): the counters +# of xml-facts, its [ignore] line included (so the HQL or SQL of a query in CDATA does not count), +# then one per mapping element, with or without a namespace prefix. "entity mappings" counts the +# JPA and the Hibernate and subclass elements; "named queries" every named query +# of either vocabulary; "listed classes" the entries of a persistence unit. A of +# persistence.xml is a listed class and, in an hbm.xml, a mapping, so each file counts it under the +# label of its own kind and once under the other. EnterpriseXmlFactPatternsTest pins every case; +# ProfileFactPatternsLinearityTest measures that every pattern reads linearly. +[include] xml-facts +persistence units <(?:[\w.-]+:)?persistence-unit[ \t\r\n>] +JTA data sources <(?:[\w.-]+:)?jta-data-source[ \t\r\n>] +non-JTA data sources <(?:[\w.-]+:)?non-jta-data-source[ \t\r\n>] +listed classes <(?:[\w.-]+:)?class> +entity mappings <(?:[\w.-]+:)?(?:entity|class|subclass|joined-subclass|union-subclass)[ \t\r\n] +embeddables and mapped superclasses <(?:[\w.-]+:)?(?:embeddable|mapped-superclass)[ \t\r\n] +named queries <(?:[\w.-]+:)?(?:named-query|named-native-query|named-stored-procedure-query|query|sql-query)[ \t\r\n] +associations <(?:[\w.-]+:)?(?:many-to-one|one-to-one|one-to-many|many-to-many|element-collection)[ \t\r\n/>] +mapping files <(?:[\w.-]+:)?(?:mapping-file|mapping)[ \t\r\n>] +properties <(?:[\w.-]+:)?property[ \t\r\n] diff --git a/profiles/v3/pom-facts.tsv b/profiles/v3/pom-facts.tsv index 1572a262..a4119f35 100644 --- a/profiles/v3/pom-facts.tsv +++ b/profiles/v3/pom-facts.tsv @@ -8,9 +8,10 @@ # plugin configuration (SpotBugs detectors, assembly modules) do not count. "dependencies" counts every # of the dependencies, dependencyManagement and profile sections; "plugins" every plugin # of build, pluginManagement, reporting and profiles; the two "managed ... sections" say whether there -# are any. A plugin opener other than , or plugins nested more than one level deep, are not -# read. XmlFactPatternsTest pins every case. -[ignore] comments, CDATA and plugin bodies (?s)||(?<=)(?:[^<]++|<(?!/plugin>|plugin>)|(?:[^<]++|<(?!/plugin>))*+)*+ +# are any. A comment or CDATA section that is never closed runs to the end of the file. A plugin opener +# other than , or plugins nested more than one level deep, are not read. Every pattern stays +# linear in the length of the file; XmlFactPatternsTest pins every case. +[ignore] comments, CDATA and plugin bodies (?s)|.*+)||.*+)|(?<=)(?:[^<]++|<(?!/plugin>|plugin>)|(?:[^<]++|<(?!/?plugin>))*+)*+ dependencies ] managed dependency sections ] plugins ] diff --git a/profiles/v3/powershell-facts.tsv b/profiles/v3/powershell-facts.tsv new file mode 100644 index 00000000..2412c38b --- /dev/null +++ b/profiles/v3/powershell-facts.tsv @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +# +# PowerShell counters (.ps1, .psm1), for a rule with the prompt file-body-fallback: one per line, +# label TAB pattern (Java regex), keywords in any case as PowerShell reads them. "requirements" is +# [raw]: #Requires is a comment to the parser. The [ignore] line then blanks, leftmost region first, +# block comments (<# ... #>), here-strings (@" or @' at the end of a line up to "@ or '@ first on a +# line), # comments and string literals, so a "function" in a help comment or a string does not +# count; a block comment or a here-string that is never closed runs to the end of the file. +# "Verb-Noun command calls (approx)" counts every name of the Verb-Noun shape written with capitals +# (ForEach-Object, ConvertTo-Json too), the script's own functions too. OpsFactPatternsTest pins +# every case; ProfileFactPatternsLinearityTest measures that every pattern reads linearly. +[raw] requirements (?im)^#Requires\b +[ignore] comments, here-strings and strings (?ims)<#.*?(?:#>|\z)|@(["'])[ \t]*+\n(?:.*?^\1@|.*+)|(? +# +# SPDX-License-Identifier: Apache-2.0 +# +# Java properties counters (.properties: application.properties, messages, log4j, gradle.properties), +# for a rule with the prompt file-body-ops: one per line, label TAB pattern (Java regex). The +# [ignore] line blanks comment lines (# or ! first on the line). "keys (approx)" counts a line that +# starts with a key followed by = or :, so a key separated from its value by a blank alone, and the +# continuation line of a value that holds = or :, are counted wrongly; "keys naming a secret" a key +# with password, passwd, secret, token or credential in it, which the prompt names without its value. +# OpsFactPatternsTest pins every case; ProfileFactPatternsLinearityTest measures that every pattern +# reads linearly. +[ignore] comment lines (?m)^[ \t]*+[#!][^\n]*+ +keys (approx) (?m)^[ \t]*+[^\s#!=:][^=:\n]*?[ \t]*+[=:] +keys naming a secret (?im)^[ \t]*+[^\s#!=:][^=:\n]*?(?:password|passwd|secret|token|credential)[^=:\n]*?[ \t]*+[=:] +placeholders \$\{[^}\n]*+\} +URLs \b[a-z][a-z0-9+.-]*+:// diff --git a/profiles/v3/proto-facts.tsv b/profiles/v3/proto-facts.tsv new file mode 100644 index 00000000..4f7f4028 --- /dev/null +++ b/profiles/v3/proto-facts.tsv @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +# +# Protocol Buffers counters (.proto of proto2, proto3 and editions), for a rule with the prompt +# file-body-contract: one per line, label TAB pattern (Java regex). The [ignore] line blanks line and +# block comments and string literals, leftmost region first, so a "message" in a comment or an option +# value does not count; a block comment that is never closed runs to the end of the file. +# "fields (approx)" counts a field declared at the start of a line with its number (optional, required +# or repeated, a scalar, message or map type), not an enum value; "streaming rpcs" an rpc whose +# request or response is a stream. ContractFactPatternsTest pins every case; +# ProfileFactPatternsLinearityTest measures that every pattern reads linearly. +[ignore] comments and string literals (?s)//[^\n]*+|/\*(?:[^*]++|\*(?!/))*+(?:\*/|\z)|"(?:[^"\\\n]|\\.)*+"|'(?:[^'\\\n]|\\.)*+' +messages \bmessage[ \t]++[A-Za-z_] +enums \benum[ \t]++[A-Za-z_] +services \bservice[ \t]++[A-Za-z_] +rpcs \brpc[ \t]++[A-Za-z_] +streaming rpcs \brpc[ \t]++\w++[ \t]*+\((?:[ \t]*+stream\b|[^)]*+\)[ \t\n]*+returns[ \t]*+\([ \t]*+stream\b) +fields (approx) (?m)^[ \t]*+(?:(?:optional|required|repeated)[ \t]++)?(?:map[ \t]*+<[^>\n]*+>|[A-Za-z_][\w.]*+)[ \t]++[A-Za-z_]\w*+[ \t]*+=[ \t]*+\d +enum values (?m)^[ \t]*+[A-Z_][A-Z0-9_]*+[ \t]*+=[ \t]*+-?\d +oneofs \boneof[ \t]++[A-Za-z_] +reserved ranges and names (?m)^[ \t]*+reserved\b +imports (?m)^[ \t]*+import[ \t]++ diff --git a/profiles/v3/scala-facts.tsv b/profiles/v3/scala-facts.tsv new file mode 100644 index 00000000..5f4fab90 --- /dev/null +++ b/profiles/v3/scala-facts.tsv @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +# +# Scala fact counters (.scala, .sc; Scala 2 and 3), for a rule with the shared prompt file-body-oop: +# one per line, label TAB pattern (Java regex), counted over the whole file. The [ignore] line runs +# first and reads the file as the Scala lexer does, leftmost region first: it blanks line comments, +# block comments (nested two levels deep; a third level ends the comment early), triple-quoted +# strings ("""...""", interpolated or not), string literals and character literals, so a "def" or +# "class" in a Scaladoc, a string or a commented-out block does not count. A region that is never +# closed runs to the end of the file; a symbol literal ('name) is no character literal and stays. +# "type declarations" counts every class, trait, object and enum declared at the start of a line, +# case classes and companions too; "methods (approx)" every def at the start of a line (members, +# local and extension methods); "givens and implicits" a given instance or an implicit val, def, +# object or class. Counts are regex heuristics: a declaration after another on the same line is not +# counted. JvmFactPatternsTest pins every case; ProfileFactPatternsLinearityTest measures that every +# pattern reads linearly. +[ignore] comments and string literals (?s)//[^\n]*+|/\*(?:[^*/]++|\*(?!/)|/(?!\*)|/\*(?:[^*]++|\*(?!/))*+(?:\*/|\z))*+(?:\*/|\z)|""".*?(?:"""|\z)|"(?:[^"\\\n]|\\.)*+"|'(?:[^'\\\n]|\\.)' +type declarations (?m)^[ \t]*+(?:@[\w.]++(?:\([^()\n]*+\))?[ \t]++)*+(?:(?:private|protected|final|sealed|abstract|implicit|case|open|transparent|inline|opaque)(?:\[[\w.]*+\])?[ \t]++)*+(?:class|trait|object|enum)[ \t]++[A-Za-z_`] +case classes and case objects \bcase[ \t]++(?:class|object)[ \t]++[A-Za-z_`] +traits (?m)^[ \t]*+(?:(?:private|protected|sealed|transparent)(?:\[[\w.]*+\])?[ \t]++)*+trait[ \t]++[A-Za-z_`] +methods (approx) (?m)^[ \t]*+(?:@[\w.]++(?:\([^()\n]*+\))?[ \t]++)*+(?:(?:private|protected|final|override|implicit|inline|transparent|abstract)(?:\[[\w.]*+\])?[ \t]++)*+def[ \t]++[A-Za-z_`+\-*/<>=!~^&|%:?] +extension methods (?m)^[ \t]*+extension\b[ \t]*+[(\[] +givens and implicits (?m)^[ \t]*+(?:(?:private|protected|final|override|inline)(?:\[[\w.]*+\])?[ \t]++)*+(?:given\b|implicit[ \t]++(?:lazy[ \t]++)?(?:val|def|object|class|var)\b) +vals and vars at the start of a line (members and locals) (?m)^[ \t]*+(?:@[\w.]++(?:\([^()\n]*+\))?[ \t]++)*+(?:(?:private|protected|final|override|implicit|lazy)(?:\[[\w.]*+\])?[ \t]++)*+(?:val|var)[ \t]++[A-Za-z_`(] +type aliases (?m)^[ \t]*+(?:(?:private|protected|opaque|override)(?:\[[\w.]*+\])?[ \t]++)*+type[ \t]++[A-Za-z_`] +imports (?m)^[ \t]*+import[ \t]++ diff --git a/profiles/v3/shell-facts.tsv b/profiles/v3/shell-facts.tsv index ae864d58..1ea05bac 100644 --- a/profiles/v3/shell-facts.tsv +++ b/profiles/v3/shell-facts.tsv @@ -17,12 +17,13 @@ # environment prefix of a command (LC_ALL=C sort). Counts are regex heuristics: a function defined # inside a string, an option arm written on one line with others, the second of two heredocs started # on one line, a blank and # inside a quoted string (read as a comment), and a value with more than -# one level of $( ) are not read as the shell reads them. ShellFactPatternsTest pins every case. +# one level of $( ) are not read as the shell reads them. ShellFactPatternsTest pins every case; +# ProfileFactPatternsLinearityTest measures that every pattern of the profile reads linearly. [ignore] comments and heredoc bodies (?ms)^[ \t]*#[^\n]*|(?<=[ \t])#[^\n]*|(?=<<)(?|&;()'"`]++))(?:[^\s"'`\\#]++|[^\S\n]++(?:#[^\n]*+)?|#|"(?:[^"\\\n]|\\.)*+"|'[^'\n]*+'|`(?:[^`\\\n]|\\.)*+`|\\.)*+\n(?:.*?^\t*(?:\2|\3)$|.*)|[ \t]*(?:(["'])((?:(?!\4)[^\n])+)\4|\\?([^\s<>|&;()'"`-][^\s<>|&;()'"`]*+))(?:[^\s"'`\\#]++|[^\S\n]++(?:#[^\n]*+)?|#|"(?:[^"\\\n]|\\.)*+"|'[^'\n]*+'|`(?:[^`\\\n]|\\.)*+`|\\.)*+\n(?:.*?^(?:\5|\6)$|.*)) functions (?m)^[ \t]*(?:function[ \t]+[A-Za-z_][\w.:-]*[ \t]*(?:\([ \t]*\))?|[A-Za-z_][\w.:-]*[ \t]*\([ \t]*\))[ \t]*(?:\{|\(|$|\[\[|(?:if|for|while|until|case|select)\b) getopts loops \bgetopts[ \t]+ getopts option letters (?:\bgetopts[ \t]+["']?:?|\G(?<=[:A-Za-z0-9]):?)[A-Za-z0-9] -dash-option case arms (?m)^[ \t]*\(?[ \t]*(?:-[A-Za-z0-9]|--[A-Za-z0-9][\w-]*)(?:=\*)?(?:[ \t]*\|[ \t]*(?:-[A-Za-z0-9]|--[A-Za-z0-9][\w-]*)(?:=\*)?)*[ \t]*\) +dash-option case arms (?m)^[ \t]*+\(?[ \t]*+(?:-[A-Za-z0-9]|--[A-Za-z0-9][\w-]*)(?:=\*)?(?:[ \t]*+\|[ \t]*+(?:-[A-Za-z0-9]|--[A-Za-z0-9][\w-]*)(?:=\*)?)*[ \t]*+\) named positional parameters (?m)^[ \t]*(?:(?:local|readonly|declare|typeset|export)(?:[ \t]+-\w+)*[ \t]+)?[A-Za-z_]\w*=["']?\$(?:\{[1-9][0-9]*(?:[:?=+#%-][^}]*)?\}|[1-9]) exported variables (?m)(?:^[ \t]*(?:export|(?:declare|typeset|local)[ \t]+-(?=[a-zA-Z]*x)(?![a-zA-Z]*[fFn])[a-zA-Z]+)(?:[ \t]+-[a-eg-mo-zA-Z]+)*(?![ \t]+-)|\G(?<=[^\n])(?:=(?:"[^"\n]*+"|'[^'\n]*+'|\$\([^)\n]*+\)|\$\{[^}\n]*+\}|[^\s;&|"'$()]++|\$)*+)?)[ \t]+[A-Za-z_]\w* readonly variables (?m)(?:^[ \t]*(?:readonly|(?:declare|typeset|local)[ \t]+-(?=[a-zA-Z]*r)(?![a-zA-Z]*[fFn])[a-zA-Z]+)(?:[ \t]+-[a-eg-mo-zA-Z]+)*(?![ \t]+-)|\G(?<=[^\n])(?:=(?:"[^"\n]*+"|'[^'\n]*+'|\$\([^)\n]*+\)|\$\{[^}\n]*+\}|[^\s;&|"'$()]++|\$)*+)?)[ \t]+[A-Za-z_]\w* diff --git a/profiles/v3/terraform-facts.tsv b/profiles/v3/terraform-facts.tsv new file mode 100644 index 00000000..8c0b9dd9 --- /dev/null +++ b/profiles/v3/terraform-facts.tsv @@ -0,0 +1,29 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +# +# Terraform, OpenTofu and Terragrunt counters (.tf, .hcl), for a rule with the prompt file-body-ops: +# one per line, label TAB pattern (Java regex). The [ignore] line blanks, leftmost region first, # +# and // comments, block comments, heredocs (< +# +# SPDX-License-Identifier: Apache-2.0 +# +# WSDL 1.1 and 2.0 counters (.wsdl): the counters of xml-facts, its [ignore] line included (an +# embedded XML Schema counts there, under "XSD type definitions"), then one per WSDL element, without +# a prefix or with wsdl: or wsdl2:, so the soap:binding and soap:operation of a binding count only +# under "SOAP bindings". "operations" counts every of a portType, an interface and a +# binding, so an operation bound once counts twice. EnterpriseXmlFactPatternsTest pins every case; +# ProfileFactPatternsLinearityTest measures that every pattern reads linearly. +[include] xml-facts +services <(?:wsdl2?:)?service[ \t\r\n>] +ports and endpoints <(?:wsdl2?:)?(?:port|endpoint)[ \t\r\n>] +port types and interfaces <(?:wsdl2?:)?(?:portType|interface)[ \t\r\n>] +bindings <(?:wsdl2?:)?binding[ \t\r\n>] +operations <(?:wsdl2?:)?operation[ \t\r\n>] +messages <(?:wsdl2?:)?message[ \t\r\n>] +SOAP bindings " inside an attribute value, or a "]" inside an -# attribute value of the internal subset, is not seen. XmlFactPatternsTest pins every case; pom-facts -# adds the Maven counters. -[ignore] comments, CDATA, processing instructions and the DOCTYPE (?s)||<\?.*?\?>|]*(?:\[.*?\][^>]*)?> +# entity does not count and a "|.*+)||.*+)|<\?(?:.*?\?>|.*+)|]*+(?:\[(?:.*?\]|.*+))?[^>]*+>? elements <(?![!?/])[A-Za-z_][\w.:-]* namespace declarations \bxmlns(?::[\w.-]+)?[ \t\r\n]*=[ \t\r\n]*["'] id and name attributes [ \t\r\n](?!xmlns:)(?:[\w.-]+:)?(?:id|name)[ \t\r\n]*=[ \t\r\n]*["'] -XSD type definitions <(?:\w+:)?(?:complexType|simpleType)\b[^>]*\bname[ \t\r\n]*= +XSD type definitions <(?:\w+:)?(?:complexType|simpleType)\b[^<>]*\bname[ \t\r\n]*= XSLT templates <(?:\w+:)?template[ \t\r\n/>] Spring beans <(?:\w+:)?bean[ \t\r\n/>] diff --git a/srcmorph-cli/README.md b/srcmorph-cli/README.md index a8925361..72ba617a 100644 --- a/srcmorph-cli/README.md +++ b/srcmorph-cli/README.md @@ -20,8 +20,9 @@ cd examples/build-your-own-jar java -jar target/srcmorph.jar ``` -The examples follow this repository and need srcmorph 1.4.0; against a reactor build, `mvn install` it -and pass its version as `-Dsrcmorph.version`. +The examples follow this repository: on `main` they need the next release; until it is out, +`mvn install` the reactor and pass its version as `-Dsrcmorph.version` (`1.5.0-SNAPSHOT`). For 1.4.0, +take the examples of the `v1.4.0` tag. Its `pom.xml` takes `srcmorph-cli` from Maven Central, swaps the CPU natives of every desktop platform (`llama-platform`) for the one natives jar of your OS/arch (picked by a Maven profile), and @@ -80,9 +81,12 @@ public class CConfiguration { command means no model load and nothing written. An unknown one fails, naming the eight. - **`srcMorph`** — the run: `baseDirectory` (unset: the directory of the file), `outputDirectory` (unset: `src/site/ai` below the base directory), `subtrees`, `excludes`, `fileExtensions`, + `fileNames` (globs over the file name, for files without an extension), `fileInterpreters` + (scripts without an extension, by their `#!` line), `contentHeadChars`, `minFileSizeBytes` / `maxFileSizeBytes`, `generationProvider`, `promptDefinitions`, `profileDirectory`, `aiDefinitions`, `modelDirectory`, `fieldGenerations` (the file rules), - `factDefinitions`, `force`, `planOnly`, `aiVersion`, `projectName`, `runRecordFile` (below). A + `factDefinitions`, `force`, `regenerateOn`, `planOnly`, `aiVersion`, `projectName`, + `runRecordFile` (below). A relative directory or `runRecordFile` resolves against the file's directory, a relative `modelPath` against `modelDirectory`, a relative `templateFile` or `factsFile` against `profileDirectory`; unset, those two are the file's directory diff --git a/srcmorph-cli/src/test/java/net/ladenthin/srcmorph/cli/ExamplesConfigBindingTest.java b/srcmorph-cli/src/test/java/net/ladenthin/srcmorph/cli/ExamplesConfigBindingTest.java index 060c78c0..f88fb78d 100644 --- a/srcmorph-cli/src/test/java/net/ladenthin/srcmorph/cli/ExamplesConfigBindingTest.java +++ b/srcmorph-cli/src/test/java/net/ladenthin/srcmorph/cli/ExamplesConfigBindingTest.java @@ -166,10 +166,22 @@ public void copilotApiGatewayLunaExample_routesEveryRuleToLunaWithFacts() throws assertThat(model.getBaseUrl(), is(equalTo("http://127.0.0.1:3030/v1"))); assertThat(model.getApiKeyEnv(), is(equalTo("COPILOT_GATEWAY_API_KEY"))); assertThat(model.isStream(), is(true)); + assertThat(srcMorph.isForce(), is(false)); + assertThat(srcMorph.getRegenerateOn().isSource(), is(true)); + assertThat(srcMorph.getRegenerateOn().isPrompt(), is(true)); + assertThat(srcMorph.getRegenerateOn().isFacts(), is(true)); + assertThat(srcMorph.getRegenerateOn().isModel(), is(true)); + assertThat(srcMorph.getRegenerateOn().isChildren(), is(true)); final Path profileDirectory = directory.resolve( Objects.requireNonNull(srcMorph.getProfileDirectory()).getPath()); - final List rules = new ArrayList<>(srcMorph.getFieldGenerations()); + final List rules = new ArrayList<>(); + final List skipped = new ArrayList<>(); + for (final AiFieldGenerationConfig rule : srcMorph.getFieldGenerations()) { + (rule.isSkip() ? skipped : rules).add(rule); + } + assertThat("the credentials rule", skipped.size(), is(1)); + assertThat(skipped.get(0).getId(), is(equalTo("secrets"))); rules.addAll(Objects.requireNonNull(configuration.packageFieldGenerations)); rules.addAll(Objects.requireNonNull(configuration.projectFieldGenerations)); for (final AiFieldGenerationConfig rule : rules) { @@ -180,18 +192,153 @@ public void copilotApiGatewayLunaExample_routesEveryRuleToLunaWithFacts() throws assertThat( label, Files.isRegularFile(profileDirectory.resolve(rule.getReducePromptKey() + ".md")), is(true)); } + final List withoutFacts = new ArrayList<>(); for (final AiFieldGenerationConfig rule : srcMorph.getFieldGenerations()) { final String label = "rule " + rule.getId(); - if (!rule.isFallback()) { + if (rule.isSkip()) { + continue; + } + if (rule.getFactsKey() == null) { + withoutFacts.add(rule.getId()); + } else { assertThat( label + " counts the facts of its kind", Files.isRegularFile(profileDirectory.resolve(rule.getFactsKey() + ".tsv")), is(true)); } } + // the kinds profile v3 has no counters for + assertThat(withoutFacts, is(List.of("ops", "fallback"))); assertPromptFilesResolve(directory, configuration, "copilot-api-gateway/srcmorph-luna.yaml"); } + @Test + public void credentialsRule_skipsFilesWithSecretsInEveryProfileConfig_andNoSource() throws Exception { + final List secrets = List.of( + ".env", + ".env.production", + "prod.tfvars", + "terraform.tfstate", + "settings.xml", + "settings-security.xml", + "server.pem", + "tls.key", + "id_rsa", + "vault.yml", + "db-credentials.yaml", + "app-secrets.properties", + "Secrets.JSON"); + final List sources = List.of( + "SecretManager.java", + "CredentialsProvider.java", + "PasswordEncoder.java", + "pom.xml", + "web.xml", + "secrets.sh", + "keys.sql", + "Settings.java"); + for (final Path config : List.of( + EXAMPLES_DIRECTORY.resolve("copilot-api-gateway/srcmorph-luna.yaml"), + EXAMPLES_DIRECTORY.resolve("build-your-own-jar/srcmorph.yaml"))) { + final List rules = + Main.fromYaml(Main.readString(config)).srcMorph.getFieldGenerations(); + final net.ladenthin.srcmorph.config.AiFieldGenerationSelector selector = + new net.ladenthin.srcmorph.config.AiFieldGenerationSelector(); + selector.validate(rules); + for (final String name : secrets) { + final AiFieldGenerationConfig rule = selector.select(rules, context(name)); + assertThat(config + ": " + name, rule != null && rule.isSkip(), is(true)); + } + for (final String name : sources) { + final AiFieldGenerationConfig rule = selector.select(rules, context(name)); + assertThat(config + ": " + name, rule != null && !rule.isSkip(), is(true)); + } + } + } + + @Test + public void lunaExample_routesEveryKindToItsRule() throws Exception { + final List rules = Main.fromYaml( + Main.readString(EXAMPLES_DIRECTORY.resolve("copilot-api-gateway/srcmorph-luna.yaml"))) + .srcMorph + .getFieldGenerations(); + final net.ladenthin.srcmorph.config.AiFieldGenerationSelector selector = + new net.ladenthin.srcmorph.config.AiFieldGenerationSelector(); + selector.validate(rules); + final String[][] cases = { + {"src/main/java/shop/Order.java", "package shop;\nclass Order {}\n", "java"}, + {"src/main/java/shop/OrderBean.java", "package shop;\nimport jakarta.ejb.Stateless;\n", "java-ee"}, + {"src/main/java/shop/Legacy.java", "import javax.persistence.Entity;\n", "java-ee"}, + {"src/main/java/shop/Audit.java", "import static jakarta.transaction.Transactional.TxType.*;\n", "java-ee"}, + {"src/main/java/shop/Timer.java", "package shop;\n@jakarta.ejb.Singleton\nclass Timer {}\n", "java-ee"}, + {"src/main/java/shop/Notes.java", "// see jakarta.ejb.Stateless\nclass Notes {}\n", "java"}, + {"src/main/kotlin/Invoice.kt", "class Invoice\n", "kotlin"}, + {"build.gradle.kts", "plugins {}\n", "gradle"}, + {"src/main/kotlin/Build.kts", "println(1)\n", "kotlin"}, + {"src/test/groovy/OrderSpec.groovy", "class OrderSpec {}\n", "groovy"}, + {"src/main/scala/Order.scala", "case class Order()\n", "scala"}, + {"src/main/webapp/WEB-INF/web.xml", "\n", "jee"}, + {"META-INF/ejb-jar.xml", "\n", "jee"}, + {"META-INF/persistence.xml", "\n", "persistence"}, + {"mapping/Shipment.hbm.xml", "\n", "persistence"}, + {"mapper/CustomerMapper.xml", "\n", "mybatis" + }, + { + "camel/routes.xml", + "\n", + "integration" + }, + {"process/order.bpmn", "\n", "bpmn"}, + {"rules/discount.dmn", "\n", "dmn"}, + {"wsdl/Stock.wsdl", "\n", "wsdl"}, + {"pom.xml", "\n", "pom"}, + {"conf/context.xml", "\n", "xml"}, + {"webapp/list.jsp", "<%@ page %>\n", "jsp"}, + {"webapp/checkout.xhtml", "\n", "facelets"}, + {"api/orders.yaml", "openapi: 3.0.3\n", "openapi"}, + {"api/openapi.json", "{\"openapi\":\"3.0.3\"}", "openapi"}, + {"proto/order.proto", "syntax = \"proto3\";\n", "proto"}, + {"avro/order.avsc", "{\"type\": \"record\"}\n", "avro"}, + {"graphql/schema.graphqls", "type Query { x: Int }\n", "graphql"}, + {"api/events.yaml", "asyncapi: 3.0.0\n", "asyncapi"}, + {"api/asyncapi.json", "{\"asyncapi\":\"3.0.0\"}", "asyncapi"}, + {"docker-compose.yml", "services:\n db:\n image: postgres\n", "compose"}, + {"deploy/compose.override.yaml", "services: {}\n", "compose"}, + {"ansible/site.yml", "- name: Shop\n hosts: web\n", "ansible"}, + {"ansible/roles/web/tasks/main.yml", "- name: Copy\n copy: {}\n", "ansible"}, + {"infra/terragrunt.hcl", "include \"root\" {}\n", "terraform"}, + {"settings.gradle", "include 'core'\n", "gradle"}, + {"src/main/resources/application.properties", "server.port=8080\n", "properties"}, + {"tools/deploy.ps1", "param()\n", "powershell"}, + {"tools/build.cmd", "@echo off\n", "batch"}, + {"bin/deploy", "#!/usr/bin/env bash\nset -e\n", "shell"}, + {"bin/report", "#!/usr/bin/perl -w\n", "perl"}, + {"bin/tool", "#!/usr/bin/env python3\n", "fallback"}, + {".github/workflows/ci.yml", "on: push\n", "actions"}, + {"k8s/deployment.yaml", "apiVersion: apps/v1\nkind: Deployment\n", "k8s"}, + {"camel/orders.yaml", "- route:\n id: orders\n from:\n uri: jms:queue:orders\n", "camel-yaml"}, + {"camel/timer.yaml", "- from:\n uri: timer:tick\n", "camel-yaml"}, + {"build.gradle", "plugins { id 'java' }\n", "gradle"}, + {"docker/Dockerfile", "FROM alpine\n", "dockerfile"}, + {"Jenkinsfile", "pipeline {}\n", "ops"}, + {"config/application.yml", "server:\n port: 8080\n", "ops"}, + {"infra/main.tf", "resource \"x\" \"y\" {}\n", "terraform"}, + {"scripts/tool.py", "print(1)\n", "fallback"}, + {"config/.env", "TOKEN=x\n", "secrets"}, + }; + for (final String[] c : cases) { + final String path = c[0]; + final String name = path.substring(path.lastIndexOf('/') + 1); + final AiFieldGenerationConfig rule = selector.select( + rules, new net.ladenthin.srcmorph.config.AiFileContext(name, path, 100L, 3, 0L, c[1])); + assertThat(path, rule == null ? null : rule.getId(), is(equalTo(c[2]))); + } + } + + private static net.ladenthin.srcmorph.config.AiFileContext context(final String name) { + return new net.ladenthin.srcmorph.config.AiFileContext(name, "src/" + name, 100L, 3, 0L); + } + private static void assertBindsSuccessfully(final Path exampleConfig) throws IOException { final String fileName = exampleConfig.getFileName().toString(); final String content = Main.readString(exampleConfig); diff --git a/srcmorph-maven-plugin/README.md b/srcmorph-maven-plugin/README.md index 74358e79..4d5ecfbb 100644 --- a/srcmorph-maven-plugin/README.md +++ b/srcmorph-maven-plugin/README.md @@ -62,6 +62,7 @@ The plugin runs in three phases, building a navigable index from fine to coarse. - X: file - P: 3F2A91C0 - N: 7D04E5B1 +- M: 5C1E08A2 --- > Immutable value type pairing a deterministic metadata header with the AI-generated markdown body of one .ai.md document. @@ -76,10 +77,32 @@ The plugin runs in three phases, building a navigable index from fine to coarse. - `body() -> String` — the AI-generated markdown body. ``` -`P` and `N` are the CRC32 of the system prompt (with the rule's map and reduce prompts, when it names -them) and of the fact counters the summary was written with -(file summaries only, and only when set): a run record names them for an unchanged file, so a changed -prompt shows which summaries it has not rewritten yet. +`P`, `N`, `M` and `K` are the CRC32 of what the summary was written with, each only when set: the +system prompt (with the rule's map and reduce prompts, when it names them), the fact counters, the +model (the definition's key, its `remoteModel` and the file name of its `modelPath`) and, for a +package or the project, the child summaries it read. A summary is rewritten when it is missing or +empty, or its header format (`H`), node type (`X`), title or `aiVersion` (`A`) changed, always; and +when one of the fields below differs while its switch under `regenerateOn` is `true`, as each is by +default (a summary that does not record a field differs too): + +| Switch | Field | Changes with | +|---|---|---| +| `source` | `C` | the file's source; a package's files; the packages the project lists and their checksums | +| `prompt` | `P` | the rule's prompts | +| `facts` | `N` | the rule's fact counters | +| `model` | `M` | the rule's model definition, or the model it names | +| `children` | `K` | a summary a package or the project is written from (a file re-summarized over the same source) | + +```yaml +srcMorph: + force: false # true: rewrite every summary, whatever regenerateOn says + regenerateOn: + prompt: false # e.g. keep the summaries of the old prompt after a prompt edit +``` + +A switch set to `false` keeps the summary and records the new value at its next rewrite: a run +record names the hashes for an unchanged file, so it shows which summaries an older prompt wrote. +`D`, `T` and `G` never cause a rewrite; a sampling parameter is in no hash (raise `aiVersion`). ## Requirements - Java 8+ (the plugin and the core are Java 8 bytecode; the descriptor states Java 1.8) - Maven 3.6.3+ @@ -139,7 +162,8 @@ The file has three building blocks: 2. **`profileDirectory`** — the profile: one directory with a file per prompt (`.md`) and per group of exact fact counters (`.tsv`), named by key from the rules, so no prompt text and no regex is written into the configuration. A prompt is the **system prompt** and takes **no - placeholders**: the file/package name and the source (for packages, the child summaries; for the + placeholders**: the file's path below the base directory (a package's name) and the source (for + packages, the child summaries; for the optional project overview, the per-package leads) are sent as a separate user message (`AiPromptSupport`). A `%s` in a prompt reaches the model literally. The measured profile of this repository is [`profiles/v3/`](../profiles/README.md); copy it into your project or point at a @@ -149,7 +173,14 @@ The file has three building blocks: `aiDefinitionKey` (model id, which carries the full parameter set) and selects files with a composable **`condition`** tree: `and`/`or`/`not` over the leaves `extensions`, `size` (`min`/`max` bytes), `lines` (`min`/`max`), `modifiedAfter`/`modifiedBefore` (ISO-8601 instant vs - the file's last-modified time), and `pathGlob` (base-relative glob). When several rules match, the + the file's last-modified time), `pathGlob` (base-relative glob, in the case written, so it + matches the same on every system), `fileNames` (globs over the name without its directory, in any + case: `Dockerfile`, `Jenkinsfile`, `Dockerfile.*`), `contentMatches` (a Java regular expression + found in the first `contentHeadChars` characters of the file, 16,384 by default, so a Kubernetes + manifest and an OpenAPI document of the same extension take different rules: + `(?m)^apiVersion:`) and `interpreters` (the interpreter the file's `#!` line names, a version of + it too: `[bash, sh]`, `[python]` matches `#!/usr/bin/env python3`). A glob takes `*`, `**`, `?` + and `{a,b}` alternatives (`**/*.{yml,yaml}`). When several rules match, the highest `priority` wins (ties by declaration order). A rule may instead be `skip: true` (ignore matching files — a high-priority skip beats routes and the fallback), and **exactly one** `fallback: true` (no condition) catches the rest. A file that matches no rule and no fallback @@ -206,7 +237,9 @@ The file has three building blocks: **Exact counts with `factsKey` (optional, every file — not just oversize).** A sampled/chunked AI summary can't reliably *count* things (no single call sees the whole file — it will guess "25 rows"). A rule's `factsKey` names a group of counters, `/.tsv` (one `labelregex` - per line, `#` comments, an `[ignore]` label for a region blanked before counting), and each reports + per line, `#` comments, an `[ignore]` label for a region blanked before counting, `[raw]` for a + counter that counts before the blanking, `[distinct]` for one that counts different names; see + [`profiles/README.md`](../profiles/README.md)), and each reports its regex match count over the **whole** source, prepended to the body of every file the rule matches as an exact facts line — so downstream agents get authoritative structural counts in every summary. It's fully generic — the meaning is in the regex, so the same mechanism counts SQL rows or @@ -268,14 +301,14 @@ srcMorph: temperature: 0.7 threads: 8 # 2) The profile: srcmorph's profiles/v3/ copied into your project (or a checkout of it). Every - # promptKey and factsKey here is a file there: file-body-java.md, file-body-fallback.md, + # promptKey and factsKey here is a file there: file-body-oop.md, file-body-fallback.md, # package-body.md, project-body.md, java-facts.tsv. profileDirectory: src/srcmorph/profile # 3) The file rules: a .java rule (matched by its condition) and the fallback for everything else. # See "Routing rules" below for size/lines/modified/glob conditions, priority, and skip. fieldGenerations: - id: java - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: coder factsKey: java-facts condition: @@ -304,7 +337,7 @@ files, skip generated sources, and a fallback for everything else: priority: 100 condition: {pathGlob: "**/generated/**"} - id: java-small - promptKey: file-body-java-terse + promptKey: file-body-oop aiDefinitionKey: gpt-oss-16k condition: and: @@ -312,7 +345,7 @@ files, skip generated sources, and a fallback for everything else: - extensions: [".java"] - size: {max: 16384} - id: java-mid - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: gpt-oss-48k condition: and: @@ -320,7 +353,7 @@ files, skip generated sources, and a fallback for everything else: - extensions: [".java"] - size: {min: 16384, max: 49152} - id: java-large - promptKey: file-body-java-detailed + promptKey: file-body-oop aiDefinitionKey: gpt-oss-20B-mxfp4 condition: and: @@ -328,7 +361,7 @@ files, skip generated sources, and a fallback for everything else: - extensions: [".java"] - size: {min: 49152} - id: java-huge # huge files: chunk over a SMALL fast window + combine - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: granite-4.0-h-1b-fastchunk onOversize: sampleChunks maxChunks: 6 # ~7 cheap calls; bounds time to ~1 h/file @@ -400,12 +433,23 @@ The POM sets only these; everything else is the configuration file (above). global switch skips. The keys of the file under `srcMorph` (`baseDirectory`, `subtrees`, `outputDirectory`, `fileExtensions`, -`excludes`, `minFileSizeBytes` / `maxFileSizeBytes`, `generationProvider`, `modelDirectory`, +`fileNames`, `fileInterpreters`, `contentHeadChars`, `excludes`, `minFileSizeBytes` / +`maxFileSizeBytes`, `generationProvider`, `modelDirectory`, `profileDirectory`, `promptDefinitions`, `factDefinitions`, `aiDefinitions`, `fieldGenerations`, -`force`, `planOnly`, `aiVersion`, `projectName`, `runRecordFile`) are described in +`force`, `regenerateOn`, `planOnly`, `aiVersion`, `projectName`, `runRecordFile`) are +described in [`srcmorph-cli/README.md`](../srcmorph-cli/README.md) and [`srcmorph/README.md`](../srcmorph/README.md). A configured subtree that does not exist, or lies outside the base directory, fails the goal; file -extensions match with their dot and in any case. +extensions match with their dot and in any case. `fileNames` adds files by name, for those without an +extension (`Dockerfile`, `Jenkinsfile`, `Makefile`): globs over the name, in any case. +`fileInterpreters` adds the scripts without an extension whose `#!` line names one of the +interpreters (`[bash, sh, perl, python]`: `bin/deploy`, a Git hook); that line is read only for a +file the subtrees, the excludes and the size band let through, and one that cannot be read is +skipped with a warning. `contentHeadChars` (default 16,384, at least 256) is how much of a file the +`contentMatches` and `interpreters` conditions read while planning: raise it when the marker of a kind +comes after a long license header; the head is never read past the file's end. A source file +is read as UTF-8, or as UTF-16 when it starts with that byte order mark; a byte order mark is not +part of the text the model and the fact counters see. ### Per-model `aiDefinitions` parameters @@ -488,11 +532,14 @@ Prompts are referenced by key from the rules and read from the profile (`profile self-test configuration uses the ten prompt files and the six fact-counter files of [`profiles/v3/`](../profiles/README.md); the benchmark and the examples read the same files, so each prompt and each counter exists once in the repository: -- `file-body-java` — summarizes a single Java source file (types, public API, dependencies) +- `file-body-oop` — summarizes a single source file of a class-based language: Java, Kotlin, Groovy, Scala (types, public API, dependencies) - `file-body-sql` — summarizes a single SQL file as schema (tables/views/procedures, columns, the tables it reads vs writes, and relationships) - `file-body-shell`, `file-body-perl`, `file-body-xml` — the same for shell scripts, Perl and XML - `file-body-fallback` — generic multi-language summary for any other source file +- `file-body-view`, `file-body-contract`, `file-body-ops` — JSP and Facelets views; API contracts + (OpenAPI, Protobuf, ...); CI, Docker, Kubernetes and other deploy files. The self-test does not + route them; `examples/copilot-api-gateway/srcmorph-luna.yaml` does, with their fact counters - `package-body` — synthesizes a package summary from the already-generated file summaries - `project-body` — (optional) synthesizes the short project `#### Overview` paragraph from the package leads - `map-chunk`, `reduce-parts` — not prompts of their own: a chunked rule's `mapPromptKey` / diff --git a/srcmorph-maven-plugin/srcmorph-selftest.yaml b/srcmorph-maven-plugin/srcmorph-selftest.yaml index 01a562ef..d799281a 100644 --- a/srcmorph-maven-plugin/srcmorph-selftest.yaml +++ b/srcmorph-maven-plugin/srcmorph-selftest.yaml @@ -59,6 +59,17 @@ srcMorph: - "**/package-info.java" - "**/module-info.java" + # When a summary is rewritten. force: true rewrites every one. Otherwise a summary is rewritten when + # it is missing or empty, its aiVersion changed, or a change below whose switch is true (each one is + # by default); false keeps the summary and records the new value at its next rewrite. + force: false + regenerateOn: + source: true # C: the file's source, a package's files, the project's packages + prompt: true # P: the rule's prompts, its map and reduce prompts too + facts: true # N: the rule's fact counters + model: true # M: the rule's model (definition key, remoteModel, model file) + children: true # K: the summaries a package or the project is written from + generationProvider: llamacpp-jni modelDirectory: "${ai.modelDir}" # a relative modelPath below is relative to this directory # The measured profile (profiles/README.md): a rule's promptKey names /.md, its @@ -125,8 +136,29 @@ srcMorph: # By priority, the most specific wins: huge (>1 MB) -> H-1B over sampled chunks, big # (~275 KB .. 1 MB) -> H-Tiny map-reduce, then gpt-oss for Java, SQL and every other file. fieldGenerations: + # Files that hold credentials are never sent to a model, whatever their extension: the highest + # priority, so no other rule takes them. The prompts name a secret and never copy it; this keeps + # the file out altogether. fileNames match the name in any case. + - id: secrets + skip: true + priority: 1000 + condition: + fileNames: + - ".env" + - ".env.*" + - "*.tfvars" + - "*.tfstate" + - "*.tfstate.backup" + - "settings.xml" # Maven: server passwords + - "settings-security.xml" + - "*.pem" + - "*.key" + - "id_rsa*" + - "id_ed25519*" + - "vault*.{yml,yaml}" + - "*{secret,secrets,credential,credentials}*.{yml,yaml,properties,json,xml,conf,env}" - id: huge-java - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: granite-4.0-h-1b-fastchunk priority: 200 mapPromptKey: map-chunk @@ -155,7 +187,7 @@ srcMorph: - extensions: [".sql"] - size: {min: 1000000} - id: big-java - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: granite-4.0-h-tiny-mapreduce priority: 100 mapPromptKey: map-chunk @@ -181,7 +213,7 @@ srcMorph: - extensions: [".sql"] - size: {min: 275000} - id: java - promptKey: file-body-java + promptKey: file-body-oop aiDefinitionKey: "${ai.model}" factsKey: java-facts condition: diff --git a/srcmorph/README.md b/srcmorph/README.md index d566c4eb..e29dae06 100644 --- a/srcmorph/README.md +++ b/srcmorph/README.md @@ -26,8 +26,8 @@ Major field groups: | Group | Fields | |---|---| -| Source selection | `baseDirectory`, `subtrees`, `excludes`, `fileExtensions`, `minFileSizeBytes`/`maxFileSizeBytes` | -| Output | `outputDirectory`, `force`, `planOnly`, `runRecordFile` (the JSON record of a file phase, `engine.RunRecord`) | +| Source selection | `baseDirectory`, `subtrees`, `excludes`, `fileExtensions`, `fileNames` (globs over the file name, in any case, for files without an extension), `fileInterpreters` (scripts without an extension, by the interpreter their `#!` line names, `support.AiShebang`), `contentHeadChars` (how much of a file the `contentMatches` and `interpreters` conditions read, default 16,384, at least 256), `minFileSizeBytes`/`maxFileSizeBytes`; a glob takes `*`, `**`, `?` and `{a,b}` (`support.AiGlob`) | +| Output | `outputDirectory`, `force`, `regenerateOn` (`config.AiRegenerateOn`: `source`, `prompt`, `facts`, `model`, `children`, each `true` by default, each the header field `C`, `P`, `N`, `M` or `K` whose change rewrites a summary; `force` rewrites every one), `planOnly`, `runRecordFile` (the JSON record of a file phase, `engine.RunRecord`) | | Routing & prompts | `promptDefinitions` (`List`: a `key` and a `template` or a `templateFile`), `profileDirectory` (the profile: a rule's `promptKey` / `factsKey` without a definition is read from `.md` / `.tsv` there, and a relative `templateFile` / `factsFile` resolves against it), `aiDefinitions` (`List`), `modelDirectory` (a relative `modelPath` resolves against it, an absolute one is used as it is), `fieldGenerations` (`List` — the routing rules), `factDefinitions` (`List`: a `key` and `facts` or a `factsFile`) | | AI backend | `generationProvider` (`"mock"`, `"llamacpp-jni"` or `"openai-compatible"`; a model definition's own `provider` overrides it); every model parameter is a field of an `aiDefinitions` entry | | Header metadata | `pluginVersion`, `aiVersion`, `projectName` | @@ -35,7 +35,8 @@ Major field groups: Every other `config/` class is a plain, Maven-annotation-free JavaBean too: `AiModelDefinition` (a named, complete set of GGUF sampling parameters), `AiPromptDefinition` (a named prompt template — its `template` string is the system instructions, used verbatim; `AiPromptSupport` automatically -appends the file/package name and the source text as a separate user message, so a template needs no +appends the file's path below the base directory (a package's name) and the source text as a +separate user message, so a template needs no placeholder), `AiFieldGenerationConfig` (one routing rule: a `condition` tree, `priority`, and either a route, a `skip`, or the explicit `fallback`), `AiCondition`/`AiConditionGroup`/`AiRangeCondition` (the composable and/or/not condition tree over @@ -142,7 +143,7 @@ net.ladenthin.srcmorph/ ``` See [`../CLAUDE.md`](../CLAUDE.md) for the full architecture rules (`CoreArchitectureTest`), the -layered-package dependency direction, and the PIT mutation-testing scope (currently 78 classes at +layered-package dependency direction, and the PIT mutation-testing scope (currently 83 classes at 100%). ## Testing diff --git a/srcmorph/pom.xml b/srcmorph/pom.xml index 5431fe4f..dfc36e81 100644 --- a/srcmorph/pom.xml +++ b/srcmorph/pom.xml @@ -733,6 +733,7 @@ SPDX-License-Identifier: Apache-2.0 net.ladenthin.srcmorph.indexer.AiCalibrationMeasurement net.ladenthin.srcmorph.indexer.AiInputWindowCalculator net.ladenthin.srcmorph.indexer.AiIndexPlan + net.ladenthin.srcmorph.indexer.AiHeaderHashes net.ladenthin.srcmorph.indexer.AiIndexPlan$Entry net.ladenthin.srcmorph.indexer.AiIndexTally net.ladenthin.srcmorph.indexer.AiMapReduceSupport @@ -769,11 +770,15 @@ SPDX-License-Identifier: Apache-2.0 net.ladenthin.srcmorph.config.AiFactDefinitionLoader net.ladenthin.srcmorph.config.AiFactDefinitionSupport net.ladenthin.srcmorph.config.AiFactExtractor + net.ladenthin.srcmorph.config.AiFactExtractor$ReadBudget + net.ladenthin.srcmorph.config.AiRegenerateOn net.ladenthin.srcmorph.support.AiChecksumSupport net.ladenthin.srcmorph.support.AiDeterministicSummary net.ladenthin.srcmorph.support.AiSourceLines net.ladenthin.srcmorph.support.AiGenerationTimeEstimator + net.ladenthin.srcmorph.support.AiGlob net.ladenthin.srcmorph.support.AiPathSupport + net.ladenthin.srcmorph.support.AiShebang net.ladenthin.srcmorph.support.AiProfileFileSupport net.ladenthin.srcmorph.support.AiProgressBar net.ladenthin.srcmorph.support.AiSourceExcludeFilter diff --git a/srcmorph/spotbugs-exclude.xml b/srcmorph/spotbugs-exclude.xml index 6478a9ac..b9c68013 100644 --- a/srcmorph/spotbugs-exclude.xml +++ b/srcmorph/spotbugs-exclude.xml @@ -34,6 +34,7 @@ SPDX-License-Identifier: Apache-2.0 + @@ -72,6 +73,17 @@ SPDX-License-Identifier: Apache-2.0 + + + + + + + + + + + + + + + + + + + + + + + + + "), headCtx(head)); + } finally { + logger.detachAppender(appender); + } + + // assert + assertThat(matched, is(false)); + assertThat(appender.list.size(), is(1)); + assertThat( + appender.list.get(0).getFormattedMessage(), + is("contentMatches '(?s)' stopped after reading " + + (AiFactExtractor.READS_PER_CHAR * head.length() + AiFactExtractor.READ_ALLOWANCE) + + " characters of the 42000-character head of k8s/deploy.yaml: the pattern backtracks" + + " too far, so the condition does not match")); + assertThat(evaluator.matches(content("(?s)\nelements\t<\\w\n"); + write("jee-facts.tsv", "first\ta\n[include]\txml-facts\nservlets\t", "elements = <\\w", "servlets = load(null, "a")); + final IllegalArgumentException self = assertThrows(IllegalArgumentException.class, () -> load(null, "self")); + + assertThat(cycle.getMessage(), is("the facts file a includes itself: a -> b -> a")); + assertThat(self.getMessage(), is("the facts file self includes itself: self -> self")); + } + + @Test + public void load_includeOfTheSameFileTwice_isRefusedForTheLabelUsedTwice() throws IOException { + write("a.tsv", "a\tx\n"); + write("b.tsv", "[include]\ta\n[include]\ta\n"); + + final IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> load(null, "b")); + + assertThat(thrown.getMessage(), containsString("the label 'a' is used twice")); + } + + @Test + public void load_includeOfAMissingFile_namesIt() throws IOException { + write("b.tsv", "[include]\tnowhere\n"); + + final IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> load(null, "b")); + + assertThat(thrown.getMessage(), containsString("factsKey nowhere is included, but there is no ")); + assertThat(thrown.getMessage(), containsString("nowhere.tsv")); + } + + @Test + public void load_includeWithoutAKey_isRefused() throws IOException { + write("b.tsv", "b\ty\n[include]\t \n"); + + final IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> load(null, "b")); + + assertThat(thrown.getMessage(), containsString("line 2: [include] names no facts key")); + } + + @Test + public void load_factsFileWithInclude_readsItFromTheProfileDirectory() throws IOException { + write("a.tsv", "a\tx\n"); + write("own/b.tsv", "[include]\ta\nb\ty\n"); + + final List loaded = load(Collections.singletonList(fromFile("mine", "own/b.tsv"))); + + assertThat(describe(loaded.get(0)), is(Arrays.asList("a = x", "b = y"))); + } + + @Test + public void load_factsFileWithIncludeAndNoProfileDirectory_isRefused() throws IOException { + write("own/a.tsv", "a\tx\n"); + final Path b = write("own/b.tsv", "[include]\ta\nb\ty\n"); + final AiFactDefinition definition = fromFile("mine", b.toAbsolutePath().toString()); + + final IllegalArgumentException thrown = assertThrows( + IllegalArgumentException.class, + () -> new AiFactDefinitionLoader(null) + .load(Collections.singletonList(definition), Collections.emptyList())); + + assertThat( + thrown.getMessage(), containsString("line 1: [include] a needs a profile directory to read it from")); + } + + @Test + public void load_includeWithALabelAfterTheMarker_isAnUnknownMarker() throws IOException { + write("b.tsv", "[include] more\ta\n"); + + final IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> load(null, "b")); + + assertThat(thrown.getMessage(), containsString("unknown marker in '[include] more'")); + } + + @Test + public void load_includedFileUnreadable_throwsTheIoException() throws IOException { + write("b.tsv", "[include]\tdir\n"); + Files.createDirectories(profileDirectory.resolve("dir.tsv")); + + final IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> load(null, "b")); + + assertThat(thrown.getMessage(), containsString("factsKey dir is included, but there is no ")); + } + + @Test + public void parse_includeWithoutADirectory_isRefused() { + final IllegalArgumentException thrown = + assertThrows(IllegalArgumentException.class, () -> AiFactDefinitionLoader.parse("f", "[include]\ta\n")); + + assertThat(thrown.getMessage(), is("f line 1: [include] a needs a profile directory to read it from")); + } + + @Test + public void parse_unknownMarker_namesEveryMarker() { + final IllegalArgumentException thrown = + assertThrows(IllegalArgumentException.class, () -> AiFactDefinitionLoader.parse("f", "[count]\ta\n")); + + assertThat( + thrown.getMessage(), + is("f line 1: unknown marker in '[count]'; the only ones are [ignore], [raw], [distinct] and" + + " [include]")); + } + // + @Test public void toString_namesTheProfileDirectory() { assertThat( diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFactDefinitionSupportTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFactDefinitionSupportTest.java index 14e27747..59e2ad66 100644 --- a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFactDefinitionSupportTest.java +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFactDefinitionSupportTest.java @@ -60,6 +60,16 @@ public void facts_groupWithNullFacts_returnsEmptyNotThrow() { assertThat(support.facts("empty").isEmpty(), is(true)); } + @Test + public void constructor_aKeyDefinedTwice_throwsNamingItsSecondIndex() { + final IllegalArgumentException thrown = assertThrows( + IllegalArgumentException.class, + () -> new AiFactDefinitionSupport(java.util.Arrays.asList( + definition("sql-facts", Collections.emptyList()), + definition("sql-facts", Collections.emptyList())))); + assertThat(thrown.getMessage(), is("factDefinitions[1].key 'sql-facts' is defined twice")); + } + @Test public void constructor_nullDefinitions_yieldsEmptyRegistry() { final AiFactDefinitionSupport support = new AiFactDefinitionSupport(null); diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFactExtractorTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFactExtractorTest.java index 2c7eefd3..a90419b7 100644 --- a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFactExtractorTest.java +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFactExtractorTest.java @@ -152,6 +152,15 @@ public void counts_anIgnoredRegionWithinALine_keepsTheWordsAroundItApart() { assertThat(counts.get("joins"), is(1)); } + @Test + public void counts_anIgnoredRegionAtTheStartOfALine_leavesTheLineStartingWithWhatFollows() { + // the first region starts the text, the second follows a line feed, the third a carriage return + final Map counts = AiFactExtractor.counts( + Arrays.asList(ignore("comments", "(?s)/\\*.*?\\*/"), counter("types", "(?m)^class\\b")), + "/* x */class A {}\n/* y */class B {}\r/* z */class C {}\n"); + assertThat(counts.get("types"), is(3)); + } + @Test public void counts_twoIgnoreCounters_bothBlank() { final Map counts = AiFactExtractor.counts( @@ -243,5 +252,204 @@ public void validate_invalidRegex_isRefusedNamingTheLabel() { public void validate_onlyIgnoreCounters_isRefused() { assertThat(refusal(ignore("POD", POD), ignore("comments", "#.*")), is("g: no counter, only ignore patterns")); } + + @Test + public void validate_ignoreCounterThatIsRawOrDistinct_isRefused() { + final AiFactCounter raw = ignore("comments", "#.*"); + raw.setRaw(true); + final AiFactCounter distinct = ignore("comments", "#.*"); + distinct.setDistinct(true); + + assertThat( + refusal(counter("subs", SUBS), raw), + is("g counter 2 ('comments') is an ignore counter, which counts nothing; raw and distinct apply to" + + " counters")); + assertThat( + refusal(counter("subs", SUBS), distinct), + is("g counter 2 ('comments') is an ignore counter, which counts nothing; raw and distinct apply to" + + " counters")); + } + + @Test + public void validate_rawAndDistinctCounters_doNotThrow() { + final AiFactCounter both = counter("names", "(\\w+)"); + both.setRaw(true); + both.setDistinct(true); + + assertDoesNotThrow(() -> AiFactExtractor.validate("g", Arrays.asList(ignore("comments", "#.*"), both))); + } + // + + // + private static AiFactCounter raw(final String label, final String pattern) { + final AiFactCounter c = counter(label, pattern); + c.setRaw(true); + return c; + } + + private static AiFactCounter distinct(final String label, final String pattern) { + final AiFactCounter c = counter(label, pattern); + c.setDistinct(true); + return c; + } + + @Test + public void counts_rawCounter_countsTheSourceBeforeTheIgnoreCountersBlankIt() { + final Map counts = AiFactExtractor.counts( + Arrays.asList( + ignore("comments", "//[^\\n]*"), + raw("TODO raw", "\\bTODO\\b"), + counter("TODO blanked", "\\bTODO\\b")), + "int a; // TODO one\nint b; // TODO two\n"); + + assertThat(counts.get("TODO raw"), is(2)); + assertThat(counts.get("TODO blanked"), is(0)); + } + + @Test + public void counts_distinctCounter_countsTheDifferentFirstGroups() { + final String source = "@Inject Clock a;\n@Inject Clock b;\n@Inject Bus c;\n"; + + final Map counts = AiFactExtractor.counts( + Arrays.asList( + distinct("injected types", "@Inject (\\w+) \\w+"), + counter("injection points", "@Inject (\\w+) \\w+")), + source); + + assertThat(counts.get("injected types"), is(2)); + assertThat(counts.get("injection points"), is(3)); + } + + @Test + public void counts_distinctCounterWithoutAGroup_countsTheDifferentMatches() { + final Map counts = + AiFactExtractor.counts(Collections.singletonList(distinct("types", "\\b[A-Z]\\w*")), "Foo Foo Bar a"); + + assertThat(counts.get("types"), is(2)); + } + + @Test + public void counts_distinctCounterWhoseGroupDidNotTakePart_countsTheWholeMatch() { + final Map counts = + AiFactExtractor.counts(Collections.singletonList(distinct("names", "a(b)?")), "a ab ab"); + + // "a" (the group did not take part) and "b" + assertThat(counts.get("names"), is(2)); + } + // + + // + /** An unclosed comment opener per line: the lazy pattern rescans to the end from each one. */ + private static final String UNCLOSED_COMMENTS = repeat(""; + + private static String repeat(final String line, final int times) { + final StringBuilder text = new StringBuilder(line.length() * times); + for (int i = 0; i < times; i++) { + text.append(line); + } + return text.toString(); + } + + @Test + public void readBudget_isTwoThousandCharactersPerCharacterPlusAMillion() { + assertThat(AiFactExtractor.readBudget(0), is(1_000_000L)); + assertThat(AiFactExtractor.readBudget(10), is(1_020_000L)); + } + + @Test + public void readBudget_letsTheMatcherReadItsBudgetAndStopsItAfter() { + final AiFactExtractor.ReadBudget text = new AiFactExtractor.ReadBudget("abcd", 3); + + assertThat(text.charAt(0), is('a')); + assertThat(text.charAt(1), is('b')); + assertThat(text.charAt(3), is('d')); + assertThrows(AiFactExtractor.ReadBudget.Exhausted.class, () -> text.charAt(2)); + } + + @Test + public void readBudget_readsAsTheTextItWraps() { + final AiFactExtractor.ReadBudget text = new AiFactExtractor.ReadBudget("abcd", 0); + + assertThat(text.length(), is(4)); + assertThat(text.subSequence(1, 3).toString(), is("bc")); + assertThat(text.toString(), is("abcd")); + } + + @Test + public void counts_counterPastItsTimeLimit_isLeftOut() { + final Map counts = AiFactExtractor.counts( + Arrays.asList(counter("comments", QUADRATIC), counter("lines", "(?m)^<")), UNCLOSED_COMMENTS); + + assertThat(counts.containsKey("comments"), is(false)); + assertThat(counts.get("lines"), is(16_000)); + } + + @Test + public void counts_distinctCounterPastItsTimeLimit_isLeftOut() { + final Map counts = AiFactExtractor.counts( + Arrays.asList(distinct("comments", QUADRATIC), counter("lines", "(?m)^<")), UNCLOSED_COMMENTS); + + assertThat(counts.containsKey("comments"), is(false)); + } + + @Test + public void counts_ignoreCounterPastItsTimeLimit_blanksNothing() { + final Map counts = AiFactExtractor.counts( + Arrays.asList(ignore("comments", QUADRATIC), counter("x", "\\bx\\b")), UNCLOSED_COMMENTS); + + assertThat(counts.get("x"), is(16_000)); + } + + @Test + public void factsBlock_counterPastItsTimeLimit_isLeftOutOfTheLine() { + final String block = AiFactExtractor.factsBlock( + Arrays.asList(counter("comments", QUADRATIC), counter("lines", "(?m)^<")), UNCLOSED_COMMENTS); + + assertThat(block, is(AiFactExtractor.FACTS_HEADER + "lines: 16000" + AiFactExtractor.FACTS_SUFFIX)); + } + + @Test + public void counts_patternPastItsTimeLimit_warnsNamingTheCounterAndWhatItDoes() { + final ch.qos.logback.classic.Logger logger = + (ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(AiFactExtractor.class); + final ch.qos.logback.core.read.ListAppender appender = + new ch.qos.logback.core.read.ListAppender<>(); + appender.start(); + logger.addAppender(appender); + try { + AiFactExtractor.counts( + Arrays.asList(ignore("comments", QUADRATIC), counter("lazy", QUADRATIC), counter("x", "x")), + UNCLOSED_COMMENTS); + } finally { + logger.detachAppender(appender); + } + + final java.util.List warnings = new java.util.ArrayList<>(); + for (final ch.qos.logback.classic.spi.ILoggingEvent event : appender.list) { + if (event.getLevel() == ch.qos.logback.classic.Level.WARN) { + warnings.add(event.getFormattedMessage()); + } + } + final String characters = UNCLOSED_COMMENTS.length() + "-character source"; + final String reads = String.valueOf(AiFactExtractor.readBudget(UNCLOSED_COMMENTS.length())); + assertThat( + warnings, + is(Arrays.asList( + "Fact counter 'comments' stopped after reading " + reads + " characters of a " + characters + + ": its pattern backtracks too far, so it is not blanked", + "Fact counter 'lazy' stopped after reading " + reads + " characters of a " + characters + + ": its pattern backtracks too far, so it is left out of the facts"))); + } + + @Test + public void factsBlock_everyCounterPastItsTimeLimit_returnsEmpty() { + assertThat( + AiFactExtractor.factsBlock( + Collections.singletonList(counter("comments", QUADRATIC)), UNCLOSED_COMMENTS), + is("")); + } // } diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFileContextTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFileContextTest.java index 7c51b97b..011610d1 100644 --- a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFileContextTest.java +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiFileContextTest.java @@ -19,5 +19,18 @@ public void accessorsReturnConstructorValues() { assertThat(c.sizeBytes(), is(equalTo(1234L))); assertThat(c.lineCount(), is(equalTo(56))); assertThat(c.lastModifiedEpochMilli(), is(equalTo(7890L))); + assertThat(c.head(), is(equalTo(""))); + } + + @Test + public void head_isTheGivenTextAndNotInToString() { + final AiFileContext c = new AiFileContext("d.yaml", "k8s/d.yaml", 10L, 1, 5L, "apiVersion: v1\n"); + assertThat(c.fileName(), is(equalTo("d.yaml"))); + assertThat(c.relativePath(), is(equalTo("k8s/d.yaml"))); + assertThat(c.sizeBytes(), is(equalTo(10L))); + assertThat(c.lineCount(), is(equalTo(1))); + assertThat(c.lastModifiedEpochMilli(), is(equalTo(5L))); + assertThat(c.head(), is(equalTo("apiVersion: v1\n"))); + assertThat(c.toString().contains("apiVersion"), is(false)); } } diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiModelDefinitionSupportTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiModelDefinitionSupportTest.java index 97e53439..36363b2e 100644 --- a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiModelDefinitionSupportTest.java +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/AiModelDefinitionSupportTest.java @@ -290,6 +290,24 @@ public void constructor_definitionWithNullKey_throwsWithIndexAndBadEntry() { assertThat(npe.getMessage(), containsString("AiModelDefinition")); } + @Test + public void constructor_aKeyDefinedTwice_throwsNamingItsSecondIndex() { + // arrange + final AiModelDefinition first = new AiModelDefinition(); + first.setKey("gpt"); + final AiModelDefinition other = new AiModelDefinition(); + other.setKey("other"); + final AiModelDefinition again = new AiModelDefinition(); + again.setKey("gpt"); + + // act + final IllegalArgumentException thrown = assertThrows( + IllegalArgumentException.class, () -> new AiModelDefinitionSupport(Arrays.asList(first, other, again))); + + // assert + assertThat(thrown.getMessage(), is(equalTo("aiDefinitions[2].key 'gpt' is defined twice"))); + } + @Test public void getConfig_nullDefinitionsList_throwsForAnyKey() { // arrange diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ContractFactPatternsTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ContractFactPatternsTest.java new file mode 100644 index 00000000..bdc18412 --- /dev/null +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ContractFactPatternsTest.java @@ -0,0 +1,190 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.srcmorph.config; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +/** + * Validates the fact counters of the profile for interface contracts besides OpenAPI + * ({@code profiles/v3/proto-facts.tsv}, {@code avro-facts.tsv}, {@code graphql-facts.tsv}; AsyncAPI is + * in {@link OpsFactPatternsTest} next to OpenAPI, whose ignore line it shares), counted the way the + * facts line counts them: each sample has a commented-out or quoted declaration that must not count. + */ +public class ContractFactPatternsTest { + + private static final List PROTO = ProfileFactPatterns.counters("proto-facts"); + + private static final List AVRO = ProfileFactPatterns.counters("avro-facts"); + + private static final List GRAPHQL = ProfileFactPatterns.counters("graphql-facts"); + + private static int count(final List counters, final String label, final String source) { + final Map counts = ProfileFactPatterns.counts(counters, source); + final Integer count = counts.get(label); + if (count == null) { + throw new IllegalStateException("no counter '" + label + "' in " + counts.keySet()); + } + return count; + } + + // + private static final String PROTO_SOURCE = "syntax = \"proto3\";\n" + + "package shop.v1;\n" + + "import \"google/protobuf/timestamp.proto\";\n" + + "option java_package = \"shop.message Fake\";\n" + + "// message Old { int32 id = 1; }\n" + + "/* service Legacy {\n rpc Gone(A) returns (B);\n} */\n" + + "message Order {\n" + + " reserved 2, 15;\n" + + " string id = 1;\n" + + " repeated Line lines = 3;\n" + + " map counts = 4;\n" + + " optional google.protobuf.Timestamp created = 5;\n" + + " oneof payment {\n" + + " string card = 6;\n" + + " string iban = 7;\n" + + " }\n" + + " message Line { int32 qty = 1; }\n" + + "}\n" + + "enum Status {\n" + + " STATUS_UNSPECIFIED = 0;\n" + + " STATUS_PAID = 1;\n" + + "}\n" + + "service Orders {\n" + + " rpc Get(GetRequest) returns (Order);\n" + + " rpc Watch(WatchRequest) returns (stream Order);\n" + + " rpc Chat(stream Note) returns (stream Note);\n" + + "}\n"; + + @Test + public void proto_countsTheDeclarationsAndNotTheComments() { + assertThat(count(PROTO, "messages", PROTO_SOURCE), is(2)); + assertThat(count(PROTO, "enums", PROTO_SOURCE), is(1)); + assertThat(count(PROTO, "services", PROTO_SOURCE), is(1)); + assertThat(count(PROTO, "rpcs", PROTO_SOURCE), is(3)); + assertThat(count(PROTO, "streaming rpcs", PROTO_SOURCE), is(2)); + // id, lines, counts, created, card, iban; qty follows "{" on its line + assertThat(count(PROTO, "fields (approx)", PROTO_SOURCE), is(6)); + assertThat(count(PROTO, "enum values", PROTO_SOURCE), is(2)); + assertThat(count(PROTO, "oneofs", PROTO_SOURCE), is(1)); + assertThat(count(PROTO, "reserved ranges and names", PROTO_SOURCE), is(1)); + assertThat(count(PROTO, "imports", PROTO_SOURCE), is(1)); + } + + @Test + public void proto_anUnclosedBlockCommentRunsToTheEnd() { + assertThat(count(PROTO, "messages", "message A {}\n/* message B {}\nmessage C {}\n"), is(1)); + } + // + + // + private static final String AVRO_SOURCE = "{\n" + + " \"type\": \"record\", \"name\": \"Order\", \"namespace\": \"shop.avro\",\n" + + " \"fields\": [\n" + + " {\"name\": \"id\", \"type\": {\"type\": \"string\", \"logicalType\": \"uuid\"}},\n" + + " {\"name\": \"status\", \"type\": {\"type\": \"enum\", \"name\": \"Status\"," + + " \"symbols\": [\"NEW\", \"PAID\"]}},\n" + + " {\"name\": \"lines\", \"type\": {\"type\": \"array\", \"items\":\n" + + " {\"type\" : \"record\", \"name\": \"Line\", \"fields\": [{\"name\": \"qty\", \"type\": \"int\"}]}}},\n" + + " {\"name\": \"tags\", \"type\": {\"type\": \"map\", \"values\": \"string\"}},\n" + + " {\"name\": \"hash\", \"type\": {\"type\": \"fixed\", \"name\": \"Md5\", \"size\": 16}},\n" + + " {\"name\": \"note\", \"type\": [\"null\", \"string\"], \"default\": null}\n" + + " ]\n" + + "}\n"; + + @Test + public void avro_countsTheTypesAndTheNamedElements() { + assertThat(count(AVRO, "records", AVRO_SOURCE), is(2)); + assertThat(count(AVRO, "enums", AVRO_SOURCE), is(1)); + assertThat(count(AVRO, "fixed types", AVRO_SOURCE), is(1)); + assertThat(count(AVRO, "arrays", AVRO_SOURCE), is(1)); + assertThat(count(AVRO, "maps", AVRO_SOURCE), is(1)); + assertThat(count(AVRO, "unions", AVRO_SOURCE), is(1)); + // Order, id, status, Status, lines, Line, qty, tags, hash, Md5, note + assertThat(count(AVRO, "named elements (types and fields)", AVRO_SOURCE), is(11)); + assertThat(count(AVRO, "field lists", AVRO_SOURCE), is(2)); + assertThat(count(AVRO, "defaults", AVRO_SOURCE), is(1)); + assertThat(count(AVRO, "logical types", AVRO_SOURCE), is(1)); + assertThat(count(AVRO, "namespaces", AVRO_SOURCE), is(1)); + } + // + + // + private static final String SCHEMA = "\"\"\"\n" + + "The shop. type Fake { x: Int }\n" + + "\"\"\"\n" + + "schema { query: Query mutation: Mutation }\n" + + "# type Old { id: ID }\n" + + "directive @auth(role: String) on FIELD_DEFINITION\n" + + "scalar DateTime\n" + + "interface Node {\n" + + " id: ID!\n" + + "}\n" + + "type Order implements Node @key(fields: \"id\") {\n" + + " id: ID!\n" + + " \"the lines; total: Int\"\n" + + " lines(first: Int = 10, after: String): [Line!]!\n" + + " total: Int @deprecated(reason: \"use amount\")\n" + + "}\n" + + "type Line { qty: Int }\n" + + "union SearchResult = Order | Line\n" + + "enum Status {\n" + + " NEW\n" + + " PAID @deprecated\n" + + "}\n" + + "input OrderInput {\n" + + " lines: [Int!]\n" + + "}\n" + + "type Query {\n" + + " order(id: ID!): Order @auth(role: \"user\")\n" + + "}\n" + + "extend type Query {\n" + + " search(text: String): [SearchResult]\n" + + "}\n" + + "type Mutation {\n" + + " placeOrder(input: OrderInput!): Order\n" + + "}\n"; + + @Test + public void graphql_countsTheSchemaAndNotTheDescriptions() { + assertThat(count(GRAPHQL, "object types", SCHEMA), is(2)); + assertThat(count(GRAPHQL, "root operation types", SCHEMA), is(3)); + assertThat(count(GRAPHQL, "interfaces", SCHEMA), is(1)); + assertThat(count(GRAPHQL, "unions", SCHEMA), is(1)); + assertThat(count(GRAPHQL, "enums", SCHEMA), is(1)); + assertThat(count(GRAPHQL, "input types", SCHEMA), is(1)); + assertThat(count(GRAPHQL, "scalars", SCHEMA), is(1)); + // id (Node), id, lines, total, lines (input), order, search, placeOrder; qty is on the type's line + assertThat(count(GRAPHQL, "fields (approx)", SCHEMA), is(8)); + assertThat(count(GRAPHQL, "directive definitions", SCHEMA), is(1)); + // @key, @deprecated twice, @auth; not the definition's own @auth + assertThat(count(GRAPHQL, "directive uses", SCHEMA), is(4)); + assertThat(count(GRAPHQL, "deprecated fields and values", SCHEMA), is(2)); + assertThat(count(GRAPHQL, "operations", SCHEMA), is(0)); + } + + @Test + public void graphql_countsTheOperationsAndFragmentsOfAnExecutableDocument() { + final String operations = "query Orders($first: Int) {\n" + + " orders(first: $first) { ...OrderParts }\n" + + "}\n" + + "mutation Pay { pay(id: 1) { ok } }\n" + + "# subscription Old { x }\n" + + "fragment OrderParts on Order { id total }\n"; + + assertThat(count(GRAPHQL, "operations", operations), is(2)); + assertThat(count(GRAPHQL, "fragments", operations), is(1)); + } + + @Test + public void graphql_anUnclosedBlockStringRunsToTheEnd() { + assertThat(count(GRAPHQL, "object types", "type A { x: Int }\n\"\"\"\ntype B { y: Int }\n"), is(1)); + } + // +} diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/EnterpriseXmlFactPatternsTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/EnterpriseXmlFactPatternsTest.java new file mode 100644 index 00000000..e72216ba --- /dev/null +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/EnterpriseXmlFactPatternsTest.java @@ -0,0 +1,408 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.srcmorph.config; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +/** + * Validates the fact counters of the profile for the XML of enterprise Java and integration + * ({@code profiles/v3/jee-facts.tsv}, {@code persistence-facts.tsv}, {@code mybatis-facts.tsv}, + * {@code integration-facts.tsv}, {@code bpmn-facts.tsv}, {@code wsdl-facts.tsv}), counted the way the + * facts line counts them. All but the MyBatis file include {@code xml-facts}, so its {@code [ignore]} + * line blanks comments and CDATA first; each sample has a commented-out element that must not count, + * and the elements whose names begin like a counted one ({@code }, {@code }). + */ +public class EnterpriseXmlFactPatternsTest { + + private static final List XML = ProfileFactPatterns.counters("xml-facts"); + + private static final List JEE = ProfileFactPatterns.counters("jee-facts"); + + private static final List PERSISTENCE = ProfileFactPatterns.counters("persistence-facts"); + + private static final List MYBATIS = ProfileFactPatterns.counters("mybatis-facts"); + + private static final List INTEGRATION = ProfileFactPatterns.counters("integration-facts"); + + private static final List BPMN = ProfileFactPatterns.counters("bpmn-facts"); + + private static final List WSDL = ProfileFactPatterns.counters("wsdl-facts"); + + private static int count(final List counters, final String label, final String source) { + final Map counts = ProfileFactPatterns.counts(counters, source); + final Integer count = counts.get(label); + if (count == null) { + throw new IllegalStateException("no counter '" + label + "' in " + counts.keySet()); + } + return count; + } + + private static List labels(final List counters) { + return new ArrayList<>(ProfileFactPatterns.counts(counters, "").keySet()); + } + + @Test + public void everyFileButMyBatis_startsWithTheXmlCounters() { + final List xml = labels(XML); + for (final List counters : List.of(JEE, PERSISTENCE, INTEGRATION, BPMN, WSDL)) { + assertThat(labels(counters).subList(0, xml.size()), is(xml)); + } + assertThat(labels(MYBATIS).contains("elements"), is(false)); + } + + // + private static final String WEB_XML = "\n" + + "\n" + + "\n" + + "a\n" + + "Frontx.Front\n" + + "Front/app/*" + + "*.do\n" + + "FF" + + "/*\n" + + "x.L\n" + + "30\n" + + "/admin/*" + + "\n" + + "admin\n" + + "ejb/O" + + "jdbc/DS\n" + + "max\n" + + "\n"; + + private static final String EJB_JAR = "\n" + + "OrderServiceStateless" + + "\n" + + "\n Cart Stateful \n" + + "OrderListener\n" + + "Customer\n" + + "x.I" + + "\n" + + "r" + + "\n"; + + @Test + public void jee_webXml_countsEveryComponentOnceAndNotItsChildren() { + assertThat(count(JEE, "servlets", WEB_XML), is(1)); + assertThat(count(JEE, "servlet mappings", WEB_XML), is(1)); + assertThat(count(JEE, "URL patterns", WEB_XML), is(4)); + assertThat(count(JEE, "filters", WEB_XML), is(1)); + assertThat(count(JEE, "filter mappings", WEB_XML), is(1)); + assertThat(count(JEE, "listeners", WEB_XML), is(1)); + assertThat(count(JEE, "context parameters", WEB_XML), is(1)); + assertThat(count(JEE, "session beans", WEB_XML), is(0)); + assertThat(count(JEE, "security roles", WEB_XML), is(1)); + assertThat(count(JEE, "security constraints", WEB_XML), is(1)); + assertThat(count(JEE, "EJB references", WEB_XML), is(1)); + assertThat(count(JEE, "resource references", WEB_XML), is(1)); + assertThat(count(JEE, "persistence references", WEB_XML), is(1)); + assertThat(count(JEE, "environment entries", WEB_XML), is(1)); + } + + @Test + public void jee_ejbJar_countsBeansByKind() { + assertThat(count(JEE, "session beans", EJB_JAR), is(2)); + assertThat(count(JEE, "stateless session beans", EJB_JAR), is(1)); + assertThat(count(JEE, "message-driven beans", EJB_JAR), is(1)); + assertThat(count(JEE, "entity beans (EJB 2.x)", EJB_JAR), is(1)); + assertThat(count(JEE, "interceptors", EJB_JAR), is(1)); + assertThat(count(JEE, "timers", EJB_JAR), is(1)); + assertThat(count(JEE, "container transactions", EJB_JAR), is(1)); + assertThat(count(JEE, "method permissions", EJB_JAR), is(1)); + } + + @Test + public void jee_applicationXml_countsItsModules() { + assertThat( + count( + JEE, + "EAR modules", + "a.jarw.war" + + "\n"), + is(2)); + } + // + + // + private static final String PERSISTENCE_XML = + "" + + "java:/ShopDSMETA-INF/orm.xml" + + "x.Orderx.Line" + + "\n"; + + private static final String ORM_XML = "" + + "SELECT o FROM Order o" + + "" + + "\n"; + + private static final String HBM_XML = "\n" + + "\n" + + "" + + "" + + "\n" + + "]]>" + + "\n"; + + @Test + public void persistence_persistenceXml_countsTheUnitAndItsClasses() { + assertThat(count(PERSISTENCE, "persistence units", PERSISTENCE_XML), is(1)); + assertThat(count(PERSISTENCE, "JTA data sources", PERSISTENCE_XML), is(1)); + assertThat(count(PERSISTENCE, "non-JTA data sources", PERSISTENCE_XML), is(0)); + assertThat(count(PERSISTENCE, "listed classes", PERSISTENCE_XML), is(2)); + assertThat(count(PERSISTENCE, "entity mappings", PERSISTENCE_XML), is(0)); + assertThat(count(PERSISTENCE, "mapping files", PERSISTENCE_XML), is(1)); + assertThat(count(PERSISTENCE, "properties", PERSISTENCE_XML), is(1)); + } + + @Test + public void persistence_ormXml_countsEntitiesQueriesAndAssociations() { + assertThat(count(PERSISTENCE, "persistence units", ORM_XML), is(0)); + assertThat(count(PERSISTENCE, "named queries", ORM_XML), is(1)); + assertThat(count(PERSISTENCE, "entity mappings", ORM_XML), is(1)); + assertThat(count(PERSISTENCE, "embeddables and mapped superclasses", ORM_XML), is(1)); + assertThat(count(PERSISTENCE, "associations", ORM_XML), is(1)); + } + + @Test + public void persistence_hbmXml_countsMappingsAndNotTheQueryTextInCdata() { + assertThat(count(PERSISTENCE, "entity mappings", HBM_XML), is(2)); + assertThat(count(PERSISTENCE, "named queries", HBM_XML), is(2)); + assertThat(count(PERSISTENCE, "associations", HBM_XML), is(2)); + assertThat(count(PERSISTENCE, "properties", HBM_XML), is(1)); + assertThat(count(PERSISTENCE, "mapping files", HBM_XML), is(0)); + assertThat(count(PERSISTENCE, "listed classes", HBM_XML), is(0)); + } + // + + // + private static final String MAPPER = "\n" + + "\n" + + "\n" + + "\n" + + "id, total\n" + + "\n" + + "insert into orders values (#{id,jdbcType=INTEGER})\n" + + "update orders total=#{t}\n"; + + @Test + public void mybatis_countsStatementsAndReadsTheSqlInCdata() { + assertThat(count(MYBATIS, "mapper namespaces", MAPPER), is(1)); + assertThat(count(MYBATIS, "select statements", MAPPER), is(1)); + assertThat(count(MYBATIS, "insert, update and delete statements", MAPPER), is(2)); + assertThat(count(MYBATIS, "result maps", MAPPER), is(1)); + assertThat(count(MYBATIS, "SQL fragments", MAPPER), is(1)); + assertThat(count(MYBATIS, "fragment includes", MAPPER), is(1)); + assertThat(count(MYBATIS, "dynamic SQL tags", MAPPER), is(3)); + // #{id}, #{max} in CDATA, #{id,jdbcType=INTEGER}, #{t} + assertThat(count(MYBATIS, "parameters #{}", MAPPER), is(4)); + // ${sort}; not the commented-out ${bad} + assertThat(count(MYBATIS, "substitutions ${}", MAPPER), is(1)); + } + // + + // + private static final String CAMEL = "\n" + + "\n" + + "\n" + + "\n" + + "java.io.IOException" + + "\n" + + "\n" + + "\n" + + "${body.total} > 100" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n"; + + private static final String MULE = "\n" + + "" + + "\n" + + "\n" + + "\n"; + + @Test + public void integration_camelRoute_countsRoutesEndpointsAndPlaceholders() { + assertThat(count(INTEGRATION, "Camel routes and route templates", CAMEL), is(1)); + assertThat(count(INTEGRATION, "Camel REST services", CAMEL), is(1)); + assertThat(count(INTEGRATION, "Camel consumer endpoints (from)", CAMEL), is(1)); + assertThat(count(INTEGRATION, "Camel producer endpoints", CAMEL), is(4)); + assertThat(count(INTEGRATION, "error handlers", CAMEL), is(1)); + assertThat(count(INTEGRATION, "property placeholders", CAMEL), is(3)); + assertThat(count(INTEGRATION, "Spring beans", CAMEL), is(1)); + } + + @Test + public void integration_muleSpringIntegrationAndSynapse() { + assertThat(count(INTEGRATION, "Mule flows and sub-flows", MULE), is(2)); + assertThat(count(INTEGRATION, "Mule flow references", MULE), is(1)); + assertThat(count(INTEGRATION, "error handlers", MULE), is(1)); + final String springIntegration = "" + + "\n"; + assertThat(count(INTEGRATION, "Spring Integration channels", springIntegration), is(2)); + assertThat(count(INTEGRATION, "channel adapters and gateways", springIntegration), is(2)); + final String synapse = "" + + "
" + + "\n"; + assertThat(count(INTEGRATION, "Synapse proxies, APIs, sequences and endpoints (named)", synapse), is(3)); + assertThat(count(INTEGRATION, "error handlers", synapse), is(1)); + } + // + + // + private static final String DIAGRAM = "" + + "" + + "\n"; + + private static final String PROCESS = "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "" + + "${ok}\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + DIAGRAM + + "\n"; + + @Test + public void bpmn_countsTheProcessAndNotTheDiagram() { + assertThat(count(BPMN, "processes", PROCESS), is(1)); + assertThat(count(BPMN, "tasks", PROCESS), is(3)); + assertThat(count(BPMN, "call activities and sub-processes", PROCESS), is(1)); + assertThat(count(BPMN, "gateways", PROCESS), is(1)); + assertThat(count(BPMN, "events", PROCESS), is(3)); + assertThat(count(BPMN, "sequence flows", PROCESS), is(2)); + assertThat(count(BPMN, "messages, signals, errors and escalations (named)", PROCESS), is(1)); + assertThat(count(BPMN, "Java delegate bindings", PROCESS), is(1)); + assertThat(count(BPMN, "external task topics, job types and work items", PROCESS), is(1)); + // the diagram's shapes and edges are blanked, so the elements are those of the process alone + assertThat(count(BPMN, "elements", PROCESS), is(count(BPMN, "elements", PROCESS.replace(DIAGRAM, "")))); + assertThat(count(XML, "elements", PROCESS) > count(BPMN, "elements", PROCESS), is(true)); + } + + @Test + public void bpmn_anUnclosedDiagramRunsToTheEnd() { + assertThat(count(BPMN, "processes", "\n\n\n"), is(1)); + } + // + + // + private static final List DMN = ProfileFactPatterns.counters("dmn-facts"); + + /** The diagram interchange of {@link #DECISIONS}: shapes and edges, which must not count. */ + private static final String DMN_DIAGRAM = "\n" + + "\n" + + "\n" + + "\n"; + + /** A decision requirements graph with two decision tables, one of them FIRST, and a literal decision. */ + private static final String DECISIONS = "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " type\n" + + " total\n" + + " \n" + + " \"gold\"-" + + "0.1\n" + + " -> 100" + + "0.05\n" + + " \n" + + " \n" + + "\n" + + "\n" + + " " + + "\n" + + "\n" + + "\"x\"\n" + + "\n" + + DMN_DIAGRAM + + "\n"; + + @Test + public void dmn_countsTheDecisionsAndNotTheDiagram() { + assertThat(count(DMN, "decisions", DECISIONS), is(4)); + assertThat(count(DMN, "decision tables", DECISIONS), is(2)); + assertThat(count(DMN, "decision tables with a hit policy other than UNIQUE", DECISIONS), is(1)); + assertThat(count(DMN, "inputs", DECISIONS), is(3)); + assertThat(count(DMN, "outputs", DECISIONS), is(2)); + assertThat(count(DMN, "rules", DECISIONS), is(3)); + assertThat(count(DMN, "input data", DECISIONS), is(1)); + assertThat(count(DMN, "business knowledge models", DECISIONS), is(1)); + assertThat(count(DMN, "knowledge sources", DECISIONS), is(1)); + assertThat(count(DMN, "requirements", DECISIONS), is(3)); + assertThat(count(DMN, "literal expressions", DECISIONS), is(1)); + assertThat(count(DMN, "boxed contexts, invocations, relations and functions", DECISIONS), is(1)); + // the diagram's shapes and edges are blanked, so the elements are those of the decisions alone + assertThat(count(DMN, "elements", DECISIONS), is(count(DMN, "elements", DECISIONS.replace(DMN_DIAGRAM, "")))); + } + + @Test + public void dmn_hitPolicyWithAPrefixOrSpacesAndAnUnclosedDiagram() { + assertThat( + count( + DMN, + "decision tables with a hit policy other than UNIQUE", + "\n"), + is(1)); + assertThat(count(DMN, "decisions", "\n\n\n"), is(1)); + } + // + + // + private static final String WSDL_SOURCE = "\n" + + "\n" + + "\n" + + "\n" + + "" + + "\n" + + "" + + "\n" + + "" + + "\n" + + "\n"; + + @Test + public void wsdl_countsTheServiceAndKeepsSoapElementsApart() { + assertThat(count(WSDL, "services", WSDL_SOURCE), is(1)); + assertThat(count(WSDL, "ports and endpoints", WSDL_SOURCE), is(1)); + assertThat(count(WSDL, "port types and interfaces", WSDL_SOURCE), is(1)); + assertThat(count(WSDL, "bindings", WSDL_SOURCE), is(1)); + assertThat(count(WSDL, "operations", WSDL_SOURCE), is(2)); + assertThat(count(WSDL, "messages", WSDL_SOURCE), is(2)); + assertThat(count(WSDL, "SOAP bindings", WSDL_SOURCE), is(1)); + assertThat(count(WSDL, "XSD type definitions", WSDL_SOURCE), is(1)); + assertThat(count(WSDL, "operations", WSDL_SOURCE.replace("<", " +} diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/JavaStructureFactPatternsTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/JavaStructureFactPatternsTest.java index 6e6351f9..cf6bb31a 100644 --- a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/JavaStructureFactPatternsTest.java +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/JavaStructureFactPatternsTest.java @@ -147,6 +147,38 @@ public void field_genericType_counts() { assertThat(count(FIELD_PATTERN, " private Map> m;"), is(1)); } + @Test + public void field_initializerOverManyLines_counts() { + assertThat( + count(FIELD_PATTERN, " private static final int[] A = {\n 1,\n 2,\n };\n"), is(1)); + assertThat( + count( + FIELD_PATTERN, + " private final Runnable r = new Runnable() {\n public void run() {\n" + + " go();\n }\n };\n"), + is(1)); + } + + @Test + public void field_initializerLongerThanTenThousandCharacters_doesNotCount() { + // the initializer is read up to 10,000 characters, which keeps the pattern linear over a file + // of declarations without their semicolons + final String table = " static final String T = \"" + "x".repeat(10_000) + "\";\n"; + assertThat(count(FIELD_PATTERN, table), is(0)); + assertThat(count(FIELD_PATTERN, " static final String T = \"" + "x".repeat(9_000) + "\";\n"), is(1)); + } + + @Test + public void field_genericTypeOverTwoLines_doesNotCount() { + // type arguments are read within one line, so a declaration without its ">" cannot rescan the file + assertThat(count(FIELD_PATTERN, " private Map m;\n"), is(0)); + } + + @Test + public void method_typeParametersOverTwoLines_doNotCount() { + assertThat(count(METHOD_PATTERN, " public void put(K k, V v) {\n"), is(0)); + } + @Test public void field_transientArray_counts() { assertThat(count(FIELD_PATTERN, " transient Object[] elementData;"), is(1)); @@ -223,4 +255,59 @@ public void typeDeclarations_afterManyBlankLines_stayLinear() { assertThat(assertTimeoutPreemptively(LONG_INPUT_LIMIT, () -> count(TYPE_PATTERN, source)), is(1)); } // + + // + /** A class whose comments, Javadoc, strings, text block and char literal name declarations. */ + private static final String COMMENTED_CLASS = "/** A public class Example: {@code public void run()} */\n" + + "public class A {\n" + + " // TODO public later\n" + + " private static final String S = \"public class X // not a comment\";\n" + + " private static final String T = \"\"\"\n" + + " public class Y \" \\\"\"\" still the block\n" + + " \"\"\";\n" + + " /* FIXME */ public void run() {\n" + + " }\n" + + " char c = '\"';\n" + + " char d = '\\'';\n" + + " public int x = 1;\n" + + "}\n"; + + @Test + public void wholeFile_commentsStringsAndTextBlocks_doNotCount() { + final Map counts = + ProfileFactPatterns.counts(ProfileFactPatterns.counters("java-facts"), COMMENTED_CLASS); + + assertThat(counts.get("type declarations"), is(1)); + assertThat(counts.get("public declarations"), is(3)); + assertThat(counts.get("methods (approx)"), is(1)); + assertThat(counts.get("field declarations (w/ modifier)"), is(3)); + } + + @Test + public void wholeFile_todosInComments_count() { + final Map counts = + ProfileFactPatterns.counts(ProfileFactPatterns.counters("java-facts"), COMMENTED_CLASS); + + assertThat(counts.get("TODO/FIXME"), is(2)); + } + + @Test + public void wholeFile_unclosedBlockCommentAndTextBlock_runToTheEnd() { + final Map comment = + ProfileFactPatterns.counts(ProfileFactPatterns.counters("java-facts"), "public class A {\n/* public\n"); + final Map textBlock = ProfileFactPatterns.counts( + ProfileFactPatterns.counters("java-facts"), "public class A {\nString s = \"\"\"\npublic\n"); + + assertThat(comment.get("public declarations"), is(1)); + assertThat(textBlock.get("public declarations"), is(1)); + } + + @Test + public void wholeFile_stringNotClosedOnItsLine_isNotBlanked() { + final Map counts = ProfileFactPatterns.counts( + ProfileFactPatterns.counters("java-facts"), "String s = \"public\npublic class A {\n"); + + assertThat(counts.get("public declarations"), is(2)); + } + // } diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/JvmFactPatternsTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/JvmFactPatternsTest.java new file mode 100644 index 00000000..b40f47ff --- /dev/null +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/JvmFactPatternsTest.java @@ -0,0 +1,354 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.srcmorph.config; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +/** + * Validates the fact counters of the profile for the JVM languages besides Java, which share the + * prompt {@code file-body-oop} ({@code profiles/v3/kotlin-facts.tsv}, {@code groovy-facts.tsv}), and + * the Jakarta EE counters over Java ({@code java-ee-facts.tsv}, which includes {@code java-facts}), + * counted the way the facts line counts them: the {@code [ignore]} lines blank comments and strings + * first. Each sample holds the traps of its language: a keyword in a comment, a doc comment, a string + * or a raw string. + */ +public class JvmFactPatternsTest { + + private static final List KOTLIN = ProfileFactPatterns.counters("kotlin-facts"); + + private static final List GROOVY = ProfileFactPatterns.counters("groovy-facts"); + + private static final List JAVA_EE = ProfileFactPatterns.counters("java-ee-facts"); + + private static final List JAVA = ProfileFactPatterns.counters("java-facts"); + + private static final List SCALA = ProfileFactPatterns.counters("scala-facts"); + + private static int count(final List counters, final String label, final String source) { + final Map counts = ProfileFactPatterns.counts(counters, source); + final Integer count = counts.get(label); + if (count == null) { + throw new IllegalStateException("no counter '" + label + "' in " + counts.keySet()); + } + return count; + } + + // + private static final String KOTLIN_SOURCE = "package shop.orders\n" + + "\n" + + "import kotlinx.coroutines.flow.Flow\n" + + "import shop.Money\n" + + "\n" + + "/** A fun class in KDoc: fun x() */\n" + + "// fun commented() {}\n" + + "/* outer /* nested fun inner() */ class StillComment */\n" + + "@JvmInline\n" + + "value class OrderId(val raw: String)\n" + + "\n" + + "data class Order(\n" + + " val id: OrderId,\n" + + " private var total: Money,\n" + + " val note: String = \"fun inString() class X ${id}\",\n" + + ")\n" + + "\n" + + "sealed interface Event\n" + + "object Registry {\n" + + " const val LIMIT = 10\n" + + " lateinit var cache: String\n" + + " fun size(): Int = 0\n" + + "}\n" + + "\n" + + "class OrderService(private val repo: Repo) : Service {\n" + + " companion object {\n" + + " private const val TAG = \"svc\"\n" + + " }\n" + + " constructor() : this(Repo())\n" + + " suspend fun load(id: OrderId): Order = repo.find(id)\n" + + " override fun toString() = \"\"\"raw fun in string\n" + + " class Fake\"\"\"\n" + + " private fun String.normalized(): String = trim()\n" + + "}\n" + + "\n" + + "fun Order.total(): Money = total\n" + + "internal suspend inline fun retry(block: () -> T): T = block()\n" + + "fun interface Handler { fun handle() }\n"; + + @Test + public void kotlinProfile_hasTheseCountersInThisOrder() { + assertThat( + new ArrayList<>(ProfileFactPatterns.counts(KOTLIN, "").keySet()), + is(Arrays.asList( + "type declarations", + "companion objects", + "data classes", + "sealed types", + "functions (approx)", + "extension functions", + "suspend functions", + "secondary constructors", + "constructor properties (approx)", + "const vals", + "lateinit properties", + "imports"))); + } + + @Test + public void kotlin_typesCountAndCommentsKdocAndStringsDoNot() { + // value class, data class, sealed interface, object, class, fun interface + assertThat(count(KOTLIN, "type declarations", KOTLIN_SOURCE), is(6)); + assertThat(count(KOTLIN, "companion objects", KOTLIN_SOURCE), is(1)); + assertThat(count(KOTLIN, "data classes", KOTLIN_SOURCE), is(1)); + assertThat(count(KOTLIN, "sealed types", KOTLIN_SOURCE), is(1)); + } + + @Test + public void kotlin_functionsCountAtTheStartOfALineAndAFunInterfaceDoesNot() { + // size, load, toString, normalized, total, retry; not "fun interface", not a fun mid-line + assertThat(count(KOTLIN, "functions (approx)", KOTLIN_SOURCE), is(6)); + assertThat(count(KOTLIN, "extension functions", KOTLIN_SOURCE), is(2)); + assertThat(count(KOTLIN, "suspend functions", KOTLIN_SOURCE), is(2)); + } + + @Test + public void kotlin_constructorsAndProperties() { + assertThat(count(KOTLIN, "secondary constructors", KOTLIN_SOURCE), is(1)); + // raw, id, total, note, repo + assertThat(count(KOTLIN, "constructor properties (approx)", KOTLIN_SOURCE), is(5)); + assertThat(count(KOTLIN, "const vals", KOTLIN_SOURCE), is(2)); + assertThat(count(KOTLIN, "lateinit properties", KOTLIN_SOURCE), is(1)); + assertThat(count(KOTLIN, "imports", KOTLIN_SOURCE), is(2)); + } + + @Test + public void kotlin_unclosedRawStringAndBlockComment_areBlankedToTheEnd() { + assertThat(count(KOTLIN, "functions (approx)", "fun a() = 1\nval s = \"\"\"\nfun b() = 2\n"), is(1)); + assertThat(count(KOTLIN, "functions (approx)", "fun a() = 1\n/* /* */\nfun b() = 2\n"), is(1)); + } + // + + // + private static final String GROOVY_SOURCE = "#!/usr/bin/env groovy\n" + + "package shop\n" + + "\n" + + "import groovy.transform.CompileStatic\n" + + "import spock.lang.Specification\n" + + "\n" + + "/* class Commented {} */\n" + + "@CompileStatic\n" + + "class OrderSpec extends Specification {\n" + + " def service = new OrderService()\n" + + "\n" + + " def \"places an order\"() {\n" + + " given:\n" + + " def order = new Order(total: 5)\n" + + " when:\n" + + " service.place(order)\n" + + " then:\n" + + " order.placed\n" + + " }\n" + + "\n" + + " void 'rejects an empty order'() {\n" + + " expect:\n" + + " service.validate([]) == false\n" + + " where:\n" + + " x << [1, 2]\n" + + " }\n" + + "\n" + + " private int helper(String s) {\n" + + " return s.size()\n" + + " }\n" + + "}\n" + + "\n" + + "trait Audited {\n" + + " def audit(String who) { println \"class Fake ${who}\" }\n" + + "}\n" + + "\n" + + "def total = items.collect { item -> item.price }.sum()\n" + + "def pattern = /class\\s+\\w+/\n" + + "String gstring = \"\"\"\n" + + "def fake() { }\n" + + "\"\"\"\n"; + + @Test + public void groovyProfile_hasTheseCountersInThisOrder() { + assertThat( + new ArrayList<>(ProfileFactPatterns.counts(GROOVY, "").keySet()), + is(Arrays.asList( + "type declarations", + "methods (approx)", + "Spock feature methods", + "Spock blocks", + "closures with parameters (approx)", + "static type checking", + "imports"))); + } + + @Test + public void groovy_typesAndMethodsCountAndStringsCommentsAndRegexesDoNot() { + assertThat(count(GROOVY, "type declarations", GROOVY_SOURCE), is(2)); + // helper and the def method audit; not the feature methods, not a call, not the GString's def + assertThat(count(GROOVY, "methods (approx)", GROOVY_SOURCE), is(2)); + } + + @Test + public void groovy_spockFeaturesNamedByStringsAndTheirBlocks() { + assertThat(count(GROOVY, "Spock feature methods", GROOVY_SOURCE), is(2)); + assertThat(count(GROOVY, "Spock blocks", GROOVY_SOURCE), is(5)); + } + + @Test + public void groovy_closuresStaticCheckingAndImports() { + assertThat(count(GROOVY, "closures with parameters (approx)", GROOVY_SOURCE), is(1)); + assertThat(count(GROOVY, "static type checking", GROOVY_SOURCE), is(1)); + assertThat(count(GROOVY, "imports", GROOVY_SOURCE), is(2)); + } + + @Test + public void groovy_shebangAndDollarSlashyString_areBlanked() { + assertThat(count(GROOVY, "type declarations", "#!/bin/class X\nclass A {}\n"), is(1)); + assertThat(count(GROOVY, "type declarations", "def s = $/\nclass B {}\n/$\nclass A {}\n"), is(1)); + } + // + + // + private static final String JAVA_EE_SOURCE = "package shop;\n" + + "\n" + + "import jakarta.ejb.Stateless;\n" + + "\n" + + "/**\n" + + " * Uses @Inject and\n" + + " * @Stateless in prose.\n" + + " */\n" + + "@Stateless\n" + + "@TransactionAttribute(TransactionAttributeType.REQUIRED)\n" + + "@RolesAllowed(\"admin\") @Path(\"/orders\")\n" + + "public class OrderResource {\n" + + " // @Inject Old old;\n" + + " @Inject private Foo foo;\n" + + " @Named(\"x\") @Inject Bar bar;\n" + + " @PersistenceContext(unitName = \"shop\")\n" + + " private EntityManager em;\n" + + " @EJB(lookup = \"java:global/x\") Baz baz;\n" + + " @GET @Path(\"{id}\") @Produces(\"application/json\")\n" + + " public Order get(@PathParam(\"id\") long id) { return null; }\n" + + " @Schedule(hour = \"*\") void tick() {}\n" + + "}\n" + + "@jakarta.persistence.Entity\n" + + "@NamedQueries({@NamedQuery(name = \"a\", query = \"x\"), @NamedQuery(name = \"b\", query = \"y\")})\n" + + "class Order {}\n" + + "@MessageDriven class Listener {}\n" + + "@WebServlet(\"/x\") class Front {}\n" + + "@javax.jws.WebService class Soap {}\n" + + "@javax.inject.Singleton class S {}\n"; + + @Test + public void javaEeProfile_startsWithTheJavaCountersAndAddsItsOwn() { + final List labels = + new ArrayList<>(ProfileFactPatterns.counts(JAVA_EE, "").keySet()); + final List java = + new ArrayList<>(ProfileFactPatterns.counts(JAVA, "").keySet()); + assertThat(labels.subList(0, java.size()), is(java)); + assertThat( + labels.subList(java.size(), labels.size()), + is(Arrays.asList( + "EJB session beans", + "message-driven beans", + "JPA entities and embeddables", + "JPA named queries", + "injection points", + "JAX-RS resource paths", + "HTTP method annotations", + "servlets, filters and listeners", + "SOAP endpoints", + "transaction annotations", + "EJB timers", + "security annotations"))); + assertThat( + count(JAVA_EE, "type declarations", JAVA_EE_SOURCE), + is(count(JAVA, "type declarations", JAVA_EE_SOURCE))); + } + + @Test + public void javaEe_componentsCountAndProseAndOtherPackagesDoNot() { + assertThat(count(JAVA_EE, "EJB session beans", JAVA_EE_SOURCE), is(1)); + assertThat(count(JAVA_EE, "message-driven beans", JAVA_EE_SOURCE), is(1)); + assertThat(count(JAVA_EE, "JPA entities and embeddables", JAVA_EE_SOURCE), is(1)); + assertThat(count(JAVA_EE, "JPA named queries", JAVA_EE_SOURCE), is(2)); + assertThat(count(JAVA_EE, "servlets, filters and listeners", JAVA_EE_SOURCE), is(1)); + assertThat(count(JAVA_EE, "SOAP endpoints", JAVA_EE_SOURCE), is(1)); + } + + @Test + public void javaEe_wiringCountsAfterOtherAnnotationsAndNotInAComment() { + // foo, bar (after @Named), em, baz; not the commented-out @Inject + assertThat(count(JAVA_EE, "injection points", JAVA_EE_SOURCE), is(4)); + assertThat(count(JAVA_EE, "JAX-RS resource paths", JAVA_EE_SOURCE), is(2)); + assertThat(count(JAVA_EE, "HTTP method annotations", JAVA_EE_SOURCE), is(1)); + assertThat(count(JAVA_EE, "transaction annotations", JAVA_EE_SOURCE), is(1)); + assertThat(count(JAVA_EE, "EJB timers", JAVA_EE_SOURCE), is(1)); + assertThat(count(JAVA_EE, "security annotations", JAVA_EE_SOURCE), is(1)); + } + // + + // + private static final String SCALA_SOURCE = "package shop\n" + + "import scala.concurrent.Future\n" + + "import shop.model.{Order, Line}\n" + + "/** A class Fake in the Scaladoc; def fake() = 1 */\n" + + "sealed trait Event\n" + + "final case class Placed(id: String) extends Event\n" + + "case object Cancelled extends Event\n" + + "/* class Old {\n /* nested */ def gone() = 0\n} */\n" + + "@deprecated(\"use Orders\") private[shop] class OrderService(repo: Repo) {\n" + + " private val Prefix = \"def notAMethod = 1\"\n" + + " lazy val cache = Map.empty[String, Order]\n" + + " type Id = String\n" + + " override def toString: String = s\"OrderService(${repo})\"\n" + + " def place(order: Order)(implicit ec: ExecutionContext): Future[Order] = {\n" + + " val symbol = 'placed\n" + + " val quote = '\"'\n" + + " def local(x: Int) = x + 1\n" + + " repo.save(order)\n" + + " }\n" + + " def +(other: OrderService): OrderService = this\n" + + "}\n" + + "object OrderService {\n" + + " implicit val ordering: Ordering[Order] = Ordering.by(_.id)\n" + + " given Conversion[String, Order] = Order(_)\n" + + "}\n" + + "enum Status:\n" + + " case New, Paid\n" + + "extension (o: Order)\n" + + " def total: BigDecimal = o.lines.map(_.price).sum\n" + + "opaque type Money = BigDecimal\n"; + + @Test + public void scala_countsDeclarationsAndNotCommentsOrStrings() { + // Event, Placed, Cancelled, OrderService, OrderService (companion), Status + assertThat(count(SCALA, "type declarations", SCALA_SOURCE), is(6)); + assertThat(count(SCALA, "case classes and case objects", SCALA_SOURCE), is(2)); + assertThat(count(SCALA, "traits", SCALA_SOURCE), is(1)); + // toString, place, local, +, total + assertThat(count(SCALA, "methods (approx)", SCALA_SOURCE), is(5)); + assertThat(count(SCALA, "extension methods", SCALA_SOURCE), is(1)); + assertThat(count(SCALA, "givens and implicits", SCALA_SOURCE), is(2)); + // Prefix, cache, symbol, quote, ordering + assertThat(count(SCALA, "vals and vars at the start of a line (members and locals)", SCALA_SOURCE), is(5)); + assertThat(count(SCALA, "type aliases", SCALA_SOURCE), is(2)); + assertThat(count(SCALA, "imports", SCALA_SOURCE), is(2)); + } + + @Test + public void scala_anUnclosedNestedCommentRunsToTheEnd() { + assertThat(count(SCALA, "type declarations", "class A\n/* /* nested */ still open\nclass B\n"), is(1)); + } + // +} diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/OpsFactPatternsTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/OpsFactPatternsTest.java new file mode 100644 index 00000000..ed409f16 --- /dev/null +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/OpsFactPatternsTest.java @@ -0,0 +1,762 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.srcmorph.config; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +/** + * Validates the fact counters of the profile for API contracts and operations files + * ({@code profiles/v3/openapi-facts.tsv} for the prompt {@code file-body-contract}; + * {@code k8s-facts.tsv}, {@code actions-facts.tsv} and {@code dockerfile-facts.tsv} for + * {@code file-body-ops}), counted the way the facts line counts them: comments, and in an OpenAPI + * document the body of a block scalar, are blanked first, so a path or a kind quoted in a description + * does not count. + */ +public class OpsFactPatternsTest { + + private static final List OPENAPI = ProfileFactPatterns.counters("openapi-facts"); + + private static final List K8S = ProfileFactPatterns.counters("k8s-facts"); + + private static final List ACTIONS = ProfileFactPatterns.counters("actions-facts"); + + private static final List DOCKERFILE = ProfileFactPatterns.counters("dockerfile-facts"); + + private static final List ASYNCAPI = ProfileFactPatterns.counters("asyncapi-facts"); + + private static final List TERRAFORM = ProfileFactPatterns.counters("terraform-facts"); + + private static final List ANSIBLE = ProfileFactPatterns.counters("ansible-facts"); + + private static final List COMPOSE = ProfileFactPatterns.counters("compose-facts"); + + private static final List CAMEL_YAML = ProfileFactPatterns.counters("camel-yaml-facts"); + + private static final List GRADLE = ProfileFactPatterns.counters("gradle-facts"); + + private static final List PROPERTIES = ProfileFactPatterns.counters("properties-facts"); + + private static final List POWERSHELL = ProfileFactPatterns.counters("powershell-facts"); + + private static final List BATCH = ProfileFactPatterns.counters("batch-facts"); + + private static int count(final List counters, final String label, final String source) { + final Map counts = ProfileFactPatterns.counts(counters, source); + final Integer count = counts.get(label); + if (count == null) { + throw new IllegalStateException("no counter '" + label + "' in " + counts.keySet()); + } + return count; + } + + // + private static final String OPENAPI_YAML = "openapi: 3.0.3\n" + + "info:\n" + + " title: Orders\n" + + " description: |\n" + + " Lists orders. Example path:\n" + + " /fake/path:\n" + + " get:\n" + + " type: object\n" + + " version: 1.0.0\n" + + "# /commented:\n" + + "paths:\n" + + " /orders:\n" + + " get:\n" + + " operationId: listOrders\n" + + " parameters:\n" + + " - name: limit\n" + + " in: query\n" + + " responses:\n" + + " '200':\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/Order'\n" + + " post:\n" + + " operationId: createOrder\n" + + " deprecated: true\n" + + " /orders/{id}:\n" + + " get:\n" + + " operationId: getOrder\n" + + " parameters:\n" + + " - in: path\n" + + " name: id\n" + + "components:\n" + + " schemas:\n" + + " Order:\n" + + " type: object\n" + + " securitySchemes:\n" + + " bearer:\n" + + " type: http\n"; + + @Test + public void openapi_yaml_countsPathsOperationsAndSchemasAndNotADescription() { + assertThat(count(OPENAPI, "paths", OPENAPI_YAML), is(2)); + assertThat(count(OPENAPI, "operations (approx)", OPENAPI_YAML), is(3)); + assertThat(count(OPENAPI, "operationIds", OPENAPI_YAML), is(3)); + assertThat(count(OPENAPI, "parameters", OPENAPI_YAML), is(2)); + assertThat(count(OPENAPI, "$ref references", OPENAPI_YAML), is(1)); + assertThat(count(OPENAPI, "object schemas", OPENAPI_YAML), is(1)); + assertThat(count(OPENAPI, "security schemes", OPENAPI_YAML), is(1)); + assertThat(count(OPENAPI, "deprecated operations and fields", OPENAPI_YAML), is(1)); + } + + @Test + public void openapi_minifiedJson_countsTheSameKeys() { + final String json = "{\"openapi\":\"3.0.3\",\"paths\":{\"/orders\":{\"get\":{\"operationId\":\"listOrders\"," + + "\"parameters\":[{\"in\":\"query\",\"name\":\"limit\"}]},\"post\":{\"operationId\":\"createOrder\"}}}," + + "\"components\":{\"schemas\":{\"Order\":{\"type\":\"object\"}}}}"; + assertThat(count(OPENAPI, "paths", json), is(1)); + assertThat(count(OPENAPI, "operations (approx)", json), is(2)); + assertThat(count(OPENAPI, "operationIds", json), is(2)); + assertThat(count(OPENAPI, "parameters", json), is(1)); + assertThat(count(OPENAPI, "object schemas", json), is(1)); + } + // + + // + private static final String MANIFEST = "# kind: Commented\n" + + "apiVersion: apps/v1\n" + + "kind: Deployment\n" + + "metadata:\n" + + " name: orders\n" + + "spec:\n" + + " replicas: {{ .Values.replicas }}\n" + + " template:\n" + + " spec:\n" + + " containers:\n" + + " - name: app\n" + + " image: shop/orders:1.4.0\n" + + " ports:\n" + + " - containerPort: 8080\n" + + " livenessProbe:\n" + + " httpGet: {path: /health}\n" + + " env:\n" + + " - name: DB_PASSWORD\n" + + " valueFrom:\n" + + " secretKeyRef:\n" + + " name: db\n" + + "{{- /* if .Values.debug */ -}}\n" + + "{{- if .Values.ingress.enabled }}\n" + + "---\n" + + "apiVersion: v1\n" + + "kind: Service\n" + + "metadata:\n" + + " name: orders\n" + + "---\n" + + "kind: ConfigMap\n" + + "data:\n" + + " manifest.yaml: |\n" + + " kind: Secret\n" + + "{{- end }}\n"; + + @Test + public void k8s_countsResourcesAtColumnZeroAndNotACommentOrAQuotedManifest() { + assertThat(count(K8S, "resources", MANIFEST), is(3)); + assertThat(count(K8S, "workloads", MANIFEST), is(1)); + assertThat(count(K8S, "Services, Ingresses and Routes", MANIFEST), is(1)); + assertThat(count(K8S, "ConfigMaps and Secrets", MANIFEST), is(1)); + } + + @Test + public void k8s_countsContainersAndHelmActionsAndNotAHelmComment() { + assertThat(count(K8S, "container images", MANIFEST), is(1)); + assertThat(count(K8S, "container ports", MANIFEST), is(1)); + assertThat(count(K8S, "probes", MANIFEST), is(1)); + assertThat(count(K8S, "secret references", MANIFEST), is(1)); + assertThat(count(K8S, "Helm control actions (approx)", MANIFEST), is(1)); + assertThat(count(K8S, ".Values references", MANIFEST), is(2)); + } + // + + // + private static final String WORKFLOW = "name: CI\n" + + "on:\n" + + " push:\n" + + " schedule:\n" + + " - cron: '0 3 * * *'\n" + + "permissions:\n" + + " contents: read\n" + + "jobs:\n" + + " build:\n" + + " runs-on: ubuntu-latest\n" + + " strategy:\n" + + " matrix:\n" + + " java: [21, 25]\n" + + " steps:\n" + + " - uses: actions/checkout@v4\n" + + " - name: Build\n" + + " run: mvn -B verify\n" + + " env:\n" + + " TOKEN: ${{ secrets.SONAR_TOKEN }}\n" + + " # - uses: old/action@v1\n" + + " release:\n" + + " uses: ./.github/workflows/release.yml\n" + + " secrets: inherit\n"; + + @Test + public void actions_countsJobsStepsActionsAndSecretNames() { + assertThat(count(ACTIONS, "jobs on a runner", WORKFLOW), is(1)); + assertThat(count(ACTIONS, "reusable workflow calls", WORKFLOW), is(1)); + assertThat(count(ACTIONS, "steps (approx)", WORKFLOW), is(2)); + assertThat(count(ACTIONS, "actions used", WORKFLOW), is(1)); + assertThat(count(ACTIONS, "secret references", WORKFLOW), is(1)); + assertThat(count(ACTIONS, "cron schedules", WORKFLOW), is(1)); + assertThat(count(ACTIONS, "matrices", WORKFLOW), is(1)); + assertThat(count(ACTIONS, "permissions blocks", WORKFLOW), is(1)); + } + // + + // + private static final String DOCKERFILE_SOURCE = "# syntax=docker/dockerfile:1\n" + + "FROM maven:3.9-eclipse-temurin-21 AS build\n" + + "ARG VERSION=1.0\n" + + "COPY pom.xml .\n" + + "RUN mvn -B package \\\n" + + " && echo FROM done\n" + + "from eclipse-temurin:21-jre\n" + + "ENV JAVA_OPTS=-Xmx512m\n" + + "COPY --from=build /app/target/app.jar /app.jar\n" + + "EXPOSE 8080\n" + + "USER app\n" + + "HEALTHCHECK CMD curl -f http://localhost:8080/health\n" + + "# RUN rm -rf /\n" + + "ENTRYPOINT [\"java\", \"-jar\", \"/app.jar\"]\n"; + + @Test + public void dockerfile_countsInstructionsAtTheStartOfALineInAnyCase() { + assertThat(count(DOCKERFILE, "build stages", DOCKERFILE_SOURCE), is(2)); + assertThat(count(DOCKERFILE, "RUN instructions", DOCKERFILE_SOURCE), is(1)); + assertThat(count(DOCKERFILE, "COPY and ADD instructions", DOCKERFILE_SOURCE), is(2)); + assertThat(count(DOCKERFILE, "environment entries", DOCKERFILE_SOURCE), is(2)); + assertThat(count(DOCKERFILE, "exposed ports", DOCKERFILE_SOURCE), is(1)); + assertThat(count(DOCKERFILE, "users", DOCKERFILE_SOURCE), is(1)); + assertThat(count(DOCKERFILE, "entrypoints and commands", DOCKERFILE_SOURCE), is(1)); + assertThat(count(DOCKERFILE, "healthchecks", DOCKERFILE_SOURCE), is(1)); + } + // + + // + private static final String ASYNCAPI_V2 = "asyncapi: 2.6.0\n" + + "info:\n" + + " title: Orders\n" + + " description: |\n" + + " Publishes orders.\n" + + " publish:\n" + + "servers:\n" + + " prod:\n" + + " url: broker:9092\n" + + " protocol: kafka\n" + + "channels:\n" + + " order/placed:\n" + + " publish:\n" + + " operationId: placeOrder\n" + + " bindings:\n" + + " kafka:\n" + + " clientId: shop\n" + + " message:\n" + + " correlationId:\n" + + " location: $message.header#/id\n" + + " payload:\n" + + " type: object\n" + + " # order/old:\n" + + " order/shipped:\n" + + " subscribe:\n" + + " message:\n" + + " $ref: '#/components/messages/Shipped'\n" + + "components:\n" + + " securitySchemes:\n" + + " sasl:\n" + + " type: scramSha512\n"; + + @Test + public void asyncapi_countsVersionTwoOperationsAndNotTheDescription() { + assertThat(count(ASYNCAPI, "operations", ASYNCAPI_V2), is(2)); + assertThat(count(ASYNCAPI, "operationIds", ASYNCAPI_V2), is(1)); + assertThat(count(ASYNCAPI, "payloads", ASYNCAPI_V2), is(1)); + assertThat(count(ASYNCAPI, "server protocols", ASYNCAPI_V2), is(1)); + assertThat(count(ASYNCAPI, "bindings", ASYNCAPI_V2), is(1)); + assertThat(count(ASYNCAPI, "correlation ids", ASYNCAPI_V2), is(1)); + assertThat(count(ASYNCAPI, "$ref references", ASYNCAPI_V2), is(1)); + assertThat(count(ASYNCAPI, "object schemas", ASYNCAPI_V2), is(1)); + assertThat(count(ASYNCAPI, "security schemes", ASYNCAPI_V2), is(1)); + assertThat(count(ASYNCAPI, "channel addresses (3.x)", ASYNCAPI_V2), is(0)); + } + + @Test + public void asyncapi_aSchemaPropertyNamedAddress_isNoChannelAddress() { + final String schema = "asyncapi: 2.6.0\n" + + "components:\n" + + " schemas:\n" + + " Customer:\n" + + " properties:\n" + + " address:\n" + + " type: string\n" + + " billing: {\"address\": {\"type\": \"string\"}}\n"; + + assertThat(count(ASYNCAPI, "channel addresses (3.x)", schema), is(0)); + assertThat( + count(ASYNCAPI, "channel addresses (3.x)", "{\"channels\": {\"a\": {\"address\": \"order/a\"}}}"), + is(1)); + } + + @Test + public void asyncapi_countsVersionThreeChannelsAndActions() { + final String v3 = "asyncapi: 3.0.0\n" + + "channels:\n" + + " placed:\n" + + " address: order/placed\n" + + " shipped:\n" + + " address: 'order/{id}/shipped'\n" + + "operations:\n" + + " onPlaced:\n" + + " action: receive\n" + + " sendShipped:\n" + + " action: send\n" + + " # action: send\n"; + + assertThat(count(ASYNCAPI, "channel addresses (3.x)", v3), is(2)); + assertThat(count(ASYNCAPI, "operations", v3), is(2)); + } + // + + // + private static final String TERRAFORM_SOURCE = "terraform {\n" + + " required_providers {\n" + + " aws = { source = \"hashicorp/aws\" }\n" + + " }\n" + + " backend \"s3\" {\n" + + " bucket = \"state\"\n" + + " }\n" + + "}\n" + + "provider \"aws\" {\n" + + " region = var.region\n" + + "}\n" + + "variable \"region\" {\n" + + " default = \"eu-central-1\"\n" + + "}\n" + + "variable \"db_password\" {\n" + + " sensitive = true\n" + + "}\n" + + "locals {\n" + + " name = \"shop # not a comment\"\n" + + "}\n" + + "# resource \"aws_s3_bucket\" \"old\" {}\n" + + "// module \"old\" {}\n" + + "/* data \"aws_ami\" \"old\" {} */\n" + + "data \"aws_ami\" \"base\" {\n" + + " most_recent = true\n" + + "}\n" + + "resource \"aws_instance\" \"web\" {\n" + + " count = 2\n" + + " provider = aws.west\n" + + " user_data = <<-EOF\n" + + " resource \"fake\" \"x\" {}\n" + + " EOF\n" + + " dynamic \"ebs_block_device\" {\n" + + " for_each = var.disks\n" + + " content {}\n" + + " }\n" + + "}\n" + + "module \"network\" {\n" + + " source = \"./network\"\n" + + "}\n" + + "moved {\n" + + " from = aws_instance.old\n" + + " to = aws_instance.web\n" + + "}\n" + + "output \"ip\" {\n" + + " value = aws_instance.web[0].public_ip\n" + + "}\n"; + + @Test + public void terraform_countsTheBlocksAndNotCommentsHeredocsOrAttributes() { + assertThat(count(TERRAFORM, "resources", TERRAFORM_SOURCE), is(1)); + assertThat(count(TERRAFORM, "data sources", TERRAFORM_SOURCE), is(1)); + assertThat(count(TERRAFORM, "modules", TERRAFORM_SOURCE), is(1)); + assertThat(count(TERRAFORM, "variables", TERRAFORM_SOURCE), is(2)); + assertThat(count(TERRAFORM, "outputs", TERRAFORM_SOURCE), is(1)); + assertThat(count(TERRAFORM, "locals blocks", TERRAFORM_SOURCE), is(1)); + assertThat(count(TERRAFORM, "providers", TERRAFORM_SOURCE), is(1)); + assertThat(count(TERRAFORM, "backends", TERRAFORM_SOURCE), is(1)); + assertThat(count(TERRAFORM, "dynamic blocks", TERRAFORM_SOURCE), is(1)); + assertThat(count(TERRAFORM, "count and for_each", TERRAFORM_SOURCE), is(2)); + assertThat(count(TERRAFORM, "refactoring blocks", TERRAFORM_SOURCE), is(1)); + assertThat(count(TERRAFORM, "sensitive values", TERRAFORM_SOURCE), is(1)); + assertThat(count(TERRAFORM, "Terragrunt includes and dependencies", TERRAFORM_SOURCE), is(0)); + } + + @Test + public void terraform_terragruntBlocksAndAnUnclosedHeredoc() { + final String terragrunt = "include \"root\" {\n path = find_in_parent_folders()\n}\n" + + "dependency \"vpc\" {\n config_path = \"../vpc\"\n}\n"; + final String unclosed = "resource \"a\" \"b\" {\n x = < + + // + private static final String PLAYBOOK = "---\n" + + "- name: Deploy the shop\n" + + " hosts: web\n" + + " become: true\n" + + " roles:\n" + + " - common\n" + + " tasks:\n" + + " - name: Copy the jar\n" + + " ansible.builtin.copy:\n" + + " src: shop.jar\n" + + " dest: \"/opt/{{ app_dir }}/shop.jar\"\n" + + " notify: restart shop\n" + + " - name: Run the migration\n" + + " ansible.builtin.shell: |\n" + + " - name: not a task\n" + + " ./migrate.sh\n" + + " register: migration\n" + + " when: migrate | bool\n" + + " # - name: old task\n" + + " - name: Open the ports\n" + + " community.general.ufw:\n" + + " port: \"{{ item }}\"\n" + + " loop: [8080, 8443]\n" + + " - ansible.builtin.include_tasks: extra.yml\n" + + " - name: Users\n" + + " ansible.builtin.user:\n" + + " name: \"{{ item }}\"\n" + + " password: !vault |\n" + + " $ANSIBLE_VAULT;1.1;AES256\n" + + " with_items: [a, b]\n" + + " handlers:\n" + + " - name: restart shop\n" + + " ansible.builtin.service:\n" + + " name: shop\n" + + "- import_playbook: monitoring.yml\n"; + + @Test + public void ansible_countsPlaysTasksAndModulesAndNotTheScriptBody() { + assertThat(count(ANSIBLE, "plays", PLAYBOOK), is(1)); + assertThat(count(ANSIBLE, "named tasks, handlers and plays", PLAYBOOK), is(6)); + assertThat(count(ANSIBLE, "FQCN module calls", PLAYBOOK), is(6)); + assertThat(count(ANSIBLE, "role inclusions", PLAYBOOK), is(1)); + assertThat(count(ANSIBLE, "task and playbook inclusions", PLAYBOOK), is(2)); + assertThat(count(ANSIBLE, "handler notifications", PLAYBOOK), is(1)); + assertThat(count(ANSIBLE, "privilege escalation", PLAYBOOK), is(1)); + assertThat(count(ANSIBLE, "conditionals", PLAYBOOK), is(1)); + assertThat(count(ANSIBLE, "loops", PLAYBOOK), is(2)); + assertThat(count(ANSIBLE, "registered results", PLAYBOOK), is(1)); + assertThat(count(ANSIBLE, "vault-encrypted values", PLAYBOOK), is(1)); + assertThat(count(ANSIBLE, "template expressions", PLAYBOOK), is(3)); + } + // + + // + private static final String COMPOSE_SOURCE = "services:\n" + + " shop:\n" + + " build: .\n" + + " image: shop:${TAG:-latest}\n" + + " ports:\n" + + " - \"8080:8080\"\n" + + " environment:\n" + + " DB_URL: jdbc:postgresql://db/shop\n" + + " env_file: .env\n" + + " depends_on:\n" + + " - db\n" + + " restart: unless-stopped\n" + + " deploy:\n" + + " replicas: 2\n" + + " secrets:\n" + + " - db_password\n" + + " db:\n" + + " image: postgres:16\n" + + " command: >\n" + + " postgres -c image: x\n" + + " healthcheck:\n" + + " test: [\"CMD\", \"pg_isready\"]\n" + + " volumes:\n" + + " - data:/var/lib/postgresql/data\n" + + " profiles: [full]\n" + + " networks: [back]\n" + + " # cache:\n" + + " # image: redis\n" + + "volumes:\n" + + " data: {}\n" + + "networks:\n" + + " back: {}\n" + + "secrets:\n" + + " db_password:\n" + + " file: ./db_password.txt\n"; + + @Test + public void compose_countsServicesAndTheirKeysAndNotComments() { + assertThat(count(COMPOSE, "services with an image", COMPOSE_SOURCE), is(2)); + assertThat(count(COMPOSE, "services built here", COMPOSE_SOURCE), is(1)); + assertThat(count(COMPOSE, "port lists", COMPOSE_SOURCE), is(1)); + assertThat(count(COMPOSE, "dependencies between services", COMPOSE_SOURCE), is(1)); + assertThat(count(COMPOSE, "healthchecks", COMPOSE_SOURCE), is(1)); + assertThat(count(COMPOSE, "environment blocks and files", COMPOSE_SOURCE), is(2)); + assertThat(count(COMPOSE, "volume lists", COMPOSE_SOURCE), is(2)); + assertThat(count(COMPOSE, "network lists", COMPOSE_SOURCE), is(2)); + assertThat(count(COMPOSE, "secret lists", COMPOSE_SOURCE), is(2)); + assertThat(count(COMPOSE, "restart policies", COMPOSE_SOURCE), is(1)); + assertThat(count(COMPOSE, "profiles", COMPOSE_SOURCE), is(1)); + assertThat(count(COMPOSE, "deploy sections", COMPOSE_SOURCE), is(1)); + assertThat(count(COMPOSE, "variable substitutions", COMPOSE_SOURCE), is(1)); + } + // + + // + private static final String CAMEL_ROUTES = "- beans:\n" + + " - name: pricing\n" + + " type: shop.Pricing\n" + + "- route:\n" + + " id: orders\n" + + " from:\n" + + " uri: jms:queue:orders\n" + + " steps:\n" + + " - log: received ${body}\n" + + " - choice:\n" + + " when:\n" + + " - simple: ${header.priority} == 'high'\n" + + " steps:\n" + + " - to:\n" + + " uri: jms:queue:urgent\n" + + " otherwise:\n" + + " steps:\n" + + " - toD: jms:queue:${header.region}\n" + + " - split:\n" + + " simple: ${body.lines}\n" + + " - setBody:\n" + + " groovy: |\n" + + " - to: not a step\n" + + " - bean:\n" + + " ref: pricing\n" + + " # - wireTap: jms:queue:audit\n" + + "- from:\n" + + " uri: timer:tick\n" + + " steps:\n" + + " - doTry:\n" + + " steps:\n" + + " - to: http://stock/refresh\n" + + "- routeTemplate:\n" + + " id: poller\n" + + "- rest:\n" + + " path: /orders\n" + + " get:\n" + + " - to: direct:list\n" + + " post:\n" + + " - to: direct:create\n"; + + @Test + public void camelYaml_countsRoutesAndEipsAndNotTheScripts() { + assertThat(count(CAMEL_YAML, "routes", CAMEL_ROUTES), is(2)); + assertThat(count(CAMEL_YAML, "route templates", CAMEL_ROUTES), is(1)); + assertThat(count(CAMEL_YAML, "consumers (from)", CAMEL_ROUTES), is(2)); + assertThat(count(CAMEL_YAML, "producers (to, toD, wireTap, enrich, pollEnrich)", CAMEL_ROUTES), is(5)); + assertThat(count(CAMEL_YAML, "endpoint URIs", CAMEL_ROUTES), is(3)); + assertThat(count(CAMEL_YAML, "content-based routers (choice)", CAMEL_ROUTES), is(1)); + assertThat(count(CAMEL_YAML, "splitters, aggregators and other routing EIPs", CAMEL_ROUTES), is(1)); + assertThat(count(CAMEL_YAML, "processors and transformations", CAMEL_ROUTES), is(3)); + assertThat(count(CAMEL_YAML, "error handling", CAMEL_ROUTES), is(1)); + assertThat(count(CAMEL_YAML, "REST definitions", CAMEL_ROUTES), is(1)); + assertThat(count(CAMEL_YAML, "REST verb blocks (get, post, put, delete, patch, head)", CAMEL_ROUTES), is(2)); + assertThat(count(CAMEL_YAML, "bean declarations", CAMEL_ROUTES), is(1)); + } + // + + // + private static final String GROOVY_BUILD = "plugins {\n" + + " id 'java-library'\n" + + " id \"org.springframework.boot\" version \"3.3.0\"\n" + + " alias(libs.plugins.spotless)\n" + + "}\n" + + "apply plugin: 'maven-publish'\n" + + "repositories {\n" + + " mavenCentral()\n" + + " maven { url 'https://repo.example.org/releases' }\n" + + "}\n" + + "dependencies {\n" + + " implementation platform(libs.spring.bom)\n" + + " implementation 'org.slf4j:slf4j-api:2.0.13'\n" + + " api project(':core')\n" + + " // implementation 'old:lib:1.0'\n" + + " compileOnly libs.lombok\n" + + " annotationProcessor libs.lombok\n" + + " testImplementation \"org.junit.jupiter:junit-jupiter:5.10.2\"\n" + + "}\n" + + "configurations {\n" + + " implementation.extendsFrom(custom)\n" + + "}\n" + + "tasks.register('fatJar', Jar) {\n" + + " description = \"\"\"implementation 'x:y:1' in a string\"\"\"\n" + + "}\n" + + "task hello {\n" + + "}\n"; + + private static final String KOTLIN_BUILD = "plugins {\n" + + " `java-library`\n" + + " kotlin(\"jvm\") version \"2.0.0\"\n" + + " id(\"com.diffplug.spotless\")\n" + + "}\n" + + "dependencies {\n" + + " implementation(enforcedPlatform(libs.boot.bom))\n" + + " implementation(projects.core)\n" + + " runtimeOnly(\"org.postgresql:postgresql:42.7.3\")\n" + + " /* testImplementation(\"old:lib:1.0\") */\n" + + "}\n" + + "tasks.named(\"test\") {\n" + + " useJUnitPlatform()\n" + + "}\n"; + + @Test + public void gradle_countsAGroovyBuildScript() { + assertThat(count(GRADLE, "plugins", GROOVY_BUILD), is(4)); + assertThat(count(GRADLE, "dependency declarations", GROOVY_BUILD), is(6)); + assertThat(count(GRADLE, "project dependencies", GROOVY_BUILD), is(1)); + assertThat(count(GRADLE, "platforms and BOMs", GROOVY_BUILD), is(1)); + assertThat(count(GRADLE, "repositories", GROOVY_BUILD), is(2)); + assertThat(count(GRADLE, "tasks registered, created or configured", GROOVY_BUILD), is(2)); + assertThat(count(GRADLE, "version catalog references", GROOVY_BUILD), is(4)); + } + + @Test + public void gradle_countsAKotlinBuildScriptAndASettingsScript() { + final String settings = "rootProject.name = \"shop\"\n" + + "include(\"core\", \"web\")\n" + + "include ':cli'\n" + + "includeBuild(\"build-logic\")\n"; + + assertThat(count(GRADLE, "plugins", KOTLIN_BUILD), is(3)); + assertThat(count(GRADLE, "dependency declarations", KOTLIN_BUILD), is(3)); + assertThat(count(GRADLE, "project dependencies", KOTLIN_BUILD), is(1)); + assertThat(count(GRADLE, "platforms and BOMs", KOTLIN_BUILD), is(1)); + assertThat(count(GRADLE, "tasks registered, created or configured", KOTLIN_BUILD), is(1)); + assertThat(count(GRADLE, "included projects and builds", settings), is(3)); + } + // + + // + @Test + public void properties_countsKeysAndNotComments() { + final String properties = "# server.port=1\n" + + "! legacy=1\n" + + "server.port=8080\n" + + "spring.datasource.url = jdbc:postgresql://db:5432/shop\n" + + "spring.datasource.password=${DB_PASSWORD}\n" + + "app.api-token: abc\n" + + "greeting=Hello\n" + + "\n"; + + assertThat(count(PROPERTIES, "keys (approx)", properties), is(5)); + assertThat(count(PROPERTIES, "keys naming a secret", properties), is(2)); + assertThat(count(PROPERTIES, "placeholders", properties), is(1)); + assertThat(count(PROPERTIES, "URLs", properties), is(1)); + } + // + + // + private static final String POWERSHELL_SCRIPT = "#Requires -Version 7\n" + + "#requires -Modules Az.Accounts\n" + + "<#\n" + + ".SYNOPSIS\n" + + "function Not-AFunction { }\n" + + "#>\n" + + "using module Shop.Tools\n" + + "Import-Module Az.Storage\n" + + ". ./common.ps1\n" + + "class Order { [string] $Id }\n" + + "function Deploy-Shop {\n" + + " [CmdletBinding()]\n" + + " param(\n" + + " [Parameter(Mandatory)] [string] $Environment\n" + + " )\n" + + " # function Old-Thing { }\n" + + " $note = \"function Fake-Thing in a string\"\n" + + " $body = @\"\n" + + "function Here-String { }\n" + + "\"@\n" + + " try {\n" + + " Get-AzStorageAccount -Name $Environment | ForEach-Object { $_ } | ConvertTo-Json\n" + + " } catch {\n" + + " Write-Error \"failed\"\n" + + " throw\n" + + " }\n" + + "}\n" + + "FUNCTION helper { }\n"; + + @Test + public void powershell_countsFunctionsAndRequirementsAndNotHelpOrStrings() { + assertThat(count(POWERSHELL, "requirements", POWERSHELL_SCRIPT), is(2)); + assertThat(count(POWERSHELL, "functions", POWERSHELL_SCRIPT), is(2)); + assertThat(count(POWERSHELL, "advanced functions", POWERSHELL_SCRIPT), is(1)); + assertThat(count(POWERSHELL, "parameter blocks", POWERSHELL_SCRIPT), is(1)); + assertThat(count(POWERSHELL, "mandatory parameters", POWERSHELL_SCRIPT), is(1)); + assertThat(count(POWERSHELL, "classes", POWERSHELL_SCRIPT), is(1)); + assertThat(count(POWERSHELL, "modules imported", POWERSHELL_SCRIPT), is(2)); + assertThat(count(POWERSHELL, "dot-sourced scripts", POWERSHELL_SCRIPT), is(1)); + assertThat(count(POWERSHELL, "try blocks", POWERSHELL_SCRIPT), is(1)); + assertThat(count(POWERSHELL, "errors raised", POWERSHELL_SCRIPT), is(2)); + // Import-Module, Deploy-Shop, Get-AzStorageAccount, ForEach-Object, ConvertTo-Json, Write-Error + assertThat(count(POWERSHELL, "Verb-Noun command calls (approx)", POWERSHELL_SCRIPT), is(6)); + } + // + + // + @Test + public void batch_countsLabelsCallsAndVariablesAndNotComments() { + final String script = "@echo off\n" + + "setlocal enabledelayedexpansion\n" + + "REM goto :old\n" + + ":: call old.bat\n" + + "@rem set OLD=1\n" + + "set APP_HOME=%~dp0\n" + + "set /a COUNT=0\n" + + "if \"%1\"==\"\" goto :usage\n" + + "call :build\n" + + "for /f \"tokens=*\" %%a in (list.txt) do set /a COUNT+=1\n" + + "for /r C:\\src %%f in (*.java) do echo %%f\n" + + "if errorlevel 1 exit /b 1\n" + + "goto :eof\n" + + ":build\n" + + "call mvn -B package\n" + + "exit /b %errorlevel%\n" + + ":usage\n" + + "echo usage: build.bat target\n" + + "EXIT /B 2\n"; + + assertThat(count(BATCH, "labels", script), is(2)); + assertThat(count(BATCH, "calls", script), is(2)); + assertThat(count(BATCH, "gotos", script), is(2)); + assertThat(count(BATCH, "variables set", script), is(3)); + assertThat(count(BATCH, "conditionals (approx)", script), is(2)); + assertThat(count(BATCH, "for loops", script), is(2)); + assertThat(count(BATCH, "local scopes", script), is(1)); + assertThat(count(BATCH, "exits", script), is(3)); + assertThat(count(BATCH, "error level checks", script), is(2)); + } + // +} diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ProfileFactPatterns.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ProfileFactPatterns.java index 48dd6f03..c6db9714 100644 --- a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ProfileFactPatterns.java +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ProfileFactPatterns.java @@ -9,6 +9,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -35,15 +36,8 @@ private ProfileFactPatterns() { * @return the patterns by label, in file order */ static Map load(final String key) { - final Path file = PROFILE_DIRECTORY.resolve(key + ".tsv"); - final String text; - try { - text = new String(Files.readAllBytes(file), StandardCharsets.UTF_8); - } catch (final IOException e) { - throw new UncheckedIOException(e); - } final Map patterns = new LinkedHashMap<>(); - for (final AiFactCounter counter : AiFactDefinitionLoader.parse(file.toString(), text)) { + for (final AiFactCounter counter : counters(key)) { patterns.put(counter.getLabel(), counter.getPattern()); } return patterns; @@ -65,16 +59,22 @@ static String pattern(final Map patterns, final String label) { } /** - * Reads one facts file of the profile as the production loader does, ignore counters included. + * Reads one facts file of the profile as the production loader does, ignore counters and included + * files included. * * @param key the facts key, the file name without {@code .tsv} * @return the counters in file order */ static List counters(final String key) { - final Path file = PROFILE_DIRECTORY.resolve(key + ".tsv"); try { - return AiFactDefinitionLoader.parse( - file.toString(), new String(Files.readAllBytes(file), StandardCharsets.UTF_8)); + final List facts = new AiFactDefinitionLoader(PROFILE_DIRECTORY.toFile()) + .load(null, Collections.singletonList(key)) + .get(0) + .getFacts(); + if (facts == null) { + throw new IllegalStateException("no counters in " + key); + } + return facts; } catch (final IOException e) { throw new UncheckedIOException(e); } diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ProfileFactPatternsLinearityTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ProfileFactPatternsLinearityTest.java new file mode 100644 index 00000000..43ac10e8 --- /dev/null +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ProfileFactPatternsLinearityTest.java @@ -0,0 +1,310 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.srcmorph.config; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.lessThanOrEqualTo; +import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +/** + * Measures that every pattern of every facts file of the current profile ({@code profiles/v3/*.tsv}, + * the {@code [ignore]} lines included) reads its input in linear time, over inputs that repeat one + * adversarial line: an opener that is never closed, a tag without its {@code >}, a heredoc marker, an + * unbalanced parenthesis, in the languages of every facts file. + * + *

The measure is not a stopwatch: the input is a {@link CharSequence} that counts the characters + * the matcher reads, and a pattern must read at most {@value #MAX_GROWTH} times as many for an input + * {@value #GROWTH} times as long. A linear pattern reads about {@value #GROWTH} times as many, a + * quadratic one {@value #GROWTH} squared, so the test is exact on any machine and under any load. A + * facts file added to the profile is measured without a change here. + */ +public class ProfileFactPatternsLinearityTest { + + /** Repetitions of the line in the shorter input. */ + private static final int SHORT_REPETITIONS = 2000; + + /** How much longer the longer input is. */ + private static final int GROWTH = 4; + + /** The most the reads may grow from the shorter input to the longer one; linear is {@value #GROWTH}. */ + private static final int MAX_GROWTH = 6; + + /** A bound for a pattern far worse than quadratic, so a regression fails instead of hanging. */ + private static final Duration PATTERN_LIMIT = Duration.ofSeconds(60); + + /** + * The repeated lines: the openers, tags and markers of every language the profile counts, and a few + * runs of single characters. + */ + private static final List LINES = Arrays.asList( + // XML and POM + "", "(?s)).)*-->"); + } + + private static String repeat(final String line, final int times) { + final StringBuilder text = new StringBuilder(line.length() * times); + for (int i = 0; i < times; i++) { + text.append(line); + } + return text.toString(); + } + + /** Runs {@code pattern} over {@code text} as the facts line does and returns the characters read. */ + private static long reads(final Pattern pattern, final String text) { + final CountingSequence sequence = new CountingSequence(text); + final Matcher matcher = pattern.matcher(sequence); + // find every match, as AiFactExtractor counts them + boolean found = matcher.find(); + while (found) { + found = matcher.find(); + } + return sequence.reads; + } + + private static String quoted(final String line) { + return "\"" + line.replace("\n", "\\n") + "\""; + } + + /** A text that counts the characters a matcher reads from it. */ + private static final class CountingSequence implements CharSequence { + + private final String text; + + private long reads; + + private CountingSequence(final String text) { + this.text = text; + } + + @Override + public int length() { + return text.length(); + } + + @Override + public char charAt(final int index) { + reads++; + return text.charAt(index); + } + + @Override + public CharSequence subSequence(final int start, final int end) { + return text.subSequence(start, end); + } + + @Override + public String toString() { + return text; + } + } +} diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/SrcMorphConfigurationFileLoaderTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/SrcMorphConfigurationFileLoaderTest.java index 220da21c..341b68f4 100644 --- a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/SrcMorphConfigurationFileLoaderTest.java +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/SrcMorphConfigurationFileLoaderTest.java @@ -18,6 +18,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -87,6 +88,27 @@ public void load_anotherExtension_isRefused() throws IOException { assertThat(thrown.getMessage(), containsString("A configuration file ends with .yaml, .yml, .json or .js")); } + @ParameterizedTest(name = "{0}") + @ValueSource(strings = {"srcmorph.json", "srcmorph.yaml"}) + public void load_aByteOrderMark_isNotPartOfTheText(final String name) throws IOException { + // arrange: what Windows PowerShell 5.1's Out-File -Encoding utf8 writes + final String text = name.endsWith(".json") ? "{\"srcMorph\": {\"force\": true}}" : "srcMorph:\n force: true\n"; + final byte[] body = text.getBytes(StandardCharsets.UTF_8); + final byte[] bytes = new byte[body.length + 3]; + bytes[0] = (byte) 0xEF; + bytes[1] = (byte) 0xBB; + bytes[2] = (byte) 0xBF; + System.arraycopy(body, 0, bytes, 3, body.length); + final Path file = Files.write(tempDir.resolve(name), bytes); + + // act + final SrcMorphConfigurationFile content = + SrcMorphConfigurationFileLoader.load(file, defaultBase(), NO_PROPERTIES); + + // assert + assertThat(content.getSrcMorph().isForce(), is(true)); + } + @Test public void load_anEmptyFile_isEveryDefault() throws IOException { final SrcMorphConfigurationFile content = @@ -155,6 +177,71 @@ public void load_propertiesFillTheFile() throws IOException { assertThat(content.getSrcMorph().getMaxFileSizeBytes(), is(4096L)); } + @Test + public void load_fileNamesAndTheNewConditionLeaves_bind() throws IOException { + final Path file = write( + "srcmorph.yaml", + "srcMorph:\n fileNames: [\"Dockerfile\", \"Jenkinsfile\"]\n fieldGenerations:\n" + + " - promptKey: file-body-ops\n condition:\n or:\n conditions:\n" + + " - fileNames: [\"Dockerfile.*\"]\n" + + " - contentMatches: \"(?m)^apiVersion:\"\n" + + " - pathGlob: \"**/{k8s,helm}/**\"\n"); + + final SrcMorphConfiguration srcMorph = SrcMorphConfigurationFileLoader.load(file, defaultBase(), NO_PROPERTIES) + .getSrcMorph(); + + assertThat(srcMorph.getFileNames(), is(Arrays.asList("Dockerfile", "Jenkinsfile"))); + final List leaves = + srcMorph.getFieldGenerations().get(0).getCondition().getOr().getConditions(); + assertThat(leaves.get(0).getFileNames(), is(Arrays.asList("Dockerfile.*"))); + assertThat(leaves.get(1).getContentMatches(), is("(?m)^apiVersion:")); + assertThat(leaves.get(2).getPathGlob(), is("**/{k8s,helm}/**")); + } + + @Test + public void load_fileInterpretersAndContentHeadChars_bindFromTheFile() throws IOException { + final Path file = + write("scripts.yaml", "srcMorph:\n fileInterpreters: [bash, perl]\n contentHeadChars: 65536\n"); + + final SrcMorphConfiguration loaded = SrcMorphConfigurationFileLoader.load(file, defaultBase(), NO_PROPERTIES) + .getSrcMorph(); + + assertThat(loaded.getFileInterpreters(), is(java.util.Arrays.asList("bash", "perl"))); + assertThat(loaded.getContentHeadChars(), is(65_536)); + } + + @Test + public void load_regenerateOn_aSwitchTheFileSetsAndTheOthersOn() throws IOException { + final Path unset = write("unset.yaml", "srcMorph:\n force: false\n"); + final Path empty = write("empty.yaml", "srcMorph:\n regenerateOn:\n"); + final Path off = write("off.yaml", "srcMorph:\n regenerateOn:\n prompt: false\n children: false\n"); + + final AiRegenerateOn unsetOn = SrcMorphConfigurationFileLoader.load(unset, defaultBase(), NO_PROPERTIES) + .getSrcMorph() + .getRegenerateOn(); + final AiRegenerateOn emptyOn = SrcMorphConfigurationFileLoader.load(empty, defaultBase(), NO_PROPERTIES) + .getSrcMorph() + .getRegenerateOn(); + final AiRegenerateOn offOn = SrcMorphConfigurationFileLoader.load(off, defaultBase(), NO_PROPERTIES) + .getSrcMorph() + .getRegenerateOn(); + + assertThat(unsetOn.isPrompt(), is(true)); + assertThat(emptyOn.isPrompt(), is(true)); + assertThat(offOn.isPrompt(), is(false)); + assertThat(offOn.isChildren(), is(false)); + assertThat(offOn.isSource(), is(true)); + assertThat(offOn.isFacts(), is(true)); + assertThat(offOn.isModel(), is(true)); + } + + @Test + public void load_regenerateOn_anUnknownSwitch_fails() throws IOException { + final Path file = write("typo.yaml", "srcMorph:\n regenerateOn:\n prompts: false\n"); + + assertThrows(IOException.class, () -> SrcMorphConfigurationFileLoader.load(file, defaultBase(), NO_PROPERTIES)); + } + @ParameterizedTest(name = "{0}") @ValueSource( strings = { diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/SrcMorphConfigurationTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/SrcMorphConfigurationTest.java index 519b5eb0..b1a6120a 100644 --- a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/SrcMorphConfigurationTest.java +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/SrcMorphConfigurationTest.java @@ -85,6 +85,44 @@ public void forceRoundTrips() { assertThat(c.isForce(), is(true)); } + @Test + public void fileInterpretersAndContentHeadChars_defaultAndRoundTrip() { + final SrcMorphConfiguration c = new SrcMorphConfiguration(); + assertThat(c.getFileInterpreters() == null, is(true)); + assertThat(c.getContentHeadChars(), is(AiConditionEvaluator.CONTENT_HEAD_CHARS)); + c.setFileInterpreters(java.util.Arrays.asList("bash", "perl")); + c.setContentHeadChars(65_536); + assertThat(c.getFileInterpreters(), is(java.util.Arrays.asList("bash", "perl"))); + assertThat(c.getContentHeadChars(), is(65_536)); + } + + @Test + public void regenerateOn_everySwitchOnByDefault_andNullTurnsThemOnAgain() { + final SrcMorphConfiguration c = new SrcMorphConfiguration(); + final AiRegenerateOn defaults = c.getRegenerateOn(); + assertThat(defaults.isSource(), is(true)); + assertThat(defaults.isPrompt(), is(true)); + assertThat(defaults.isFacts(), is(true)); + assertThat(defaults.isModel(), is(true)); + assertThat(defaults.isChildren(), is(true)); + + final AiRegenerateOn frozen = new AiRegenerateOn(); + frozen.setSource(false); + frozen.setPrompt(false); + frozen.setFacts(false); + frozen.setModel(false); + frozen.setChildren(false); + c.setRegenerateOn(frozen); + assertThat(c.getRegenerateOn().isSource(), is(false)); + assertThat(c.getRegenerateOn().isPrompt(), is(false)); + assertThat(c.getRegenerateOn().isFacts(), is(false)); + assertThat(c.getRegenerateOn().isModel(), is(false)); + assertThat(c.getRegenerateOn().isChildren(), is(false)); + + c.setRegenerateOn(null); + assertThat(c.getRegenerateOn().isPrompt(), is(true)); + } + @Test public void planOnlyRoundTrips() { final SrcMorphConfiguration c = new SrcMorphConfiguration(); diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ViewFactPatternsTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ViewFactPatternsTest.java new file mode 100644 index 00000000..9ac17b3f --- /dev/null +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/ViewFactPatternsTest.java @@ -0,0 +1,99 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.srcmorph.config; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +/** + * Validates the fact counters of the profile for server-side views, which share the prompt + * {@code file-body-view} ({@code profiles/v3/jsp-facts.tsv}, {@code facelets-facts.tsv}), counted the + * way the facts line counts them. A JSP comment is blanked; an HTML comment is not, since the server + * still runs the scriptlet in it. A Facelets view includes {@code xml-facts}, whose {@code [ignore]} + * line blanks XML comments. + */ +public class ViewFactPatternsTest { + + private static final List JSP = ProfileFactPatterns.counters("jsp-facts"); + + private static final List FACELETS = ProfileFactPatterns.counters("facelets-facts"); + + private static int count(final List counters, final String label, final String source) { + final Map counts = ProfileFactPatterns.counts(counters, source); + final Integer count = counts.get(label); + if (count == null) { + throw new IllegalStateException("no counter '" + label + "' in " + counts.keySet()); + } + return count; + } + + // + private static final String PAGE = "<%@ page contentType=\"text/html\" import=\"java.util.*,x.Order\" %>\n" + + "<%@ taglib prefix=\"c\" uri=\"jakarta.tags.core\" %>\n" + + "<%@ include file=\"/WEB-INF/jspf/header.jspf\" %>\n" + + "<%-- <% oldCode(); %> ${old} --%>\n" + + "\n" + + "<% List os = (List) request.getAttribute(\"orders\"); %>\n" + + "<%! int counter; %>\n" + + "
\n" + + " ${param.q} " + + "\n" + + "\n"; + + @Test + public void jsp_directivesAndServerCode_countAndAJspCommentDoesNot() { + assertThat(count(JSP, "page directives", PAGE), is(1)); + assertThat(count(JSP, "taglib directives", PAGE), is(1)); + assertThat(count(JSP, "includes and forwards", PAGE), is(2)); + assertThat(count(JSP, "tag file attributes", PAGE), is(0)); + assertThat(count(JSP, "scriptlets", PAGE), is(1)); + // the one in the HTML comment: the server runs it + assertThat(count(JSP, "expressions", PAGE), is(1)); + assertThat(count(JSP, "declarations", PAGE), is(1)); + } + + @Test + public void jsp_dataTagsAndForms() { + assertThat(count(JSP, "EL expressions", PAGE), is(3)); + assertThat(count(JSP, "prefixed tags", PAGE), is(5)); + assertThat(count(JSP, "forms", PAGE), is(2)); + assertThat(count(JSP, "input fields", PAGE), is(3)); + assertThat(count(JSP, "request parameters read", PAGE), is(2)); + } + + @Test + public void jsp_tagFileAttributes_andAnUnclosedCommentRunsToTheEnd() { + assertThat(count(JSP, "tag file attributes", "<%@ attribute name=\"total\" required=\"true\" %>\n"), is(1)); + assertThat(count(JSP, "scriptlets", "<% a(); %>\n<%-- <% b(); %>\n<% c(); %>\n"), is(1)); + } + //
+ + // + private static final String VIEW = "\n" + + "\n" + + "" + + "\n" + + "\n" + + "\n"; + + @Test + public void facelets_countsBindingsFormsAndTemplatesAndNotAComment() { + assertThat(count(FACELETS, "EL expressions", VIEW), is(4)); + assertThat(count(FACELETS, "forms", VIEW), is(1)); + assertThat(count(FACELETS, "input fields", VIEW), is(2)); + assertThat(count(FACELETS, "EL method bindings", VIEW), is(2)); + assertThat(count(FACELETS, "templates and includes", VIEW), is(2)); + assertThat(count(FACELETS, "composite component interfaces", VIEW), is(0)); + assertThat( + count(FACELETS, "composite component interfaces", ""), + is(1)); + } + // +} diff --git a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/XmlFactPatternsTest.java b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/XmlFactPatternsTest.java index 4907c261..04b90b8c 100644 --- a/srcmorph/src/test/java/net/ladenthin/srcmorph/config/XmlFactPatternsTest.java +++ b/srcmorph/src/test/java/net/ladenthin/srcmorph/config/XmlFactPatternsTest.java @@ -5,7 +5,9 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively; +import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -15,11 +17,19 @@ /** * Validates the XML fact counters of the current profile ({@code profiles/v3/xml-facts.tsv} for any XML, * XSD and XSLT file, {@code profiles/v3/pom-facts.tsv} for Maven POMs), counted the way the facts line - * counts them: the {@code [ignore]} counters blank comments and CDATA sections first. The last tests pin - * the counts of the benchmark's language corpus. + * counts them: the {@code [ignore]} counters blank comments and CDATA sections first. The run-time tests + * repeat an unclosed opener or tag over a long input, where the lazy patterns these replaced were + * quadratic (about 8 s at 100 KB) or worse. The last tests pin the counts of the benchmark's language + * corpus. */ public class XmlFactPatternsTest { + /** What a long input may take; a linear pattern needs well under a second. */ + private static final Duration LONG_INPUT_LIMIT = Duration.ofSeconds(10); + + /** Lines of the generated inputs of the run-time tests. */ + private static final int LONG_INPUT_LINES = 20_000; + private static final List XML = ProfileFactPatterns.counters("xml-facts"); private static final List POM = ProfileFactPatterns.counters("pom-facts"); @@ -33,6 +43,19 @@ private static int count(final List counters, final String label, return count; } + /** Repeats {@code line} {@value #LONG_INPUT_LINES} times behind {@code head}. */ + private static String headThenLines(final String head, final String line) { + final StringBuilder source = new StringBuilder(head); + for (int i = 0; i < LONG_INPUT_LINES; i++) { + source.append(line).append('\n'); + } + return source.toString(); + } + + private static int countLong(final List counters, final String label, final String source) { + return assertTimeoutPreemptively(LONG_INPUT_LIMIT, () -> count(counters, label, source)); + } + @Test public void xmlProfile_hasTheseCountersInThisOrder() { assertThat( @@ -159,6 +182,49 @@ public void elements_markupInADoctypeInternalSubset_doesNotCount() { + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n"), is(2)); } + + @Test + public void elements_unclosedComment_isBlankedToTheEnd() { + assertThat(count(XML, "elements", "\n\n\n"), is(1)); } + + @Test + public void dependencies_afterAnUnclosedComment_areNone() { + assertThat(count(POM, "dependencies", "\n