feat(Periscope): add classified event authoring - #273
Open
kyleve wants to merge 3 commits into
Open
Conversation
kyleve
commented
Aug 21, 2026
| ) | ||
| public var reporting: AmbientLog.Event.Reporting | ||
|
|
||
| public var message: String { |
Owner
Author
There was a problem hiding this comment.
(important) Is this useful to keep at all if the macro gives us access to the JSON and we can format it on ask?
kyleve
commented
Aug 21, 2026
| } | ||
| } | ||
|
|
||
| public typealias AmbientEvent = AmbientLog.Event |
Owner
Author
There was a problem hiding this comment.
IMO not useful, let's remove and just use the full type qualification.
kyleve
commented
Aug 21, 2026
| Self.values[notification.name].map { | ||
| AmbientEvent(kind: .appLifecycle, value: ["phase": .string($0)]) | ||
| AmbientEvent( | ||
| kind: .restricted(.technicalState, .appLifecycle), |
Owner
Author
There was a problem hiding this comment.
I don't think this should be restricted, it's not PII or otherwise identifiable?
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.