Repository navigation
refactor(export): build a document's identity facts through per-symbol helpers - #1802
Conversation
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…l helpers documentIdentity's loop over the identity table now delegates to newIdentityFacts, consumeAnnotated, noteScope, identityRoot and index, so the same facts are gathered with the same errors in the same order. The runtime's reused-execution release closure says why it is empty. The api-json baseline re-records the writer digest only. Co-Authored-By: jason.han <hanhuijun@gmail.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
benchstat for The wide sec/op intervals come from the machine, not the change: the api-json baseline re-record and the export suites of another branch were running at the same time, and the memory and allocation columns — which that contention cannot move — are flat. |
…entity-complexity Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential-baseline.json
|
benchstat for Ten rounds, |
…entity-complexity Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential-baseline.json
…entity-complexity Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential-baseline.json
…entity-complexity # Conflicts: # docs/project/api-json-differential-baseline.json
What and why
SonarCloud's analysis of
developlists two open Go smells. This clears both with no change in behaviour; no suppression, no rule change, and no changelog fragment because nothing is user-visible.internal/translate/export/rdf_identity.go:137documentIdentitycarried the whole per-symbol loop body (annotation decoding, scope keys, root lookup, the three index maps) in nestedif/for/switchblocks → the loop callsfacts.consumeAnnotated,facts.noteScope,identityRootandfacts.index, withnewIdentityFactsbuilding the struct;gocognitreadsdocumentIdentityat 37 on develop, and after the split no function in the file is above 10 except the untouchedsubjectOf(24)internal/exec/runtime/context.go:1917release = func() {}for a reused execution → the closure says why it is empty: a reused execution is released by whoever first started it, so the caller that joins an execution in flight must release nothing — the no-op is the implementation, not a stubdocumentIdentitystill walkstable.Symbols()in order, decodes the same annotations with the same error (returned at the same symbol), notes the same scope keys and fills the same three maps; the helpers are methods on theidentityFactsit was already building, so no state moved and nothing is computed twice. Any edit underinternal/translate/exportmoves the api-json writer's source digest, so the differential baseline is re-recorded on this tree.The branch is merged with develop
37aef6cf3(one merge commit per develop movement). Develop'selement_ids.go— satisfy-subject, positional-name, implied-conjugate, FeatureValue, expression-parameter, invocation-argument and reference-membership ids — is taken as is; the refactor touchesrdf_identity.goonly, and the identical scorecard below shows that every id develop writes is still written.How it was verified
On the merged tree (develop
37aef6cf3+ this branch):gofmt -l .empty,go build ./...,go vet ./...cleango test -count=1 ./internal/translate/export/... ./tests/export/... ./internal/semantic/...— okgo -C tools test -count=1 ./referee/apijson/... ./oracle/baseline/...— okOPENSYSML_REQUIRE_TRAINING_CORPUS=1 OPENSYSML_REQUIRE_PILOT_CORPORA=1 OPENSYSML_REQUIRE_SPEC_EXAMPLES=1 go test -count=1 ./tests/corpus -run '^TestCorpusRoundTrip$'— ok, no movementgo test -count=1 ./internal/exec/runtime/ -run 'TestExecutionConformance|TestExecutionTrace|TestRuntimeRobustness'— okgo run -C tools ./cmd/pilot-apijson-diff -updateon the merged tree, develop's baseline taken first — vs develop's baseline the diff is the writersourceDigestline (5206509b…→47dda6db…); 935 files and every count identical to develop's (93445 matched, 1157295 present-equal / 27835 present-different / 1067050 ours-missing / 69936 pilot-missing)WriteAPIJSON(exact develop vs the merged tree, own test binary per side, interleaved, n=6, re-run at each re-merge up tof25732edd; re-run against37aef6cf3after the last re-merge): sec/op, B/op and allocs/op~on every row, output bytes identical; the earlier rounds are posted as commentsChecklist
make testandmake lintpass locally (the gates above; the full race suite runs in CI)docs/project/api-json-differential-baseline.json, writer digest only, identical countsLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/33201010c187402c8fde446269d9a54c
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/33201010c187402c8fde446269d9a54c?variant=devin
Requested by: @HuiJun