feat(Periscope): add classified event authoring - #273
Open
kyleve wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@LogScope,@LogEvent, and@LogFieldauthoring with compiler-checked classified inputsJSONValuepayloadsLogscope-typed and add type-erasedLogContextpropagationProblem
The former model used enum event families and hand-written remote projections. Emission sites did not prove the exposure, semantic kind, or Swift type.
Architecture
@LogScopedefines a stable scope namespace. Each nested@LogEventstruct defines one stable event name and version. Each@LogFieldsupplies a stable coding key, exposure, and semantic kind.Generated event methods accept phantom-typed
ClassifiedLogInputvalues. Local records retain the complete event. The generatedclassifiedFieldsprojection contains approved values and restricted descriptors without restricted values.Log<Scope>retains scope derivation, entity scopes, linking, tags, freeform helpers, task-local context, and spans.LogContextcarries the same recorder state without a generic scope.Design decisions
JSONValueencodes natural recursive JSON and rejects non-finite doubles.CaseIterablevalues.LogScopeDefinitionisSendablefor safe span isolation.Privacy boundary
A shareable field requires approval at declaration and emission. This approval does not inspect the contents of strings or JSON values.
Local sinks can access the complete event. The classified projection is the safe baseline export surface, not a security boundary for arbitrary sinks.
Breaking changes
This PR keeps the legacy remote-field interfaces temporarily. PR #269 removes them after it migrates all app events.
Compatibility
There is no store migration or decode fallback. Old rows remain as raw historical records with their stored message and payload.
The development Periscope store must be removed before new-build validation. This repository is pre-release, so the old-span limitation is accepted.
Review focus
Testing
./swiftformat --lint./test PeriscopeMacrosTests— 15 architecture tests and 10 macro tests passed./test PeriscopeMacrosTests— no architecture violations and all host regressions passed./test --skip-architecture PeriscopeCoreTests— 317 tests passedStack
This PR is 1 of 2 and targets
main. PR #269 migrates app-level logging and removes the transitional APIs.