Ship oracle journal values, bytecode/frontend hardening, and replay-policy Lean.
Host exposes oracle journals as language values with refuse/copy gates; bytecode and foreign session paths get modularized; applications and verification replay-policy sources land with Lake builds ignored. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
e3d9021bb6
commit
8f1010f967
101 files changed
+17962
-1727
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,34 @@
|
||||
# Application composition corpus
|
||||
|
||||
Four authored tasks exercise the actual document loader, tree/bytecode evaluators
|
||||
and interactive history API. Each has separate Python and Node implementations
|
||||
of the producer and consumer. `CASES.json` is the eight-case regression subset;
|
||||
the reviewer driver generates 80 size/seed/direction instances before execution.
|
||||
They are four application families, not 80 independent real-user applications.
|
||||
|
||||
- Invoice ledger: discard void rows, first-posted invoice deduplication, integer
|
||||
cents/discount accounting, signed refunds with floor division, regional totals.
|
||||
- Routes: minimum nonnegative parallel edge, zero-cost edges, disconnected nodes
|
||||
and weighted single-source distances. Python uses heap-based Dijkstra, Node a
|
||||
linear frontier; independent reference uses SQL and all-pairs Floyd-Warshall.
|
||||
- Concordance: NFC plus **ASCII** lowercase, explicit space/tab/LF/CR/NBSP
|
||||
separators, occurrence/document frequencies, UTF-8 byte order. This is not
|
||||
Unicode full case folding. Wide IDs remain strings; special object-key text,
|
||||
combining marks, BMP and astral characters are included.
|
||||
- Wine: UCI red-wine CSV, exact decimal density/pH scaling to integers and
|
||||
quality-group count/sum/min/max. Full input contains 1599 rows; no predictor
|
||||
accuracy or general machine-learning performance is claimed.
|
||||
|
||||
Independent SQL/Fraction/Floyd references live in the reviewer experiment
|
||||
`application_cases.py`; no foreign program output supplies expected answers.
|
||||
The raw/public-data digest, citation, license and retrieval source are preserved
|
||||
in `data/PROVENANCE.json`. Wine Quality is by Cortez, Cerdeira, Almeida, Matos and
|
||||
Reis (2009), UCI, DOI 10.24432/C56S3T, CC BY 4.0. CSV text fixture generation
|
||||
normalizes physical line endings and uses the requested first N data rows.
|
||||
|
||||
The composition copies input into a producer, gets a normalized value, copies it
|
||||
into the consumer, records an expected ordinary exception after saving `answer`,
|
||||
recovers it, replaces the consumer's bridge with null, verifies the producer's
|
||||
copy and answer remain, and closes both sessions. Interactive recordings repeat
|
||||
these actions and strictly replay both raw and losslessly packed history.
|
||||
Native and independent checks distinguish explicit null from display stdout.
|
||||
@@ -0,0 +1,10 @@
|
||||
var index = new Map();
|
||||
for (var row of bridge) {
|
||||
for (var word of row.tokens) {
|
||||
var value = index.get(word) || {count:0,docs:new Set()};
|
||||
value.count++; value.docs.add(row.id); index.set(word,value);
|
||||
}
|
||||
}
|
||||
var answer = [...index].sort((a,b)=>Buffer.compare(Buffer.from(a[0]),Buffer.from(b[0])))
|
||||
.map(([word,v])=>({word,occurrences:v.count,documents:v.docs.size}));
|
||||
answer;
|
||||
@@ -0,0 +1,10 @@
|
||||
from collections import Counter, defaultdict
|
||||
occurrences = Counter()
|
||||
documents = defaultdict(set)
|
||||
for row in bridge:
|
||||
for word in row['tokens']:
|
||||
occurrences[word] += 1
|
||||
documents[word].add(row['id'])
|
||||
answer = [{'word':word,'occurrences':occurrences[word],'documents':len(documents[word])}
|
||||
for word in sorted(occurrences,key=lambda s:s.encode('utf-8'))]
|
||||
answer
|
||||
@@ -0,0 +1,3 @@
|
||||
var bridge = data.map(row=>({id:row.id,tokens:row.text.normalize('NFC').replace(/[A-Z]/g,c=>c.toLowerCase()).split(/[ \n\t\r\u00a0]+/).filter(t=>t.length)}));
|
||||
bridge.sort((a,b)=>Buffer.compare(Buffer.from(a.id),Buffer.from(b.id)));
|
||||
bridge;
|
||||
@@ -0,0 +1,6 @@
|
||||
import re, unicodedata
|
||||
ascii_lower = str.maketrans('ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')
|
||||
bridge = [{'id': row['id'], 'tokens': [t for t in re.split('[ \n\t\r\u00a0]+',unicodedata.normalize('NFC',row['text']).translate(ascii_lower)) if t]}
|
||||
for row in data]
|
||||
bridge.sort(key=lambda row:row['id'].encode('utf-8'))
|
||||
bridge
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"source": "https://archive.ics.uci.edu/static/public/186/wine+quality.zip",
|
||||
"landing_page": "https://archive.ics.uci.edu/dataset/186/wine%2Bquality",
|
||||
"doi": "10.24432/C56S3T",
|
||||
"authors": [
|
||||
"Paulo Cortez",
|
||||
"A. Cerdeira",
|
||||
"F. Almeida",
|
||||
"T. Matos",
|
||||
"J. Reis"
|
||||
],
|
||||
"year": 2009,
|
||||
"license": "CC BY 4.0",
|
||||
"license_url": "https://creativecommons.org/licenses/by/4.0/",
|
||||
"retrieved": "2026-11-03",
|
||||
"files": {
|
||||
"winequality.names": "15d215e73b39105952380fd487e4ce1bf5a6b83a425abb285c2ec55193d3ca92",
|
||||
"winequality-red.csv": "4a402cf041b025d4566d954c3b9ba8635a3a8a01e039005d97d6a710278cf05e",
|
||||
"wine-quality.zip": "3ed56667f4b828242bd732d7d1dd7f2861e54432239d7fa63877014cbb0304d4"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,72 @@
|
||||
Citation Request:
|
||||
This dataset is public available for research. The details are described in [Cortez et al., 2009].
|
||||
Please include this citation if you plan to use this database:
|
||||
|
||||
P. Cortez, A. Cerdeira, F. Almeida, T. Matos and J. Reis.
|
||||
Modeling wine preferences by data mining from physicochemical properties.
|
||||
In Decision Support Systems, Elsevier, 47(4):547-553. ISSN: 0167-9236.
|
||||
|
||||
Available at: [@Elsevier] http://dx.doi.org/10.1016/j.dss.2009.05.016
|
||||
[Pre-press (pdf)] http://www3.dsi.uminho.pt/pcortez/winequality09.pdf
|
||||
[bib] http://www3.dsi.uminho.pt/pcortez/dss09.bib
|
||||
|
||||
1. Title: Wine Quality
|
||||
|
||||
2. Sources
|
||||
Created by: Paulo Cortez (Univ. Minho), Antonio Cerdeira, Fernando Almeida, Telmo Matos and Jose Reis (CVRVV) @ 2009
|
||||
|
||||
3. Past Usage:
|
||||
|
||||
P. Cortez, A. Cerdeira, F. Almeida, T. Matos and J. Reis.
|
||||
Modeling wine preferences by data mining from physicochemical properties.
|
||||
In Decision Support Systems, Elsevier, 47(4):547-553. ISSN: 0167-9236.
|
||||
|
||||
In the above reference, two datasets were created, using red and white wine samples.
|
||||
The inputs include objective tests (e.g. PH values) and the output is based on sensory data
|
||||
(median of at least 3 evaluations made by wine experts). Each expert graded the wine quality
|
||||
between 0 (very bad) and 10 (very excellent). Several data mining methods were applied to model
|
||||
these datasets under a regression approach. The support vector machine model achieved the
|
||||
best results. Several metrics were computed: MAD, confusion matrix for a fixed error tolerance (T),
|
||||
etc. Also, we plot the relative importances of the input variables (as measured by a sensitivity
|
||||
analysis procedure).
|
||||
|
||||
4. Relevant Information:
|
||||
|
||||
The two datasets are related to red and white variants of the Portuguese "Vinho Verde" wine.
|
||||
For more details, consult: http://www.vinhoverde.pt/en/ or the reference [Cortez et al., 2009].
|
||||
Due to privacy and logistic issues, only physicochemical (inputs) and sensory (the output) variables
|
||||
are available (e.g. there is no data about grape types, wine brand, wine selling price, etc.).
|
||||
|
||||
These datasets can be viewed as classification or regression tasks.
|
||||
The classes are ordered and not balanced (e.g. there are munch more normal wines than
|
||||
excellent or poor ones). Outlier detection algorithms could be used to detect the few excellent
|
||||
or poor wines. Also, we are not sure if all input variables are relevant. So
|
||||
it could be interesting to test feature selection methods.
|
||||
|
||||
5. Number of Instances: red wine - 1599; white wine - 4898.
|
||||
|
||||
6. Number of Attributes: 11 + output attribute
|
||||
|
||||
Note: several of the attributes may be correlated, thus it makes sense to apply some sort of
|
||||
feature selection.
|
||||
|
||||
7. Attribute information:
|
||||
|
||||
For more information, read [Cortez et al., 2009].
|
||||
|
||||
Input variables (based on physicochemical tests):
|
||||
1 - fixed acidity
|
||||
2 - volatile acidity
|
||||
3 - citric acid
|
||||
4 - residual sugar
|
||||
5 - chlorides
|
||||
6 - free sulfur dioxide
|
||||
7 - total sulfur dioxide
|
||||
8 - density
|
||||
9 - pH
|
||||
10 - sulphates
|
||||
11 - alcohol
|
||||
Output variable (based on sensory data):
|
||||
12 - quality (score between 0 and 10)
|
||||
|
||||
8. Missing Attribute Values: None
|
||||
@@ -0,0 +1,10 @@
|
||||
var totals = new Map();
|
||||
for (var row of bridge) {
|
||||
var value = totals.get(row.region) || [0, 0];
|
||||
value[0] += 1;
|
||||
value[1] += Math.floor(row.units * row.cents * (10000-row.discount) / 10000);
|
||||
totals.set(row.region, value);
|
||||
}
|
||||
var answer = [...totals].sort((a,b) => Buffer.compare(Buffer.from(a[0]),Buffer.from(b[0])))
|
||||
.map(([region, value]) => ({region, invoices: value[0], net_cents: value[1]}));
|
||||
answer;
|
||||
@@ -0,0 +1,8 @@
|
||||
from collections import defaultdict
|
||||
totals = defaultdict(lambda: [0, 0])
|
||||
for row in bridge:
|
||||
totals[row['region']][0] += 1
|
||||
totals[row['region']][1] += row['units'] * row['cents'] * (10000-row['discount']) // 10000
|
||||
answer = [{'region': k, 'invoices': v[0], 'net_cents': v[1]}
|
||||
for k, v in sorted(totals.items(), key=lambda kv: kv[0].encode('utf-8'))]
|
||||
answer
|
||||
@@ -0,0 +1,10 @@
|
||||
var seen = new Set();
|
||||
var bridge = [];
|
||||
for (var row of data) {
|
||||
if (row.status === 'posted' && !seen.has(row.id)) {
|
||||
seen.add(row.id);
|
||||
bridge.push({id: row.id, region: row.region, units: row.units, cents: row.cents, discount: row.discount});
|
||||
}
|
||||
}
|
||||
bridge.sort((a, b) => Buffer.compare(Buffer.from(a.id), Buffer.from(b.id)));
|
||||
bridge;
|
||||
@@ -0,0 +1,8 @@
|
||||
seen = set()
|
||||
bridge = []
|
||||
for row in data:
|
||||
if row['status'] == 'posted' and row['id'] not in seen:
|
||||
seen.add(row['id'])
|
||||
bridge.append({k: row[k] for k in ('id', 'region', 'units', 'cents', 'discount')})
|
||||
bridge.sort(key=lambda r: r['id'].encode('utf-8'))
|
||||
bridge
|
||||
@@ -0,0 +1,14 @@
|
||||
var distance = new Map(bridge.nodes.map(n=>[n,Infinity]));
|
||||
distance.set(bridge.source,0);
|
||||
var unvisited = new Set(bridge.nodes);
|
||||
while (unvisited.size) {
|
||||
var best = [...unvisited].reduce((a,b)=>distance.get(a)<=distance.get(b)?a:b);
|
||||
unvisited.delete(best);
|
||||
if (!Number.isFinite(distance.get(best))) break;
|
||||
for (var edge of bridge.edges) {
|
||||
if (edge.from === best && distance.get(best)+edge.weight < distance.get(edge.to))
|
||||
distance.set(edge.to,distance.get(best)+edge.weight);
|
||||
}
|
||||
}
|
||||
var answer = bridge.nodes.map(node=>({node,distance:Number.isFinite(distance.get(node))?distance.get(node):null}));
|
||||
answer;
|
||||
@@ -0,0 +1,17 @@
|
||||
import heapq
|
||||
adjacency = {node: [] for node in bridge['nodes']}
|
||||
for edge in bridge['edges']:
|
||||
adjacency[edge['from']].append((edge['to'], edge['weight']))
|
||||
distance = {bridge['source']: 0}
|
||||
pending = [(0, bridge['source'])]
|
||||
while pending:
|
||||
cost, node = heapq.heappop(pending)
|
||||
if distance[node] != cost:
|
||||
continue
|
||||
for target, weight in adjacency[node]:
|
||||
candidate = cost + weight
|
||||
if target not in distance or candidate < distance[target]:
|
||||
distance[target] = candidate
|
||||
heapq.heappush(pending, (candidate, target))
|
||||
answer = [{'node': n, 'distance': distance.get(n)} for n in bridge['nodes']]
|
||||
answer
|
||||
@@ -0,0 +1,11 @@
|
||||
var minimum = new Map();
|
||||
for (var edge of data.edges) {
|
||||
if (edge.weight >= 0) {
|
||||
var key = JSON.stringify([edge.from, edge.to]);
|
||||
minimum.set(key, Math.min(minimum.has(key) ? minimum.get(key) : edge.weight, edge.weight));
|
||||
}
|
||||
}
|
||||
var edges = [...minimum].map(([key,weight]) => ({from: JSON.parse(key)[0], to: JSON.parse(key)[1], weight}));
|
||||
edges.sort((a,b) => Buffer.compare(Buffer.from(a.from),Buffer.from(b.from)) || Buffer.compare(Buffer.from(a.to),Buffer.from(b.to)));
|
||||
var bridge = {source:data.source, nodes:[...data.nodes].sort((a,b)=>Buffer.compare(Buffer.from(a),Buffer.from(b))), edges};
|
||||
bridge;
|
||||
@@ -0,0 +1,8 @@
|
||||
minimum = {}
|
||||
for edge in data['edges']:
|
||||
if edge['weight'] >= 0:
|
||||
key = (edge['from'], edge['to'])
|
||||
minimum[key] = min(minimum.get(key, edge['weight']), edge['weight'])
|
||||
bridge = {'source': data['source'], 'nodes': sorted(data['nodes'], key=lambda n:n.encode('utf-8')),
|
||||
'edges': [{'from': a, 'to': b, 'weight': w} for (a,b), w in sorted(minimum.items(), key=lambda kv: (kv[0][0].encode('utf-8'), kv[0][1].encode('utf-8')))]}
|
||||
bridge
|
||||
@@ -0,0 +1,9 @@
|
||||
var groups = new Map();
|
||||
for (var row of bridge) {
|
||||
var g=groups.get(row.quality) || {quality:row.quality,count:0,sum_density_ppm:0,min_ph_cent:row.ph_cent,max_ph_cent:row.ph_cent};
|
||||
g.count++;g.sum_density_ppm+=row.density_ppm;
|
||||
g.min_ph_cent=Math.min(g.min_ph_cent,row.ph_cent);g.max_ph_cent=Math.max(g.max_ph_cent,row.ph_cent);
|
||||
groups.set(row.quality,g);
|
||||
}
|
||||
var answer=[...groups.values()].sort((a,b)=>a.quality-b.quality);
|
||||
answer;
|
||||
@@ -0,0 +1,7 @@
|
||||
from itertools import groupby
|
||||
answer = []
|
||||
for quality, group in groupby(sorted(bridge,key=lambda r:r['quality']),key=lambda r:r['quality']):
|
||||
rows = list(group)
|
||||
answer.append({'quality':quality,'count':len(rows),'sum_density_ppm':sum(r['density_ppm'] for r in rows),
|
||||
'min_ph_cent':min(r['ph_cent'] for r in rows),'max_ph_cent':max(r['ph_cent'] for r in rows)})
|
||||
answer
|
||||
@@ -0,0 +1,13 @@
|
||||
function scaledDecimal(s, digits) {
|
||||
var parts = s.split('.');
|
||||
var tail = parts.length > 1 ? parts[1] : '';
|
||||
if (tail.length > digits) throw Error('unsupported decimal precision');
|
||||
return Number(parts[0])*10**digits + Number(tail.padEnd(digits,'0'));
|
||||
}
|
||||
var lines = data.trim().split(/\r?\n/);
|
||||
var header = lines[0].split(';').map(s=>s.replaceAll('"',''));
|
||||
var bridge = lines.slice(1).map(line=>{
|
||||
var fields=line.split(';');
|
||||
return {quality:Number(fields[header.indexOf('quality')]),density_ppm:scaledDecimal(fields[header.indexOf('density')],6),ph_cent:scaledDecimal(fields[header.indexOf('pH')],2)};
|
||||
});
|
||||
bridge;
|
||||
@@ -0,0 +1,5 @@
|
||||
import csv, io
|
||||
from decimal import Decimal
|
||||
bridge = [{'quality':int(row['quality']), 'density_ppm':int(Decimal(row['density'])*1000000), 'ph_cent':int(Decimal(row['pH'])*100)}
|
||||
for row in csv.DictReader(io.StringIO(data),delimiter=';')]
|
||||
bridge
|
||||
Reference in new issue
Block a user