Step 1: relabel two blind2 paths, add 81 class-mate paths to risk_labels.json, test blind2 exactly; done: 3 tests fail / next: fix classifier
This commit is contained in:
1 parent
ab8291d8d9
commit
b3fde4005f
3 files changed
+414
-8
No files matched your search
@@ -1256,5 +1256,390 @@
|
||||
"path": "version.txt",
|
||||
"floor": "release",
|
||||
"why": "version marker"
|
||||
},
|
||||
{
|
||||
"path": "godot/scripts/entities/boss.gd",
|
||||
"floor": "isolated",
|
||||
"why": "game scripts: a game entity is an actor in the scene, not an ORM entity"
|
||||
},
|
||||
{
|
||||
"path": "unity/Assets/Scripts/Entities/Goblin.cs",
|
||||
"floor": "isolated",
|
||||
"why": "game actor class in a Unity project"
|
||||
},
|
||||
{
|
||||
"path": "engine/ecs/entities.rs",
|
||||
"floor": "isolated",
|
||||
"why": "entity-component-system storage of game objects, not stored data"
|
||||
},
|
||||
{
|
||||
"path": "bevy_game/src/entity_spawner.rs",
|
||||
"floor": "isolated",
|
||||
"why": "spawns game entities into a scene"
|
||||
},
|
||||
{
|
||||
"path": "sprites/entity_sprite.lua",
|
||||
"floor": "isolated",
|
||||
"why": "sprite of a game entity"
|
||||
},
|
||||
{
|
||||
"path": "catalog/domain/Store.kt",
|
||||
"floor": "isolated",
|
||||
"why": "a Store business object (a shop) in a domain model, not a data store"
|
||||
},
|
||||
{
|
||||
"path": "franchise/domain/Store.ts",
|
||||
"floor": "isolated",
|
||||
"why": "a shop in the franchise domain"
|
||||
},
|
||||
{
|
||||
"path": "merchant/domain/Store.py",
|
||||
"floor": "isolated",
|
||||
"why": "a shop as a business object"
|
||||
},
|
||||
{
|
||||
"path": "shop/domain/Stores.php",
|
||||
"floor": "isolated",
|
||||
"why": "a collection of shops in a domain model"
|
||||
},
|
||||
{
|
||||
"path": "lib/domain/store.rb",
|
||||
"floor": "isolated",
|
||||
"why": "the Store of a shop domain, a business object"
|
||||
},
|
||||
{
|
||||
"path": "src/user_store.py",
|
||||
"floor": "data",
|
||||
"why": "a user store: compound name means stored data"
|
||||
},
|
||||
{
|
||||
"path": "lib/SessionStore.java",
|
||||
"floor": "data",
|
||||
"why": "session store: stored data"
|
||||
},
|
||||
{
|
||||
"path": "data/datastore/client.go",
|
||||
"floor": "data",
|
||||
"why": "datastore client: stored data"
|
||||
},
|
||||
{
|
||||
"path": "analytics/stats/percentile.py",
|
||||
"floor": "logic",
|
||||
"why": "numeric algorithm: percentile arithmetic"
|
||||
},
|
||||
{
|
||||
"path": "geo/geometry/polygon_area.go",
|
||||
"floor": "logic",
|
||||
"why": "geometry arithmetic"
|
||||
},
|
||||
{
|
||||
"path": "billing_math/tax_rate.rb",
|
||||
"floor": "critical",
|
||||
"why": "tax rates in billing code move money"
|
||||
},
|
||||
{
|
||||
"path": "lib/math/matrix_multiply.rs",
|
||||
"floor": "logic",
|
||||
"why": "matrix arithmetic"
|
||||
},
|
||||
{
|
||||
"path": "etl/aggregate_daily_totals.py",
|
||||
"floor": "logic",
|
||||
"why": "aggregation arithmetic over many inputs"
|
||||
},
|
||||
{
|
||||
"path": "search/rank_results.java",
|
||||
"floor": "logic",
|
||||
"why": "ranking algorithm over a broad input space"
|
||||
},
|
||||
{
|
||||
"path": "util/diff_text.js",
|
||||
"floor": "logic",
|
||||
"why": "diff algorithm"
|
||||
},
|
||||
{
|
||||
"path": "crypto_free/hashing/consistent_hash.go",
|
||||
"floor": "logic",
|
||||
"why": "hash ring algorithm"
|
||||
},
|
||||
{
|
||||
"path": "sim/dedupe_events.kt",
|
||||
"floor": "logic",
|
||||
"why": "deduplication over streams"
|
||||
},
|
||||
{
|
||||
"path": "finance/currency_convert.swift",
|
||||
"floor": "logic",
|
||||
"why": "currency conversion arithmetic"
|
||||
},
|
||||
{
|
||||
"path": "rollup.dev.config.mjs",
|
||||
"floor": "integration",
|
||||
"why": "build tool configuration with an environment in its name"
|
||||
},
|
||||
{
|
||||
"path": "vite.staging.config.ts",
|
||||
"floor": "integration",
|
||||
"why": "build tool configuration per environment"
|
||||
},
|
||||
{
|
||||
"path": "esbuild.prod.config.js",
|
||||
"floor": "integration",
|
||||
"why": "build tool configuration for production"
|
||||
},
|
||||
{
|
||||
"path": "jest.e2e.config.ts",
|
||||
"floor": "integration",
|
||||
"why": "test runner configuration decides what runs and how"
|
||||
},
|
||||
{
|
||||
"path": ".swcrc",
|
||||
"floor": "integration",
|
||||
"why": "dotfile configuration of a compiler toolchain"
|
||||
},
|
||||
{
|
||||
"path": ".parcelrc",
|
||||
"floor": "integration",
|
||||
"why": "dotfile configuration of a bundler"
|
||||
},
|
||||
{
|
||||
"path": ".browserslistrc",
|
||||
"floor": "integration",
|
||||
"why": "which browsers the build targets"
|
||||
},
|
||||
{
|
||||
"path": "libfoo/include/foo/api.h",
|
||||
"floor": "integration",
|
||||
"why": "public C header: the interface other code compiles against"
|
||||
},
|
||||
{
|
||||
"path": "native/include/mylib/mylib.hpp",
|
||||
"floor": "integration",
|
||||
"why": "public C++ header under an include path"
|
||||
},
|
||||
{
|
||||
"path": "types/index.d.cts",
|
||||
"floor": "integration",
|
||||
"why": "type definitions other code compiles against"
|
||||
},
|
||||
{
|
||||
"path": "idl/inventory.idl",
|
||||
"floor": "integration",
|
||||
"why": "interface definition"
|
||||
},
|
||||
{
|
||||
"path": "specs/petstore-swagger.json",
|
||||
"floor": "integration",
|
||||
"why": "API description file"
|
||||
},
|
||||
{
|
||||
"path": "schemas/events.capnp",
|
||||
"floor": "integration",
|
||||
"why": "wire schema shared between services"
|
||||
},
|
||||
{
|
||||
"path": "sdk/java/src/public/Client.java",
|
||||
"floor": "integration",
|
||||
"why": "public surface of an SDK"
|
||||
},
|
||||
{
|
||||
"path": "ml/feature_store/read_features.py",
|
||||
"floor": "data",
|
||||
"why": "a feature store holds stored data; machine learning cancels model, not store"
|
||||
},
|
||||
{
|
||||
"path": "ml/training/checkpoint_store.py",
|
||||
"floor": "data",
|
||||
"why": "checkpoint store: stored data"
|
||||
},
|
||||
{
|
||||
"path": "etl/load/lake_writer.py",
|
||||
"floor": "data",
|
||||
"why": "writes to a data lake in a load stage"
|
||||
},
|
||||
{
|
||||
"path": "pipeline/sink/postgres_sink.py",
|
||||
"floor": "data",
|
||||
"why": "a sink in a pipeline writes to stored data"
|
||||
},
|
||||
{
|
||||
"path": "jobs/load_orders_to_warehouse.sql",
|
||||
"floor": "data",
|
||||
"why": "loads a warehouse"
|
||||
},
|
||||
{
|
||||
"path": "ingest/warehouse/dim_customers.py",
|
||||
"floor": "data",
|
||||
"why": "warehouse tables"
|
||||
},
|
||||
{
|
||||
"path": "batch/table_writer.scala",
|
||||
"floor": "data",
|
||||
"why": "writes rows to a table"
|
||||
},
|
||||
{
|
||||
"path": "deploy/cronjobs/refund-sweeper.yml",
|
||||
"floor": "critical",
|
||||
"why": "refunds move money and the job runs unattended"
|
||||
},
|
||||
{
|
||||
"path": "batch/payroll/run_payroll.py",
|
||||
"floor": "critical",
|
||||
"why": "payroll moves money"
|
||||
},
|
||||
{
|
||||
"path": "jobs/settlement/nightly_settlement.go",
|
||||
"floor": "critical",
|
||||
"why": "settlement moves money"
|
||||
},
|
||||
{
|
||||
"path": "ops/k8s/ledger-reconcile-cronjob.yaml",
|
||||
"floor": "critical",
|
||||
"why": "ledger changes, run on a schedule"
|
||||
},
|
||||
{
|
||||
"path": ".github/workflows/nightly-payouts.yml",
|
||||
"floor": "critical",
|
||||
"why": "scheduled workflow that pays out"
|
||||
},
|
||||
{
|
||||
"path": "helm/templates/cleanup-cronjob.yaml",
|
||||
"floor": "integration",
|
||||
"why": "a scheduled cluster job with no money or data in its name"
|
||||
},
|
||||
{
|
||||
"path": "scripts/issue_service_tokens.sh",
|
||||
"floor": "critical",
|
||||
"why": "issues tokens: credential issuance"
|
||||
},
|
||||
{
|
||||
"path": "ops/rotate-signing-keys.rb",
|
||||
"floor": "critical",
|
||||
"why": "rotates signing keys"
|
||||
},
|
||||
{
|
||||
"path": "pki/issue_cert.py",
|
||||
"floor": "critical",
|
||||
"why": "certificate issuance"
|
||||
},
|
||||
{
|
||||
"path": "helpers/AwsCredsProvider.java",
|
||||
"floor": "critical",
|
||||
"why": "credentials provider"
|
||||
},
|
||||
{
|
||||
"path": "hack/vault_unseal.sh",
|
||||
"floor": "critical",
|
||||
"why": "unseals a secrets vault"
|
||||
},
|
||||
{
|
||||
"path": "android/app/release.keystore",
|
||||
"floor": "critical",
|
||||
"why": "signing keystore"
|
||||
},
|
||||
{
|
||||
"path": "tools/revoke_api_keys.go",
|
||||
"floor": "critical",
|
||||
"why": "revokes api keys"
|
||||
},
|
||||
{
|
||||
"path": "app/Http/Middleware/EnsureUserIsAdmin.php",
|
||||
"floor": "critical",
|
||||
"why": "middleware that decides who is an administrator"
|
||||
},
|
||||
{
|
||||
"path": "src/guards/roles.guard.ts",
|
||||
"floor": "critical",
|
||||
"why": "role guard: access control"
|
||||
},
|
||||
{
|
||||
"path": "internal/http/middleware/require_login.go",
|
||||
"floor": "critical",
|
||||
"why": "requires a login: access control"
|
||||
},
|
||||
{
|
||||
"path": "app/Policies/PostPolicy.php",
|
||||
"floor": "critical",
|
||||
"why": "authorization policy"
|
||||
},
|
||||
{
|
||||
"path": "config/opa/policy.rego",
|
||||
"floor": "critical",
|
||||
"why": "access policy language"
|
||||
},
|
||||
{
|
||||
"path": "core/tenant/can_access_tenant.kt",
|
||||
"floor": "critical",
|
||||
"why": "access check across tenants"
|
||||
},
|
||||
{
|
||||
"path": "build/Containerfile",
|
||||
"floor": "integration",
|
||||
"why": "container build file"
|
||||
},
|
||||
{
|
||||
"path": "images/web.containerfile",
|
||||
"floor": "integration",
|
||||
"why": "container build file"
|
||||
},
|
||||
{
|
||||
"path": "containers/worker/docker-entrypoint.sh",
|
||||
"floor": "integration",
|
||||
"why": "how a service starts inside a container"
|
||||
},
|
||||
{
|
||||
"path": "service/entrypoint.bash",
|
||||
"floor": "integration",
|
||||
"why": "container entrypoint script"
|
||||
},
|
||||
{
|
||||
"path": "docker-bake.hcl",
|
||||
"floor": "integration",
|
||||
"why": "container build definition"
|
||||
},
|
||||
{
|
||||
"path": ".devcontainer/devcontainer.json",
|
||||
"floor": "integration",
|
||||
"why": "development container definition"
|
||||
},
|
||||
{
|
||||
"path": "charts/web/Chart.yaml",
|
||||
"floor": "release",
|
||||
"why": "Helm chart metadata names and versions a release"
|
||||
},
|
||||
{
|
||||
"path": "homebrew-tap/Formula/mytool.rb",
|
||||
"floor": "release",
|
||||
"why": "Homebrew formula: how the tool is distributed"
|
||||
},
|
||||
{
|
||||
"path": "Casks/mytool.rb",
|
||||
"floor": "release",
|
||||
"why": "Homebrew cask"
|
||||
},
|
||||
{
|
||||
"path": "packaging/debian/control",
|
||||
"floor": "release",
|
||||
"why": "Debian packaging metadata"
|
||||
},
|
||||
{
|
||||
"path": "rpm/mytool.spec",
|
||||
"floor": "release",
|
||||
"why": "RPM packaging"
|
||||
},
|
||||
{
|
||||
"path": "snap/snapcraft.yaml",
|
||||
"floor": "release",
|
||||
"why": "snap packaging"
|
||||
},
|
||||
{
|
||||
"path": "flatpak/org.example.App.yml",
|
||||
"floor": "release",
|
||||
"why": "flatpak manifest"
|
||||
},
|
||||
{
|
||||
"path": "fastlane/metadata/en-US/release_notes.txt",
|
||||
"floor": "release",
|
||||
"why": "app-store listing metadata"
|
||||
}
|
||||
]
|
||||
@@ -15,7 +15,6 @@
|
||||
{"path": "ops/docs/password-rotation-runbook.md", "floor": "trivial", "reason": "a runbook as text; it changes no secret"},
|
||||
{"path": "CHANGELOG.txt", "floor": "trivial", "reason": "plain text history"},
|
||||
{"path": "internal/docs/CONTRIBUTING.md", "floor": "trivial", "reason": "contributor documentation"},
|
||||
|
||||
{"path": "src/components/Button/Button.tsx", "floor": "isolated", "reason": "one UI component, its own behaviour only"},
|
||||
{"path": "web/src/viewmodels/CartViewModel.ts", "floor": "isolated", "reason": "front-end view model for one screen"},
|
||||
{"path": "web/src/store/cartSlice.ts", "floor": "isolated", "reason": "front-end UI state store, affects one feature"},
|
||||
@@ -32,14 +31,13 @@
|
||||
{"path": "src/generated/api_client_out.ts", "floor": "isolated", "reason": "generated output on its own"},
|
||||
{"path": "lib/ui/widgets/entity_card.dart", "floor": "isolated", "reason": "a UI widget named for an entity; display only"},
|
||||
{"path": "services/notifications/src/main/kotlin/ui/NotificationPanel.kt", "floor": "isolated", "reason": "one UI panel"},
|
||||
|
||||
{"path": "ledger-core/src/money/round.py", "floor": "logic", "reason": "money rounding rules, wide input space"},
|
||||
{"path": "pricing/tax_rules.go", "floor": "logic", "reason": "numeric tax calculation rules"},
|
||||
{"path": "parser/json_reader.rs", "floor": "logic", "reason": "parsing with wide input space"},
|
||||
{"path": "src/encoding/base32.c", "floor": "logic", "reason": "encoding algorithm"},
|
||||
{"path": "scheduler/cron_expr.rb", "floor": "logic", "reason": "schedule expression evaluation"},
|
||||
{"path": "engine/expression/eval.ts", "floor": "logic", "reason": "expression evaluator"},
|
||||
{"path": "src/state/checkout_machine.ex", "floor": "logic", "reason": "state machine for checkout flow"},
|
||||
{"path": "src/state/checkout_machine.ex", "floor": "critical", "reason": "state machine for checkout flow; relabelled: checkout moves money (originally labelled logic)"},
|
||||
{"path": "ml/training/metrics/f1_score.py", "floor": "logic", "reason": "numeric metric; subtle mistakes give wrong answers"},
|
||||
{"path": "ops/scheduling/shift_planner.java", "floor": "logic", "reason": "scheduling algorithm"},
|
||||
{"path": "tests/billing/test_proration.py", "floor": "logic", "reason": "a test of billing money rules: test of critical code is logic"},
|
||||
@@ -49,7 +47,6 @@
|
||||
{"path": "pipeline/transform/dedupe_rows.py", "floor": "logic", "reason": "dedupe algorithm over data rows"},
|
||||
{"path": "swift/Sources/Units/Currency.swift", "floor": "logic", "reason": "currency arithmetic and rounding"},
|
||||
{"path": "pkg/calc/interest.ts", "floor": "logic", "reason": "interest numeric rules"},
|
||||
|
||||
{"path": "api/openapi/public-v2.yaml", "floor": "integration", "reason": "public API definition"},
|
||||
{"path": "proto/inventory/v1/inventory.proto", "floor": "integration", "reason": "public interface definition for other services"},
|
||||
{"path": "package-lock.json", "floor": "integration", "reason": "lockfile; code we did not write"},
|
||||
@@ -66,7 +63,6 @@
|
||||
{"path": "sdk/ts/src/public/index.d.ts", "floor": "integration", "reason": "public type definitions for SDK users"},
|
||||
{"path": "build/cmake/Toolchain.cmake", "floor": "integration", "reason": "build configuration"},
|
||||
{"path": "pyproject.toml", "floor": "integration", "reason": "dependency and build manifest"},
|
||||
|
||||
{"path": "db/migrations/20260412_add_invoice_status.sql", "floor": "data", "reason": "schema migration"},
|
||||
{"path": "src/db/models/user.py", "floor": "data", "reason": "ORM model for stored users"},
|
||||
{"path": "src/main/java/com/acme/storage/StoreRepository.java", "floor": "data", "reason": "repository, data access"},
|
||||
@@ -83,7 +79,6 @@
|
||||
{"path": "src/dao/inventory_dao.cpp", "floor": "data", "reason": "data-access object"},
|
||||
{"path": "migrations/0042_drop_legacy_column.sql", "floor": "data", "reason": "drops a stored column"},
|
||||
{"path": "server/src/repos/session_repository.go", "floor": "data", "reason": "repository for stored sessions"},
|
||||
|
||||
{"path": "internal/auth/jwt_verify.go", "floor": "critical", "reason": "authentication token verification"},
|
||||
{"path": "services/auth/src/session.ts", "floor": "critical", "reason": "session authentication"},
|
||||
{"path": "src/crypto/aes_gcm.rs", "floor": "critical", "reason": "cryptography"},
|
||||
@@ -101,8 +96,7 @@
|
||||
{"path": "infra/iam/policy_admin.tf", "floor": "critical", "reason": "authorization policy"},
|
||||
{"path": "scripts/rotate_api_keys.py", "floor": "critical", "reason": "rotates credentials"},
|
||||
{"path": "server/middleware/require_role.php", "floor": "critical", "reason": "authorization check"},
|
||||
{"path": "docker/entrypoint.sh", "floor": "critical", "reason": "runs automatically at container start"},
|
||||
|
||||
{"path": "docker/entrypoint.sh", "floor": "integration", "reason": "runs automatically at container start; relabelled: changes how a service starts inside a container, not on a user machine (originally labelled critical)"},
|
||||
{"path": "VERSION", "floor": "release", "reason": "version marker"},
|
||||
{"path": "mobile/android/app/version.properties", "floor": "release", "reason": "version marker for app store builds"},
|
||||
{"path": "deploy/helm/app/Chart.yaml", "floor": "release", "reason": "chart version marker"},
|
||||
|
||||
@@ -83,6 +83,14 @@ def _labels():
|
||||
return json.load(f)
|
||||
|
||||
|
||||
BLIND2 = os.path.join(os.path.dirname(os.path.abspath(__file__)), "risk_labels_blind2.json")
|
||||
|
||||
|
||||
def _blind2():
|
||||
with open(BLIND2, encoding="utf-8") as f:
|
||||
return [{"path": r["path"], "floor": r["floor"], "why": r["reason"]} for r in json.load(f)]
|
||||
|
||||
|
||||
def _heldout():
|
||||
with open(HELDOUT, encoding="utf-8") as f:
|
||||
return [{"path": r["path"], "floor": r["floor"], "why": r["reason"]} for r in json.load(f)]
|
||||
@@ -144,6 +152,25 @@ class LabelledSetTests(SisiCase):
|
||||
if r["floor"] in ("data", "critical"):
|
||||
self.assertGreaterEqual(order[risk.assess([r["path"]])[0]], order[r["floor"]], r["path"])
|
||||
|
||||
def test_third_labelled_set_gets_its_labelled_floor(self):
|
||||
"""R-5.3-1, R-5.3-2: tests/risk_labels_blind2.json scores exactly. This set was blind
|
||||
when first measured (89 of 106 right, six data-or-critical paths under-rated) and has
|
||||
been used for tuning since, so it no longer measures generalisation: only a fresh blind
|
||||
set can. Two of its labels were revised after review (checkout_machine.ex critical,
|
||||
docker/entrypoint.sh integration), each carrying a "relabelled" note. Seen failing
|
||||
first: see the count in the commit that added this test."""
|
||||
order = {name: i for i, name in enumerate(risk.PROFILES)}
|
||||
rows = _blind2()
|
||||
self.assertGreaterEqual(len(rows), 100)
|
||||
wrong = []
|
||||
for r in rows:
|
||||
got, _ = risk.assess([r["path"]])
|
||||
if got != r["floor"]:
|
||||
wrong.append("%s: labelled %s, got %s (%s)" % (r["path"], r["floor"], got, r["why"]))
|
||||
elif r["floor"] in ("data", "critical"):
|
||||
self.assertGreaterEqual(order[got], order[r["floor"]], r["path"])
|
||||
self.assertEqual(wrong, [], "\n".join(wrong))
|
||||
|
||||
def test_source_code_is_never_trivial(self):
|
||||
"""R-5.3-2, R-5.3-4: file kind comes from the extension first. A file with a
|
||||
source-code extension is never `trivial`, whatever its name or directory:
|
||||
|
||||
Reference in new issue
Block a user