feat(pbs): add Set and reusable identity hashing

This commit is contained in:
2026-10-25 12:15:13 +00:00
parent 632ba6d0d6
commit 8105604f92
59 changed files with 4190 additions and 34 deletions
@@ -0,0 +1,156 @@
# Set and reusable identity qualification
Owner: compiler/pbs. Captured 2026-10-25 for accepted DEC-0078 / PLN-0156.
Studio baseline HEAD: `632ba6d0d6988a5e5020f0d70e4fb3993739bc85`.
Runtime: clean `dcf6561ea73446e0a3e1cf1c73eda20923b38df0`, unchanged throughout.
No commit was created in either repository. Runtime builds used external targets.
## Commands and outcomes
All commands ran from Studio unless a runtime working directory is specified.
The compressed raw outputs and SHA-256 manifest are alongside this file.
```sh
./gradlew test :prometeu-app:installedKnowledgeTest --console=plain
python3 tools/runtime-catalog/verify.py --runtime ../runtime
CARGO_TARGET_DIR=/tmp/pln156-pbx-target python3 tools/pbx-conformance/run.py --runtime ../runtime
CARGO_TARGET_DIR=/tmp/pln156-pbx-target python3 tools/pbx-conformance/run.py --runtime ../runtime --release
```
All four commands returned zero. Gradle completed in 46 seconds: 94 actionable
tasks, 21 executed and 73 up-to-date. Aggregated JUnit reports contain 1,062 cases,
zero failures/errors and 13 existing skipped cases (1,049 executed cases). Skips
belong to BackendGateIIntegrationTest (8), MainProjectPipelineIntegrationTest (4)
and ExternalSourceDevelopmentHostTest (1); individual names and suite counts are
in `gradle-results.json`. None belongs to the new identity/Set tests. Installed
knowledge validation additionally completed outside the checkout using the built
distribution JARs and produced the mandatory hash/Set PBX examples.
Focused class sizes in the full regression: IdentityHashingPipelineTest 3,
PbsIdentityHashingTest 3, PbsSetTest 15. PBS frontend totals 300; architecture totals
115; build-pipeline totals 200 including its 12 existing skips. The complete
regression also covers editor/LSP, Array, List, Linked, generic structs/contracts,
native groups, Random, compiler architecture and ordinary packaging.
Both complete production VM harness commands passed. Each includes the following
new mandatory observations (no missing fixture is skipped):
| Corpus | Count per Rust profile |
| --- | ---: |
| Scalar/String independent oracle + exact attempted cost + zero fuel | 60 |
| Complete reference/common/source groups, aliases, costs, unused results | 16 |
| Neutral category/TypeId/dead-code admission rejects | 8 |
| Partial group / truncated instruction admission rejects | 2 |
| Null views / complete invalid right operand / cost / fuel | 3 |
| Set success and expected callback/overflow faults, paired producers | 52 |
| Natural Set quota refusals with instruction-prefix comparison | 282 |
| Separate test-only post-publication quota injection | 2 |
| Snapshot GC observations / source Set GC observations | 4 / 4 |
| Real Set import/reexport and installed-example executions | 2 |
| Real installed hash-example execution | 1 |
The full harness additionally requires the existing common Registry, math, Random,
input, structured values, generic contracts/structs, storage/copy, List/Linked,
closure/lifecycle and loader/schema corpora. Historical upstream schema exceptions
remain explicit: LifecycleRole and NonFiniteValue are absent from the selected
provider's published headless enum. The harness preserves the original payload
and does not call those two cases unmodified-schema conformance.
Provider supplement (runtime working directory; external target only):
```sh
cargo test --locked --offline --target-dir /tmp/pln156-provider-target -p prometeu-vm --test identity_hashing
cargo test --locked --offline --target-dir /tmp/pln156-provider-target -p prometeu-vm --lib identity_tests
cargo test --locked --offline --target-dir /tmp/pln156-provider-target -p prometeu-vm --lib 'hashing::'
```
The three suites passed 7 + 6 + 2 tests in debug and again with `--release`.
These provider tests cover stale handles/generation reuse, complete invalid
groups, fault order, non-finite injected Float bits, foreign/resident String
owners, quota-free borrowed queries, GC non-rooting and all independent reference
hash vectors. They supplement actual Studio-produced PBX; they do not substitute
for it. Two exploratory `--lib hash_intrinsics::` filters in the retained combined
log selected zero tests and provide no additional qualification.
The explicit catalog exporter check passed one provider test and compared both
CSV artifacts byte-for-byte against committed provider source and Studio mirrors.
## Resource observations
Ordinary and optimized producers produced identical resource vectors. These are
whole-fixture/session high-water measurements, including earlier setup, complete
carriers and call preparation, not standalone object layout sizes.
| Operation | GuestBytes peak before → after | HandleSlots peak before → after | Maximum Set nodes / bucket tables | Natural refusals per producer |
| --- | --- | --- | --- | ---: |
| Growth 6 → 7 | 21,304 → 44,192 | 68 → 140 | 13 / 2 | 38 |
| Add without growth 5 → 6 | 17,288 → 22,216 | 55 → 71 | 6 / 1 | 28 |
| Duplicate add | 17,288 → 19,440 | 55 → 62 | 5 / 1 | 13 |
| Remove | 17,288 → 20,680 | 55 → 66 | 5 / 1 | 21 |
| Clear | 17,288 → 17,592 | 55 → 56 | 5 / 1 | 5 |
| Cursor | 17,288 → 31,808 | 55 → 102 | 5 / 1 | 36 |
Growth's AuxiliaryBytes peak was 9,968 → 17,648, TemporaryBytes 3,840 → 7,680
and CallDepth 5 → 7. The eight raw peak entries are GuestBytes, HandleSlots,
AuxiliaryBytes, TemporaryBytes, StringBytes, StringAllocations,
IndividualStringBytes and CallDepth. Detailed limits, fault opcodes and complete
vectors are printed in both profile logs. Every natural refusal was before a
structural write; an installed guard may remain. Snapshot failures always
preserved the source Set and returned no partial result.
The independently named `pbs-set-injected-refusal-growth*` fixtures use an
in-memory SDK override that inserts one controlled Array allocation after the
real candidate table store. A GuestBytes quota refuses the probe: the source now
references a 16-bucket table with seven nodes, still reports old size six and
retains its guard. The failing instruction preserves its own entry state. This
is explicitly test-only post-write evidence, not production refusal frequency.
The production SDK has no injected allocation. Real safepoints measured snapshot
nodes/payloads 1,200 → 1 → 1 → 0 without retained source Set nodes, and source
collection nodes 64 → 61 → 0 → 0 after removal/clear/release. Captures and their
final values assume no iteration order.
## Hashing-first chronology and scope
The plan recorded a successful gate on 2026-10-24 before any Set algorithm edits:
60 scalar/String oracle executions plus 14 common/source reference executions.
At that stage IdentityHashingPipelineTest had two tests and
PbsIdentityHashingTest three. The original `/tmp/pln156-hashing-*` log names were
subsequently reused for expanded requalification. Retained focused logs therefore
show the later 89-observation corpus; they are not represented as untouched raw
outputs from the initial temporal gate. This chronology preserves the original
plan's contemporaneous record without fabricating an earlier log.
Final scope: local macOS 27.0.1, arm64; Rust 1.98.1; Java/Gradle toolchain recorded
in `environment.txt`; VM resource-diagnostics feature and default production
ceilings except explicitly lowered quotas. Source optimizer paths are independent
of Rust runtime profiles. Cross-host, installed game deployment, performance and
adversarial hash resistance are not qualified by these runs.
`source.sha256` fingerprints 39 changed/new Studio production, test and documentation
files. `fixtures.sha256.gz` fingerprints 1,301 generated PBX artifacts available to
the full harness; regenerate them with the Gradle command. `gradle-results.json`
preserves all suite counts and skipped names. `SHA256SUMS` fingerprints retained
evidence files. Logs can be read with `gzip -dc <file>.gz`.
## Workflow closure
`discussion mark-plan PLN-0156 done` completed successfully, followed by
`discussion housekeep DSC-0092 --lesson discussion/lessons/DSC-0092-pbs-sdk-set/LSN-0093-reusable-identity-and-source-set-buckets.md`.
The CLI removed three completed control artifacts and registered LSN-0093.
`discussion validate` passed afterward; DSC-0092 is done with only its lesson
registered. AGD-0089 and AGD-0095 reference the delivered result and keep Map's
remaining questions open. Final read-only workflow state is in `workflow.txt`.
## Accepted requirement coverage
| Requirements | Final evidence |
| --- | --- |
| R1 / R3 | Source API/default/explicit/type/privacy tests, generic invariance, concrete editor projections and installed examples |
| R2 / R5 | Neutral IR instruction/width/encoding tests, oracle and complete-group source execution, malformed instructions and source-order fixtures |
| R4 | Topology assertions, 8 → 16 threshold, duplicate/no-shrink/clear, signed-long/u32 arithmetic and cached rehash counters |
| R6 / R7 | Alias reentrancy faults, permitted callback reads, callback-fault guard observations and natural/injected instruction-prefix resource evidence |
| R8 | Empty/single/multiple complete Cursor state table, payload sharing, independent capture and real GC lifetime |
| R9 / R10 | Hashing-first chronology, paired producer/profile runs, provider supplement, collision/callback counters and measured coexistence |
| R11 | Public Identity/hash handoff to Map without Map API/layout implementation |
| R12 | Clean fixed provider, external targets, English specs/lesson, packaged SDK/examples, full regression and CLI validation/housekeeping |
@@ -0,0 +1,19 @@
01b966b6a3f710c150c960c6a5b49f1b45d1db93fe7d5fa536db761f3489dfad README.md
fb48082c878378f7fa01009361380b38be074a0b711edc605c531c9fb575ff5a conformance-debug.log.gz
4e5b52584c70bca57c3b715558102b663daf51cf84bebf549600bdf11c88cab4 conformance-release.log.gz
774b5aa6f29a3e4d986bab805427b7d0a0c53445749e03a93db4320cee376302 distribution-tests.log.gz
1510a88944e6a632e4373d35e3e5855a06a1273f7f0be3b590d811faa209d830 environment.txt
5b136af3ee037ba0879c02cc57c135350ed446853dedfd41a7455a532e4852e6 fixtures.sha256.gz
b7a05d6c252b869cd2a909edd40ef16a094279d6aee4379daa67b607753cfe2b gradle-results.json
3e4e33aa6338142b79a4740945c50b149c572980ad108219d930e3909dd73f8a hashing-conformance.log.gz
6c4a1723e53ad40a2315a509a43a6a0058db145cc006ee4bc7a346cd12333fee hashing-tests.log.gz
79b81e38a9ecf948c7381796c77aa30929dbcfcd2f4eb0a5ead71032fbb5bf04 provider-catalog.log.gz
2f53ddd02d054c4c801aeaf20981f83eb28961b9b973fd025c10aed6673dd254 provider-hash-remaining.log.gz
0d2a846ee52a7a40662c1720055ffdf36179cdbaf846696e07d7ab0149d4367d provider-identity-debug.log.gz
0255d42eb28c98566741fa17987480969ab89b35a113c568481240713f69aa1e provider-identity-private-debug.log.gz
f6ca7e0c4865b83031d8f21e166248209089a91466103d193cb14ffd8e533df7 regression.log.gz
9f9bf7af13da11147a1388ea86a41f8e59202b4d08333dca24d4385d5329dc21 set-conformance.log.gz
60b879014ec61aad58eb6aba651e28fb017077c3c17a6f06b2851f99be50ca72 set-tests.log.gz
2d0b3b19a447fa29a4ae127842db26d4adacb400af77837c09edd8ea0c9874c3 source.sha256
0e245cc1d83d697f9ffb3fb0a8dd18800cdc0892c23def0d4e14737c3cb42cbc workflow.txt
8ee423550b4716622600a4a943084837961ff9587259f2ff485e25d30005e434 ../LSN-0093-reusable-identity-and-source-set-buckets.md
@@ -0,0 +1,32 @@
macOS-27.0.1-arm64-arm-64bit-Mach-O
632ba6d0d6988a5e5020f0d70e4fb3993739bc85
dcf6561ea73446e0a3e1cf1c73eda20923b38df0
runtime working tree: clean
rustc 1.98.1 (48a229cea 2026-09-01)
binary: rustc
commit-hash: 48a229ceaefd4985c50990b14116b6d856af0985
commit-date: 2026-09-01
host: aarch64-apple-darwin
release: 1.98.1
LLVM version: 22.1.8
------------------------------------------------------------
Gradle 9.3.1
------------------------------------------------------------
Build time: 2026-01-29 14:15:01 UTC
Revision: 44f4e8d3122ee6e7cbf5a248d7e20b4ca666bda3
Kotlin: 2.2.21
Groovy: 4.0.29
Ant: Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM: 21.0.4 (Amazon.com Inc. 21.0.4+7-LTS)
Daemon JVM: /Users/niltonconstantino/.sdkman/candidates/java/21.0.4-amzn (no Daemon JVM specified, using current Java home)
OS: Mac OS X 27.0.1 aarch64
Java toolchain: buildSrc/src/main/kotlin/gradle.java-common-conventions.gradle.kts sets 21
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,39 @@
b86f24c8ce609b0994b9fcfabfff0ec2a78a0fafaf242b931db10ba2325d30fb docs/compiler/general/specs/runtime-catalog-support.md
cbaec6777d4a41bff62486763a084aaec4fd5a7c9cacbf7c34ec83b50e8c208c docs/compiler/general/specs/typed-registry-and-pbx-v0.md
e61f3a1a2d3ebe17f680dddee805de56f8e57356a98ea3821885da1ba70d1d98 docs/compiler/pbs/specs/generic-contracts.md
da61fca1efa1410ea1e57452724c022a492356836ca1a113e2668b8255596d85 docs/compiler/pbs/specs/sdk-list-and-cursor.md
73de7f4148daf4f40050c503bed8c118f9422a14239082b3e1501ea66fbf509b docs/compiler/pbs/specs/sdk-set-and-identity.md
ca7103dbe6613b4501f9a8c8ca210a84b7ce37eb0e1b27e0321dc1b31588e427 docs/specs/compiler-languages/pbs/README.md
9e6eb38e60753b9e4b092f14d0aeec9debb7023ee706a8ff4b81d3380334e741 prometeu-app/src/test/java/p/studio/app/compiler/InstalledKnowledgeProbe.java
0d29ca282e27488852f35ec36ac858cc23dc69e4acc31812f1c0cb4a49188357 prometeu-architecture-tests/src/test/java/p/studio/compiler/backend/irvm/PbsIdentityHashingTest.java
9cbdfc340dba2467388c09958bb436fc319091b2948ca8b353b0d714b56e7f5e prometeu-architecture-tests/src/test/java/p/studio/compiler/backend/irvm/PbsListCursorTest.java
980b429d3c3c823a03e3aa6d63affc7773eda8f260fe72501999bc13aab0682c prometeu-architecture-tests/src/test/java/p/studio/compiler/backend/irvm/PbsSetTest.java
a863486eaea14ab1a010f076f355eed0d5738207dad3651f7d10e92fc09f74d4 prometeu-architecture-tests/src/test/resources/hash/hash-conformance.tsv
9a7d614a6f50b2368d66c2bf7c8b7d706ca609c555c2ed8f1bf447c2568edca8 prometeu-architecture-tests/src/test/resources/hash/provenance.txt
3ab546b5e93345442550e385e271b7152aa6a749f1d2b7a7cab3b9b29521c76d prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/PbsContractTypes.java
dae77c30a768f709a95b10a909e6b17c82fbf5ed81108c475f8ed07921eb2168 prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/PbsGenericInstantiation.java
3d771f40ebf91919a6e9f2c0df54aa1de49d7f4daa992fb8ceb44a9db4faaf3e prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/PbsGenericTemplateValidator.java
dd0202c2867f9175778bab0476d91dc75fff1f6ac2b56546016461485f3cb9ad prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/PbsSdkCollections.java
0f5a2a8a1a23519ee315d87703e83db33c1737b1d2213be18387ee64ee2b84be prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsExecutableBodyLowerer.java
3f713dfc25a34b6b1cdc40ebf74b73d66292ff55704844b81058650a88838bef prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/lowering/PbsRuntimeTypes.java
09b812332999c41161741debb61e509777e5c35661526b14ce5ac1b8ea0db69c prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/parser/PbsDeclarationParser.java
6c2f87d0f4409823474df16704d6a3394ad386d8c04402d36e15970799b47150 prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/semantics/PbsEditorialSupportService.java
d3d656a09c5b422b04b69fb8e6178be925e368b39dd52a48ca79d174dad0eb18 prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/semantics/PbsFlowExpressionAnalyzer.java
af43f155ac52d777f0ce33d7abe178175493cf215cdb05fb58c00faeea7d5f64 prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/semantics/PbsFlowSemanticSupport.java
0a812aa055a0584a2994cf7e03432e7a793ed3dafa46fb0d99649aa87b61e5fa prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/game/stdlib/1/sdk/collections/main.pbs
282bf48949e9541ac0c2b8ac8f22c32c88c2b989db47e735d93986e1be5aa35d prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/game/stdlib/1/sdk/collections/mod.barrel
5fefadf0c171849db43a84a8e96ee9b65f9085630c54fc2605b478b052202f3e prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/game/stdlib/1/sdk/hash/main.pbs
96c5efc77fa829cd1ada41551455d5ab702af7d93003bff166a917cfe94d5c91 prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/game/stdlib/1/sdk/hash/mod.barrel
51a535c87ea1f6cfe63921c16116325e98ff5b792c52d29c554708f6f747fbbe prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/pbs-knowledge/examples/game/1/src/hashing.pbs
f41f867226127c663a4aff3429c482bab5d685dbdeede7dbb156fd31e8056cb4 prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/pbs-knowledge/examples/game/1/src/mod.barrel
af301f0399bbf960efb011bc9a64bc203198b5dd808cfce4e726d28460f081a5 prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/pbs-knowledge/examples/game/1/src/sets.pbs
b2f68ef00a5d2f2b2959ca7b35293b3ebbddaccac6c7983800a3ce2686dfd315 prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/PbsGenericStructsTest.java
b012912e78dac60d7f87b0133c4a40802acbe8f8470a64aa599e01a745da894f prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/semantics/PbsListCursorEditorialTest.java
6924220bb90f36d8e14a7e58a9b645863661fa5244ec2984f380dcdcc135a458 prometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/backend/bytecode/BytecodeOpcodeLayout.java
ff70c90b3803325c21a9c8b7c9614d18df6e70950e2ad04f182e0d02a3ee11bf prometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/backend/bytecode/BytecodePreloadVerifierService.java
ad66da924ae8a41358f3ccfe31fab2e69e961892bc24dab2dbeb8aa148cfb20e prometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/backend/registry/RegistryInstructionLowerer.java
b78a89315c3335d13a14e4fae67025844ca06ebdd6cd6450333550a7ffe63670 prometeu-compiler/prometeu-build-pipeline/src/test/java/p/studio/compiler/backend/registry/IdentityHashingPipelineTest.java
5b65afa2b540d9322e66e51618e3b30ef48773c21b3b22c449f96151fabff4a4 prometeu-compiler/prometeu-frontend-api/src/main/java/p/studio/compiler/models/registry/IRRegistryInstruction.java
a97ccf7cf1ef9cc955b4c8149cc4617a0c5d1e7d5bbb1568bf747ed6c8c901a1 tools/pbx-conformance/README.md
7034976755c6231001c716190dee2bb45a8fc5123dfe99cbb88eff3cddce6a4a tools/pbx-conformance/main.rs
314882419dcab726c9944450e114e8da92348a82976cfb64a4157c47485ddb83 tools/pbx-conformance/run.py
@@ -0,0 +1,10 @@
$ discussion validate
validation passed
$ discussion inspect DSC-0092
DSC-0092 done pbs-sdk-set
PBS SDK Set
tags: compiler-pbs, collections, umbrella-agd-0089
lessons:
- LSN-0093 done exists /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/studio/discussion/lessons/DSC-0092-pbs-sdk-set/LSN-0093-reusable-identity-and-source-set-buckets.md